@glamsystems/glam-sdk 1.1.0-alpha.0 → 1.1.0-alpha.2

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 (85) hide show
  1. package/index.cjs.js +4898 -1183
  2. package/index.esm.js +4890 -1172
  3. package/package.json +2 -2
  4. package/target/idl/glam_mint-staging.json +236 -0
  5. package/target/idl/glam_protocol-staging.json +5 -0
  6. package/target/idl/glam_protocol.json +5 -0
  7. package/target/types/glam_mint-staging.ts +236 -0
  8. package/target/types/glam_protocol-staging.ts +5 -0
  9. package/target/types/glam_protocol.ts +5 -0
  10. package/src/assets.d.ts +0 -39
  11. package/src/client/access.d.ts +0 -57
  12. package/src/client/base.d.ts +0 -184
  13. package/src/client/bridge.d.ts +0 -183
  14. package/src/client/bridgeRegistry.d.ts +0 -32
  15. package/src/client/cctp.d.ts +0 -156
  16. package/src/client/epi.d.ts +0 -78
  17. package/src/client/fees.d.ts +0 -33
  18. package/src/client/invest.d.ts +0 -37
  19. package/src/client/jupiter.d.ts +0 -45
  20. package/src/client/kamino/farm.d.ts +0 -39
  21. package/src/client/kamino/index.d.ts +0 -4
  22. package/src/client/kamino/lending.d.ts +0 -86
  23. package/src/client/kamino/types.d.ts +0 -56
  24. package/src/client/kamino/vaults.d.ts +0 -31
  25. package/src/client/loopscale.d.ts +0 -84
  26. package/src/client/marinade.d.ts +0 -42
  27. package/src/client/mint.d.ts +0 -127
  28. package/src/client/neutral.d.ts +0 -111
  29. package/src/client/price.d.ts +0 -137
  30. package/src/client/stake-pool.d.ts +0 -39
  31. package/src/client/stake.d.ts +0 -34
  32. package/src/client/state.d.ts +0 -56
  33. package/src/client/timelock.d.ts +0 -31
  34. package/src/client/vault.d.ts +0 -90
  35. package/src/client.d.ts +0 -68
  36. package/src/clientConfig.d.ts +0 -29
  37. package/src/constants.d.ts +0 -84
  38. package/src/deser/base.d.ts +0 -18
  39. package/src/deser/index.d.ts +0 -3
  40. package/src/deser/integrationPolicies.d.ts +0 -120
  41. package/src/deser/kaminoLayouts.d.ts +0 -264
  42. package/src/deser/tokenAclLayouts.d.ts +0 -67
  43. package/src/error.d.ts +0 -29
  44. package/src/glamExports.d.ts +0 -5116
  45. package/src/globalConfig.d.ts +0 -27
  46. package/src/index.d.ts +0 -20
  47. package/src/models/acl.d.ts +0 -43
  48. package/src/models/index.d.ts +0 -8
  49. package/src/models/mint.d.ts +0 -64
  50. package/src/models/state.d.ts +0 -104
  51. package/src/models/types.d.ts +0 -28
  52. package/src/react/cluster-provider.d.ts +0 -22
  53. package/src/react/glam.d.ts +0 -47
  54. package/src/react/index.d.ts +0 -5
  55. package/src/react/query-keys.d.ts +0 -38
  56. package/src/react/useVaultBalanceSubscription.d.ts +0 -17
  57. package/src/utils/accounts.d.ts +0 -72
  58. package/src/utils/bitmask.d.ts +0 -53
  59. package/src/utils/blockhash.d.ts +0 -11
  60. package/src/utils/common.d.ts +0 -37
  61. package/src/utils/computeBudget.d.ts +0 -15
  62. package/src/utils/evm.d.ts +0 -10
  63. package/src/utils/fraction.d.ts +0 -29
  64. package/src/utils/glamPDAs.d.ts +0 -15
  65. package/src/utils/index.d.ts +0 -16
  66. package/src/utils/jupiterApi.d.ts +0 -89
  67. package/src/utils/lookupTables.d.ts +0 -53
  68. package/src/utils/pkmap.d.ts +0 -87
  69. package/src/utils/pkset.d.ts +0 -73
  70. package/src/utils/positionCategorizer.d.ts +0 -36
  71. package/src/utils/rpc.d.ts +0 -33
  72. package/src/utils/timelock.d.ts +0 -52
  73. package/src/utils/transaction.d.ts +0 -13
  74. package/target/types/ext_bridge.d.ts +0 -2385
  75. package/target/types/ext_cctp.d.ts +0 -1268
  76. package/target/types/ext_epi.d.ts +0 -2175
  77. package/target/types/ext_kamino.d.ts +0 -3433
  78. package/target/types/ext_loopscale.d.ts +0 -3547
  79. package/target/types/ext_marinade.d.ts +0 -1593
  80. package/target/types/ext_neutral.d.ts +0 -1786
  81. package/target/types/ext_spl.d.ts +0 -1274
  82. package/target/types/ext_stake_pool.d.ts +0 -1622
  83. package/target/types/glam_config.d.ts +0 -755
  84. package/target/types/glam_mint.d.ts +0 -6106
  85. package/target/types/glam_protocol.d.ts +0 -2708
@@ -1,184 +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 { AddressLookupTableAccount, Connection, Keypair, PublicKey, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
5
- import { ExtBridgeProgram, ExtEpiProgram, ExtCctpProgram, ExtKaminoProgram, ExtMarinadeProgram, ExtLoopscaleProgram, ExtNeutralProgram, ExtSplProgram, ExtStakePoolProgram, GlamMintProgram, GlamProtocolProgram } from "../glamExports";
6
- import { ClusterNetwork, GlamClientConfig } from "../clientConfig";
7
- import { GlobalConfig } from "../globalConfig";
8
- import { RequestQueue, StateAccount, StateModel } from "../models";
9
- import { BlockhashWithCache } from "../utils/blockhash";
10
- import { JupiterApiClient, PkMap } from "../utils";
11
- import { AssetMeta } from "../assets";
12
- export type TxOptions = {
13
- signer?: PublicKey;
14
- computeUnitLimit?: number;
15
- getPriorityFeeMicroLamports?: (tx: VersionedTransaction) => Promise<number>;
16
- maxFeeLamports?: number;
17
- useMaxFee?: boolean;
18
- preInstructions?: TransactionInstruction[];
19
- postInstructions?: TransactionInstruction[];
20
- lookupTables?: PublicKey[] | AddressLookupTableAccount[];
21
- simulate?: boolean;
22
- };
23
- export type TokenAccount = {
24
- owner: PublicKey;
25
- pubkey: PublicKey;
26
- mint: PublicKey;
27
- programId: PublicKey;
28
- decimals: number;
29
- amount: string;
30
- uiAmount: number;
31
- frozen: boolean;
32
- };
33
- export declare class BaseClient {
34
- cluster: ClusterNetwork;
35
- provider: anchor.Provider;
36
- blockhashWithCache: BlockhashWithCache;
37
- jupiterApiKey?: string;
38
- jupiterApiClient?: JupiterApiClient;
39
- onSentListeners: Set<(sig: string) => void>;
40
- readonly staging: boolean;
41
- private _protocolProgram?;
42
- private _mintProgram?;
43
- private _extSplProgram?;
44
- private _extKaminoProgram?;
45
- private _extMarinadeProgram?;
46
- private _extStakePoolProgram?;
47
- private _extCctpProgram?;
48
- private _extBridgeProgram?;
49
- private _extEpiProgram?;
50
- private _extLoopscaleProgram?;
51
- private _extNeutralProgram?;
52
- private _statePda?;
53
- private _globalConfig?;
54
- private _globalConfigPromise?;
55
- private _assetMetas?;
56
- private _assetMetasPromise?;
57
- constructor(config?: GlamClientConfig);
58
- get protocolProgram(): GlamProtocolProgram;
59
- get mintProgram(): GlamMintProgram;
60
- get extSplProgram(): ExtSplProgram;
61
- get extKaminoProgram(): ExtKaminoProgram;
62
- get extMarinadeProgram(): ExtMarinadeProgram;
63
- get extStakePoolProgram(): ExtStakePoolProgram;
64
- get extCctpProgram(): ExtCctpProgram;
65
- get extBridgeProgram(): ExtBridgeProgram;
66
- get extEpiProgram(): ExtEpiProgram;
67
- get extLoopscaleProgram(): ExtLoopscaleProgram;
68
- get extNeutralProgram(): ExtNeutralProgram;
69
- get isVaultConnected(): boolean;
70
- get statePda(): PublicKey;
71
- set statePda(statePda: PublicKey);
72
- get isMainnet(): boolean;
73
- /**
74
- * Converts a legacy transaction into a versioned transaction.
75
- */
76
- intoVersionedTransaction(tx: Transaction, { lookupTables, signer, computeUnitLimit, getPriorityFeeMicroLamports, maxFeeLamports, useMaxFee, simulate, }: TxOptions): Promise<VersionedTransaction>;
77
- sendAndConfirm(tx: VersionedTransaction | Transaction, additionalSigners?: Keypair[]): Promise<TransactionSignature>;
78
- private confirmTransaction;
79
- get connection(): Connection;
80
- get signer(): PublicKey;
81
- get wallet(): Wallet;
82
- get vaultPda(): PublicKey;
83
- get mintPda(): PublicKey;
84
- get escrowPda(): PublicKey;
85
- get extraMetasPda(): PublicKey;
86
- get requestQueuePda(): PublicKey;
87
- /**
88
- * Returns SOL and token balances of the given owner pubkey
89
- */
90
- getSolAndTokenBalances(owner: PublicKey): Promise<{
91
- balanceLamports: number;
92
- uiAmount: number;
93
- tokenAccounts: TokenAccount[];
94
- }>;
95
- /**
96
- * Returns user's token account for the given mint and token program ID
97
- */
98
- getAta(mint: PublicKey, owner: PublicKey, tokenProgram?: anchor.web3.PublicKey): PublicKey;
99
- /**
100
- * Returns glam vault's token account for the given mint and token program ID
101
- */
102
- getVaultAta(mint: PublicKey, tokenProgramId?: PublicKey): PublicKey;
103
- /**
104
- * Returns user's glam mint token account
105
- */
106
- getMintAta(user?: PublicKey): PublicKey;
107
- /**
108
- * Returns glam vault's SOL balance
109
- */
110
- getVaultBalance(): Promise<number>;
111
- /**
112
- * Returns glam vault's SOL balance in lamports
113
- */
114
- getVaultLamports(): Promise<number>;
115
- /**
116
- * Returns glam vault's token balance for the given mint
117
- */
118
- getVaultTokenBalance(mintPubkey: PublicKey): Promise<{
119
- amount: BN;
120
- uiAmount: number;
121
- }>;
122
- /**
123
- * Returns user's glam mint token balance
124
- */
125
- getMintTokenBalance(owner?: PublicKey): Promise<{
126
- amount: BN;
127
- uiAmount: number;
128
- }>;
129
- isLockupEnabled(): Promise<boolean>;
130
- fetchGlobalConfig(options?: {
131
- refresh?: boolean;
132
- }): Promise<GlobalConfig>;
133
- fetchAssetMetas(options?: {
134
- refresh?: boolean;
135
- }): Promise<PkMap<AssetMeta>>;
136
- refreshAssetMetaCache(): Promise<PkMap<AssetMeta>>;
137
- getAssetMeta(assetMint: string | PublicKey, options?: {
138
- refresh?: boolean;
139
- }): Promise<AssetMeta>;
140
- getSolOracle(options?: {
141
- refresh?: boolean;
142
- }): Promise<PublicKey>;
143
- fetchStateAccount(statePda?: PublicKey): Promise<StateAccount>;
144
- private getMintProgramIdForStateAccount;
145
- private getMintProgramForStateAccount;
146
- fetchRequestQueue(requestQueuePda?: PublicKey, mintProgram?: GlamMintProgram): Promise<RequestQueue>;
147
- /**
148
- * Builds a StateModel from onchain accounts (state, mint, etc)
149
- *
150
- * @param statePda Optional state PDA
151
- */
152
- fetchStateModel(statePda?: PublicKey): Promise<StateModel>;
153
- /**
154
- * Fetches glam state models and applies filters
155
- *
156
- * @param filterOptions Filter options
157
- */
158
- fetchGlamStates(filterOptions?: {
159
- owner?: PublicKey;
160
- delegate?: PublicKey;
161
- type?: string;
162
- }): Promise<StateModel[]>;
163
- fetchProtocolPolicy<T>(integProgramId: PublicKey, protocolBitflag: number, policyClass: {
164
- decode(buffer: Buffer, staging?: boolean): T;
165
- }): Promise<T | null>;
166
- }
167
- /**
168
- * Base transaction builder for sub-clients
169
- */
170
- export declare class BaseTxBuilder<T extends {
171
- base: BaseClient;
172
- }> {
173
- readonly client: T;
174
- constructor(client: T);
175
- /**
176
- * Build a legacy transaction with the given instructions.
177
- * Pre and post instructions in txOptions are preserved.
178
- */
179
- build(ixs: TransactionInstruction[], txOptions?: TxOptions): Transaction;
180
- /**
181
- * Build a versioned transaction that is ready to be sent.
182
- */
183
- buildVersionedTx(ixs: TransactionInstruction[], txOptions?: TxOptions): Promise<VersionedTransaction>;
184
- }
@@ -1,183 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { Keypair, PublicKey, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
3
- import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
4
- import { LayerzeroOftRouteProfile } from "./bridgeRegistry";
5
- import { LayerzeroOftPolicy, LayerzeroOftRoute, RouteManagementMode } from "../deser/integrationPolicies";
6
- export declare const LAYERZERO_OFT_PROTOCOL: number;
7
- type BufferLike = Uint8Array | number[] | Buffer;
8
- type RouteManagementModeArg = RouteManagementMode | number | {
9
- unmanagedOnly: Record<string, never>;
10
- } | {
11
- managedOnly: Record<string, never>;
12
- } | {
13
- either: Record<string, never>;
14
- };
15
- export type LayerzeroOftRouteInput = Omit<LayerzeroOftRoute, "managementMode"> & {
16
- managementMode: RouteManagementModeArg;
17
- };
18
- export type OftTransferParams = {
19
- transferId: PublicKey;
20
- sourceMint: PublicKey;
21
- sourceAmount: BN;
22
- providerInstructions: TransactionInstruction[];
23
- providerReceipt: PublicKey;
24
- managed?: boolean;
25
- providerSigners?: Keypair[];
26
- };
27
- export type LayerzeroOftSendParams = {
28
- transferId?: PublicKey;
29
- sourceMint: PublicKey;
30
- sourceAmount: BN;
31
- destinationChain: number;
32
- destinationRecipient: PublicKey;
33
- nativeFeeLamports: BN;
34
- minAmountLd?: BN;
35
- lzTokenFee?: BN;
36
- options?: BufferLike;
37
- composeMsg?: BufferLike | null;
38
- sourceTokenAccount?: PublicKey;
39
- nonceAccount?: PublicKey;
40
- managed?: boolean;
41
- providerProgram?: PublicKey;
42
- };
43
- type BridgeTransferStatusAccount = {
44
- committed: Record<string, never>;
45
- } | {
46
- validated: Record<string, never>;
47
- } | {
48
- settled: Record<string, never>;
49
- };
50
- type BridgeTransferRecordAccount = {
51
- glamState: PublicKey;
52
- transferId: PublicKey;
53
- protocol: number;
54
- status: BridgeTransferStatusAccount;
55
- managed: true;
56
- receiptVerified: true;
57
- sourceMint: PublicKey;
58
- sourceDecimals: number;
59
- providerProgram: PublicKey;
60
- providerConfig: PublicKey;
61
- sourceAmount: BN;
62
- quotedOutAmount: BN;
63
- destinationChain: number;
64
- destinationRecipient: PublicKey;
65
- providerEmitter: PublicKey;
66
- providerSequence: BN;
67
- committedSlot: BN;
68
- };
69
- export declare function getActiveRegistryTransfers(registry: {
70
- managedTransferCount: BN | number;
71
- transfers: any[];
72
- }): any[];
73
- export declare function deriveLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
74
- export declare function deriveOftAuxiliaryAccountSeed(glamState: PublicKey, transferId: PublicKey): Promise<string>;
75
- export declare function deriveOftAuxiliaryAccount(glamSigner: PublicKey, glamState: PublicKey, transferId: PublicKey, tokenProgram: PublicKey): Promise<{
76
- address: PublicKey;
77
- seed: string;
78
- }>;
79
- declare class TxBuilder extends BaseTxBuilder<BridgeClient> {
80
- addLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
81
- updateLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
82
- deleteLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
83
- buildOftTransferTx(params: OftTransferParams, txOptions?: TxOptions): Promise<{
84
- tx: VersionedTransaction;
85
- additionalSigners: Keypair[];
86
- sessionPda: PublicKey;
87
- auxiliaryTokenAccount: PublicKey;
88
- sourceTokenAccount: PublicKey;
89
- }>;
90
- }
91
- declare class LayerzeroOftBridgeProtocolClient {
92
- readonly bridge: BridgeClient;
93
- constructor(bridge: BridgeClient);
94
- buildSendTx(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<{
95
- auxiliaryTokenAccount: PublicKey;
96
- nonceAccount: PublicKey;
97
- routeProfile: LayerzeroOftRouteProfile;
98
- sendInstruction: TransactionInstruction;
99
- tx: VersionedTransaction;
100
- additionalSigners: Keypair[];
101
- sessionPda: PublicKey;
102
- sourceTokenAccount: PublicKey;
103
- }>;
104
- send(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<TransactionSignature>;
105
- }
106
- export declare class BridgeClient {
107
- readonly base: BaseClient;
108
- readonly txBuilder: TxBuilder;
109
- readonly oft: LayerzeroOftBridgeProtocolClient;
110
- constructor(base: BaseClient);
111
- getRegistryPda(): PublicKey;
112
- getSessionPda(transferId: PublicKey): PublicKey;
113
- getLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
114
- deriveOftAuxiliaryTokenAccount(transferId: PublicKey, sourceMint: PublicKey, signer?: PublicKey): Promise<{
115
- tokenProgram: PublicKey;
116
- address: PublicKey;
117
- seed: string;
118
- }>;
119
- private resolveLayerzeroOftRouteProfile;
120
- private resolveLayerzeroOftNonceAccount;
121
- private materializeLayerzeroOftRemainingAccounts;
122
- private buildLayerzeroOftInstructionBaseAccounts;
123
- private buildLayerzeroOftSendInstruction;
124
- fetchLayerzeroOftPolicy(): Promise<LayerzeroOftPolicy | null>;
125
- fetchRegistry(): Promise<{
126
- glamState: PublicKey;
127
- managedTransferCount: number;
128
- reserved: number[];
129
- transfers: any[];
130
- } | null>;
131
- fetchSession(transferId: PublicKey): Promise<{
132
- glamState: PublicKey;
133
- signer: PublicKey;
134
- transferId: PublicKey;
135
- protocol: number;
136
- managed: boolean;
137
- sourceMint: PublicKey;
138
- sourceDecimals: number;
139
- sourceTokenAccount: PublicKey;
140
- providerProgram: PublicKey;
141
- providerConfig: PublicKey;
142
- providerSender: PublicKey;
143
- providerDelegate: PublicKey;
144
- providerReceipt: PublicKey;
145
- providerInstructionHash: number[];
146
- providerInstructionCount: number;
147
- sourceAmount: BN;
148
- quotedOutAmount: BN;
149
- initialSourceBalance: BN;
150
- initialProviderSequence: BN;
151
- destinationChain: number;
152
- destinationRecipient: PublicKey;
153
- quoteExpiresAt: BN;
154
- preparedSlot: BN;
155
- bump: number;
156
- } | null>;
157
- fetchTransferRecordNullable(transferId: PublicKey): Promise<BridgeTransferRecordAccount | null>;
158
- addLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
159
- updateLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
160
- deleteLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
161
- buildOftTransferTx(params: OftTransferParams, txOptions?: TxOptions): Promise<{
162
- tx: VersionedTransaction;
163
- additionalSigners: Keypair[];
164
- sessionPda: PublicKey;
165
- auxiliaryTokenAccount: PublicKey;
166
- sourceTokenAccount: PublicKey;
167
- }>;
168
- buildLayerzeroOftSendTx(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<{
169
- auxiliaryTokenAccount: PublicKey;
170
- nonceAccount: PublicKey;
171
- routeProfile: LayerzeroOftRouteProfile;
172
- sendInstruction: TransactionInstruction;
173
- tx: VersionedTransaction;
174
- additionalSigners: Keypair[];
175
- sessionPda: PublicKey;
176
- sourceTokenAccount: PublicKey;
177
- }>;
178
- sendOft(params: OftTransferParams, txOptions?: TxOptions): Promise<TransactionSignature>;
179
- private extendLookupTables;
180
- settleManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
181
- validateManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
182
- }
183
- 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,156 +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, TxOptions } from "./base";
4
- export declare class CctpBridgeEvent {
5
- readonly amount: BN;
6
- readonly sourceDomain: number;
7
- readonly sourceAddress: string;
8
- readonly destinationDomain: number;
9
- readonly destinationCaller: string;
10
- readonly destinationAddress: string;
11
- readonly attestation: string;
12
- readonly nonce: string;
13
- readonly status: string;
14
- readonly txHash: string;
15
- readonly uiAmount: number;
16
- slot?: number;
17
- constructor(amount: BN, sourceDomain: number, sourceAddress: string, destinationDomain: number, destinationCaller: string, destinationAddress: string, attestation: string, nonce: string, status: string, txHash: string);
18
- }
19
- declare class TxBuilder extends BaseTxBuilder<CctpClient> {
20
- /**
21
- * Returns a transaction that calls CCTP's `depositForBurn` instruction that bridges USDC to another chain.
22
- * A keypair is generated for the message sent event account, which must be included as a transaction signer.
23
- */
24
- bridgeUsdcIx(amount: BN, domain: number, destinationAddress: PublicKey, params: {
25
- maxFee: BN;
26
- minFinalityThreshold: number;
27
- destinationCaller?: PublicKey;
28
- }, glamSigner: PublicKey): Promise<[TransactionInstruction, Keypair]>;
29
- bridgeUsdcTx(amount: BN, domain: number, destinationAddress: PublicKey, params: {
30
- maxFee: BN;
31
- minFinalityThreshold: number;
32
- destinationCaller?: PublicKey;
33
- }, txOptions: TxOptions): Promise<[VersionedTransaction, Keypair]>;
34
- receiveMessageIx(sourceDomain: number, messageObj: any): Promise<TransactionInstruction>;
35
- receiveUsdcTx(sourceDomain: number, params: {
36
- txHash?: string;
37
- nonce?: string;
38
- }, txOptions?: TxOptions): Promise<VersionedTransaction>;
39
- }
40
- export declare class CctpClient {
41
- readonly base: BaseClient;
42
- txBuilder: TxBuilder;
43
- constructor(base: BaseClient);
44
- /**
45
- * Bridge USDC to another chain using Circle's CCTP protocol
46
- *
47
- * @param amount Amount of USDC to bridge (in smallest units)
48
- * @param domain Destination domain (e.g., 0 for Ethereum, 1 for Avalanche)
49
- * @param destinationAddress Destination address on target chain (EVM address as PublicKey)
50
- * @param params Additional parameters (maxFee, minFinalityThreshold)
51
- * @param txOptions Transaction options
52
- */
53
- bridgeUsdc(amount: BN | number, domain: number, destinationAddress: PublicKey, params: {
54
- maxFee: BN;
55
- minFinalityThreshold: number;
56
- destinationCaller?: PublicKey;
57
- }, txOptions?: TxOptions): Promise<TransactionSignature>;
58
- /**
59
- * Receive USDC from another chain using Circle's CCTP protocol
60
- *
61
- * @param sourceDomain Source domain (e.g., 0 for Ethereum, 6 for Base)
62
- * @param params Additional parameters (txHash, nonce)
63
- * @param txOptions Transaction options
64
- */
65
- receiveUsdc(sourceDomain: number, params: {
66
- txHash?: string;
67
- nonce?: string;
68
- }, txOptions?: TxOptions): Promise<string>;
69
- getReceiveMessagePdas(messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, solUsdcMint: PublicKey, remoteUsdcAddressHex: string, remoteDomain: string, nonceHex: string): Promise<{
70
- messageTransmitter: PublicKey;
71
- tokenMessenger: PublicKey;
72
- tokenMinter: PublicKey;
73
- localToken: PublicKey;
74
- remoteTokenMessengerKey: PublicKey;
75
- remoteTokenKey: PublicKey;
76
- tokenPair: PublicKey;
77
- custodyTokenAccount: PublicKey;
78
- authorityPda: PublicKey;
79
- tokenMessengerEventAuthority: PublicKey;
80
- usedNonce: PublicKey;
81
- feeRecipientTokenAccount: PublicKey;
82
- }>;
83
- /**
84
- * Get all PDAs required for CCTP deposit for burn operation
85
- *
86
- * @param messageTransmitterProgram Message transmitter program ID
87
- * @param tokenMessengerMinterProgram Token messenger minter program ID
88
- * @param usdcAddress USDC mint address
89
- * @param destinationDomain Destination domain
90
- * @returns Object containing all required PDAs
91
- */
92
- getDepositForBurnPdas(messageTransmitterProgram: PublicKey, tokenMessengerMinterProgram: PublicKey, usdcAddress: PublicKey, destinationDomain: Number): {
93
- messageTransmitterAccount: PublicKey;
94
- tokenMessengerAccount: PublicKey;
95
- tokenMinterAccount: PublicKey;
96
- localToken: PublicKey;
97
- remoteTokenMessengerKey: PublicKey;
98
- authorityPda: PublicKey;
99
- tokenMessengerEventAuthority: PublicKey;
100
- };
101
- /**
102
- * Find all message accounts onchain for a given sender wallet
103
- *
104
- * TODO: filter by burned token mint
105
- */
106
- findV2Messages(senderWallet: PublicKey, options: {
107
- commitment?: Commitment;
108
- minSlot?: number;
109
- }): Promise<PublicKey[]>;
110
- fetchV2Messages(sourceDomain: number, params: {
111
- txHash?: string;
112
- nonce?: string;
113
- }): Promise<any[]>;
114
- /**
115
- * Get bridge events from Circle API using either txHash or nonce
116
- *
117
- * @param sourceDomain Source domain
118
- * @param params Either txHash or nonce is required
119
- * @returns Array of bridge events
120
- */
121
- parseEventsFromAttestion(sourceDomain: number, { txHash, nonce }: {
122
- txHash?: string;
123
- nonce?: string;
124
- }): Promise<CctpBridgeEvent[]>;
125
- getTransactions(signatures: string[], batchSize: number, commitment?: Finality): Promise<VersionedTransactionResponse[]>;
126
- /**
127
- * Get incoming bridge events (EVM -> Solana)
128
- *
129
- * Unlike outgoing bridge events, incoming bridge events are not stored in Message accounts on Solana.
130
- * We need to examine all transactions to find the ones that contain the bridge events.
131
- * 1. Fetch all transactions involing the vault's USDC token account
132
- * 2. Filter transactions that contain the bridge events
133
- * 3. Parse the bridge events from the transactions
134
- */
135
- getIncomingBridgeEvents(options: {
136
- batchSize?: number;
137
- commitment?: Finality;
138
- txHashes?: string[];
139
- minSlot?: number;
140
- }): Promise<CctpBridgeEvent[]>;
141
- /**
142
- * Get outgoing bridge events (Solana -> EVM)
143
- *
144
- * Each transfer has a Message account on Solana. To get all events:
145
- * 1. Find all Message accounts for the vault
146
- * 2. Get the created transaction for each message account
147
- * 3. Call iris api to get the attestation status and parsed message using each tx hash
148
- */
149
- getOutgoingBridgeEvents(options: {
150
- batchSize?: number;
151
- commitment?: Commitment;
152
- txHashes?: string[];
153
- minSlot?: number;
154
- }): Promise<CctpBridgeEvent[]>;
155
- }
156
- export {};
@@ -1,78 +0,0 @@
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
- type BufferLike32 = Uint8Array | number[] | Buffer;
5
- export type EpiDenominationKindInput = {
6
- usd: Record<string, never>;
7
- } | {
8
- mint: Record<string, never>;
9
- };
10
- export type EpiDenominationSpecInput = {
11
- denom: EpiDenominationKindInput;
12
- mint: PublicKey;
13
- };
14
- export type EpiExternalPositionTypeInput = {
15
- valued: Record<string, never>;
16
- } | {
17
- tokenized: Record<string, never>;
18
- };
19
- export type EpiExternalSourceTypeInput = {
20
- trusted: Record<string, never>;
21
- } | {
22
- native: Record<string, never>;
23
- };
24
- export type EpiNativeCustodyKindInput = {
25
- splToken: Record<string, never>;
26
- } | {
27
- nativeSol: Record<string, never>;
28
- };
29
- export type UpsertExternalPositionParams = {
30
- positionId: BufferLike32;
31
- positionType: EpiExternalPositionTypeInput;
32
- sourceType: EpiExternalSourceTypeInput;
33
- denomination: EpiDenominationSpecInput;
34
- nativeCustodyAccount?: PublicKey;
35
- nativeCustodyKind?: EpiNativeCustodyKindInput;
36
- enabled?: boolean;
37
- freshnessOverrideSecs?: number;
38
- submitAllowlist?: PublicKey[];
39
- validateAllowlist?: PublicKey[];
40
- configureAllowlist?: PublicKey[];
41
- };
42
- export type SubmitExternalObservationParams = {
43
- positionId: BufferLike32;
44
- amount: BN;
45
- denomination: EpiDenominationSpecInput;
46
- observationTimestamp: BN;
47
- externalShares?: BN;
48
- reserved?: Uint8Array | number[] | Buffer;
49
- };
50
- declare class TxBuilder extends BaseTxBuilder<EpiClient> {
51
- upsertExternalPositionIx(params: UpsertExternalPositionParams, signer?: PublicKey): Promise<TransactionInstruction>;
52
- submitExternalObservationIx(params: SubmitExternalObservationParams, signer?: PublicKey): Promise<TransactionInstruction>;
53
- validateExternalObservationIx(positionId: BufferLike32, normalizedBaseAssetAmount: BN | null, signer?: PublicKey): Promise<TransactionInstruction>;
54
- refreshPricedProtocolIx(signer?: PublicKey): Promise<TransactionInstruction>;
55
- submitExternalObservationTx(params: SubmitExternalObservationParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
56
- upsertExternalPositionTx(params: UpsertExternalPositionParams, txOptions?: TxOptions): Promise<VersionedTransaction>;
57
- validateExternalObservationTx(positionId: BufferLike32, normalizedBaseAssetAmount: BN | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
58
- refreshPricedProtocolTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
59
- }
60
- export declare class EpiClient {
61
- readonly base: BaseClient;
62
- readonly txBuilder: TxBuilder;
63
- constructor(base: BaseClient);
64
- getObservationStatePda(): PublicKey;
65
- getIntegrationAuthorityPda(): PublicKey;
66
- fetchObservationState(): Promise<{
67
- glamState: PublicKey;
68
- bump: number;
69
- positionsLen: number;
70
- reserved: number[];
71
- positions: any[];
72
- } | null>;
73
- submitExternalObservation(params: SubmitExternalObservationParams, txOptions?: TxOptions): Promise<TransactionSignature>;
74
- upsertExternalPosition(params: UpsertExternalPositionParams, txOptions?: TxOptions): Promise<TransactionSignature>;
75
- validateExternalObservation(positionId: BufferLike32, normalizedBaseAssetAmount: BN | null, txOptions?: TxOptions): Promise<TransactionSignature>;
76
- refreshPricedProtocol(txOptions?: TxOptions): Promise<TransactionSignature>;
77
- }
78
- export {};
@@ -1,33 +0,0 @@
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 {};