@glamsystems/glam-sdk 1.0.14-alpha.4 → 1.0.14-alpha.6

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 (91) hide show
  1. package/index.cjs.js +50322 -20832
  2. package/index.esm.js +50167 -20833
  3. package/package.json +3 -3
  4. package/target/idl/ext_jupiter-staging.json +1960 -0
  5. package/target/idl/ext_jupiter.json +1960 -0
  6. package/target/idl/ext_orca-staging.json +2797 -0
  7. package/target/idl/ext_orca.json +2797 -0
  8. package/target/idl/glam_mint-staging.json +1452 -80
  9. package/target/idl/glam_mint.json +256 -1
  10. package/target/idl/glam_protocol-staging.json +22 -2
  11. package/target/idl/glam_protocol.json +584 -0
  12. package/target/types/ext_jupiter-staging.ts +1966 -0
  13. package/target/types/ext_jupiter.ts +1966 -0
  14. package/target/types/ext_orca-staging.ts +2803 -0
  15. package/target/types/ext_orca.ts +2803 -0
  16. package/target/types/glam_mint-staging.ts +1452 -80
  17. package/target/types/glam_mint.ts +256 -1
  18. package/target/types/glam_protocol-staging.ts +22 -2
  19. package/target/types/glam_protocol.ts +584 -0
  20. package/src/assets.d.ts +0 -40
  21. package/src/client/access.d.ts +0 -57
  22. package/src/client/base.d.ts +0 -180
  23. package/src/client/bridge.d.ts +0 -185
  24. package/src/client/bridgeRegistry.d.ts +0 -32
  25. package/src/client/cctp.d.ts +0 -156
  26. package/src/client/epi.d.ts +0 -78
  27. package/src/client/fees.d.ts +0 -33
  28. package/src/client/invest.d.ts +0 -37
  29. package/src/client/jupiter.d.ts +0 -45
  30. package/src/client/kamino/farm.d.ts +0 -39
  31. package/src/client/kamino/index.d.ts +0 -4
  32. package/src/client/kamino/lending.d.ts +0 -86
  33. package/src/client/kamino/types.d.ts +0 -56
  34. package/src/client/kamino/vaults.d.ts +0 -31
  35. package/src/client/marinade.d.ts +0 -42
  36. package/src/client/mint.d.ts +0 -127
  37. package/src/client/price.d.ts +0 -128
  38. package/src/client/stake-pool.d.ts +0 -39
  39. package/src/client/stake.d.ts +0 -34
  40. package/src/client/state.d.ts +0 -56
  41. package/src/client/timelock.d.ts +0 -31
  42. package/src/client/vault.d.ts +0 -90
  43. package/src/client.d.ts +0 -62
  44. package/src/clientConfig.d.ts +0 -29
  45. package/src/constants.d.ts +0 -82
  46. package/src/deser/base.d.ts +0 -18
  47. package/src/deser/index.d.ts +0 -3
  48. package/src/deser/integrationPolicies.d.ts +0 -106
  49. package/src/deser/kaminoLayouts.d.ts +0 -264
  50. package/src/deser/tokenAclLayouts.d.ts +0 -67
  51. package/src/error.d.ts +0 -29
  52. package/src/glamExports.d.ts +0 -5563
  53. package/src/globalConfig.d.ts +0 -22
  54. package/src/index.d.ts +0 -18
  55. package/src/models/acl.d.ts +0 -43
  56. package/src/models/index.d.ts +0 -8
  57. package/src/models/mint.d.ts +0 -64
  58. package/src/models/state.d.ts +0 -104
  59. package/src/models/types.d.ts +0 -28
  60. package/src/react/cluster-provider.d.ts +0 -22
  61. package/src/react/glam.d.ts +0 -47
  62. package/src/react/index.d.ts +0 -5
  63. package/src/react/query-keys.d.ts +0 -38
  64. package/src/react/useVaultBalanceSubscription.d.ts +0 -17
  65. package/src/utils/accounts.d.ts +0 -72
  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 -37
  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 -14
  73. package/src/utils/index.d.ts +0 -16
  74. package/src/utils/jupiterApi.d.ts +0 -89
  75. package/src/utils/lookupTables.d.ts +0 -53
  76. package/src/utils/pkmap.d.ts +0 -82
  77. package/src/utils/pkset.d.ts +0 -73
  78. package/src/utils/positionCategorizer.d.ts +0 -36
  79. package/src/utils/rpc.d.ts +0 -33
  80. package/src/utils/timelock.d.ts +0 -52
  81. package/src/utils/transaction.d.ts +0 -13
  82. package/target/types/ext_bridge.d.ts +0 -2385
  83. package/target/types/ext_cctp.d.ts +0 -1268
  84. package/target/types/ext_epi.d.ts +0 -2175
  85. package/target/types/ext_kamino.d.ts +0 -3433
  86. package/target/types/ext_marinade.d.ts +0 -1593
  87. package/target/types/ext_spl.d.ts +0 -1274
  88. package/target/types/ext_stake_pool.d.ts +0 -1622
  89. package/target/types/glam_config.d.ts +0 -755
  90. package/target/types/glam_mint.d.ts +0 -6094
  91. package/target/types/glam_protocol.d.ts +0 -2708
@@ -1,180 +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, ExtSplProgram, ExtStakePoolProgram, GlamMintProgram, GlamProtocolProgram } from "../glamExports";
6
- import { ClusterNetwork, GlamClientConfig } from "../clientConfig";
7
- import type { GlobalConfigAccount } from "../globalConfig";
8
- import { RequestQueue, StateAccount, StateModel } from "../models";
9
- import { BlockhashWithCache } from "../utils/blockhash";
10
- import { JupiterApiClient } 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 _statePda?;
51
- private _globalConfig?;
52
- private _globalConfigPromise?;
53
- private _assetMetas?;
54
- private _assetMetasPromise?;
55
- constructor(config?: GlamClientConfig);
56
- get protocolProgram(): GlamProtocolProgram;
57
- get mintProgram(): GlamMintProgram;
58
- get extSplProgram(): ExtSplProgram;
59
- get extKaminoProgram(): ExtKaminoProgram;
60
- get extMarinadeProgram(): ExtMarinadeProgram;
61
- get extStakePoolProgram(): ExtStakePoolProgram;
62
- get extCctpProgram(): ExtCctpProgram;
63
- get extBridgeProgram(): ExtBridgeProgram;
64
- get extEpiProgram(): ExtEpiProgram;
65
- get isVaultConnected(): boolean;
66
- get statePda(): PublicKey;
67
- set statePda(statePda: PublicKey);
68
- get isMainnet(): boolean;
69
- /**
70
- * Converts a legacy transaction into a versioned transaction.
71
- */
72
- intoVersionedTransaction(tx: Transaction, { lookupTables, signer, computeUnitLimit, getPriorityFeeMicroLamports, maxFeeLamports, useMaxFee, simulate, }: TxOptions): Promise<VersionedTransaction>;
73
- sendAndConfirm(tx: VersionedTransaction | Transaction, additionalSigners?: Keypair[]): Promise<TransactionSignature>;
74
- private confirmTransaction;
75
- get connection(): Connection;
76
- get signer(): PublicKey;
77
- get wallet(): Wallet;
78
- get vaultPda(): PublicKey;
79
- get mintPda(): PublicKey;
80
- get escrowPda(): PublicKey;
81
- get extraMetasPda(): PublicKey;
82
- get requestQueuePda(): PublicKey;
83
- /**
84
- * Returns SOL and token balances of the given owner pubkey
85
- */
86
- getSolAndTokenBalances(owner: PublicKey): Promise<{
87
- balanceLamports: number;
88
- uiAmount: number;
89
- tokenAccounts: TokenAccount[];
90
- }>;
91
- /**
92
- * Returns user's token account for the given mint and token program ID
93
- */
94
- getAta(mint: PublicKey, owner: PublicKey, tokenProgram?: anchor.web3.PublicKey): PublicKey;
95
- /**
96
- * Returns glam vault's token account for the given mint and token program ID
97
- */
98
- getVaultAta(mint: PublicKey, tokenProgramId?: PublicKey): PublicKey;
99
- /**
100
- * Returns user's glam mint token account
101
- */
102
- getMintAta(user?: PublicKey): PublicKey;
103
- /**
104
- * Returns glam vault's SOL balance
105
- */
106
- getVaultBalance(): Promise<number>;
107
- /**
108
- * Returns glam vault's SOL balance in lamports
109
- */
110
- getVaultLamports(): Promise<number>;
111
- /**
112
- * Returns glam vault's token balance for the given mint
113
- */
114
- getVaultTokenBalance(mintPubkey: PublicKey): Promise<{
115
- amount: BN;
116
- uiAmount: number;
117
- }>;
118
- /**
119
- * Returns user's glam mint token balance
120
- */
121
- getMintTokenBalance(owner?: PublicKey): Promise<{
122
- amount: BN;
123
- uiAmount: number;
124
- }>;
125
- isLockupEnabled(): Promise<boolean>;
126
- fetchGlobalConfig(options?: {
127
- refresh?: boolean;
128
- }): Promise<GlobalConfigAccount>;
129
- fetchAssetMetas(options?: {
130
- refresh?: boolean;
131
- }): Promise<Map<string, AssetMeta>>;
132
- refreshAssetMetaCache(): Promise<Map<string, AssetMeta>>;
133
- getAssetMeta(assetMint: string | PublicKey, options?: {
134
- refresh?: boolean;
135
- }): Promise<AssetMeta>;
136
- getSolOracle(options?: {
137
- refresh?: boolean;
138
- }): Promise<PublicKey>;
139
- fetchStateAccount(statePda?: PublicKey): Promise<StateAccount>;
140
- private getMintProgramIdForStateAccount;
141
- private getMintProgramForStateAccount;
142
- fetchRequestQueue(requestQueuePda?: PublicKey, mintProgram?: GlamMintProgram): Promise<RequestQueue>;
143
- /**
144
- * Builds a StateModel from onchain accounts (state, mint, etc)
145
- *
146
- * @param statePda Optional state PDA
147
- */
148
- fetchStateModel(statePda?: PublicKey): Promise<StateModel>;
149
- /**
150
- * Fetches glam state models and applies filters
151
- *
152
- * @param filterOptions Filter options
153
- */
154
- fetchGlamStates(filterOptions?: {
155
- owner?: PublicKey;
156
- delegate?: PublicKey;
157
- type?: string;
158
- }): Promise<StateModel[]>;
159
- fetchProtocolPolicy<T>(integProgramId: PublicKey, protocolBitflag: number, policyClass: {
160
- decode(buffer: Buffer, staging?: boolean): T;
161
- }): Promise<T | null>;
162
- }
163
- /**
164
- * Base transaction builder for sub-clients
165
- */
166
- export declare class BaseTxBuilder<T extends {
167
- base: BaseClient;
168
- }> {
169
- readonly client: T;
170
- constructor(client: T);
171
- /**
172
- * Build a legacy transaction with the given instructions.
173
- * Pre and post instructions in txOptions are preserved.
174
- */
175
- build(ixs: TransactionInstruction[], txOptions?: TxOptions): Transaction;
176
- /**
177
- * Build a versioned transaction that is ready to be sent.
178
- */
179
- buildVersionedTx(ixs: TransactionInstruction[], txOptions?: TxOptions): Promise<VersionedTransaction>;
180
- }
@@ -1,185 +0,0 @@
1
- import { BN } from "@coral-xyz/anchor";
2
- import { AccountMeta, 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
- 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
- sourceTokenAccount?: PublicKey;
24
- managed?: boolean;
25
- providerSigners?: Keypair[];
26
- prepareRemainingAccounts?: AccountMeta[];
27
- commitRemainingAccounts?: AccountMeta[];
28
- };
29
- export type LayerzeroOftSendParams = {
30
- transferId?: PublicKey;
31
- sourceMint: PublicKey;
32
- sourceAmount: BN;
33
- destinationChain: number;
34
- destinationRecipient: PublicKey;
35
- nativeFee: BN;
36
- minAmountLd?: BN;
37
- lzTokenFee?: BN;
38
- options?: BufferLike;
39
- composeMsg?: BufferLike | null;
40
- sourceTokenAccount?: PublicKey;
41
- nonceAccount?: PublicKey;
42
- managed?: boolean;
43
- providerProgram?: PublicKey;
44
- };
45
- type BridgeTransferStatusAccount = {
46
- committed: Record<string, never>;
47
- } | {
48
- validated: Record<string, never>;
49
- } | {
50
- settled: Record<string, never>;
51
- };
52
- type BridgeTransferRecordAccount = {
53
- glamState: PublicKey;
54
- transferId: PublicKey;
55
- protocol: number;
56
- status: BridgeTransferStatusAccount;
57
- managed: true;
58
- receiptVerified: true;
59
- sourceMint: PublicKey;
60
- sourceDecimals: number;
61
- providerProgram: PublicKey;
62
- providerConfig: PublicKey;
63
- sourceAmount: BN;
64
- quotedOutAmount: BN;
65
- destinationChain: number;
66
- destinationRecipient: PublicKey;
67
- providerEmitter: PublicKey;
68
- providerSequence: BN;
69
- committedSlot: BN;
70
- };
71
- export declare function deriveLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
72
- export declare function deriveOftAuxiliaryAccountSeed(glamState: PublicKey, transferId: PublicKey): Promise<string>;
73
- export declare function deriveOftAuxiliaryAccount(glamSigner: PublicKey, glamState: PublicKey, transferId: PublicKey, tokenProgram: PublicKey): Promise<{
74
- address: PublicKey;
75
- seed: string;
76
- }>;
77
- declare class TxBuilder extends BaseTxBuilder<BridgeClient> {
78
- addLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
79
- updateLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
80
- deleteLayerzeroOftRouteIx(route: LayerzeroOftRouteInput, signer?: PublicKey): Promise<TransactionInstruction>;
81
- buildOftTransferTx(params: OftTransferParams, txOptions?: TxOptions): Promise<{
82
- tx: VersionedTransaction;
83
- additionalSigners: Keypair[];
84
- sessionPda: PublicKey;
85
- auxiliaryTokenAccount: PublicKey;
86
- sourceTokenAccount: PublicKey;
87
- }>;
88
- priceManagedTransfersIxs(): Promise<TransactionInstruction[]>;
89
- priceManagedTransfersTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
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
- fetchTransferRecord(transferId: PublicKey): Promise<BridgeTransferRecordAccount>;
158
- fetchTransferRecordNullable(transferId: PublicKey): Promise<BridgeTransferRecordAccount | null>;
159
- addLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
160
- updateLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
161
- deleteLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
162
- buildOftTransferTx(params: OftTransferParams, txOptions?: TxOptions): Promise<{
163
- tx: VersionedTransaction;
164
- additionalSigners: Keypair[];
165
- sessionPda: PublicKey;
166
- auxiliaryTokenAccount: PublicKey;
167
- sourceTokenAccount: PublicKey;
168
- }>;
169
- buildLayerzeroOftSendTx(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<{
170
- auxiliaryTokenAccount: PublicKey;
171
- nonceAccount: PublicKey;
172
- routeProfile: LayerzeroOftRouteProfile;
173
- sendInstruction: TransactionInstruction;
174
- tx: VersionedTransaction;
175
- additionalSigners: Keypair[];
176
- sessionPda: PublicKey;
177
- sourceTokenAccount: PublicKey;
178
- }>;
179
- sendOft(params: OftTransferParams, txOptions?: TxOptions): Promise<TransactionSignature>;
180
- private extendLookupTables;
181
- settleManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
182
- validateManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
183
- priceManagedTransfers(txOptions?: TxOptions): Promise<string>;
184
- }
185
- 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 {};