@glamsystems/glam-sdk 1.1.0-alpha.1 → 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.
- package/index.cjs.js +6583 -2920
- package/index.esm.js +6575 -2909
- package/package.json +2 -2
- package/target/idl/glam_mint-staging.json +18 -15
- package/target/idl/glam_protocol-staging.json +5 -0
- package/target/idl/glam_protocol.json +5 -0
- package/target/types/glam_mint-staging.ts +18 -15
- package/target/types/glam_protocol-staging.ts +5 -0
- package/target/types/glam_protocol.ts +5 -0
- package/src/assets.d.ts +0 -39
- package/src/client/access.d.ts +0 -57
- package/src/client/base.d.ts +0 -184
- package/src/client/bridge.d.ts +0 -183
- package/src/client/bridgeRegistry.d.ts +0 -32
- package/src/client/cctp.d.ts +0 -156
- package/src/client/epi.d.ts +0 -78
- package/src/client/fees.d.ts +0 -33
- package/src/client/invest.d.ts +0 -37
- package/src/client/jupiter.d.ts +0 -45
- package/src/client/kamino/farm.d.ts +0 -39
- package/src/client/kamino/index.d.ts +0 -4
- package/src/client/kamino/lending.d.ts +0 -86
- package/src/client/kamino/types.d.ts +0 -56
- package/src/client/kamino/vaults.d.ts +0 -31
- package/src/client/loopscale.d.ts +0 -84
- package/src/client/marinade.d.ts +0 -42
- package/src/client/mint.d.ts +0 -127
- package/src/client/neutral.d.ts +0 -109
- package/src/client/price.d.ts +0 -138
- package/src/client/stake-pool.d.ts +0 -39
- package/src/client/stake.d.ts +0 -34
- package/src/client/state.d.ts +0 -56
- package/src/client/timelock.d.ts +0 -31
- package/src/client/vault.d.ts +0 -90
- package/src/client.d.ts +0 -68
- package/src/clientConfig.d.ts +0 -29
- package/src/constants.d.ts +0 -84
- package/src/deser/base.d.ts +0 -18
- package/src/deser/index.d.ts +0 -3
- package/src/deser/integrationPolicies.d.ts +0 -120
- package/src/deser/kaminoLayouts.d.ts +0 -264
- package/src/deser/tokenAclLayouts.d.ts +0 -67
- package/src/error.d.ts +0 -29
- package/src/glamExports.d.ts +0 -5116
- package/src/globalConfig.d.ts +0 -27
- package/src/index.d.ts +0 -20
- package/src/models/acl.d.ts +0 -43
- package/src/models/index.d.ts +0 -8
- package/src/models/mint.d.ts +0 -64
- package/src/models/state.d.ts +0 -104
- package/src/models/types.d.ts +0 -28
- package/src/react/cluster-provider.d.ts +0 -22
- package/src/react/glam.d.ts +0 -47
- package/src/react/index.d.ts +0 -5
- package/src/react/query-keys.d.ts +0 -38
- package/src/react/useVaultBalanceSubscription.d.ts +0 -17
- package/src/utils/accounts.d.ts +0 -72
- package/src/utils/bitmask.d.ts +0 -53
- package/src/utils/blockhash.d.ts +0 -11
- package/src/utils/common.d.ts +0 -37
- package/src/utils/computeBudget.d.ts +0 -15
- package/src/utils/evm.d.ts +0 -10
- package/src/utils/fraction.d.ts +0 -29
- package/src/utils/glamPDAs.d.ts +0 -15
- package/src/utils/index.d.ts +0 -16
- package/src/utils/jupiterApi.d.ts +0 -89
- package/src/utils/lookupTables.d.ts +0 -53
- package/src/utils/pkmap.d.ts +0 -87
- package/src/utils/pkset.d.ts +0 -73
- package/src/utils/positionCategorizer.d.ts +0 -36
- package/src/utils/rpc.d.ts +0 -33
- package/src/utils/timelock.d.ts +0 -52
- package/src/utils/transaction.d.ts +0 -13
- package/target/types/ext_bridge.d.ts +0 -2385
- package/target/types/ext_cctp.d.ts +0 -1268
- package/target/types/ext_epi.d.ts +0 -2175
- package/target/types/ext_kamino.d.ts +0 -3433
- package/target/types/ext_loopscale.d.ts +0 -3547
- package/target/types/ext_marinade.d.ts +0 -1593
- package/target/types/ext_neutral.d.ts +0 -1670
- package/target/types/ext_spl.d.ts +0 -1274
- package/target/types/ext_stake_pool.d.ts +0 -1622
- package/target/types/glam_config.d.ts +0 -755
- package/target/types/glam_mint.d.ts +0 -6106
- package/target/types/glam_protocol.d.ts +0 -2708
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glamsystems/glam-sdk",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.2",
|
|
4
4
|
"description": "TypeScript SDK for the GLAM Protocol",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@solana/spl-token": "^0.4.9",
|
|
27
27
|
"@solana/spl-token-metadata": "^0.1.4",
|
|
28
28
|
"@solana/web3.js": "^1.98.4",
|
|
29
|
-
"
|
|
29
|
+
"@types/bn.js": "^5.2.0",
|
|
30
30
|
"buffer": "^6.0.3",
|
|
31
31
|
"decimal.js": "^10.6.0",
|
|
32
32
|
"fzstd": "^0.1.1",
|
|
@@ -4148,26 +4148,29 @@
|
|
|
4148
4148
|
"args": []
|
|
4149
4149
|
},
|
|
4150
4150
|
{
|
|
4151
|
-
"name": "
|
|
4151
|
+
"name": "price_phoenix_traders",
|
|
4152
4152
|
"docs": [
|
|
4153
|
-
"Price
|
|
4153
|
+
"Price Phoenix trader accounts registered as vault external positions.",
|
|
4154
4154
|
"",
|
|
4155
4155
|
"Remaining accounts:",
|
|
4156
|
-
"-
|
|
4157
|
-
"
|
|
4158
|
-
"
|
|
4159
|
-
"
|
|
4160
|
-
"
|
|
4156
|
+
"- Phoenix global configuration",
|
|
4157
|
+
"- Phoenix perp asset map",
|
|
4158
|
+
"- Phoenix trader accounts x N",
|
|
4159
|
+
"- optional USDC oracle when the GLAM base asset is not USDC",
|
|
4160
|
+
"",
|
|
4161
|
+
"Prices portfolio NAV as collateral plus unrealized PnL from Phoenix's",
|
|
4162
|
+
"cached positions and mark prices. Clients should prepend Phoenix",
|
|
4163
|
+
"`update_trader_state` before this instruction when trader state may be stale."
|
|
4161
4164
|
],
|
|
4162
4165
|
"discriminator": [
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4166
|
+
112,
|
|
4167
|
+
90,
|
|
4168
|
+
177,
|
|
4169
|
+
46,
|
|
4170
|
+
145,
|
|
4171
|
+
191,
|
|
4172
|
+
219,
|
|
4173
|
+
213
|
|
4171
4174
|
],
|
|
4172
4175
|
"accounts": [
|
|
4173
4176
|
{
|
|
@@ -1831,6 +1831,11 @@
|
|
|
1831
1831
|
"name": "DelegateAclLimitExceeded",
|
|
1832
1832
|
"msg": "Delegate ACL limit exceeded"
|
|
1833
1833
|
},
|
|
1834
|
+
{
|
|
1835
|
+
"code": 49021,
|
|
1836
|
+
"name": "InvalidFeeStructure",
|
|
1837
|
+
"msg": "Invalid fee structure"
|
|
1838
|
+
},
|
|
1834
1839
|
{
|
|
1835
1840
|
"code": 50000,
|
|
1836
1841
|
"name": "WithdrawDenied",
|
|
@@ -1252,6 +1252,11 @@
|
|
|
1252
1252
|
"name": "DelegateAclLimitExceeded",
|
|
1253
1253
|
"msg": "Delegate ACL limit exceeded"
|
|
1254
1254
|
},
|
|
1255
|
+
{
|
|
1256
|
+
"code": 49021,
|
|
1257
|
+
"name": "InvalidFeeStructure",
|
|
1258
|
+
"msg": "Invalid fee structure"
|
|
1259
|
+
},
|
|
1255
1260
|
{
|
|
1256
1261
|
"code": 50000,
|
|
1257
1262
|
"name": "WithdrawDenied",
|
|
@@ -4154,26 +4154,29 @@ export type GlamMint = {
|
|
|
4154
4154
|
"args": []
|
|
4155
4155
|
},
|
|
4156
4156
|
{
|
|
4157
|
-
"name": "
|
|
4157
|
+
"name": "pricePhoenixTraders",
|
|
4158
4158
|
"docs": [
|
|
4159
|
-
"Price
|
|
4159
|
+
"Price Phoenix trader accounts registered as vault external positions.",
|
|
4160
4160
|
"",
|
|
4161
4161
|
"Remaining accounts:",
|
|
4162
|
-
"-
|
|
4163
|
-
"
|
|
4164
|
-
"
|
|
4165
|
-
"
|
|
4166
|
-
"
|
|
4162
|
+
"- Phoenix global configuration",
|
|
4163
|
+
"- Phoenix perp asset map",
|
|
4164
|
+
"- Phoenix trader accounts x N",
|
|
4165
|
+
"- optional USDC oracle when the GLAM base asset is not USDC",
|
|
4166
|
+
"",
|
|
4167
|
+
"Prices portfolio NAV as collateral plus unrealized PnL from Phoenix's",
|
|
4168
|
+
"cached positions and mark prices. Clients should prepend Phoenix",
|
|
4169
|
+
"`update_trader_state` before this instruction when trader state may be stale."
|
|
4167
4170
|
],
|
|
4168
4171
|
"discriminator": [
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4172
|
+
112,
|
|
4173
|
+
90,
|
|
4174
|
+
177,
|
|
4175
|
+
46,
|
|
4176
|
+
145,
|
|
4177
|
+
191,
|
|
4178
|
+
219,
|
|
4179
|
+
213
|
|
4177
4180
|
],
|
|
4178
4181
|
"accounts": [
|
|
4179
4182
|
{
|
|
@@ -1837,6 +1837,11 @@ export type GlamProtocol = {
|
|
|
1837
1837
|
"name": "delegateAclLimitExceeded",
|
|
1838
1838
|
"msg": "Delegate ACL limit exceeded"
|
|
1839
1839
|
},
|
|
1840
|
+
{
|
|
1841
|
+
"code": 49021,
|
|
1842
|
+
"name": "invalidFeeStructure",
|
|
1843
|
+
"msg": "Invalid fee structure"
|
|
1844
|
+
},
|
|
1840
1845
|
{
|
|
1841
1846
|
"code": 50000,
|
|
1842
1847
|
"name": "withdrawDenied",
|
|
@@ -1258,6 +1258,11 @@ export type GlamProtocol = {
|
|
|
1258
1258
|
"name": "delegateAclLimitExceeded",
|
|
1259
1259
|
"msg": "Delegate ACL limit exceeded"
|
|
1260
1260
|
},
|
|
1261
|
+
{
|
|
1262
|
+
"code": 49021,
|
|
1263
|
+
"name": "invalidFeeStructure",
|
|
1264
|
+
"msg": "Invalid fee structure"
|
|
1265
|
+
},
|
|
1261
1266
|
{
|
|
1262
1267
|
"code": 50000,
|
|
1263
1268
|
"name": "withdrawDenied",
|
package/src/assets.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { PublicKey } from "@solana/web3.js";
|
|
2
|
-
import { PkMap } from "./utils/pkmap";
|
|
3
|
-
export declare const STAKE_POOLS: {
|
|
4
|
-
name: string;
|
|
5
|
-
symbol: string;
|
|
6
|
-
mint: string;
|
|
7
|
-
decimals: number;
|
|
8
|
-
logoURI: string;
|
|
9
|
-
tokenProgram: PublicKey;
|
|
10
|
-
poolState: PublicKey;
|
|
11
|
-
isMarinade: boolean;
|
|
12
|
-
}[];
|
|
13
|
-
export declare const STAKE_POOLS_MAP: Map<string, {
|
|
14
|
-
name: string;
|
|
15
|
-
symbol: string;
|
|
16
|
-
mint: string;
|
|
17
|
-
decimals: number;
|
|
18
|
-
logoURI: string;
|
|
19
|
-
tokenProgram: PublicKey;
|
|
20
|
-
poolState: PublicKey;
|
|
21
|
-
isMarinade: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Metadata for an asset for pricing
|
|
25
|
-
*/
|
|
26
|
-
export interface AssetMeta {
|
|
27
|
-
asset: PublicKey;
|
|
28
|
-
decimals: number;
|
|
29
|
-
oracle: PublicKey;
|
|
30
|
-
programId: PublicKey;
|
|
31
|
-
oracleSource: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Transforms the LST list into a map of asset metas.
|
|
35
|
-
*
|
|
36
|
-
* We use functional prices for LSTs, and the oracle pubkey of a LST
|
|
37
|
-
* asset is the pool state.
|
|
38
|
-
*/
|
|
39
|
-
export declare const ASSETS_MAINNET: PkMap<AssetMeta>;
|
package/src/client/access.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { PublicKey, VersionedTransaction, TransactionSignature, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
-
import { BN } from "@coral-xyz/anchor";
|
|
3
|
-
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
|
-
import { EmergencyAccessUpdateArgs } from "../models";
|
|
5
|
-
declare class TxBuilder extends BaseTxBuilder<AccessClient> {
|
|
6
|
-
emergencyAccessUpdateIx(args: Partial<EmergencyAccessUpdateArgs>, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
7
|
-
emergencyAccessUpdateTx(args: Partial<EmergencyAccessUpdateArgs>, txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
8
|
-
enableDisableProtocolsIx(integrationProgram: PublicKey, protocolBitmask: number, setEnabled: boolean, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
9
|
-
enableDisableProtocolsTx(integrationProgram: PublicKey, protocolBitmask: number, setEnabled: boolean, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
10
|
-
grantRevokeDelegatePermissionsIx(delegate: PublicKey, integrationProgram: PublicKey, protocolBitflag: number, permissionsBitmask: BN, setGranted: boolean, signer?: PublicKey): Promise<TransactionInstruction>;
|
|
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>;
|
|
16
|
-
setProtocolPolicyIx(integrationProgram: PublicKey, protocolBitflag: number, data: Buffer, glamSigner: PublicKey): Promise<TransactionInstruction>;
|
|
17
|
-
setProtocolPolicyTx(integrationProgram: PublicKey, protocolBitflag: number, data: Buffer, txOptions: TxOptions): Promise<VersionedTransaction>;
|
|
18
|
-
}
|
|
19
|
-
export declare class AccessClient {
|
|
20
|
-
readonly base: BaseClient;
|
|
21
|
-
txBuilder: TxBuilder;
|
|
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>;
|
|
32
|
-
/**
|
|
33
|
-
* Emergency access update - bypasses timelock for critical access control changes
|
|
34
|
-
*/
|
|
35
|
-
emergencyAccessUpdate(args: Partial<EmergencyAccessUpdateArgs>, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
36
|
-
/**
|
|
37
|
-
* Enable protocols for an integration program
|
|
38
|
-
*/
|
|
39
|
-
enableProtocols(integrationProgram: PublicKey, protocolBitmask: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
40
|
-
/**
|
|
41
|
-
* Disable protocols for an integration program
|
|
42
|
-
*/
|
|
43
|
-
disableProtocols(integrationProgram: PublicKey, protocolBitmask: number, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
44
|
-
/**
|
|
45
|
-
* Grant delegate permissions for a specific protocol
|
|
46
|
-
*/
|
|
47
|
-
grantDelegatePermissions(delegate: PublicKey, integrationProgram: PublicKey, protocolBitflag: number, permissionsBitmask: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
48
|
-
/**
|
|
49
|
-
* Revoke delegate permissions for a specific protocol
|
|
50
|
-
*/
|
|
51
|
-
revokeDelegatePermissions(delegate: PublicKey, integrationProgram: PublicKey, protocolBitflag: number, permissionsBitmask: BN, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
52
|
-
/**
|
|
53
|
-
* Set protocol policy data for an integration
|
|
54
|
-
*/
|
|
55
|
-
setProtocolPolicy(integrationProgram: PublicKey, protocolBitflag: number, data: Buffer, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
56
|
-
}
|
|
57
|
-
export {};
|
package/src/client/base.d.ts
DELETED
|
@@ -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
|
-
}
|
package/src/client/bridge.d.ts
DELETED
|
@@ -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;
|