@glamsystems/glam-sdk 1.0.14-alpha.1 → 1.0.14-alpha.3
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 +634 -537
- package/index.esm.js +634 -537
- package/package.json +1 -1
- package/src/client/bridge.d.ts +45 -44
- package/src/client/price.d.ts +3 -1
- package/src/models/state.d.ts +2 -0
- package/target/types/ext_bridge.d.ts +428 -441
package/package.json
CHANGED
package/src/client/bridge.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { AccountMeta, Keypair, PublicKey, TransactionInstruction, TransactionSig
|
|
|
3
3
|
import { BaseClient, BaseTxBuilder, TxOptions } from "./base";
|
|
4
4
|
import { LayerzeroOftRouteProfile } from "./bridgeRegistry";
|
|
5
5
|
import { LayerzeroOftPolicy, LayerzeroOftRoute, RouteManagementMode } from "../deser/integrationPolicies";
|
|
6
|
-
type BufferLike32 = Uint8Array | number[] | Buffer;
|
|
7
6
|
type BufferLike = Uint8Array | number[] | Buffer;
|
|
8
7
|
type RouteManagementModeArg = RouteManagementMode | number | {
|
|
9
8
|
unmanagedOnly: Record<string, never>;
|
|
@@ -16,7 +15,7 @@ export type LayerzeroOftRouteInput = Omit<LayerzeroOftRoute, "managementMode"> &
|
|
|
16
15
|
managementMode: RouteManagementModeArg;
|
|
17
16
|
};
|
|
18
17
|
export type OftTransferParams = {
|
|
19
|
-
transferId:
|
|
18
|
+
transferId: PublicKey;
|
|
20
19
|
sourceMint: PublicKey;
|
|
21
20
|
sourceAmount: BN;
|
|
22
21
|
providerInstructions: TransactionInstruction[];
|
|
@@ -28,7 +27,7 @@ export type OftTransferParams = {
|
|
|
28
27
|
commitRemainingAccounts?: AccountMeta[];
|
|
29
28
|
};
|
|
30
29
|
export type LayerzeroOftSendParams = {
|
|
31
|
-
transferId?:
|
|
30
|
+
transferId?: PublicKey;
|
|
32
31
|
sourceMint: PublicKey;
|
|
33
32
|
sourceAmount: BN;
|
|
34
33
|
destinationChain: number;
|
|
@@ -43,9 +42,35 @@ export type LayerzeroOftSendParams = {
|
|
|
43
42
|
managed?: boolean;
|
|
44
43
|
providerProgram?: PublicKey;
|
|
45
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
|
+
};
|
|
46
71
|
export declare function deriveLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
|
|
47
|
-
export declare function deriveOftAuxiliaryAccountSeed(glamState: PublicKey, transferId:
|
|
48
|
-
export declare function deriveOftAuxiliaryAccount(glamSigner: PublicKey, glamState: PublicKey, transferId:
|
|
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<{
|
|
49
74
|
address: PublicKey;
|
|
50
75
|
seed: string;
|
|
51
76
|
}>;
|
|
@@ -57,10 +82,11 @@ declare class TxBuilder extends BaseTxBuilder<BridgeClient> {
|
|
|
57
82
|
tx: VersionedTransaction;
|
|
58
83
|
additionalSigners: Keypair[];
|
|
59
84
|
sessionPda: PublicKey;
|
|
60
|
-
transferRecordPda: PublicKey;
|
|
61
85
|
auxiliaryTokenAccount: PublicKey;
|
|
62
86
|
sourceTokenAccount: PublicKey;
|
|
63
87
|
}>;
|
|
88
|
+
priceManagedTransfersIxs(): Promise<TransactionInstruction[]>;
|
|
89
|
+
priceManagedTransfersTx(txOptions?: TxOptions): Promise<VersionedTransaction>;
|
|
64
90
|
}
|
|
65
91
|
declare class LayerzeroOftBridgeProtocolClient {
|
|
66
92
|
readonly bridge: BridgeClient;
|
|
@@ -73,7 +99,6 @@ declare class LayerzeroOftBridgeProtocolClient {
|
|
|
73
99
|
tx: VersionedTransaction;
|
|
74
100
|
additionalSigners: Keypair[];
|
|
75
101
|
sessionPda: PublicKey;
|
|
76
|
-
transferRecordPda: PublicKey;
|
|
77
102
|
sourceTokenAccount: PublicKey;
|
|
78
103
|
}>;
|
|
79
104
|
send(params: LayerzeroOftSendParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
@@ -84,10 +109,9 @@ export declare class BridgeClient {
|
|
|
84
109
|
readonly oft: LayerzeroOftBridgeProtocolClient;
|
|
85
110
|
constructor(base: BaseClient);
|
|
86
111
|
getRegistryPda(): PublicKey;
|
|
87
|
-
getSessionPda(transferId:
|
|
88
|
-
getTransferRecordPda(transferId: BufferLike32): PublicKey;
|
|
112
|
+
getSessionPda(transferId: PublicKey): PublicKey;
|
|
89
113
|
getLayerzeroNoncePda(endpointProgram: PublicKey, sender: PublicKey, destinationChain: number, destinationRecipient: PublicKey): PublicKey;
|
|
90
|
-
deriveOftAuxiliaryTokenAccount(transferId:
|
|
114
|
+
deriveOftAuxiliaryTokenAccount(transferId: PublicKey, sourceMint: PublicKey, signer?: PublicKey): Promise<{
|
|
91
115
|
tokenProgram: PublicKey;
|
|
92
116
|
address: PublicKey;
|
|
93
117
|
seed: string;
|
|
@@ -100,16 +124,18 @@ export declare class BridgeClient {
|
|
|
100
124
|
fetchLayerzeroOftPolicy(): Promise<LayerzeroOftPolicy | null>;
|
|
101
125
|
fetchRegistry(): Promise<{
|
|
102
126
|
glamState: PublicKey;
|
|
103
|
-
managedTransferCount:
|
|
104
|
-
|
|
127
|
+
managedTransferCount: number;
|
|
128
|
+
reserved: number[];
|
|
129
|
+
transfers: any[];
|
|
105
130
|
} | null>;
|
|
106
|
-
fetchSession(transferId:
|
|
131
|
+
fetchSession(transferId: PublicKey): Promise<{
|
|
107
132
|
glamState: PublicKey;
|
|
108
133
|
signer: PublicKey;
|
|
109
|
-
transferId:
|
|
134
|
+
transferId: PublicKey;
|
|
110
135
|
protocol: number;
|
|
111
136
|
managed: boolean;
|
|
112
137
|
sourceMint: PublicKey;
|
|
138
|
+
sourceDecimals: number;
|
|
113
139
|
sourceTokenAccount: PublicKey;
|
|
114
140
|
providerProgram: PublicKey;
|
|
115
141
|
providerConfig: PublicKey;
|
|
@@ -128,30 +154,8 @@ export declare class BridgeClient {
|
|
|
128
154
|
preparedSlot: BN;
|
|
129
155
|
bump: number;
|
|
130
156
|
} | null>;
|
|
131
|
-
fetchTransferRecord(transferId:
|
|
132
|
-
|
|
133
|
-
transferId: number[];
|
|
134
|
-
protocol: number;
|
|
135
|
-
status: any;
|
|
136
|
-
managed: boolean;
|
|
137
|
-
receiptVerified: boolean;
|
|
138
|
-
sourceMint: PublicKey;
|
|
139
|
-
sourceTokenAccount: PublicKey;
|
|
140
|
-
providerProgram: PublicKey;
|
|
141
|
-
providerConfig: PublicKey;
|
|
142
|
-
sourceAmount: BN;
|
|
143
|
-
quotedOutAmount: BN;
|
|
144
|
-
destinationChain: number;
|
|
145
|
-
destinationRecipient: PublicKey;
|
|
146
|
-
providerTransferId: number[];
|
|
147
|
-
providerEmitter: PublicKey;
|
|
148
|
-
providerSequence: BN;
|
|
149
|
-
committedSlot: BN;
|
|
150
|
-
settledSlot: BN;
|
|
151
|
-
reconciledSlot: BN;
|
|
152
|
-
failureReason: number;
|
|
153
|
-
bump: number;
|
|
154
|
-
}>;
|
|
157
|
+
fetchTransferRecord(transferId: PublicKey): Promise<BridgeTransferRecordAccount>;
|
|
158
|
+
fetchTransferRecordNullable(transferId: PublicKey): Promise<BridgeTransferRecordAccount | null>;
|
|
155
159
|
addLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
156
160
|
updateLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
157
161
|
deleteLayerzeroOftRoute(route: LayerzeroOftRouteInput, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
@@ -159,7 +163,6 @@ export declare class BridgeClient {
|
|
|
159
163
|
tx: VersionedTransaction;
|
|
160
164
|
additionalSigners: Keypair[];
|
|
161
165
|
sessionPda: PublicKey;
|
|
162
|
-
transferRecordPda: PublicKey;
|
|
163
166
|
auxiliaryTokenAccount: PublicKey;
|
|
164
167
|
sourceTokenAccount: PublicKey;
|
|
165
168
|
}>;
|
|
@@ -171,14 +174,12 @@ export declare class BridgeClient {
|
|
|
171
174
|
tx: VersionedTransaction;
|
|
172
175
|
additionalSigners: Keypair[];
|
|
173
176
|
sessionPda: PublicKey;
|
|
174
|
-
transferRecordPda: PublicKey;
|
|
175
177
|
sourceTokenAccount: PublicKey;
|
|
176
178
|
}>;
|
|
177
179
|
sendOft(params: OftTransferParams, txOptions?: TxOptions): Promise<TransactionSignature>;
|
|
178
180
|
private extendLookupTables;
|
|
179
|
-
settleManagedTransfer(transferId:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
cleanupTransferRecord(transferId: BufferLike32, txOptions?: TxOptions): Promise<string>;
|
|
181
|
+
settleManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
|
|
182
|
+
validateManagedTransfer(transferId: PublicKey, txOptions?: TxOptions): Promise<string>;
|
|
183
|
+
priceManagedTransfers(txOptions?: TxOptions): Promise<string>;
|
|
183
184
|
}
|
|
184
185
|
export {};
|
package/src/client/price.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { StateModel } from "../models";
|
|
|
6
6
|
import { PkMap, PkSet } from "../utils";
|
|
7
7
|
import { KVaultState, Reserve } from "../deser";
|
|
8
8
|
import { JupiterApiClient, TokenListItem } from "../utils/jupiterApi";
|
|
9
|
+
import { BridgeClient } from "./bridge";
|
|
9
10
|
/**
|
|
10
11
|
* Represents a single asset holding within a vault.
|
|
11
12
|
*
|
|
@@ -55,12 +56,13 @@ export declare class PriceClient {
|
|
|
55
56
|
readonly base: BaseClient;
|
|
56
57
|
readonly klend: KaminoLendingClient;
|
|
57
58
|
readonly kvaults: KaminoVaultsClient;
|
|
59
|
+
readonly bridge: BridgeClient;
|
|
58
60
|
private readonly getJupiterApi;
|
|
59
61
|
private _stateModel;
|
|
60
62
|
private _lookupTables;
|
|
61
63
|
private _kaminoVaults;
|
|
62
64
|
private _priceVaultIxsQueue;
|
|
63
|
-
constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, getJupiterApi: () => JupiterApiClient);
|
|
65
|
+
constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, bridge: BridgeClient, getJupiterApi: () => JupiterApiClient);
|
|
64
66
|
get jupiterApi(): JupiterApiClient;
|
|
65
67
|
get cachedStateModel(): StateModel | null;
|
|
66
68
|
set cachedStateModel(stateModel: StateModel);
|
package/src/models/state.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { RequestQueue } from "./types";
|
|
|
8
8
|
import type { IntegrationAcl, DelegateAcl } from "./acl";
|
|
9
9
|
export type StateAccount = IdlAccounts<GlamProtocol>["stateAccount"];
|
|
10
10
|
export type StateModelType = IdlTypes<GlamProtocol>["stateModel"];
|
|
11
|
+
export type OracleConfigsType = IdlTypes<GlamProtocol>["oracleConfigs"];
|
|
11
12
|
/**
|
|
12
13
|
* State model class as defined in the IDL.
|
|
13
14
|
*/
|
|
@@ -16,6 +17,7 @@ export declare class StateIdlModel implements StateModelType {
|
|
|
16
17
|
name: number[] | null;
|
|
17
18
|
uri: string | null;
|
|
18
19
|
enabled: boolean | null;
|
|
20
|
+
oracleConfigs: OracleConfigsType | null;
|
|
19
21
|
assets: PublicKey[] | null;
|
|
20
22
|
created: CreatedModel | null;
|
|
21
23
|
owner: PublicKey | null;
|