@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.
Files changed (141) hide show
  1. package/index.cjs.d.ts +0 -1
  2. package/index.cjs.js +120789 -1
  3. package/index.esm.d.ts +0 -1
  4. package/index.esm.js +120308 -1
  5. package/package.json +15 -27
  6. package/target/idl/glam_mint-staging.json +480 -1
  7. package/target/idl/glam_mint.json +247 -1
  8. package/target/types/glam_mint-staging.ts +480 -1
  9. package/target/types/glam_mint.ts +247 -1
  10. package/LICENSE +0 -201
  11. package/buffer-layout.d.ts +0 -88
  12. package/src/assets.d.ts +0 -39
  13. package/src/client/access.d.ts +0 -57
  14. package/src/client/base.d.ts +0 -234
  15. package/src/client/bridge.d.ts +0 -205
  16. package/src/client/bridgeRegistry.d.ts +0 -32
  17. package/src/client/cctp.d.ts +0 -164
  18. package/src/client/epi.d.ts +0 -228
  19. package/src/client/fees.d.ts +0 -33
  20. package/src/client/invest.d.ts +0 -37
  21. package/src/client/jupiter-lend/borrow.d.ts +0 -92
  22. package/src/client/jupiter-lend/earn.d.ts +0 -64
  23. package/src/client/jupiter-lend/index.d.ts +0 -3
  24. package/src/client/jupiter-lend/shared.d.ts +0 -129
  25. package/src/client/jupiter.d.ts +0 -53
  26. package/src/client/kamino/farm.d.ts +0 -39
  27. package/src/client/kamino/index.d.ts +0 -4
  28. package/src/client/kamino/lending.d.ts +0 -94
  29. package/src/client/kamino/types.d.ts +0 -56
  30. package/src/client/kamino/vaults.d.ts +0 -39
  31. package/src/client/loopscale/borrow.d.ts +0 -118
  32. package/src/client/loopscale/core.d.ts +0 -604
  33. package/src/client/loopscale/index.d.ts +0 -5
  34. package/src/client/loopscale/lend.d.ts +0 -123
  35. package/src/client/loopscale/vault.d.ts +0 -43
  36. package/src/client/marinade.d.ts +0 -42
  37. package/src/client/mint.d.ts +0 -143
  38. package/src/client/orca.d.ts +0 -255
  39. package/src/client/phoenix.d.ts +0 -214
  40. package/src/client/price.d.ts +0 -182
  41. package/src/client/stake-pool.d.ts +0 -39
  42. package/src/client/stake.d.ts +0 -34
  43. package/src/client/state.d.ts +0 -56
  44. package/src/client/timelock.d.ts +0 -31
  45. package/src/client/vault.d.ts +0 -98
  46. package/src/client.d.ts +0 -82
  47. package/src/clientConfig.d.ts +0 -32
  48. package/src/constants.d.ts +0 -111
  49. package/src/deser/base.d.ts +0 -18
  50. package/src/deser/index.d.ts +0 -4
  51. package/src/deser/integrationPolicies.d.ts +0 -195
  52. package/src/deser/kaminoLayouts.d.ts +0 -264
  53. package/src/deser/loopscaleLayouts.d.ts +0 -157
  54. package/src/deser/tokenAclLayouts.d.ts +0 -67
  55. package/src/error.d.ts +0 -29
  56. package/src/glamExports.d.ts +0 -6260
  57. package/src/globalConfig.d.ts +0 -27
  58. package/src/index.d.ts +0 -24
  59. package/src/models/acl.d.ts +0 -43
  60. package/src/models/index.d.ts +0 -8
  61. package/src/models/mint.d.ts +0 -57
  62. package/src/models/state.d.ts +0 -94
  63. package/src/models/types.d.ts +0 -28
  64. package/src/protocols.d.ts +0 -29
  65. package/src/utils/accounts.d.ts +0 -71
  66. package/src/utils/bitmask.d.ts +0 -53
  67. package/src/utils/blockhash.d.ts +0 -11
  68. package/src/utils/common.d.ts +0 -73
  69. package/src/utils/computeBudget.d.ts +0 -15
  70. package/src/utils/evm.d.ts +0 -10
  71. package/src/utils/fraction.d.ts +0 -29
  72. package/src/utils/glamPDAs.d.ts +0 -15
  73. package/src/utils/helius.d.ts +0 -66
  74. package/src/utils/index.d.ts +0 -17
  75. package/src/utils/jupiterApi.d.ts +0 -95
  76. package/src/utils/lookupTables.d.ts +0 -83
  77. package/src/utils/phoenixApi.d.ts +0 -146
  78. package/src/utils/pkmap.d.ts +0 -87
  79. package/src/utils/pkset.d.ts +0 -73
  80. package/src/utils/positionCategorizer.d.ts +0 -38
  81. package/src/utils/rpc.d.ts +0 -18
  82. package/src/utils/timelock.d.ts +0 -52
  83. package/src/utils/transaction.d.ts +0 -13
  84. package/target/idl/ext_bridge-staging.json +0 -2379
  85. package/target/idl/ext_bridge.json +0 -2379
  86. package/target/idl/ext_drift.json +0 -5464
  87. package/target/idl/ext_epi-staging.json +0 -2862
  88. package/target/idl/ext_epi.json +0 -2862
  89. package/target/idl/ext_loopscale-staging.json +0 -4708
  90. package/target/idl/ext_loopscale.json +0 -4708
  91. package/target/idl/ext_marinade-staging.json +0 -1587
  92. package/target/idl/ext_phoenix-staging.json +0 -3525
  93. package/target/idl/ext_phoenix.json +0 -3525
  94. package/target/idl/mock_layerzero_endpoint.json +0 -144
  95. package/target/idl/mock_layerzero_oft.json +0 -155
  96. package/target/idl/mock_wormhole_verify_vaa_shim.json +0 -58
  97. package/target/types/ext_bridge-staging.d.ts +0 -2385
  98. package/target/types/ext_bridge-staging.ts +0 -2385
  99. package/target/types/ext_bridge.d.ts +0 -2385
  100. package/target/types/ext_bridge.ts +0 -2385
  101. package/target/types/ext_cctp-staging.d.ts +0 -1268
  102. package/target/types/ext_cctp.d.ts +0 -1268
  103. package/target/types/ext_drift.d.ts +0 -5470
  104. package/target/types/ext_drift.ts +0 -5470
  105. package/target/types/ext_epi-staging.d.ts +0 -2868
  106. package/target/types/ext_epi-staging.ts +0 -2868
  107. package/target/types/ext_epi.d.ts +0 -2868
  108. package/target/types/ext_epi.ts +0 -2868
  109. package/target/types/ext_jupiter-staging.d.ts +0 -1966
  110. package/target/types/ext_jupiter.d.ts +0 -1966
  111. package/target/types/ext_kamino-staging.d.ts +0 -3433
  112. package/target/types/ext_kamino.d.ts +0 -3433
  113. package/target/types/ext_loopscale-staging.d.ts +0 -4714
  114. package/target/types/ext_loopscale-staging.ts +0 -4714
  115. package/target/types/ext_loopscale.d.ts +0 -4714
  116. package/target/types/ext_loopscale.ts +0 -4714
  117. package/target/types/ext_marinade-staging.d.ts +0 -1593
  118. package/target/types/ext_marinade-staging.ts +0 -1593
  119. package/target/types/ext_marinade.d.ts +0 -1593
  120. package/target/types/ext_orca-staging.d.ts +0 -2829
  121. package/target/types/ext_orca.d.ts +0 -2829
  122. package/target/types/ext_phoenix-staging.d.ts +0 -3531
  123. package/target/types/ext_phoenix-staging.ts +0 -3531
  124. package/target/types/ext_phoenix.d.ts +0 -3531
  125. package/target/types/ext_phoenix.ts +0 -3531
  126. package/target/types/ext_spl-staging.d.ts +0 -1274
  127. package/target/types/ext_spl.d.ts +0 -1274
  128. package/target/types/ext_stake_pool-staging.d.ts +0 -1622
  129. package/target/types/ext_stake_pool.d.ts +0 -1622
  130. package/target/types/glam_config.d.ts +0 -755
  131. package/target/types/glam_mint-staging.d.ts +0 -8802
  132. package/target/types/glam_mint.d.ts +0 -6349
  133. package/target/types/glam_policies.d.ts +0 -477
  134. package/target/types/glam_protocol-staging.d.ts +0 -3362
  135. package/target/types/glam_protocol.d.ts +0 -2783
  136. package/target/types/mock_layerzero_endpoint.d.ts +0 -150
  137. package/target/types/mock_layerzero_endpoint.ts +0 -150
  138. package/target/types/mock_layerzero_oft.d.ts +0 -161
  139. package/target/types/mock_layerzero_oft.ts +0 -161
  140. package/target/types/mock_wormhole_verify_vaa_shim.d.ts +0 -64
  141. package/target/types/mock_wormhole_verify_vaa_shim.ts +0 -64
@@ -1,234 +0,0 @@
1
- import * as anchor from "@coral-xyz/anchor";
2
- import { BN } from "@coral-xyz/anchor";
3
- import { Wallet } from "@coral-xyz/anchor";
4
- import { Connection, Keypair, PublicKey, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
5
- import { type LookupTableInput } from "../utils/lookupTables";
6
- import { ExtBridgeProgram, ExtEpiProgram, ExtCctpProgram, ExtJupiterProgram, ExtKaminoProgram, ExtMarinadeProgram, ExtLoopscaleProgram, ExtPhoenixProgram, ExtOrcaProgram, ExtSplProgram, ExtStakePoolProgram, GlamMintProgram, GlamProtocolProgram } from "../glamExports";
7
- import { ClusterNetwork, GlamClientConfig } from "../clientConfig";
8
- import { GlobalConfig } from "../globalConfig";
9
- import { RequestQueue, StateAccount, StateModel } from "../models";
10
- import { BlockhashWithCache } from "../utils/blockhash";
11
- import { JupiterApiClient, PhoenixApiClient, PkMap } from "../utils";
12
- import { AssetMeta } from "../assets";
13
- export type TxOptions = {
14
- signer?: PublicKey;
15
- computeUnitLimit?: number;
16
- getPriorityFeeMicroLamports?: (tx: VersionedTransaction) => Promise<number>;
17
- maxFeeLamports?: number;
18
- useMaxFee?: boolean;
19
- preInstructions?: TransactionInstruction[];
20
- postInstructions?: TransactionInstruction[];
21
- lookupTables?: LookupTableInput[];
22
- simulate?: boolean;
23
- };
24
- export interface ProtocolPolicyTxBuilder<TPolicy> {
25
- setPolicyIx(policy: TPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
26
- setPolicyTx(policy: TPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
27
- clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
28
- clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
29
- }
30
- export interface ProtocolPolicyClient<TPolicy> {
31
- fetchPolicy(): Promise<TPolicy | null>;
32
- setPolicy(policy: TPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
33
- clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
34
- }
35
- export type TokenAccount = {
36
- owner: PublicKey;
37
- pubkey: PublicKey;
38
- mint: PublicKey;
39
- programId: PublicKey;
40
- decimals: number;
41
- amount: string;
42
- uiAmount: number;
43
- frozen: boolean;
44
- };
45
- export declare class BaseClient {
46
- cluster: ClusterNetwork;
47
- provider: anchor.Provider;
48
- blockhashWithCache: BlockhashWithCache;
49
- jupiterApiKey?: string;
50
- jupiterApiClient?: JupiterApiClient;
51
- phoenixApiUrl?: string;
52
- phoenixApiClient?: PhoenixApiClient;
53
- onSentListeners: Set<(sig: string) => void>;
54
- readonly staging: boolean;
55
- private _protocolProgram?;
56
- private _mintProgram?;
57
- private _extSplProgram?;
58
- private _extKaminoProgram?;
59
- private _extMarinadeProgram?;
60
- private _extStakePoolProgram?;
61
- private _extCctpProgram?;
62
- private _extBridgeProgram?;
63
- private _extEpiProgram?;
64
- private _extLoopscaleProgram?;
65
- private _extPhoenixProgram?;
66
- private _extJupiterProgram?;
67
- private _extOrcaProgram?;
68
- private _statePda?;
69
- private _globalConfig?;
70
- private _globalConfigPromise?;
71
- private _assetMetas?;
72
- private _assetMetasPromise?;
73
- private _defaultLookupTablesPromise?;
74
- private _glamLookupTablesPromise?;
75
- private _glamLookupTablesCacheKey?;
76
- constructor(config?: GlamClientConfig);
77
- get protocolProgram(): GlamProtocolProgram;
78
- get mintProgram(): GlamMintProgram;
79
- get extSplProgram(): ExtSplProgram;
80
- get extKaminoProgram(): ExtKaminoProgram;
81
- get extMarinadeProgram(): ExtMarinadeProgram;
82
- get extStakePoolProgram(): ExtStakePoolProgram;
83
- get extCctpProgram(): ExtCctpProgram;
84
- get extBridgeProgram(): ExtBridgeProgram;
85
- get extEpiProgram(): ExtEpiProgram;
86
- get extLoopscaleProgram(): ExtLoopscaleProgram;
87
- get extPhoenixProgram(): ExtPhoenixProgram;
88
- get extJupiterProgram(): ExtJupiterProgram;
89
- get extOrcaProgram(): ExtOrcaProgram;
90
- get isVaultConnected(): boolean;
91
- get statePda(): PublicKey;
92
- set statePda(statePda: PublicKey);
93
- /**
94
- * Mainnet-only default lookup tables (Kamino lending, Loopscale).
95
- * Cached for the session; safe to assume static contents.
96
- */
97
- private getDefaultLookupTables;
98
- /**
99
- * Discovers GLAM ALTs for the connected vault and caches the result for the
100
- * session.
101
- *
102
- * Call `invalidateGlamLookupTablesCache()` after creating or extending an ALT
103
- * to force a re-discovery on the next tx.
104
- */
105
- private getGlamLookupTablesCached;
106
- invalidateGlamLookupTablesCache(): void;
107
- private warmupGlamLookupTables;
108
- get isMainnet(): boolean;
109
- /**
110
- * Converts a legacy transaction into a versioned transaction.
111
- */
112
- intoVersionedTransaction(tx: Transaction, { lookupTables, signer, computeUnitLimit, getPriorityFeeMicroLamports, maxFeeLamports, useMaxFee, simulate, }: TxOptions): Promise<VersionedTransaction>;
113
- /**
114
- * Signs, sends, and confirms a transaction.
115
- *
116
- * Legacy transactions receive missing fee-payer/blockhash values here and
117
- * extra signers are applied with `partialSign` before wallet signing.
118
- * Versioned transactions are expected to be fully built by the caller; extra
119
- * signers are applied after wallet signing so this remains compatible with
120
- * transactions created by another `@solana/web3.js` package instance.
121
- *
122
- * Transactions are sent with preflight disabled because callers commonly
123
- * simulate while building compute-budget instructions.
124
- */
125
- sendAndConfirm(tx: VersionedTransaction | Transaction, additionalSigners?: Keypair[]): Promise<TransactionSignature>;
126
- private confirmTransaction;
127
- get connection(): Connection;
128
- get signer(): PublicKey;
129
- get wallet(): Wallet;
130
- get vaultPda(): PublicKey;
131
- get mintPda(): PublicKey;
132
- get escrowPda(): PublicKey;
133
- get extraMetasPda(): PublicKey;
134
- get requestQueuePda(): PublicKey;
135
- /**
136
- * Returns SOL and token balances of the given owner pubkey
137
- */
138
- getSolAndTokenBalances(owner: PublicKey): Promise<{
139
- balanceLamports: number;
140
- uiAmount: number;
141
- tokenAccounts: TokenAccount[];
142
- }>;
143
- /**
144
- * Returns user's token account for the given mint and token program ID
145
- */
146
- getAta(mint: PublicKey, owner: PublicKey, tokenProgram?: anchor.web3.PublicKey): PublicKey;
147
- /**
148
- * Returns glam vault's token account for the given mint and token program ID
149
- */
150
- getVaultAta(mint: PublicKey, tokenProgramId?: PublicKey): PublicKey;
151
- /**
152
- * Returns user's glam mint token account
153
- */
154
- getMintAta(user?: PublicKey): PublicKey;
155
- /**
156
- * Returns glam vault's SOL balance
157
- */
158
- getVaultBalance(): Promise<number>;
159
- /**
160
- * Returns glam vault's SOL balance in lamports
161
- */
162
- getVaultLamports(): Promise<number>;
163
- /**
164
- * Returns glam vault's token balance for the given mint
165
- */
166
- getVaultTokenBalance(mintPubkey: PublicKey): Promise<{
167
- amount: BN;
168
- uiAmount: number;
169
- }>;
170
- /**
171
- * Returns user's glam mint token balance
172
- */
173
- getMintTokenBalance(owner?: PublicKey): Promise<{
174
- amount: BN;
175
- uiAmount: number;
176
- }>;
177
- isLockupEnabled(): Promise<boolean>;
178
- fetchGlobalConfig(options?: {
179
- refresh?: boolean;
180
- }): Promise<GlobalConfig>;
181
- fetchAssetMetas(options?: {
182
- refresh?: boolean;
183
- }): Promise<PkMap<AssetMeta>>;
184
- refreshAssetMetaCache(): Promise<PkMap<AssetMeta>>;
185
- getAssetMeta(assetMint: string | PublicKey, options?: {
186
- refresh?: boolean;
187
- }): Promise<AssetMeta>;
188
- getSolOracle(options?: {
189
- refresh?: boolean;
190
- }): Promise<PublicKey>;
191
- fetchStateAccount(statePda?: PublicKey): Promise<StateAccount>;
192
- private getMintProgramIdForStateAccount;
193
- private getMintProgramForStateAccount;
194
- fetchRequestQueue(requestQueuePda?: PublicKey, mintProgram?: GlamMintProgram): Promise<RequestQueue>;
195
- /**
196
- * Builds a StateModel from onchain accounts (state, mint, etc)
197
- *
198
- * @param statePda Optional state PDA
199
- */
200
- fetchStateModel(statePda?: PublicKey): Promise<StateModel>;
201
- /**
202
- * Fetches glam state models and applies filters
203
- *
204
- * @param filterOptions Filter options
205
- */
206
- fetchGlamStates(filterOptions?: {
207
- owner?: PublicKey;
208
- delegate?: PublicKey;
209
- type?: string;
210
- }): Promise<StateModel[]>;
211
- fetchProtocolPolicy<T>(integProgramId: PublicKey, protocolBitflag: number, policyClass: {
212
- decode(buffer: Buffer, staging?: boolean): T;
213
- }): Promise<T | null>;
214
- }
215
- /**
216
- * Base transaction builder for sub-clients
217
- */
218
- export declare class BaseTxBuilder<T extends {
219
- base: BaseClient;
220
- }> {
221
- readonly client: T;
222
- constructor(client: T);
223
- clearProtocolPolicyIx(integrationProgram: PublicKey, protocolBitflag: number, signer?: PublicKey): Promise<TransactionInstruction>;
224
- clearProtocolPolicyTx(integrationProgram: PublicKey, protocolBitflag: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
225
- /**
226
- * Build a legacy transaction with the given instructions.
227
- * Pre and post instructions in txOptions are preserved.
228
- */
229
- build(ixs: TransactionInstruction[], txOptions?: TxOptions): Transaction;
230
- /**
231
- * Build a versioned transaction that is ready to be sent.
232
- */
233
- buildVersionedTx(ixs: TransactionInstruction[], txOptions?: TxOptions): Promise<VersionedTransaction>;
234
- }
@@ -1,205 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { Keypair, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, ProtocolPolicyClient, ProtocolPolicyTxBuilder, TxOptions } from "./base";
4
- import { LayerzeroOftRouteProfile } from "./bridgeRegistry";
5
- import { LayerzeroOftPolicy, LayerzeroOftRoute, RouteManagementMode } from "../deser/integrationPolicies";
6
- type BufferLike = Uint8Array | number[] | Buffer;
7
- type RouteManagementModeArg = RouteManagementMode | number | {
8
- unmanagedOnly: Record<string, never>;
9
- } | {
10
- managedOnly: Record<string, never>;
11
- } | {
12
- either: Record<string, never>;
13
- };
14
- export type LayerzeroOftRouteInput = Omit<LayerzeroOftRoute, "managementMode"> & {
15
- managementMode: RouteManagementModeArg;
16
- };
17
- export type OftTransferParams = {
18
- transferId: PublicKey;
19
- sourceMint: PublicKey;
20
- sourceAmount: BN;
21
- providerInstructions: TransactionInstruction[];
22
- providerReceipt: PublicKey;
23
- managed?: boolean;
24
- providerSigners?: Keypair[];
25
- };
26
- export type LayerzeroOftSendParams = {
27
- transferId?: PublicKey;
28
- sourceMint: PublicKey;
29
- sourceAmount: BN;
30
- destinationChain: number;
31
- destinationRecipient: PublicKey;
32
- nativeFeeLamports: BN;
33
- minAmountLd?: BN;
34
- lzTokenFee?: BN;
35
- options?: BufferLike;
36
- composeMsg?: BufferLike | null;
37
- sourceTokenAccount?: PublicKey;
38
- nonceAccount?: PublicKey;
39
- managed?: boolean;
40
- providerProgram?: PublicKey;
41
- };
42
- type BridgeTransferStatusAccount = {
43
- committed: Record<string, never>;
44
- } | {
45
- validated: Record<string, never>;
46
- } | {
47
- settled: Record<string, never>;
48
- };
49
- type BridgeTransferRecordAccount = {
50
- glamState: PublicKey;
51
- transferId: PublicKey;
52
- protocol: number;
53
- status: BridgeTransferStatusAccount;
54
- managed: true;
55
- receiptVerified: true;
56
- sourceMint: PublicKey;
57
- sourceDecimals: number;
58
- providerProgram: PublicKey;
59
- providerConfig: PublicKey;
60
- sourceAmount: BN;
61
- quotedOutAmount: BN;
62
- destinationChain: number;
63
- destinationRecipient: PublicKey;
64
- providerEmitter: PublicKey;
65
- providerSequence: BN;
66
- committedSlot: BN;
67
- };
68
- export declare function getActiveRegistryTransfers(registry: {
69
- managedTransferCount: BN | number;
70
- transfers: any[];
71
- }): any[];
72
- export declare function deriveLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
73
- export declare function deriveOftAuxiliaryAccountSeed(glamState: PublicKey, transferId: PublicKey): Promise<string>;
74
- export declare function deriveOftAuxiliaryAccount(glamSigner: PublicKey, glamState: PublicKey, transferId: PublicKey, tokenProgram: PublicKey): Promise<{
75
- address: PublicKey;
76
- seed: string;
77
- }>;
78
- declare class TxBuilder extends BaseTxBuilder<BridgeClient> implements ProtocolPolicyTxBuilder<LayerzeroOftPolicy> {
79
- setPolicyIx(policy: LayerzeroOftPolicy, signer?: PublicKey): Promise<TransactionInstruction>;
80
- setPolicyTx(policy: LayerzeroOftPolicy, txOptions?: TxOptions): Promise<VersionedTransaction>;
81
- clearPolicyIx(signer?: PublicKey): Promise<TransactionInstruction>;
82
- clearPolicyTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
83
- addLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
84
- updateLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
85
- deleteLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
86
- buildOftTransferTx(params: OftTransferParams, txOptions?: TxOptions): Promise<{
87
- tx: VersionedTransaction;
88
- additionalSigners: Keypair[];
89
- sessionPda: PublicKey;
90
- auxiliaryTokenAccount: PublicKey;
91
- sourceTokenAccount: PublicKey;
92
- }>;
93
- }
94
- declare class LayerzeroOftBridgeProtocolClient {
95
- readonly bridge: BridgeClient;
96
- constructor(bridge: BridgeClient);
97
- buildSendTx(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<{
98
- auxiliaryTokenAccount: PublicKey;
99
- nonceAccount: PublicKey;
100
- routeProfile: LayerzeroOftRouteProfile;
101
- sendInstruction: TransactionInstruction;
102
- tx: VersionedTransaction;
103
- additionalSigners: Keypair[];
104
- sessionPda: PublicKey;
105
- sourceTokenAccount: PublicKey;
106
- }>;
107
- send(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<TransactionSignature>;
108
- }
109
- export declare class BridgeClient implements ProtocolPolicyClient<LayerzeroOftPolicy> {
110
- readonly base: BaseClient;
111
- readonly txBuilder: TxBuilder;
112
- readonly oft: LayerzeroOftBridgeProtocolClient;
113
- constructor(base: BaseClient);
114
- getRegistryPda(): PublicKey;
115
- getSessionPda(transferId: PublicKey): PublicKey;
116
- getLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
117
- deriveOftAuxiliaryTokenAccount(transferId: PublicKey, sourceMint: PublicKey, signer?: PublicKey): Promise<{
118
- tokenProgram: PublicKey;
119
- address: PublicKey;
120
- seed: string;
121
- }>;
122
- private resolveLayerzeroOftRouteProfile;
123
- private resolveLayerzeroOftNonceAccount;
124
- private materializeLayerzeroOftRemainingAccounts;
125
- private buildLayerzeroOftInstructionBaseAccounts;
126
- private buildLayerzeroOftSendInstruction;
127
- fetchPolicy(): Promise<LayerzeroOftPolicy | null>;
128
- fetchLayerzeroOftPolicy(): Promise<LayerzeroOftPolicy | null>;
129
- setPolicy(policy: LayerzeroOftPolicy, txOptions?: TxOptions): Promise<TransactionSignature>;
130
- clearPolicy(txOptions?: TxOptions): Promise<TransactionSignature>;
131
- fetchRegistry(): Promise<{
132
- glamState: PublicKey;
133
- managedTransferCount: number;
134
- reserved: number[];
135
- transfers: {
136
- transferId: PublicKey;
137
- sourceMint: PublicKey;
138
- destinationRecipient: PublicKey;
139
- providerProgram: PublicKey;
140
- providerConfig: PublicKey;
141
- providerEmitter: PublicKey;
142
- sourceAmount: BN;
143
- quotedOutAmount: BN;
144
- providerSequence: BN;
145
- committedSlot: BN;
146
- protocol: number;
147
- destinationChain: number;
148
- sourceDecimals: number;
149
- status: number;
150
- reserved: number[];
151
- }[];
152
- } | null>;
153
- fetchSession(transferId: PublicKey): Promise<{
154
- glamState: PublicKey;
155
- signer: PublicKey;
156
- transferId: PublicKey;
157
- protocol: number;
158
- managed: boolean;
159
- sourceMint: PublicKey;
160
- sourceDecimals: number;
161
- sourceTokenAccount: PublicKey;
162
- providerProgram: PublicKey;
163
- providerConfig: PublicKey;
164
- providerSender: PublicKey;
165
- providerDelegate: PublicKey;
166
- providerReceipt: PublicKey;
167
- providerInstructionHash: number[];
168
- providerInstructionCount: number;
169
- sourceAmount: BN;
170
- quotedOutAmount: BN;
171
- initialSourceBalance: BN;
172
- initialProviderSequence: BN;
173
- destinationChain: number;
174
- destinationRecipient: PublicKey;
175
- quoteExpiresAt: BN;
176
- preparedSlot: BN;
177
- bump: number;
178
- } | null>;
179
- fetchTransferRecordNullable(transferId: PublicKey): Promise<BridgeTransferRecordAccount | null>;
180
- addLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
181
- updateLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
182
- deleteLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
183
- buildOftTransferTx(params: OftTransferParams, txOptions?: TxOptions): Promise<{
184
- tx: VersionedTransaction;
185
- additionalSigners: Keypair[];
186
- sessionPda: PublicKey;
187
- auxiliaryTokenAccount: PublicKey;
188
- sourceTokenAccount: PublicKey;
189
- }>;
190
- buildLayerzeroOftSendTx(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<{
191
- auxiliaryTokenAccount: PublicKey;
192
- nonceAccount: PublicKey;
193
- routeProfile: LayerzeroOftRouteProfile;
194
- sendInstruction: TransactionInstruction;
195
- tx: VersionedTransaction;
196
- additionalSigners: Keypair[];
197
- sessionPda: PublicKey;
198
- sourceTokenAccount: PublicKey;
199
- }>;
200
- sendOft(params: OftTransferParams, txOptions?: TxOptions): Promise<TransactionSignature>;
201
- private extendLookupTables;
202
- settleManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
203
- validateManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
204
- }
205
- export {};
@@ -1,32 +0,0 @@
1
- import { PublicKey } from "@solana/web3.js";
2
- import { ClusterNetwork } from "../clientConfig";
3
- export type RouteAccountPlaceholder = "payer" | "nonce";
4
- export type SerializableRouteAccountMeta = {
5
- pubkey?: PublicKey;
6
- placeholder?: RouteAccountPlaceholder;
7
- isSigner: boolean;
8
- isWritable: boolean;
9
- };
10
- export type LayerzeroOftRouteProfile = {
11
- sourceMint: PublicKey;
12
- destinationChain: number;
13
- providerProgram: PublicKey;
14
- providerConfig: PublicKey;
15
- nonceAccount?: PublicKey;
16
- peerConfig: PublicKey;
17
- providerSender: PublicKey;
18
- enforcedOptions: PublicKey;
19
- tokenEscrow: PublicKey;
20
- eventAuthority: PublicKey;
21
- lookupTables?: PublicKey[];
22
- defaultOptions?: Uint8Array | number[] | Buffer;
23
- defaultMinAmountBps?: number;
24
- remainingAccounts: SerializableRouteAccountMeta[];
25
- quoteRemainingAccounts?: SerializableRouteAccountMeta[];
26
- };
27
- export declare function resolveCanonicalLayerzeroOftRouteProfile(params: {
28
- sourceMint: PublicKey;
29
- destinationChain: number;
30
- cluster: ClusterNetwork;
31
- providerProgram?: PublicKey;
32
- }): LayerzeroOftRouteProfile | null;
@@ -1,164 +0,0 @@
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 {};