@layerzerolabs/lz-solana-sdk-v2 3.0.116 → 3.0.117
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/CHANGELOG.md +13 -0
- package/dist/index.cjs +108 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.mjs +108 -113
- package/dist/index.mjs.map +1 -1
- package/dist/umi.cjs +93 -87
- package/dist/umi.cjs.map +1 -1
- package/dist/umi.d.mts +11 -9
- package/dist/umi.d.ts +11 -9
- package/dist/umi.mjs +92 -86
- package/dist/umi.mjs.map +1 -1
- package/package.json +9 -9
- package/src/endpoint.ts +56 -55
- package/src/solita/endpoint.ts +84 -91
- package/src/solita/uln.ts +54 -43
- package/src/uln.ts +33 -26
package/dist/umi.d.mts
CHANGED
|
@@ -3466,11 +3466,11 @@ declare class Endpoint {
|
|
|
3466
3466
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
3467
3467
|
* @param {number} srcEid - The source endpoint ID.
|
|
3468
3468
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
3469
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
3469
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
3470
3470
|
*/
|
|
3471
3471
|
getDefaultReceiveLibrary(rpc: RpcInterface, srcEid: number, commitment?: Commitment): Promise<{
|
|
3472
3472
|
msgLib: PublicKey;
|
|
3473
|
-
owner
|
|
3473
|
+
owner: PublicKey;
|
|
3474
3474
|
} | null>;
|
|
3475
3475
|
/**
|
|
3476
3476
|
* Gets the default send library.
|
|
@@ -3478,11 +3478,11 @@ declare class Endpoint {
|
|
|
3478
3478
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
3479
3479
|
* @param {number} dstEid - The destination endpoint ID.
|
|
3480
3480
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
3481
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
3481
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
3482
3482
|
*/
|
|
3483
3483
|
getDefaultSendLibrary(rpc: RpcInterface, dstEid: number, commitment?: Commitment): Promise<{
|
|
3484
3484
|
msgLib: PublicKey;
|
|
3485
|
-
owner
|
|
3485
|
+
owner: PublicKey;
|
|
3486
3486
|
} | null>;
|
|
3487
3487
|
/**
|
|
3488
3488
|
* Gets the configured send library for the app.
|
|
@@ -3491,11 +3491,11 @@ declare class Endpoint {
|
|
|
3491
3491
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
3492
3492
|
* @param {number} dstEid - The destination endpoint ID.
|
|
3493
3493
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
3494
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
3494
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
3495
3495
|
*/
|
|
3496
3496
|
getSendLibrary(rpc: RpcInterface, oappPda: PublicKey, dstEid: number, commitment?: Commitment): Promise<{
|
|
3497
3497
|
msgLib: PublicKey;
|
|
3498
|
-
programId
|
|
3498
|
+
programId: PublicKey;
|
|
3499
3499
|
isDefault: boolean;
|
|
3500
3500
|
}>;
|
|
3501
3501
|
/**
|
|
@@ -3505,11 +3505,11 @@ declare class Endpoint {
|
|
|
3505
3505
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
3506
3506
|
* @param {number} srcEid - The source endpoint ID.
|
|
3507
3507
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
3508
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
3508
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean; timeout: { msgLib: PublicKey; expiry: bigint } | null } | null>} A promise that resolves to the configured receive library or null if not found.
|
|
3509
3509
|
*/
|
|
3510
3510
|
getReceiveLibrary(rpc: RpcInterface, oappPda: PublicKey, srcEid: number, commitment?: Commitment): Promise<{
|
|
3511
3511
|
msgLib: PublicKey;
|
|
3512
|
-
programId
|
|
3512
|
+
programId: PublicKey;
|
|
3513
3513
|
isDefault: boolean;
|
|
3514
3514
|
timeout?: {
|
|
3515
3515
|
msgLib: PublicKey;
|
|
@@ -3581,6 +3581,7 @@ declare class Endpoint {
|
|
|
3581
3581
|
* @returns {Promise<TransactionInstruction | null>} A promise that resolves to the transaction instruction or null if not needed.
|
|
3582
3582
|
*/
|
|
3583
3583
|
transferAdmin(admin: Signer, newAdmin: PublicKey): WrappedInstruction;
|
|
3584
|
+
static checkIfBlockedMessageLib(msgLib: PublicKey): boolean;
|
|
3584
3585
|
}
|
|
3585
3586
|
|
|
3586
3587
|
declare const endpoint_DefaultMessageLib: typeof DefaultMessageLib;
|
|
@@ -7684,7 +7685,8 @@ declare class Uln implements MessageLibInterface {
|
|
|
7684
7685
|
*/
|
|
7685
7686
|
getFinalReceiveConfigState(rpc: RpcInterface, receiver: PublicKey, eid: number, commitment?: Commitment): Promise<UlnConfig>;
|
|
7686
7687
|
getFinalSendConfigState(rpc: RpcInterface, sender: PublicKey, eid: number, commitment?: Commitment): Promise<UlnConfig>;
|
|
7687
|
-
private
|
|
7688
|
+
private getUlnConfigState;
|
|
7689
|
+
private getExecutorConfigState;
|
|
7688
7690
|
}
|
|
7689
7691
|
|
|
7690
7692
|
type uln_InboundConfirmations = InboundConfirmations;
|
package/dist/umi.d.ts
CHANGED
|
@@ -3466,11 +3466,11 @@ declare class Endpoint {
|
|
|
3466
3466
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
3467
3467
|
* @param {number} srcEid - The source endpoint ID.
|
|
3468
3468
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
3469
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
3469
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
3470
3470
|
*/
|
|
3471
3471
|
getDefaultReceiveLibrary(rpc: RpcInterface, srcEid: number, commitment?: Commitment): Promise<{
|
|
3472
3472
|
msgLib: PublicKey;
|
|
3473
|
-
owner
|
|
3473
|
+
owner: PublicKey;
|
|
3474
3474
|
} | null>;
|
|
3475
3475
|
/**
|
|
3476
3476
|
* Gets the default send library.
|
|
@@ -3478,11 +3478,11 @@ declare class Endpoint {
|
|
|
3478
3478
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
3479
3479
|
* @param {number} dstEid - The destination endpoint ID.
|
|
3480
3480
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
3481
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
3481
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
3482
3482
|
*/
|
|
3483
3483
|
getDefaultSendLibrary(rpc: RpcInterface, dstEid: number, commitment?: Commitment): Promise<{
|
|
3484
3484
|
msgLib: PublicKey;
|
|
3485
|
-
owner
|
|
3485
|
+
owner: PublicKey;
|
|
3486
3486
|
} | null>;
|
|
3487
3487
|
/**
|
|
3488
3488
|
* Gets the configured send library for the app.
|
|
@@ -3491,11 +3491,11 @@ declare class Endpoint {
|
|
|
3491
3491
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
3492
3492
|
* @param {number} dstEid - The destination endpoint ID.
|
|
3493
3493
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
3494
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
3494
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
3495
3495
|
*/
|
|
3496
3496
|
getSendLibrary(rpc: RpcInterface, oappPda: PublicKey, dstEid: number, commitment?: Commitment): Promise<{
|
|
3497
3497
|
msgLib: PublicKey;
|
|
3498
|
-
programId
|
|
3498
|
+
programId: PublicKey;
|
|
3499
3499
|
isDefault: boolean;
|
|
3500
3500
|
}>;
|
|
3501
3501
|
/**
|
|
@@ -3505,11 +3505,11 @@ declare class Endpoint {
|
|
|
3505
3505
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
3506
3506
|
* @param {number} srcEid - The source endpoint ID.
|
|
3507
3507
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
3508
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
3508
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean; timeout: { msgLib: PublicKey; expiry: bigint } | null } | null>} A promise that resolves to the configured receive library or null if not found.
|
|
3509
3509
|
*/
|
|
3510
3510
|
getReceiveLibrary(rpc: RpcInterface, oappPda: PublicKey, srcEid: number, commitment?: Commitment): Promise<{
|
|
3511
3511
|
msgLib: PublicKey;
|
|
3512
|
-
programId
|
|
3512
|
+
programId: PublicKey;
|
|
3513
3513
|
isDefault: boolean;
|
|
3514
3514
|
timeout?: {
|
|
3515
3515
|
msgLib: PublicKey;
|
|
@@ -3581,6 +3581,7 @@ declare class Endpoint {
|
|
|
3581
3581
|
* @returns {Promise<TransactionInstruction | null>} A promise that resolves to the transaction instruction or null if not needed.
|
|
3582
3582
|
*/
|
|
3583
3583
|
transferAdmin(admin: Signer, newAdmin: PublicKey): WrappedInstruction;
|
|
3584
|
+
static checkIfBlockedMessageLib(msgLib: PublicKey): boolean;
|
|
3584
3585
|
}
|
|
3585
3586
|
|
|
3586
3587
|
declare const endpoint_DefaultMessageLib: typeof DefaultMessageLib;
|
|
@@ -7684,7 +7685,8 @@ declare class Uln implements MessageLibInterface {
|
|
|
7684
7685
|
*/
|
|
7685
7686
|
getFinalReceiveConfigState(rpc: RpcInterface, receiver: PublicKey, eid: number, commitment?: Commitment): Promise<UlnConfig>;
|
|
7686
7687
|
getFinalSendConfigState(rpc: RpcInterface, sender: PublicKey, eid: number, commitment?: Commitment): Promise<UlnConfig>;
|
|
7687
|
-
private
|
|
7688
|
+
private getUlnConfigState;
|
|
7689
|
+
private getExecutorConfigState;
|
|
7688
7690
|
}
|
|
7689
7691
|
|
|
7690
7692
|
type uln_InboundConfirmations = InboundConfirmations;
|
package/dist/umi.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import { createDefaultProgramRepository } from '@metaplex-foundation/umi-program
|
|
|
5
5
|
import { toWeb3JsPublicKey, fromWeb3JsPublicKey, toWeb3JsInstruction } from '@metaplex-foundation/umi-web3js-adapters';
|
|
6
6
|
import * as web3 from '@solana/web3.js';
|
|
7
7
|
import { TransactionInstruction } from '@solana/web3.js';
|
|
8
|
+
import invariant3 from 'tiny-invariant';
|
|
8
9
|
import { keccak_256, sha2_256 } from '@layerzerolabs/lz-foundation';
|
|
9
10
|
import { arrayify } from '@layerzerolabs/lz-utilities';
|
|
10
11
|
import { addressToBytes32, PacketV1Codec } from '@layerzerolabs/lz-v2-utilities';
|
|
11
12
|
import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
|
|
12
|
-
import invariant2 from 'tiny-invariant';
|
|
13
13
|
import { fetchAllAddressLookupTable } from '@metaplex-foundation/mpl-toolbox';
|
|
14
14
|
import { Environment } from '@layerzerolabs/lz-definitions';
|
|
15
15
|
|
|
@@ -5301,7 +5301,7 @@ var SIMPLE_MESSAGELIB_PROGRAM_ID = "6GsmxMTHAAiFKfemuM4zBjumTjNSX5CAiw4xSSXM2Toy
|
|
|
5301
5301
|
// src/endpoint.ts
|
|
5302
5302
|
var EventEmitDiscriminator = "e445a52e51cb9a1d";
|
|
5303
5303
|
var DefaultMessageLib = defaultPublicKey();
|
|
5304
|
-
var Endpoint = class {
|
|
5304
|
+
var Endpoint = class _Endpoint {
|
|
5305
5305
|
constructor(programId = ENDPOINT_PROGRAM_ID, rpc) {
|
|
5306
5306
|
this.programId = programId;
|
|
5307
5307
|
this.pda = new EndpointPDA(programId);
|
|
@@ -5777,9 +5777,6 @@ var Endpoint = class {
|
|
|
5777
5777
|
const { path, msgLibProgram } = params;
|
|
5778
5778
|
const { sender, dstEid, receiver } = path;
|
|
5779
5779
|
const sendLibInfo = await this.getSendLibrary(rpc, sender, dstEid, commitment);
|
|
5780
|
-
if (!sendLibInfo.programId) {
|
|
5781
|
-
throw new Error("default send library not initialized or blocked message lib");
|
|
5782
|
-
}
|
|
5783
5780
|
const { msgLib, programId: owner } = sendLibInfo;
|
|
5784
5781
|
const txBuilder = quote(
|
|
5785
5782
|
{ programs: this.programRepo },
|
|
@@ -5820,9 +5817,6 @@ var Endpoint = class {
|
|
|
5820
5817
|
const { path, msgLibProgram } = params;
|
|
5821
5818
|
const { sender, dstEid, receiver } = path;
|
|
5822
5819
|
const info = await this.getSendLibrary(rpc, sender, dstEid, commitment);
|
|
5823
|
-
if (!info.programId) {
|
|
5824
|
-
throw new Error("default send library not initialized or blocked message lib");
|
|
5825
|
-
}
|
|
5826
5820
|
const sendLibrary = info.msgLib;
|
|
5827
5821
|
const txBuilder = send(
|
|
5828
5822
|
{ programs: this.programRepo },
|
|
@@ -6111,7 +6105,7 @@ var Endpoint = class {
|
|
|
6111
6105
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
6112
6106
|
* @param {number} srcEid - The source endpoint ID.
|
|
6113
6107
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6114
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
6108
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
6115
6109
|
*/
|
|
6116
6110
|
async getDefaultReceiveLibrary(rpc, srcEid, commitment = "confirmed") {
|
|
6117
6111
|
const [defaultReceiveLibConfig] = this.pda.defaultReceiveLibraryConfig(srcEid);
|
|
@@ -6121,14 +6115,16 @@ var Endpoint = class {
|
|
|
6121
6115
|
if (defaultInfo == null) {
|
|
6122
6116
|
return null;
|
|
6123
6117
|
}
|
|
6124
|
-
|
|
6125
|
-
if (
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
};
|
|
6118
|
+
let msgLibProgram;
|
|
6119
|
+
if (_Endpoint.checkIfBlockedMessageLib(defaultInfo.messageLib)) {
|
|
6120
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6121
|
+
} else {
|
|
6122
|
+
const messageLibInfo = await rpc.getAccount(defaultInfo.messageLib, { commitment });
|
|
6123
|
+
invariant3(messageLibInfo.exists, "messageLibInfo should not be null");
|
|
6124
|
+
msgLibProgram = messageLibInfo.owner;
|
|
6129
6125
|
}
|
|
6130
6126
|
return {
|
|
6131
|
-
owner:
|
|
6127
|
+
owner: msgLibProgram,
|
|
6132
6128
|
msgLib: defaultInfo.messageLib
|
|
6133
6129
|
};
|
|
6134
6130
|
}
|
|
@@ -6138,7 +6134,7 @@ var Endpoint = class {
|
|
|
6138
6134
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
6139
6135
|
* @param {number} dstEid - The destination endpoint ID.
|
|
6140
6136
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6141
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
6137
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
6142
6138
|
*/
|
|
6143
6139
|
async getDefaultSendLibrary(rpc, dstEid, commitment = "confirmed") {
|
|
6144
6140
|
const [defaultSendLibConfig] = this.pda.defaultSendLibraryConfig(dstEid);
|
|
@@ -6146,14 +6142,16 @@ var Endpoint = class {
|
|
|
6146
6142
|
if (defaultInfo == null) {
|
|
6147
6143
|
return null;
|
|
6148
6144
|
}
|
|
6149
|
-
|
|
6150
|
-
if (
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
};
|
|
6145
|
+
let msgLibProgram;
|
|
6146
|
+
if (_Endpoint.checkIfBlockedMessageLib(defaultInfo.messageLib)) {
|
|
6147
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6148
|
+
} else {
|
|
6149
|
+
const messageLibInfo = await rpc.getAccount(defaultInfo.messageLib, { commitment });
|
|
6150
|
+
invariant3(messageLibInfo.exists, "messageLibInfo should not be null");
|
|
6151
|
+
msgLibProgram = messageLibInfo.owner;
|
|
6154
6152
|
}
|
|
6155
6153
|
return {
|
|
6156
|
-
owner:
|
|
6154
|
+
owner: msgLibProgram,
|
|
6157
6155
|
msgLib: defaultInfo.messageLib
|
|
6158
6156
|
};
|
|
6159
6157
|
}
|
|
@@ -6164,7 +6162,7 @@ var Endpoint = class {
|
|
|
6164
6162
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
6165
6163
|
* @param {number} dstEid - The destination endpoint ID.
|
|
6166
6164
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
6167
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
6165
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
6168
6166
|
*/
|
|
6169
6167
|
async getSendLibrary(rpc, oappPda, dstEid, commitment = "confirmed") {
|
|
6170
6168
|
const [sendLibConfig] = this.pda.sendLibraryConfig(oappPda, dstEid);
|
|
@@ -6182,20 +6180,19 @@ var Endpoint = class {
|
|
|
6182
6180
|
const defaultSendLibConfigInfo = deserializeSendLibraryConfig(defaultSendLibConfigBuf);
|
|
6183
6181
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
6184
6182
|
const isDefault = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString();
|
|
6185
|
-
|
|
6186
|
-
if (
|
|
6187
|
-
|
|
6188
|
-
programId: void 0,
|
|
6189
|
-
msgLib,
|
|
6190
|
-
isDefault
|
|
6191
|
-
};
|
|
6183
|
+
let msgLibProgram;
|
|
6184
|
+
if (_Endpoint.checkIfBlockedMessageLib(msgLib)) {
|
|
6185
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6192
6186
|
} else {
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
isDefault
|
|
6197
|
-
};
|
|
6187
|
+
const msgLibInfo = await rpc.getAccount(msgLib, { commitment });
|
|
6188
|
+
invariant3(msgLibInfo.exists, "msgLibInfo should not be null");
|
|
6189
|
+
msgLibProgram = msgLibInfo.owner;
|
|
6198
6190
|
}
|
|
6191
|
+
return {
|
|
6192
|
+
programId: msgLibProgram,
|
|
6193
|
+
msgLib,
|
|
6194
|
+
isDefault
|
|
6195
|
+
};
|
|
6199
6196
|
}
|
|
6200
6197
|
/**
|
|
6201
6198
|
* Gets the configured receive library for the app.
|
|
@@ -6204,7 +6201,7 @@ var Endpoint = class {
|
|
|
6204
6201
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
6205
6202
|
* @param {number} srcEid - The source endpoint ID.
|
|
6206
6203
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6207
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
6204
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean; timeout: { msgLib: PublicKey; expiry: bigint } | null } | null>} A promise that resolves to the configured receive library or null if not found.
|
|
6208
6205
|
*/
|
|
6209
6206
|
async getReceiveLibrary(rpc, oappPda, srcEid, commitment = "confirmed") {
|
|
6210
6207
|
const [receiveLibConfig] = this.pda.receiveLibraryConfig(oappPda, srcEid);
|
|
@@ -6223,21 +6220,20 @@ var Endpoint = class {
|
|
|
6223
6220
|
const finalReceiveLibConfigInfo = receiveLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultReceiveLibConfigInfo : receiveLibConfigInfo;
|
|
6224
6221
|
const msgLib = finalReceiveLibConfigInfo.messageLib;
|
|
6225
6222
|
const isDefault = receiveLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString();
|
|
6226
|
-
|
|
6223
|
+
let msgLibProgram;
|
|
6224
|
+
if (_Endpoint.checkIfBlockedMessageLib(msgLib)) {
|
|
6225
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6226
|
+
} else {
|
|
6227
|
+
const msgLibInfo = await rpc.getAccount(msgLib, { commitment });
|
|
6228
|
+
invariant3(msgLibInfo.exists, "msgLibInfo should not be null");
|
|
6229
|
+
msgLibProgram = msgLibInfo.owner;
|
|
6230
|
+
}
|
|
6227
6231
|
const receiveTimeout = isSome(finalReceiveLibConfigInfo.timeout) ? {
|
|
6228
6232
|
msgLib: finalReceiveLibConfigInfo.timeout.value.messageLib,
|
|
6229
6233
|
expiry: finalReceiveLibConfigInfo.timeout.value.expiry
|
|
6230
6234
|
} : void 0;
|
|
6231
|
-
if (!msgLibInfo.exists) {
|
|
6232
|
-
return {
|
|
6233
|
-
programId: void 0,
|
|
6234
|
-
msgLib,
|
|
6235
|
-
isDefault,
|
|
6236
|
-
timeout: receiveTimeout
|
|
6237
|
-
};
|
|
6238
|
-
}
|
|
6239
6235
|
return {
|
|
6240
|
-
programId:
|
|
6236
|
+
programId: msgLibProgram,
|
|
6241
6237
|
msgLib,
|
|
6242
6238
|
isDefault,
|
|
6243
6239
|
timeout: receiveTimeout
|
|
@@ -6354,6 +6350,12 @@ var Endpoint = class {
|
|
|
6354
6350
|
}
|
|
6355
6351
|
).items[0];
|
|
6356
6352
|
}
|
|
6353
|
+
static checkIfBlockedMessageLib(msgLib) {
|
|
6354
|
+
const [blockedMessageLib] = new MessageLibPDA(
|
|
6355
|
+
blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID
|
|
6356
|
+
).messageLib();
|
|
6357
|
+
return msgLib.toString() === blockedMessageLib.toString();
|
|
6358
|
+
}
|
|
6357
6359
|
};
|
|
6358
6360
|
|
|
6359
6361
|
// src/simple-message-lib.ts
|
|
@@ -10818,7 +10820,7 @@ async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0,
|
|
|
10818
10820
|
};
|
|
10819
10821
|
const receiverPubkey = publicKey(receiverBytes);
|
|
10820
10822
|
const receiverInfo = await rpc.getAccount(receiverPubkey, { commitment });
|
|
10821
|
-
|
|
10823
|
+
invariant3(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
|
|
10822
10824
|
const receiverProgram = publicKey(receiverInfo.owner);
|
|
10823
10825
|
let version4 = 1;
|
|
10824
10826
|
let receiveTypesAccounts;
|
|
@@ -13116,9 +13118,9 @@ var Uln = class {
|
|
|
13116
13118
|
}
|
|
13117
13119
|
).items[0];
|
|
13118
13120
|
} else {
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13121
|
+
invariant3(isSome(sendUlnConfig), "sendUlnConfig is required");
|
|
13122
|
+
invariant3(isSome(receiveUlnConfig), "receiveUlnConfig is required");
|
|
13123
|
+
invariant3(isSome(executorConfig), "executorConfig is required");
|
|
13122
13124
|
return initDefaultConfig2(
|
|
13123
13125
|
{ programs: this.programRepo },
|
|
13124
13126
|
{
|
|
@@ -13272,9 +13274,9 @@ var Uln = class {
|
|
|
13272
13274
|
const { payer, tokenMint, tokenSource } = accounts;
|
|
13273
13275
|
const { sender, dstEid } = path;
|
|
13274
13276
|
const ulnState = await this.getSetting(rpc, commitment);
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13277
|
+
invariant3(ulnState !== null, "ULN not initialized");
|
|
13278
|
+
invariant3(isSome(ulnState.treasury), "treasury not set");
|
|
13279
|
+
invariant3(isSome(ulnState.treasury.value.lzToken), "lzToken treasury not set");
|
|
13278
13280
|
const lzTokenTreasury = ulnState.treasury.value.lzToken.value.receiver;
|
|
13279
13281
|
let txBuilder = sendWithLzToken2(
|
|
13280
13282
|
{ payer: createNoopSigner(payer), programs: this.programRepo },
|
|
@@ -13342,7 +13344,7 @@ var Uln = class {
|
|
|
13342
13344
|
});
|
|
13343
13345
|
const priceFeedInfos = await rpc.getAccounts(priceFeeds, { commitment });
|
|
13344
13346
|
const priceFeedDict = priceFeedInfos.reduce((acc, info, i) => {
|
|
13345
|
-
|
|
13347
|
+
invariant3(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
|
|
13346
13348
|
acc.set(priceFeeds[i], info.owner);
|
|
13347
13349
|
return acc;
|
|
13348
13350
|
}, /* @__PURE__ */ new Map());
|
|
@@ -13378,38 +13380,25 @@ var Uln = class {
|
|
|
13378
13380
|
const [defaultSendConfigBuf, sendConfigBuf] = await rpc.getAccounts([defaultSendConfig, sendConfig], {
|
|
13379
13381
|
commitment
|
|
13380
13382
|
});
|
|
13381
|
-
|
|
13383
|
+
invariant3(defaultSendConfigBuf.exists, "defaultSendConfig not initialized");
|
|
13382
13384
|
const defaultSendConfigState = deserializeSendConfig(defaultSendConfigBuf);
|
|
13383
|
-
let {
|
|
13384
|
-
executor,
|
|
13385
|
-
uln: { requiredDvns, optionalDvns }
|
|
13386
|
-
} = defaultSendConfigState;
|
|
13387
13385
|
const sendConfigState = sendConfigBuf.exists ? deserializeSendConfig(sendConfigBuf) : null;
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
}
|
|
13391
|
-
|
|
13392
|
-
requiredDvns = sendConfigState.uln.requiredDvns.filter((p) => {
|
|
13393
|
-
return p !== defaultPublicKey();
|
|
13394
|
-
});
|
|
13395
|
-
}
|
|
13396
|
-
if (sendConfigState && sendConfigState.uln.optionalDvns.length > 0) {
|
|
13397
|
-
optionalDvns = sendConfigState.uln.optionalDvns.filter((p) => {
|
|
13398
|
-
return p !== defaultPublicKey();
|
|
13399
|
-
});
|
|
13400
|
-
}
|
|
13386
|
+
const finalConfigState = this.getUlnConfigState(defaultSendConfigState, sendConfigState);
|
|
13387
|
+
const finalExecutorConfigState = this.getExecutorConfigState(defaultSendConfigState, sendConfigState);
|
|
13388
|
+
const { requiredDvns, optionalDvns } = finalConfigState;
|
|
13389
|
+
const { executor } = finalExecutorConfigState;
|
|
13401
13390
|
const dvns = requiredDvns.concat(optionalDvns);
|
|
13402
|
-
const [executorBuf, ...dvnBuf] = await rpc.getAccounts([executor
|
|
13391
|
+
const [executorBuf, ...dvnBuf] = await rpc.getAccounts([executor, ...dvns], {
|
|
13403
13392
|
commitment
|
|
13404
13393
|
});
|
|
13405
|
-
|
|
13394
|
+
invariant3(executorBuf.exists, `executor:${executor} not initialized`);
|
|
13406
13395
|
return {
|
|
13407
13396
|
executor: {
|
|
13408
13397
|
config: accounts_exports4.deserializeExecutorConfig(executorBuf),
|
|
13409
13398
|
owner: executorBuf.owner
|
|
13410
13399
|
},
|
|
13411
13400
|
dvns: dvnBuf.map((dvn, i) => {
|
|
13412
|
-
|
|
13401
|
+
invariant3(dvn.exists, `dvn:${dvns[i]} not initialized`);
|
|
13413
13402
|
return {
|
|
13414
13403
|
config: accounts_exports3.deserializeDvnConfig(dvn),
|
|
13415
13404
|
owner: dvn.owner
|
|
@@ -13724,7 +13713,7 @@ var Uln = class {
|
|
|
13724
13713
|
}
|
|
13725
13714
|
const defaultConfigState = deserializeReceiveConfig2(defaultConfigInfo);
|
|
13726
13715
|
const customConfigState = customConfigInfo.exists ? deserializeReceiveConfig2(customConfigInfo) : null;
|
|
13727
|
-
return this.
|
|
13716
|
+
return this.getUlnConfigState(defaultConfigState, customConfigState);
|
|
13728
13717
|
}
|
|
13729
13718
|
async getFinalSendConfigState(rpc, sender, eid, commitment = "confirmed") {
|
|
13730
13719
|
const [defaultConfig] = this.pda.defaultSendConfig(eid);
|
|
@@ -13737,9 +13726,9 @@ var Uln = class {
|
|
|
13737
13726
|
}
|
|
13738
13727
|
const defaultConfigState = deserializeSendConfig(defaultConfigInfo);
|
|
13739
13728
|
const customConfigState = customConfigInfo.exists ? deserializeSendConfig(customConfigInfo) : null;
|
|
13740
|
-
return this.
|
|
13729
|
+
return this.getUlnConfigState(defaultConfigState, customConfigState);
|
|
13741
13730
|
}
|
|
13742
|
-
|
|
13731
|
+
getUlnConfigState(defaultConfigState, customConfigState) {
|
|
13743
13732
|
const NIL_CONFIRMATIONS = "18446744073709551615";
|
|
13744
13733
|
const NIL_DVN_COUNT = "255";
|
|
13745
13734
|
const rtn_config = {
|
|
@@ -13780,6 +13769,23 @@ var Uln = class {
|
|
|
13780
13769
|
}
|
|
13781
13770
|
return rtn_config;
|
|
13782
13771
|
}
|
|
13772
|
+
getExecutorConfigState(defaultConfigState, customConfigState) {
|
|
13773
|
+
const rtn_config = {
|
|
13774
|
+
maxMessageSize: 0,
|
|
13775
|
+
executor: defaultPublicKey()
|
|
13776
|
+
};
|
|
13777
|
+
if (customConfigState == null || customConfigState.executor.executor === defaultPublicKey()) {
|
|
13778
|
+
rtn_config.executor = defaultConfigState.executor.executor;
|
|
13779
|
+
} else {
|
|
13780
|
+
rtn_config.executor = customConfigState.executor.executor;
|
|
13781
|
+
}
|
|
13782
|
+
if (customConfigState == null || customConfigState.executor.maxMessageSize === 0) {
|
|
13783
|
+
rtn_config.maxMessageSize = defaultConfigState.executor.maxMessageSize;
|
|
13784
|
+
} else {
|
|
13785
|
+
rtn_config.maxMessageSize = customConfigState.executor.maxMessageSize;
|
|
13786
|
+
}
|
|
13787
|
+
return rtn_config;
|
|
13788
|
+
}
|
|
13783
13789
|
};
|
|
13784
13790
|
|
|
13785
13791
|
// src/pricefeed.ts
|
|
@@ -14807,7 +14813,7 @@ var SendHelper = class {
|
|
|
14807
14813
|
[sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
|
|
14808
14814
|
commitment
|
|
14809
14815
|
);
|
|
14810
|
-
|
|
14816
|
+
invariant3(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
|
|
14811
14817
|
const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
|
|
14812
14818
|
const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
|
|
14813
14819
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
@@ -14873,7 +14879,7 @@ var SendHelper = class {
|
|
|
14873
14879
|
[sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
|
|
14874
14880
|
commitment
|
|
14875
14881
|
);
|
|
14876
|
-
|
|
14882
|
+
invariant3(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
|
|
14877
14883
|
const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
|
|
14878
14884
|
const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
|
|
14879
14885
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
@@ -15056,7 +15062,7 @@ var SendHelper = class {
|
|
|
15056
15062
|
* @returns {Promise<AccountMeta[]>} A promise that resolves to an array of account metadata.
|
|
15057
15063
|
*/
|
|
15058
15064
|
async getUlnAccounts(rpc, payer, ulnInfo, ulnDefaultSendConfigInfo, ulnSendConfigInfo, quoteOrSend, commitment = "confirmed") {
|
|
15059
|
-
|
|
15065
|
+
invariant3(
|
|
15060
15066
|
ulnInfo.accountInfo.exists && ulnDefaultSendConfigInfo.accountInfo.exists,
|
|
15061
15067
|
"uln send library not initialized"
|
|
15062
15068
|
);
|
|
@@ -15086,7 +15092,7 @@ var SendHelper = class {
|
|
|
15086
15092
|
[executor.executor, ...dvnsKey],
|
|
15087
15093
|
commitment
|
|
15088
15094
|
);
|
|
15089
|
-
|
|
15095
|
+
invariant3(executorBuf.exists, `executor:${executor.executor} not initialized`);
|
|
15090
15096
|
let executorAccounts, dvnAccounts;
|
|
15091
15097
|
{
|
|
15092
15098
|
const executor2 = {
|
|
@@ -15094,7 +15100,7 @@ var SendHelper = class {
|
|
|
15094
15100
|
owner: executorBuf.owner
|
|
15095
15101
|
};
|
|
15096
15102
|
const dvns = dvnBuf.map((dvn, i) => {
|
|
15097
|
-
|
|
15103
|
+
invariant3(dvn.exists, `dvn:${dvnsKey[i]} not initialized`);
|
|
15098
15104
|
return {
|
|
15099
15105
|
config: accounts_exports3.deserializeDvnConfig(dvn),
|
|
15100
15106
|
owner: dvn.owner
|
|
@@ -15106,10 +15112,10 @@ var SendHelper = class {
|
|
|
15106
15112
|
});
|
|
15107
15113
|
const priceFeedInfos = await this.getMultipleAccountsInfo(rpc, priceFeeds, commitment);
|
|
15108
15114
|
priceFeedInfos.forEach((info, i) => {
|
|
15109
|
-
|
|
15115
|
+
invariant3(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
|
|
15110
15116
|
});
|
|
15111
15117
|
const executorPriceFeed = await this.getMultipleAccountsInfo(rpc, [executor2.config.priceFeed], commitment);
|
|
15112
|
-
|
|
15118
|
+
invariant3(executorPriceFeed[0].exists, `executor priceFeed:${executor2.config.priceFeed} not initialized`);
|
|
15113
15119
|
executorAccounts = new Executor(executor2.owner).getQuoteIXAccountMetaForCPI(
|
|
15114
15120
|
executor2.config.priceFeed,
|
|
15115
15121
|
executorPriceFeed[0].owner,
|
|
@@ -15118,7 +15124,7 @@ var SendHelper = class {
|
|
|
15118
15124
|
dvnAccounts = (await Promise.all(
|
|
15119
15125
|
dvns.map(async (p, i) => {
|
|
15120
15126
|
const dvnPriceFeed = await this.getMultipleAccountsInfo(rpc, [p.config.priceFeed], commitment);
|
|
15121
|
-
|
|
15127
|
+
invariant3(dvnPriceFeed[0].exists, `dvn priceFeed:${p.config.priceFeed} not initialized`);
|
|
15122
15128
|
return new DVN(p.owner).getQuoteIXAccountMetaForCPI(
|
|
15123
15129
|
p.config.priceFeed,
|
|
15124
15130
|
dvnPriceFeed[0].owner,
|