@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/index.d.mts
CHANGED
|
@@ -7050,11 +7050,11 @@ declare class Endpoint {
|
|
|
7050
7050
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
7051
7051
|
* @param {number} srcEid - The source endpoint ID.
|
|
7052
7052
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
7053
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
7053
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
7054
7054
|
*/
|
|
7055
7055
|
getDefaultReceiveLibrary(connection: Connection, srcEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7056
7056
|
msgLib: PublicKey;
|
|
7057
|
-
owner
|
|
7057
|
+
owner: PublicKey;
|
|
7058
7058
|
} | null>;
|
|
7059
7059
|
/**
|
|
7060
7060
|
* Gets the default send library.
|
|
@@ -7062,11 +7062,11 @@ declare class Endpoint {
|
|
|
7062
7062
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
7063
7063
|
* @param {number} dstEid - The destination endpoint ID.
|
|
7064
7064
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
7065
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
7065
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
7066
7066
|
*/
|
|
7067
7067
|
getDefaultSendLibrary(connection: Connection, dstEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7068
7068
|
msgLib: PublicKey;
|
|
7069
|
-
owner
|
|
7069
|
+
owner: PublicKey;
|
|
7070
7070
|
} | null>;
|
|
7071
7071
|
/**
|
|
7072
7072
|
* Gets the configured send library for the app.
|
|
@@ -7075,13 +7075,13 @@ declare class Endpoint {
|
|
|
7075
7075
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
7076
7076
|
* @param {number} dstEid - The destination endpoint ID.
|
|
7077
7077
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
7078
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
7078
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
7079
7079
|
*/
|
|
7080
7080
|
getSendLibrary(connection: Connection, oappPda: PublicKey, dstEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7081
7081
|
msgLib: PublicKey;
|
|
7082
|
-
programId
|
|
7082
|
+
programId: PublicKey;
|
|
7083
7083
|
isDefault: boolean;
|
|
7084
|
-
}
|
|
7084
|
+
}>;
|
|
7085
7085
|
/**
|
|
7086
7086
|
* Gets the configured receive library for the app.
|
|
7087
7087
|
*
|
|
@@ -7093,13 +7093,13 @@ declare class Endpoint {
|
|
|
7093
7093
|
*/
|
|
7094
7094
|
getReceiveLibrary(connection: Connection, oappPda: PublicKey, srcEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7095
7095
|
msgLib: PublicKey;
|
|
7096
|
-
programId
|
|
7096
|
+
programId: PublicKey;
|
|
7097
7097
|
isDefault: boolean;
|
|
7098
|
-
timeout
|
|
7098
|
+
timeout?: {
|
|
7099
7099
|
msgLib: PublicKey;
|
|
7100
7100
|
expiry: bigint;
|
|
7101
|
-
}
|
|
7102
|
-
}
|
|
7101
|
+
};
|
|
7102
|
+
}>;
|
|
7103
7103
|
/**
|
|
7104
7104
|
* Gets the inbound payload hash.
|
|
7105
7105
|
*
|
|
@@ -7165,6 +7165,7 @@ declare class Endpoint {
|
|
|
7165
7165
|
* @returns {Promise<TransactionInstruction | null>} A promise that resolves to the transaction instruction or null if not needed.
|
|
7166
7166
|
*/
|
|
7167
7167
|
transferAdmin(connection: Connection, admin: PublicKey, newAdmin: PublicKey, commitment?: Commitment): Promise<TransactionInstruction | null>;
|
|
7168
|
+
static checkIfBlockedMessageLib(msgLib: PublicKey): boolean;
|
|
7168
7169
|
}
|
|
7169
7170
|
|
|
7170
7171
|
declare const endpoint_DefaultMessageLib: typeof DefaultMessageLib;
|
|
@@ -14141,6 +14142,8 @@ declare class Uln implements MessageLibInterface {
|
|
|
14141
14142
|
* @throws {Error} If no DVN is found.
|
|
14142
14143
|
*/
|
|
14143
14144
|
getFinalReceiveConfigState(connection: Connection, receiver: PublicKey, eid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<ReceiveConfig>;
|
|
14145
|
+
private getUlnConfigState;
|
|
14146
|
+
private getExecutorConfigState;
|
|
14144
14147
|
}
|
|
14145
14148
|
|
|
14146
14149
|
type uln_AtLeastOneDVNError = AtLeastOneDVNError;
|
package/dist/index.d.ts
CHANGED
|
@@ -7050,11 +7050,11 @@ declare class Endpoint {
|
|
|
7050
7050
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
7051
7051
|
* @param {number} srcEid - The source endpoint ID.
|
|
7052
7052
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
7053
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
7053
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
7054
7054
|
*/
|
|
7055
7055
|
getDefaultReceiveLibrary(connection: Connection, srcEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7056
7056
|
msgLib: PublicKey;
|
|
7057
|
-
owner
|
|
7057
|
+
owner: PublicKey;
|
|
7058
7058
|
} | null>;
|
|
7059
7059
|
/**
|
|
7060
7060
|
* Gets the default send library.
|
|
@@ -7062,11 +7062,11 @@ declare class Endpoint {
|
|
|
7062
7062
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
7063
7063
|
* @param {number} dstEid - The destination endpoint ID.
|
|
7064
7064
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
7065
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
7065
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
7066
7066
|
*/
|
|
7067
7067
|
getDefaultSendLibrary(connection: Connection, dstEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7068
7068
|
msgLib: PublicKey;
|
|
7069
|
-
owner
|
|
7069
|
+
owner: PublicKey;
|
|
7070
7070
|
} | null>;
|
|
7071
7071
|
/**
|
|
7072
7072
|
* Gets the configured send library for the app.
|
|
@@ -7075,13 +7075,13 @@ declare class Endpoint {
|
|
|
7075
7075
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
7076
7076
|
* @param {number} dstEid - The destination endpoint ID.
|
|
7077
7077
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
7078
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
7078
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
7079
7079
|
*/
|
|
7080
7080
|
getSendLibrary(connection: Connection, oappPda: PublicKey, dstEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7081
7081
|
msgLib: PublicKey;
|
|
7082
|
-
programId
|
|
7082
|
+
programId: PublicKey;
|
|
7083
7083
|
isDefault: boolean;
|
|
7084
|
-
}
|
|
7084
|
+
}>;
|
|
7085
7085
|
/**
|
|
7086
7086
|
* Gets the configured receive library for the app.
|
|
7087
7087
|
*
|
|
@@ -7093,13 +7093,13 @@ declare class Endpoint {
|
|
|
7093
7093
|
*/
|
|
7094
7094
|
getReceiveLibrary(connection: Connection, oappPda: PublicKey, srcEid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<{
|
|
7095
7095
|
msgLib: PublicKey;
|
|
7096
|
-
programId
|
|
7096
|
+
programId: PublicKey;
|
|
7097
7097
|
isDefault: boolean;
|
|
7098
|
-
timeout
|
|
7098
|
+
timeout?: {
|
|
7099
7099
|
msgLib: PublicKey;
|
|
7100
7100
|
expiry: bigint;
|
|
7101
|
-
}
|
|
7102
|
-
}
|
|
7101
|
+
};
|
|
7102
|
+
}>;
|
|
7103
7103
|
/**
|
|
7104
7104
|
* Gets the inbound payload hash.
|
|
7105
7105
|
*
|
|
@@ -7165,6 +7165,7 @@ declare class Endpoint {
|
|
|
7165
7165
|
* @returns {Promise<TransactionInstruction | null>} A promise that resolves to the transaction instruction or null if not needed.
|
|
7166
7166
|
*/
|
|
7167
7167
|
transferAdmin(connection: Connection, admin: PublicKey, newAdmin: PublicKey, commitment?: Commitment): Promise<TransactionInstruction | null>;
|
|
7168
|
+
static checkIfBlockedMessageLib(msgLib: PublicKey): boolean;
|
|
7168
7169
|
}
|
|
7169
7170
|
|
|
7170
7171
|
declare const endpoint_DefaultMessageLib: typeof DefaultMessageLib;
|
|
@@ -14141,6 +14142,8 @@ declare class Uln implements MessageLibInterface {
|
|
|
14141
14142
|
* @throws {Error} If no DVN is found.
|
|
14142
14143
|
*/
|
|
14143
14144
|
getFinalReceiveConfigState(connection: Connection, receiver: PublicKey, eid: number, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<ReceiveConfig>;
|
|
14145
|
+
private getUlnConfigState;
|
|
14146
|
+
private getExecutorConfigState;
|
|
14144
14147
|
}
|
|
14145
14148
|
|
|
14146
14149
|
type uln_AtLeastOneDVNError = AtLeastOneDVNError;
|
package/dist/index.mjs
CHANGED
|
@@ -5890,7 +5890,7 @@ var sendLibrarySetEventBeet = new beet159.BeetArgsStruct(
|
|
|
5890
5890
|
// src/solita/endpoint.ts
|
|
5891
5891
|
var EventEmitDiscriminator = "e445a52e51cb9a1d";
|
|
5892
5892
|
var DefaultMessageLib = PublicKey.default;
|
|
5893
|
-
var Endpoint = class {
|
|
5893
|
+
var Endpoint = class _Endpoint {
|
|
5894
5894
|
/**
|
|
5895
5895
|
* Creates an instance of the Endpoint class.
|
|
5896
5896
|
*
|
|
@@ -6345,9 +6345,6 @@ var Endpoint = class {
|
|
|
6345
6345
|
const sender = new PublicKey(arrayify(sender_));
|
|
6346
6346
|
const receiver = addressToBytes32(receiver_);
|
|
6347
6347
|
const sendLibInfo = await this.getSendLibrary(connection, sender, dstEid);
|
|
6348
|
-
if (!sendLibInfo?.programId) {
|
|
6349
|
-
throw new Error("default send library not initialized or blocked message lib");
|
|
6350
|
-
}
|
|
6351
6348
|
const { msgLib, programId: owner } = sendLibInfo;
|
|
6352
6349
|
const [sendLibraryInfo] = this.deriver.messageLibraryInfo(msgLib);
|
|
6353
6350
|
const remainingAccounts = await msgLibProgram.getQuoteIXAccountMetaForCPI(connection, payer, path);
|
|
@@ -6393,9 +6390,6 @@ var Endpoint = class {
|
|
|
6393
6390
|
const sender = new PublicKey(arrayify(sender_));
|
|
6394
6391
|
const receiver = addressToBytes32(receiver_);
|
|
6395
6392
|
const info = await this.getSendLibrary(connection, sender, dstEid, commitmentOrConfig);
|
|
6396
|
-
if (!info?.programId) {
|
|
6397
|
-
throw new Error("default send library not initialized or blocked message lib");
|
|
6398
|
-
}
|
|
6399
6393
|
const sendLibrary = info.msgLib;
|
|
6400
6394
|
const [sendLibraryInfo] = this.deriver.messageLibraryInfo(sendLibrary);
|
|
6401
6395
|
const remainingAccounts = await msgLibProgram.getSendIXAccountMetaForCPI(connection, payer, path);
|
|
@@ -6851,7 +6845,7 @@ var Endpoint = class {
|
|
|
6851
6845
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
6852
6846
|
* @param {number} srcEid - The source endpoint ID.
|
|
6853
6847
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6854
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
6848
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
6855
6849
|
*/
|
|
6856
6850
|
async getDefaultReceiveLibrary(connection, srcEid, commitmentOrConfig) {
|
|
6857
6851
|
const [defaultReceiveLibConfig] = this.deriver.defaultReceiveLibraryConfig(srcEid);
|
|
@@ -6861,14 +6855,16 @@ var Endpoint = class {
|
|
|
6861
6855
|
defaultReceiveLibConfig,
|
|
6862
6856
|
commitmentOrConfig
|
|
6863
6857
|
);
|
|
6864
|
-
|
|
6865
|
-
if (
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6858
|
+
let msgLibProgram;
|
|
6859
|
+
if (_Endpoint.checkIfBlockedMessageLib(defaultInfo.messageLib)) {
|
|
6860
|
+
msgLibProgram = blocked_messagelib_exports.PROGRAM_ID;
|
|
6861
|
+
} else {
|
|
6862
|
+
const messageLibInfo = await connection.getAccountInfo(defaultInfo.messageLib, commitmentOrConfig);
|
|
6863
|
+
invariant3(messageLibInfo, "messageLibInfo should not be null");
|
|
6864
|
+
msgLibProgram = messageLibInfo.owner;
|
|
6869
6865
|
}
|
|
6870
6866
|
return {
|
|
6871
|
-
owner:
|
|
6867
|
+
owner: msgLibProgram,
|
|
6872
6868
|
msgLib: defaultInfo.messageLib
|
|
6873
6869
|
};
|
|
6874
6870
|
} catch (e) {
|
|
@@ -6881,7 +6877,7 @@ var Endpoint = class {
|
|
|
6881
6877
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
6882
6878
|
* @param {number} dstEid - The destination endpoint ID.
|
|
6883
6879
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6884
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
6880
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
6885
6881
|
*/
|
|
6886
6882
|
async getDefaultSendLibrary(connection, dstEid, commitmentOrConfig) {
|
|
6887
6883
|
const [defaultSendLibConfig] = this.deriver.defaultSendLibraryConfig(dstEid);
|
|
@@ -6891,14 +6887,16 @@ var Endpoint = class {
|
|
|
6891
6887
|
defaultSendLibConfig,
|
|
6892
6888
|
commitmentOrConfig
|
|
6893
6889
|
);
|
|
6894
|
-
|
|
6895
|
-
if (
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6890
|
+
let msgLibProgram;
|
|
6891
|
+
if (_Endpoint.checkIfBlockedMessageLib(defaultInfo.messageLib)) {
|
|
6892
|
+
msgLibProgram = blocked_messagelib_exports.PROGRAM_ID;
|
|
6893
|
+
} else {
|
|
6894
|
+
const messageLibInfo = await connection.getAccountInfo(defaultInfo.messageLib, commitmentOrConfig);
|
|
6895
|
+
invariant3(messageLibInfo, "messageLibInfo should not be null");
|
|
6896
|
+
msgLibProgram = messageLibInfo.owner;
|
|
6899
6897
|
}
|
|
6900
6898
|
return {
|
|
6901
|
-
owner:
|
|
6899
|
+
owner: msgLibProgram,
|
|
6902
6900
|
msgLib: defaultInfo.messageLib
|
|
6903
6901
|
};
|
|
6904
6902
|
} catch (e) {
|
|
@@ -6912,7 +6910,7 @@ var Endpoint = class {
|
|
|
6912
6910
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
6913
6911
|
* @param {number} dstEid - The destination endpoint ID.
|
|
6914
6912
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
6915
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
6913
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
6916
6914
|
*/
|
|
6917
6915
|
async getSendLibrary(connection, oappPda, dstEid, commitmentOrConfig = "confirmed") {
|
|
6918
6916
|
const [sendLibConfig] = this.deriver.sendLibraryConfig(oappPda, dstEid);
|
|
@@ -6922,27 +6920,27 @@ var Endpoint = class {
|
|
|
6922
6920
|
commitmentOrConfig
|
|
6923
6921
|
);
|
|
6924
6922
|
if (!defaultSendLibConfigBuf || !sendLibConfigBuf) {
|
|
6925
|
-
|
|
6926
|
-
|
|
6923
|
+
throw new Error(
|
|
6924
|
+
`Unable to find defaultSendLibraryConfig/sendLibraryConfig account at ${defaultSendLibConfig.toString()}/${sendLibConfig.toString()}`
|
|
6925
|
+
);
|
|
6927
6926
|
}
|
|
6928
6927
|
const [sendLibConfigInfo] = SendLibraryConfig.fromAccountInfo(sendLibConfigBuf, 0);
|
|
6929
6928
|
const [defaultSendLibConfigInfo] = SendLibraryConfig.fromAccountInfo(defaultSendLibConfigBuf, 0);
|
|
6930
6929
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
6931
6930
|
const isDefault = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString();
|
|
6932
|
-
|
|
6933
|
-
if (
|
|
6934
|
-
|
|
6935
|
-
programId: void 0,
|
|
6936
|
-
msgLib,
|
|
6937
|
-
isDefault
|
|
6938
|
-
};
|
|
6931
|
+
let msgLibProgram;
|
|
6932
|
+
if (_Endpoint.checkIfBlockedMessageLib(msgLib)) {
|
|
6933
|
+
msgLibProgram = blocked_messagelib_exports.PROGRAM_ID;
|
|
6939
6934
|
} else {
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
isDefault
|
|
6944
|
-
};
|
|
6935
|
+
const msgLibAccountInfo = await connection.getAccountInfo(msgLib, commitmentOrConfig);
|
|
6936
|
+
invariant3(msgLibAccountInfo, "msgLibAccountInfo should not be null");
|
|
6937
|
+
msgLibProgram = msgLibAccountInfo.owner;
|
|
6945
6938
|
}
|
|
6939
|
+
return {
|
|
6940
|
+
programId: msgLibProgram,
|
|
6941
|
+
msgLib,
|
|
6942
|
+
isDefault
|
|
6943
|
+
};
|
|
6946
6944
|
}
|
|
6947
6945
|
/**
|
|
6948
6946
|
* Gets the configured receive library for the app.
|
|
@@ -6955,49 +6953,37 @@ var Endpoint = class {
|
|
|
6955
6953
|
*/
|
|
6956
6954
|
async getReceiveLibrary(connection, oappPda, srcEid, commitmentOrConfig) {
|
|
6957
6955
|
const [receiveLibConfig] = this.deriver.receiveLibraryConfig(oappPda, srcEid);
|
|
6958
|
-
const
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
if (
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
connection,
|
|
6967
|
-
defaultReceiveLibConfig,
|
|
6968
|
-
commitmentOrConfig
|
|
6956
|
+
const [defaultReceiveLibConfig] = this.deriver.defaultReceiveLibraryConfig(srcEid);
|
|
6957
|
+
const [defaultReceiveLibConfigBuf, receiveLibConfigBuf] = await connection.getMultipleAccountsInfo(
|
|
6958
|
+
[defaultReceiveLibConfig, receiveLibConfig],
|
|
6959
|
+
commitmentOrConfig
|
|
6960
|
+
);
|
|
6961
|
+
if (!defaultReceiveLibConfigBuf || !receiveLibConfigBuf) {
|
|
6962
|
+
throw new Error(
|
|
6963
|
+
`Unable to find defaultReceiveLibraryConfig/receiveLibraryConfig account at ${defaultReceiveLibConfig.toString()}/${receiveLibConfig.toString()}`
|
|
6969
6964
|
);
|
|
6970
|
-
const messageLibInfo2 = await connection.getAccountInfo(defaultInfo.messageLib, commitmentOrConfig);
|
|
6971
|
-
if (messageLibInfo2) {
|
|
6972
|
-
const { timeout: timeout2 } = defaultInfo;
|
|
6973
|
-
if (timeout2) {
|
|
6974
|
-
return {
|
|
6975
|
-
programId: defaultInfo.messageLib,
|
|
6976
|
-
msgLib: defaultInfo.messageLib,
|
|
6977
|
-
isDefault: true,
|
|
6978
|
-
timeout: { msgLib: timeout2.messageLib, expiry: BigInt(timeout2.expiry.toString()) }
|
|
6979
|
-
};
|
|
6980
|
-
}
|
|
6981
|
-
}
|
|
6982
|
-
return {
|
|
6983
|
-
programId: messageLibInfo2?.owner,
|
|
6984
|
-
msgLib: defaultInfo.messageLib,
|
|
6985
|
-
isDefault: true,
|
|
6986
|
-
timeout: null
|
|
6987
|
-
};
|
|
6988
6965
|
}
|
|
6989
|
-
const
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6966
|
+
const [receiveLibConfigInfo] = ReceiveLibraryConfig.fromAccountInfo(receiveLibConfigBuf, 0);
|
|
6967
|
+
const [defaultReceiveLibConfigInfo] = ReceiveLibraryConfig.fromAccountInfo(
|
|
6968
|
+
defaultReceiveLibConfigBuf,
|
|
6969
|
+
0
|
|
6970
|
+
);
|
|
6971
|
+
const finalReceiveLibConfigInfo = receiveLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultReceiveLibConfigInfo : receiveLibConfigInfo;
|
|
6972
|
+
const { messageLib, timeout } = finalReceiveLibConfigInfo;
|
|
6973
|
+
let msgLibProgram;
|
|
6974
|
+
if (_Endpoint.checkIfBlockedMessageLib(messageLib)) {
|
|
6975
|
+
msgLibProgram = blocked_messagelib_exports.PROGRAM_ID;
|
|
6976
|
+
} else {
|
|
6977
|
+
const msgLibAccountInfo = await connection.getAccountInfo(messageLib, commitmentOrConfig);
|
|
6978
|
+
invariant3(msgLibAccountInfo, "msgLibAccountInfo should not be null");
|
|
6979
|
+
msgLibProgram = msgLibAccountInfo.owner;
|
|
6999
6980
|
}
|
|
7000
|
-
return {
|
|
6981
|
+
return {
|
|
6982
|
+
programId: msgLibProgram,
|
|
6983
|
+
msgLib: messageLib,
|
|
6984
|
+
isDefault: receiveLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString(),
|
|
6985
|
+
timeout: timeout === null ? void 0 : { msgLib: timeout.messageLib, expiry: BigInt(timeout.expiry.toString()) }
|
|
6986
|
+
};
|
|
7001
6987
|
}
|
|
7002
6988
|
// rename to a more generic name
|
|
7003
6989
|
/**
|
|
@@ -7126,6 +7112,10 @@ var Endpoint = class {
|
|
|
7126
7112
|
this.program
|
|
7127
7113
|
);
|
|
7128
7114
|
}
|
|
7115
|
+
static checkIfBlockedMessageLib(msgLib) {
|
|
7116
|
+
const [blockedMessageLib] = new MessageLibPDADeriver(blocked_messagelib_exports.PROGRAM_ID).messageLib();
|
|
7117
|
+
return msgLib.toString() === blockedMessageLib.toString();
|
|
7118
|
+
}
|
|
7129
7119
|
};
|
|
7130
7120
|
|
|
7131
7121
|
// src/solita/simple-message-lib.ts
|
|
@@ -17388,30 +17378,14 @@ var Uln = class {
|
|
|
17388
17378
|
);
|
|
17389
17379
|
invariant3(defaultSendConfigBuf, "defaultSendConfig not initialized");
|
|
17390
17380
|
const [defaultSendConfigState] = SendConfig.fromAccountInfo(defaultSendConfigBuf);
|
|
17391
|
-
let {
|
|
17392
|
-
executor,
|
|
17393
|
-
uln: { requiredDvns, optionalDvns }
|
|
17394
|
-
} = defaultSendConfigState;
|
|
17395
17381
|
const sendConfigState = sendConfigBuf ? SendConfig.fromAccountInfo(sendConfigBuf)[0] : null;
|
|
17396
|
-
|
|
17397
|
-
|
|
17398
|
-
}
|
|
17399
|
-
|
|
17400
|
-
requiredDvns = sendConfigState.uln.requiredDvns.filter((p) => {
|
|
17401
|
-
return !p.equals(PublicKey.default);
|
|
17402
|
-
});
|
|
17403
|
-
}
|
|
17404
|
-
if (sendConfigState && sendConfigState.uln.optionalDvns.length > 0) {
|
|
17405
|
-
optionalDvns = sendConfigState.uln.optionalDvns.filter((p) => {
|
|
17406
|
-
return !p.equals(PublicKey.default);
|
|
17407
|
-
});
|
|
17408
|
-
}
|
|
17382
|
+
const finalConfigState = this.getUlnConfigState(defaultSendConfigState, sendConfigState);
|
|
17383
|
+
const finalExecutorConfigState = this.getExecutorConfigState(defaultSendConfigState, sendConfigState);
|
|
17384
|
+
const { executor } = finalExecutorConfigState;
|
|
17385
|
+
const { requiredDvns, optionalDvns } = finalConfigState;
|
|
17409
17386
|
const dvns = requiredDvns.concat(optionalDvns);
|
|
17410
|
-
const [executorBuf, ...dvnBuf] = await connection.getMultipleAccountsInfo(
|
|
17411
|
-
|
|
17412
|
-
commitment
|
|
17413
|
-
);
|
|
17414
|
-
invariant3(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
|
|
17387
|
+
const [executorBuf, ...dvnBuf] = await connection.getMultipleAccountsInfo([executor, ...dvns], commitment);
|
|
17388
|
+
invariant3(executorBuf, `executor:${executor.toBase58()} not initialized`);
|
|
17415
17389
|
return {
|
|
17416
17390
|
executor: {
|
|
17417
17391
|
config: accounts_exports4.ExecutorConfig.fromAccountInfo(executorBuf)[0],
|
|
@@ -17801,16 +17775,6 @@ var Uln = class {
|
|
|
17801
17775
|
* @throws {Error} If no DVN is found.
|
|
17802
17776
|
*/
|
|
17803
17777
|
async getFinalReceiveConfigState(connection, receiver, eid, commitmentOrConfig = "confirmed") {
|
|
17804
|
-
const NIL_CONFIRMATIONS = "18446744073709551615";
|
|
17805
|
-
const NIL_DVN_COUNT = "255";
|
|
17806
|
-
const rtn_config = {
|
|
17807
|
-
confirmations: 0,
|
|
17808
|
-
requiredDvnCount: 0,
|
|
17809
|
-
optionalDvnCount: 0,
|
|
17810
|
-
optionalDvnThreshold: 0,
|
|
17811
|
-
requiredDvns: [],
|
|
17812
|
-
optionalDvns: []
|
|
17813
|
-
};
|
|
17814
17778
|
const [defaultConfig] = this.deriver.defaultReceiveConfig(eid);
|
|
17815
17779
|
const [customConfig] = this.deriver.receiveConfig(eid, receiver);
|
|
17816
17780
|
const [defaultConfigInfo, customConfigInfo] = await connection.getMultipleAccountsInfo(
|
|
@@ -17822,7 +17786,24 @@ var Uln = class {
|
|
|
17822
17786
|
}
|
|
17823
17787
|
const defaultConfigState = ReceiveConfig2.fromAccountInfo(defaultConfigInfo)[0];
|
|
17824
17788
|
const customConfigState = customConfigInfo ? ReceiveConfig2.fromAccountInfo(customConfigInfo)[0] : null;
|
|
17825
|
-
|
|
17789
|
+
const ulnConfigState = this.getUlnConfigState(defaultConfigState, customConfigState);
|
|
17790
|
+
return ReceiveConfig2.fromArgs({
|
|
17791
|
+
bump: defaultConfigState.bump,
|
|
17792
|
+
uln: ulnConfigState
|
|
17793
|
+
});
|
|
17794
|
+
}
|
|
17795
|
+
getUlnConfigState(defaultConfigState, customConfigState) {
|
|
17796
|
+
const NIL_CONFIRMATIONS = "18446744073709551615";
|
|
17797
|
+
const NIL_DVN_COUNT = "255";
|
|
17798
|
+
const rtn_config = {
|
|
17799
|
+
confirmations: 0,
|
|
17800
|
+
requiredDvnCount: 0,
|
|
17801
|
+
optionalDvnCount: 0,
|
|
17802
|
+
optionalDvnThreshold: 0,
|
|
17803
|
+
requiredDvns: [],
|
|
17804
|
+
optionalDvns: []
|
|
17805
|
+
};
|
|
17806
|
+
if (customConfigState == null || customConfigState.uln.confirmations.toString() === "0") {
|
|
17826
17807
|
rtn_config.confirmations = defaultConfigState.uln.confirmations;
|
|
17827
17808
|
} else if (customConfigState.uln.confirmations.toString() !== NIL_CONFIRMATIONS) {
|
|
17828
17809
|
rtn_config.confirmations = customConfigState.uln.confirmations;
|
|
@@ -17850,10 +17831,24 @@ var Uln = class {
|
|
|
17850
17831
|
if (rtn_config.requiredDvnCount === 0 && rtn_config.optionalDvnCount === 0) {
|
|
17851
17832
|
throw new Error("no dvn");
|
|
17852
17833
|
}
|
|
17853
|
-
return
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17834
|
+
return rtn_config;
|
|
17835
|
+
}
|
|
17836
|
+
getExecutorConfigState(defaultConfigState, customConfigState) {
|
|
17837
|
+
const rtn_config = {
|
|
17838
|
+
maxMessageSize: 0,
|
|
17839
|
+
executor: PublicKey.default
|
|
17840
|
+
};
|
|
17841
|
+
if (customConfigState == null || customConfigState.executor.executor.equals(PublicKey.default)) {
|
|
17842
|
+
rtn_config.executor = defaultConfigState.executor.executor;
|
|
17843
|
+
} else {
|
|
17844
|
+
rtn_config.executor = customConfigState.executor.executor;
|
|
17845
|
+
}
|
|
17846
|
+
if (customConfigState == null || customConfigState.executor.maxMessageSize === 0) {
|
|
17847
|
+
rtn_config.maxMessageSize = defaultConfigState.executor.maxMessageSize;
|
|
17848
|
+
} else {
|
|
17849
|
+
rtn_config.maxMessageSize = customConfigState.executor.maxMessageSize;
|
|
17850
|
+
}
|
|
17851
|
+
return rtn_config;
|
|
17857
17852
|
}
|
|
17858
17853
|
};
|
|
17859
17854
|
|