@glamsystems/glam-sdk 1.0.12-alpha.3 → 1.0.13-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +1 -1
- package/index.cjs.js +1 -57320
- package/index.esm.js +1 -57081
- package/package.json +26 -15
- package/src/assets.d.ts +10 -17
- package/src/client/access.d.ts +13 -0
- package/src/client/base.d.ts +30 -7
- package/src/client/bridge.d.ts +183 -0
- package/src/client/bridgeRegistry.d.ts +32 -0
- package/src/client/epi.d.ts +78 -0
- package/src/client/fees.d.ts +4 -0
- package/src/client/invest.d.ts +1 -1
- package/src/client/jupiter.d.ts +27 -20
- package/src/client/loopscale.d.ts +84 -0
- package/src/client/mint.d.ts +54 -1
- package/src/client/price.d.ts +26 -39
- package/src/client.d.ts +9 -5
- package/src/constants.d.ts +11 -7
- package/src/deser/index.d.ts +1 -1
- package/src/deser/integrationPolicies.d.ts +30 -20
- package/src/deser/tokenAclLayouts.d.ts +67 -0
- package/src/error.d.ts +2 -1
- package/src/glamExports.d.ts +1351 -1546
- package/src/globalConfig.d.ts +27 -0
- package/src/index.d.ts +5 -1
- package/src/models/state.d.ts +2 -0
- package/src/utils/accounts.d.ts +9 -1
- package/src/utils/bitmask.d.ts +3 -0
- package/src/utils/common.d.ts +2 -0
- package/src/utils/glamPDAs.d.ts +6 -0
- package/src/utils/index.d.ts +0 -1
- package/src/utils/pkmap.d.ts +23 -18
- package/src/utils/positionCategorizer.d.ts +3 -21
- package/target/idl/ext_bridge-staging.json +2379 -0
- package/target/idl/ext_bridge.json +2379 -0
- package/target/idl/ext_cctp.json +1 -1
- package/target/idl/ext_drift.json +1613 -142
- package/target/idl/ext_epi-staging.json +2169 -0
- package/target/idl/ext_epi.json +2169 -0
- package/target/idl/ext_kamino-staging.json +1 -1
- package/target/idl/ext_kamino.json +109 -1
- package/target/idl/{ext_drift-staging.json → ext_loopscale-staging.json} +986 -1438
- package/target/idl/ext_loopscale.json +3541 -0
- package/target/idl/ext_marinade-staging.json +1587 -0
- package/target/idl/ext_spl-staging.json +1 -1
- package/target/idl/ext_spl.json +1 -1
- package/target/idl/glam_config.json +78 -9
- package/target/idl/glam_mint-staging.json +3002 -1244
- package/target/idl/glam_mint.json +239 -8
- package/target/idl/glam_policies.json +2 -7
- package/target/idl/glam_protocol-staging.json +187 -266
- package/target/idl/glam_protocol.json +217 -114
- package/target/idl/mock_layerzero_endpoint.json +144 -0
- package/target/idl/mock_layerzero_oft.json +155 -0
- package/target/types/ext_bridge-staging.d.ts +2385 -0
- package/target/types/ext_bridge-staging.ts +2385 -0
- package/target/types/ext_bridge.d.ts +2385 -0
- package/target/types/ext_bridge.ts +2385 -0
- package/target/types/ext_cctp.d.ts +1 -1
- package/target/types/ext_cctp.ts +1 -1
- package/target/types/ext_drift.d.ts +1609 -138
- package/target/types/ext_drift.ts +1613 -142
- package/target/types/ext_epi-staging.d.ts +2175 -0
- package/target/types/ext_epi-staging.ts +2175 -0
- package/target/types/ext_epi.d.ts +2175 -0
- package/target/types/ext_epi.ts +2175 -0
- package/target/types/ext_kamino-staging.d.ts +3433 -0
- package/target/types/ext_kamino-staging.ts +1 -1
- package/target/types/ext_kamino.d.ts +109 -1
- package/target/types/ext_kamino.ts +109 -1
- package/target/types/ext_loopscale-staging.d.ts +3547 -0
- package/target/types/{ext_drift-staging.ts → ext_loopscale-staging.ts} +988 -1440
- package/target/types/ext_loopscale.d.ts +3547 -0
- package/target/types/ext_loopscale.ts +3547 -0
- package/target/types/ext_marinade-staging.d.ts +1593 -0
- package/target/types/ext_marinade-staging.ts +1593 -0
- package/target/types/{ext_offchain.d.ts → ext_spl-staging.d.ts} +219 -19
- package/target/types/ext_spl-staging.ts +1 -1
- package/target/types/ext_spl.d.ts +1 -1
- package/target/types/ext_spl.ts +1 -1
- package/target/types/ext_stake_pool-staging.d.ts +1622 -0
- package/target/types/glam_config.d.ts +78 -9
- package/target/types/glam_config.ts +78 -9
- package/target/types/glam_mint-staging.d.ts +7856 -0
- package/target/types/glam_mint-staging.ts +3002 -1244
- package/target/types/glam_mint.d.ts +239 -8
- package/target/types/glam_mint.ts +239 -8
- package/target/types/glam_policies.d.ts +477 -0
- package/target/types/glam_policies.ts +2 -7
- package/target/types/glam_protocol-staging.d.ts +3292 -0
- package/target/types/glam_protocol-staging.ts +187 -266
- package/target/types/glam_protocol.d.ts +217 -114
- package/target/types/glam_protocol.ts +217 -114
- package/target/types/mock_layerzero_endpoint.d.ts +150 -0
- package/target/types/mock_layerzero_endpoint.ts +150 -0
- package/target/types/mock_layerzero_oft.d.ts +161 -0
- package/target/types/mock_layerzero_oft.ts +161 -0
- package/src/client/drift/index.d.ts +0 -2
- package/src/client/drift/protocol-v2.d.ts +0 -93
- package/src/client/drift/vaults.d.ts +0 -60
- package/src/deser/driftLayouts.d.ts +0 -217
- package/src/react/cluster-provider.d.ts +0 -22
- package/src/react/glam.d.ts +0 -51
- package/src/react/index.d.ts +0 -5
- package/src/react/query-keys.d.ts +0 -40
- package/src/react/useVaultBalanceSubscription.d.ts +0 -17
- package/src/utils/drift/index.d.ts +0 -2
- package/src/utils/drift/orderParams.d.ts +0 -28
- package/src/utils/drift/types.d.ts +0 -522
package/package.json
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glamsystems/glam-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13-test",
|
|
4
4
|
"description": "TypeScript SDK for the GLAM Protocol",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
7
|
+
"types": "./index.esm.d.ts",
|
|
7
8
|
"homepage": "https://www.glam.systems",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
|
-
"url": "
|
|
11
|
+
"url": "https://github.com/glamsystems/glam-sdk-ts.git"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
|
13
14
|
"glam",
|
|
14
15
|
"solana"
|
|
15
16
|
],
|
|
16
17
|
"license": "Apache-2.0",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "node scripts/build.mjs",
|
|
20
|
+
"clean": "node scripts/clean.mjs",
|
|
21
|
+
"prepack": "npm run build",
|
|
22
|
+
"pack:dry-run": "npm pack --dry-run --json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"index.cjs.js",
|
|
28
|
+
"index.esm.js",
|
|
29
|
+
"index.cjs.d.ts",
|
|
30
|
+
"index.esm.d.ts",
|
|
31
|
+
"src/**/*.d.ts",
|
|
32
|
+
"target/idl/**/*.json",
|
|
33
|
+
"target/types/**/*.ts",
|
|
34
|
+
"target/types/**/*.d.ts"
|
|
35
|
+
],
|
|
17
36
|
"publishConfig": {
|
|
18
37
|
"access": "public"
|
|
19
38
|
},
|
|
@@ -36,16 +55,8 @@
|
|
|
36
55
|
"node": ">=20.20.0"
|
|
37
56
|
},
|
|
38
57
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"@solana/spl-token@>=0.0.1": "^0.4.6",
|
|
45
|
-
"@solana/spl-stake-pool@>=0.0.1": "^1.1.5",
|
|
46
|
-
"typescript@>=0.0.1": "^5.5.3",
|
|
47
|
-
"solana-bankrun@>=0.0.1": "^0.3.0"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"types": "./index.esm.d.ts"
|
|
51
|
-
}
|
|
58
|
+
"@types/node": "^20.17.30",
|
|
59
|
+
"esbuild": "^0.25.2",
|
|
60
|
+
"typescript": "^5.8.3"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/assets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
|
-
import {
|
|
2
|
+
import { PkMap } from "./utils/pkmap";
|
|
3
3
|
export declare const STAKE_POOLS: {
|
|
4
4
|
name: string;
|
|
5
5
|
symbol: string;
|
|
@@ -8,6 +8,7 @@ export declare const STAKE_POOLS: {
|
|
|
8
8
|
logoURI: string;
|
|
9
9
|
tokenProgram: PublicKey;
|
|
10
10
|
poolState: PublicKey;
|
|
11
|
+
isMarinade: boolean;
|
|
11
12
|
}[];
|
|
12
13
|
export declare const STAKE_POOLS_MAP: Map<string, {
|
|
13
14
|
name: string;
|
|
@@ -17,30 +18,22 @@ export declare const STAKE_POOLS_MAP: Map<string, {
|
|
|
17
18
|
logoURI: string;
|
|
18
19
|
tokenProgram: PublicKey;
|
|
19
20
|
poolState: PublicKey;
|
|
21
|
+
isMarinade: boolean;
|
|
20
22
|
}>;
|
|
21
23
|
/**
|
|
22
24
|
* Metadata for an asset for pricing
|
|
23
25
|
*/
|
|
24
26
|
export interface AssetMeta {
|
|
27
|
+
asset: PublicKey;
|
|
25
28
|
decimals: number;
|
|
26
29
|
oracle: PublicKey;
|
|
27
|
-
programId
|
|
28
|
-
|
|
30
|
+
programId: PublicKey;
|
|
31
|
+
oracleSource: string;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
34
|
+
* Transforms the LST list into a map of asset metas.
|
|
32
35
|
*
|
|
33
|
-
*
|
|
36
|
+
* We use functional prices for LSTs, and the oracle pubkey of a LST
|
|
37
|
+
* asset is the pool state.
|
|
34
38
|
*/
|
|
35
|
-
export declare const ASSETS_MAINNET:
|
|
36
|
-
export declare const ASSETS_TESTS: Map<string, AssetMeta>;
|
|
37
|
-
export declare const SOL_ORACLE: PublicKey;
|
|
38
|
-
export declare const USDC_ORACLE: PublicKey;
|
|
39
|
-
/**
|
|
40
|
-
* Get metadata of an asset for pricing
|
|
41
|
-
*
|
|
42
|
-
* @param assetMint Token mint of the asset
|
|
43
|
-
* @param cluster The cluster network (defaults to mainnet)
|
|
44
|
-
* @returns Metadata of the asset
|
|
45
|
-
*/
|
|
46
|
-
export declare function getAssetMeta(assetMint: string | PublicKey, cluster?: ClusterNetwork): AssetMeta;
|
|
39
|
+
export declare const ASSETS_MAINNET: PkMap<AssetMeta>;
|
package/src/client/access.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ declare class TxBuilder extends BaseTxBuilder<AccessClient> {
|
|
|
9
9
|
enableDisableProtocolsTx(integrationProgram: PublicKey, protocolBitmask: number, setEnabled: boolean, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
10
10
|
grantRevokeDelegatePermissionsIx(delegate: PublicKey, integrationProgram: PublicKey, protocolBitflag: number, permissionsBitmask: BN, setGranted: boolean, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
11
11
|
grantRevokeDelegatePermissionsTx(delegate: PublicKey, integrationProgram: PublicKey, protocolBitflag: number, permissionsBitmask: BN, setGranted: boolean, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
12
|
+
addAssetsIx(assets: PublicKey[], signer?: PublicKey): Promise<TransactionInstruction>;
|
|
13
|
+
addAssetsTx(assets: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
14
|
+
deleteAssetsIx(assets: PublicKey[], signer?: PublicKey): Promise<TransactionInstruction>;
|
|
15
|
+
deleteAssetsTx(assets: PublicKey[], txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
12
16
|
setProtocolPolicyIx(integrationProgram: PublicKey, protocolBitflag: number, data: Buffer, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
13
17
|
setProtocolPolicyTx(integrationProgram: PublicKey, protocolBitflag: number, data: Buffer, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
14
18
|
}
|
|
@@ -16,6 +20,15 @@ export declare class AccessClient {
|
|
|
16
20
|
readonly base: BaseClient;
|
|
17
21
|
txBuilder: TxBuilder;
|
|
18
22
|
constructor(base: BaseClient);
|
|
23
|
+
/**
|
|
24
|
+
* Add assets to the vault allowlist
|
|
25
|
+
*/
|
|
26
|
+
addAssets(assets: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete assets from the vault allowlist.
|
|
29
|
+
* Assets must have zero vault balance (ATA empty or non-existent).
|
|
30
|
+
*/
|
|
31
|
+
deleteAssets(assets: PublicKey[], txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
19
32
|
/**
|
|
20
33
|
* Emergency access update - bypasses timelock for critical access control changes
|
|
21
34
|
*/
|
package/src/client/base.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import * as anchor from "@coral-xyz/anchor";
|
|
|
2
2
|
import { BN } from "@coral-xyz/anchor";
|
|
3
3
|
import { Wallet } from "@coral-xyz/anchor";
|
|
4
4
|
import { AddressLookupTableAccount, Connection, Keypair, PublicKey, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from "@solana/web3.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ExtBridgeProgram, ExtEpiProgram, ExtCctpProgram, ExtKaminoProgram, ExtMarinadeProgram, ExtLoopscaleProgram, ExtSplProgram, ExtStakePoolProgram, GlamMintProgram, GlamProtocolProgram } from "../glamExports";
|
|
6
6
|
import { ClusterNetwork, GlamClientConfig } from "../clientConfig";
|
|
7
|
+
import { GlobalConfig } from "../globalConfig";
|
|
7
8
|
import { RequestQueue, StateAccount, StateModel } from "../models";
|
|
8
9
|
import { BlockhashWithCache } from "../utils/blockhash";
|
|
9
|
-
import { JupiterApiClient } from "../utils";
|
|
10
|
+
import { JupiterApiClient, PkMap } from "../utils";
|
|
11
|
+
import { AssetMeta } from "../assets";
|
|
10
12
|
export type TxOptions = {
|
|
11
13
|
signer?: PublicKey;
|
|
12
14
|
computeUnitLimit?: number;
|
|
@@ -39,23 +41,29 @@ export declare class BaseClient {
|
|
|
39
41
|
private _protocolProgram?;
|
|
40
42
|
private _mintProgram?;
|
|
41
43
|
private _extSplProgram?;
|
|
42
|
-
private _extDriftProgram?;
|
|
43
44
|
private _extKaminoProgram?;
|
|
44
45
|
private _extMarinadeProgram?;
|
|
45
46
|
private _extStakePoolProgram?;
|
|
46
47
|
private _extCctpProgram?;
|
|
47
|
-
private
|
|
48
|
+
private _extBridgeProgram?;
|
|
49
|
+
private _extEpiProgram?;
|
|
50
|
+
private _extLoopscaleProgram?;
|
|
48
51
|
private _statePda?;
|
|
52
|
+
private _globalConfig?;
|
|
53
|
+
private _globalConfigPromise?;
|
|
54
|
+
private _assetMetas?;
|
|
55
|
+
private _assetMetasPromise?;
|
|
49
56
|
constructor(config?: GlamClientConfig);
|
|
50
57
|
get protocolProgram(): GlamProtocolProgram;
|
|
51
58
|
get mintProgram(): GlamMintProgram;
|
|
52
59
|
get extSplProgram(): ExtSplProgram;
|
|
53
|
-
get extDriftProgram(): ExtDriftProgram;
|
|
54
60
|
get extKaminoProgram(): ExtKaminoProgram;
|
|
55
61
|
get extMarinadeProgram(): ExtMarinadeProgram;
|
|
56
62
|
get extStakePoolProgram(): ExtStakePoolProgram;
|
|
57
63
|
get extCctpProgram(): ExtCctpProgram;
|
|
58
|
-
get
|
|
64
|
+
get extBridgeProgram(): ExtBridgeProgram;
|
|
65
|
+
get extEpiProgram(): ExtEpiProgram;
|
|
66
|
+
get extLoopscaleProgram(): ExtLoopscaleProgram;
|
|
59
67
|
get isVaultConnected(): boolean;
|
|
60
68
|
get statePda(): PublicKey;
|
|
61
69
|
set statePda(statePda: PublicKey);
|
|
@@ -117,8 +125,23 @@ export declare class BaseClient {
|
|
|
117
125
|
uiAmount: number;
|
|
118
126
|
}>;
|
|
119
127
|
isLockupEnabled(): Promise<boolean>;
|
|
128
|
+
fetchGlobalConfig(options?: {
|
|
129
|
+
refresh?: boolean;
|
|
130
|
+
}): Promise<GlobalConfig>;
|
|
131
|
+
fetchAssetMetas(options?: {
|
|
132
|
+
refresh?: boolean;
|
|
133
|
+
}): Promise<PkMap<AssetMeta>>;
|
|
134
|
+
refreshAssetMetaCache(): Promise<PkMap<AssetMeta>>;
|
|
135
|
+
getAssetMeta(assetMint: string | PublicKey, options?: {
|
|
136
|
+
refresh?: boolean;
|
|
137
|
+
}): Promise<AssetMeta>;
|
|
138
|
+
getSolOracle(options?: {
|
|
139
|
+
refresh?: boolean;
|
|
140
|
+
}): Promise<PublicKey>;
|
|
120
141
|
fetchStateAccount(statePda?: PublicKey): Promise<StateAccount>;
|
|
121
|
-
|
|
142
|
+
private getMintProgramIdForStateAccount;
|
|
143
|
+
private getMintProgramForStateAccount;
|
|
144
|
+
fetchRequestQueue(requestQueuePda?: PublicKey, mintProgram?: GlamMintProgram): Promise<RequestQueue>;
|
|
122
145
|
/**
|
|
123
146
|
* Builds a StateModel from onchain accounts (state, mint, etc)
|
|
124
147
|
*
|
|
@@ -0,0 +1,183 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,32 @@
|
|
|
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;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 {};
|
package/src/client/fees.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ declare class TxBuilder extends BaseTxBuilder<FeesClient> {
|
|
|
6
6
|
crystallizeFeesTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
7
7
|
claimFeesIxs(glamSigner: PublicKey): Promise<TransactionInstruction[]>;
|
|
8
8
|
claimFeesTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
|
+
chargeProtocolFeeIxs(glamSigner: PublicKey, protocolFeeAuthority: PublicKey): Promise<TransactionInstruction[]>;
|
|
10
|
+
chargeProtocolFeeTx(protocolFeeAuthority: PublicKey, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
9
11
|
setProtocolFeesIx(baseFeeBps: number, flowFeeBps: number, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
10
12
|
setProtocolFeesTx(baseFeeBps: number, flowFeeBps: number, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
11
13
|
}
|
|
@@ -24,6 +26,8 @@ export declare class FeesClient {
|
|
|
24
26
|
getClaimedFees(): Promise<any>;
|
|
25
27
|
crystallizeFees(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
26
28
|
claimFees(txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
29
|
+
chargeProtocolFee(protocolFeeAuthority: PublicKey, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
30
|
+
setProtocolFeesIx(baseFeeBps: number, flowFeeBps: number, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
27
31
|
setProtocolFees(baseFeeBps: number, flowFeeBps: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
28
32
|
}
|
|
29
33
|
export {};
|
package/src/client/invest.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare class TxBuilder extends BaseTxBuilder<InvestClient> {
|
|
|
13
13
|
cancelTx(pubkey: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
14
14
|
fulfillIx(limit: number | null, signer: PublicKey): Promise<TransactionInstruction>;
|
|
15
15
|
fulfillTx(limit: number | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
16
|
-
|
|
16
|
+
claimIxs(user: PublicKey | null, signer: PublicKey): Promise<TransactionInstruction[]>;
|
|
17
17
|
claimTx(user: PublicKey | null, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
18
18
|
}
|
|
19
19
|
export declare class InvestClient {
|
package/src/client/jupiter.d.ts
CHANGED
|
@@ -3,36 +3,43 @@ import { PublicKey, TransactionInstruction, TransactionSignature, VersionedTrans
|
|
|
3
3
|
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
4
|
import { VaultClient } from "./vault";
|
|
5
5
|
import { JupiterApiClient, JupiterInstruction, QuoteParams, QuoteResponse, SwapInstructions } from "../utils/jupiterApi";
|
|
6
|
+
import { KaminoLendingClient } from "./kamino";
|
|
7
|
+
export type JupiterSwapOptions = {
|
|
8
|
+
quoteParams?: QuoteParams;
|
|
9
|
+
quoteResponse?: QuoteResponse;
|
|
10
|
+
swapInstructions?: SwapInstructions;
|
|
11
|
+
trackingAccount?: PublicKey;
|
|
12
|
+
};
|
|
13
|
+
export type JupiterSwapV2OracleAccounts = {
|
|
14
|
+
solUsdOracle?: PublicKey;
|
|
15
|
+
inputTokenOracle?: PublicKey;
|
|
16
|
+
outputTokenOracle?: PublicKey;
|
|
17
|
+
kaminoReservesToRefresh: PublicKey[];
|
|
18
|
+
};
|
|
19
|
+
export type JupiterSwapV2Options = JupiterSwapOptions & {
|
|
20
|
+
skipQuotePriceCheck?: boolean;
|
|
21
|
+
};
|
|
6
22
|
declare class TxBuilder extends BaseTxBuilder<JupiterSwapClient> {
|
|
23
|
+
private resolveSwapInstructionContext;
|
|
24
|
+
getSwapV2OracleAccounts(inputMint: PublicKey, outputMint: PublicKey, skipQuotePriceCheck: boolean): Promise<JupiterSwapV2OracleAccounts>;
|
|
7
25
|
/**
|
|
8
26
|
* Returns the instructions for a Jupiter swap and the lookup tables
|
|
9
27
|
*/
|
|
10
|
-
swapIxs(options:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey[]]>;
|
|
16
|
-
swapTx(options: {
|
|
17
|
-
quoteParams?: QuoteParams;
|
|
18
|
-
quoteResponse?: QuoteResponse;
|
|
19
|
-
swapInstructions?: SwapInstructions;
|
|
20
|
-
trackingAccount?: PublicKey;
|
|
21
|
-
}, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
22
|
-
getPreInstructions: (signer: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, outputTokenProgram?: PublicKey) => Promise<TransactionInstruction[]>;
|
|
28
|
+
swapIxs(options: JupiterSwapOptions, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey[]]>;
|
|
29
|
+
swapV2Ixs(options: JupiterSwapV2Options, glamSigner: PublicKey): Promise<[TransactionInstruction[], PublicKey[]]>;
|
|
30
|
+
swapTx(options: JupiterSwapOptions, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
31
|
+
swapV2Tx(options: JupiterSwapV2Options, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
32
|
+
getPreInstructions(signer: PublicKey, inputMint: PublicKey, outputMint: PublicKey, amount: BN, outputTokenProgram?: PublicKey): Promise<TransactionInstruction[]>;
|
|
23
33
|
toTransactionInstruction: (ix: JupiterInstruction) => TransactionInstruction;
|
|
24
34
|
}
|
|
25
35
|
export declare class JupiterSwapClient {
|
|
26
36
|
readonly base: BaseClient;
|
|
27
37
|
readonly vault: VaultClient;
|
|
38
|
+
readonly klend: KaminoLendingClient;
|
|
28
39
|
readonly txBuilder: TxBuilder;
|
|
29
40
|
readonly jupApi: JupiterApiClient;
|
|
30
|
-
constructor(base: BaseClient, vault: VaultClient);
|
|
31
|
-
swap(options:
|
|
32
|
-
|
|
33
|
-
quoteResponse?: QuoteResponse;
|
|
34
|
-
swapInstructions?: SwapInstructions;
|
|
35
|
-
trackingAccount?: PublicKey;
|
|
36
|
-
}, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
41
|
+
constructor(base: BaseClient, vault: VaultClient, klend: KaminoLendingClient);
|
|
42
|
+
swap(options: JupiterSwapOptions, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
43
|
+
swapV2(options: JupiterSwapV2Options, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
37
44
|
}
|
|
38
45
|
export {};
|