@layerzerolabs/lz-solana-sdk-v2 3.0.116-placeholder.4 → 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.cjs
CHANGED
|
@@ -6,11 +6,11 @@ var umiEddsaWeb3js = require('@metaplex-foundation/umi-eddsa-web3js');
|
|
|
6
6
|
var umiProgramRepository = require('@metaplex-foundation/umi-program-repository');
|
|
7
7
|
var umiWeb3jsAdapters = require('@metaplex-foundation/umi-web3js-adapters');
|
|
8
8
|
var web3 = require('@solana/web3.js');
|
|
9
|
+
var invariant3 = require('tiny-invariant');
|
|
9
10
|
var lzFoundation = require('@layerzerolabs/lz-foundation');
|
|
10
11
|
var lzUtilities = require('@layerzerolabs/lz-utilities');
|
|
11
12
|
var lzV2Utilities = require('@layerzerolabs/lz-v2-utilities');
|
|
12
13
|
var splToken = require('@solana/spl-token');
|
|
13
|
-
var invariant2 = require('tiny-invariant');
|
|
14
14
|
var mplToolbox = require('@metaplex-foundation/mpl-toolbox');
|
|
15
15
|
var lzDefinitions = require('@layerzerolabs/lz-definitions');
|
|
16
16
|
|
|
@@ -35,7 +35,7 @@ function _interopNamespace(e) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
var web3__namespace = /*#__PURE__*/_interopNamespace(web3);
|
|
38
|
-
var
|
|
38
|
+
var invariant3__default = /*#__PURE__*/_interopDefault(invariant3);
|
|
39
39
|
|
|
40
40
|
var __defProp = Object.defineProperty;
|
|
41
41
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -5325,7 +5325,7 @@ var SIMPLE_MESSAGELIB_PROGRAM_ID = "6GsmxMTHAAiFKfemuM4zBjumTjNSX5CAiw4xSSXM2Toy
|
|
|
5325
5325
|
// src/endpoint.ts
|
|
5326
5326
|
var EventEmitDiscriminator = "e445a52e51cb9a1d";
|
|
5327
5327
|
var DefaultMessageLib = umi.defaultPublicKey();
|
|
5328
|
-
var Endpoint = class {
|
|
5328
|
+
var Endpoint = class _Endpoint {
|
|
5329
5329
|
constructor(programId = ENDPOINT_PROGRAM_ID, rpc) {
|
|
5330
5330
|
this.programId = programId;
|
|
5331
5331
|
this.pda = new EndpointPDA(programId);
|
|
@@ -5801,9 +5801,6 @@ var Endpoint = class {
|
|
|
5801
5801
|
const { path, msgLibProgram } = params;
|
|
5802
5802
|
const { sender, dstEid, receiver } = path;
|
|
5803
5803
|
const sendLibInfo = await this.getSendLibrary(rpc, sender, dstEid, commitment);
|
|
5804
|
-
if (!sendLibInfo.programId) {
|
|
5805
|
-
throw new Error("default send library not initialized or blocked message lib");
|
|
5806
|
-
}
|
|
5807
5804
|
const { msgLib, programId: owner } = sendLibInfo;
|
|
5808
5805
|
const txBuilder = quote(
|
|
5809
5806
|
{ programs: this.programRepo },
|
|
@@ -5844,9 +5841,6 @@ var Endpoint = class {
|
|
|
5844
5841
|
const { path, msgLibProgram } = params;
|
|
5845
5842
|
const { sender, dstEid, receiver } = path;
|
|
5846
5843
|
const info = await this.getSendLibrary(rpc, sender, dstEid, commitment);
|
|
5847
|
-
if (!info.programId) {
|
|
5848
|
-
throw new Error("default send library not initialized or blocked message lib");
|
|
5849
|
-
}
|
|
5850
5844
|
const sendLibrary = info.msgLib;
|
|
5851
5845
|
const txBuilder = send(
|
|
5852
5846
|
{ programs: this.programRepo },
|
|
@@ -6135,7 +6129,7 @@ var Endpoint = class {
|
|
|
6135
6129
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
6136
6130
|
* @param {number} srcEid - The source endpoint ID.
|
|
6137
6131
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6138
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
6132
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default receive library or null if not found.
|
|
6139
6133
|
*/
|
|
6140
6134
|
async getDefaultReceiveLibrary(rpc, srcEid, commitment = "confirmed") {
|
|
6141
6135
|
const [defaultReceiveLibConfig] = this.pda.defaultReceiveLibraryConfig(srcEid);
|
|
@@ -6145,14 +6139,16 @@ var Endpoint = class {
|
|
|
6145
6139
|
if (defaultInfo == null) {
|
|
6146
6140
|
return null;
|
|
6147
6141
|
}
|
|
6148
|
-
|
|
6149
|
-
if (
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
};
|
|
6142
|
+
let msgLibProgram;
|
|
6143
|
+
if (_Endpoint.checkIfBlockedMessageLib(defaultInfo.messageLib)) {
|
|
6144
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6145
|
+
} else {
|
|
6146
|
+
const messageLibInfo = await rpc.getAccount(defaultInfo.messageLib, { commitment });
|
|
6147
|
+
invariant3__default.default(messageLibInfo.exists, "messageLibInfo should not be null");
|
|
6148
|
+
msgLibProgram = messageLibInfo.owner;
|
|
6153
6149
|
}
|
|
6154
6150
|
return {
|
|
6155
|
-
owner:
|
|
6151
|
+
owner: msgLibProgram,
|
|
6156
6152
|
msgLib: defaultInfo.messageLib
|
|
6157
6153
|
};
|
|
6158
6154
|
}
|
|
@@ -6162,7 +6158,7 @@ var Endpoint = class {
|
|
|
6162
6158
|
* @param {Connection} connection - The connection to the Solana cluster.
|
|
6163
6159
|
* @param {number} dstEid - The destination endpoint ID.
|
|
6164
6160
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6165
|
-
* @returns {Promise<{ msgLib: PublicKey; owner
|
|
6161
|
+
* @returns {Promise<{ msgLib: PublicKey; owner: PublicKey } | null>} A promise that resolves to the default send library or null if not found.
|
|
6166
6162
|
*/
|
|
6167
6163
|
async getDefaultSendLibrary(rpc, dstEid, commitment = "confirmed") {
|
|
6168
6164
|
const [defaultSendLibConfig] = this.pda.defaultSendLibraryConfig(dstEid);
|
|
@@ -6170,14 +6166,16 @@ var Endpoint = class {
|
|
|
6170
6166
|
if (defaultInfo == null) {
|
|
6171
6167
|
return null;
|
|
6172
6168
|
}
|
|
6173
|
-
|
|
6174
|
-
if (
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
};
|
|
6169
|
+
let msgLibProgram;
|
|
6170
|
+
if (_Endpoint.checkIfBlockedMessageLib(defaultInfo.messageLib)) {
|
|
6171
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6172
|
+
} else {
|
|
6173
|
+
const messageLibInfo = await rpc.getAccount(defaultInfo.messageLib, { commitment });
|
|
6174
|
+
invariant3__default.default(messageLibInfo.exists, "messageLibInfo should not be null");
|
|
6175
|
+
msgLibProgram = messageLibInfo.owner;
|
|
6178
6176
|
}
|
|
6179
6177
|
return {
|
|
6180
|
-
owner:
|
|
6178
|
+
owner: msgLibProgram,
|
|
6181
6179
|
msgLib: defaultInfo.messageLib
|
|
6182
6180
|
};
|
|
6183
6181
|
}
|
|
@@ -6188,7 +6186,7 @@ var Endpoint = class {
|
|
|
6188
6186
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
6189
6187
|
* @param {number} dstEid - The destination endpoint ID.
|
|
6190
6188
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig='confirmed'] - The commitment level or account info configuration.
|
|
6191
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
6189
|
+
* @returns {Promise<{ msgLib: PublicKey; programId: PublicKey; isDefault: boolean } | null>} A promise that resolves to the configured send library or null if not found.
|
|
6192
6190
|
*/
|
|
6193
6191
|
async getSendLibrary(rpc, oappPda, dstEid, commitment = "confirmed") {
|
|
6194
6192
|
const [sendLibConfig] = this.pda.sendLibraryConfig(oappPda, dstEid);
|
|
@@ -6206,20 +6204,19 @@ var Endpoint = class {
|
|
|
6206
6204
|
const defaultSendLibConfigInfo = deserializeSendLibraryConfig(defaultSendLibConfigBuf);
|
|
6207
6205
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
6208
6206
|
const isDefault = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString();
|
|
6209
|
-
|
|
6210
|
-
if (
|
|
6211
|
-
|
|
6212
|
-
programId: void 0,
|
|
6213
|
-
msgLib,
|
|
6214
|
-
isDefault
|
|
6215
|
-
};
|
|
6207
|
+
let msgLibProgram;
|
|
6208
|
+
if (_Endpoint.checkIfBlockedMessageLib(msgLib)) {
|
|
6209
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6216
6210
|
} else {
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
isDefault
|
|
6221
|
-
};
|
|
6211
|
+
const msgLibInfo = await rpc.getAccount(msgLib, { commitment });
|
|
6212
|
+
invariant3__default.default(msgLibInfo.exists, "msgLibInfo should not be null");
|
|
6213
|
+
msgLibProgram = msgLibInfo.owner;
|
|
6222
6214
|
}
|
|
6215
|
+
return {
|
|
6216
|
+
programId: msgLibProgram,
|
|
6217
|
+
msgLib,
|
|
6218
|
+
isDefault
|
|
6219
|
+
};
|
|
6223
6220
|
}
|
|
6224
6221
|
/**
|
|
6225
6222
|
* Gets the configured receive library for the app.
|
|
@@ -6228,7 +6225,7 @@ var Endpoint = class {
|
|
|
6228
6225
|
* @param {PublicKey} oappPda - The OApp PDA.
|
|
6229
6226
|
* @param {number} srcEid - The source endpoint ID.
|
|
6230
6227
|
* @param {Commitment | GetAccountInfoConfig} [commitmentOrConfig] - The commitment level or account info configuration.
|
|
6231
|
-
* @returns {Promise<{ msgLib: PublicKey; programId
|
|
6228
|
+
* @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.
|
|
6232
6229
|
*/
|
|
6233
6230
|
async getReceiveLibrary(rpc, oappPda, srcEid, commitment = "confirmed") {
|
|
6234
6231
|
const [receiveLibConfig] = this.pda.receiveLibraryConfig(oappPda, srcEid);
|
|
@@ -6247,21 +6244,20 @@ var Endpoint = class {
|
|
|
6247
6244
|
const finalReceiveLibConfigInfo = receiveLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultReceiveLibConfigInfo : receiveLibConfigInfo;
|
|
6248
6245
|
const msgLib = finalReceiveLibConfigInfo.messageLib;
|
|
6249
6246
|
const isDefault = receiveLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString();
|
|
6250
|
-
|
|
6247
|
+
let msgLibProgram;
|
|
6248
|
+
if (_Endpoint.checkIfBlockedMessageLib(msgLib)) {
|
|
6249
|
+
msgLibProgram = blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID;
|
|
6250
|
+
} else {
|
|
6251
|
+
const msgLibInfo = await rpc.getAccount(msgLib, { commitment });
|
|
6252
|
+
invariant3__default.default(msgLibInfo.exists, "msgLibInfo should not be null");
|
|
6253
|
+
msgLibProgram = msgLibInfo.owner;
|
|
6254
|
+
}
|
|
6251
6255
|
const receiveTimeout = umi.isSome(finalReceiveLibConfigInfo.timeout) ? {
|
|
6252
6256
|
msgLib: finalReceiveLibConfigInfo.timeout.value.messageLib,
|
|
6253
6257
|
expiry: finalReceiveLibConfigInfo.timeout.value.expiry
|
|
6254
6258
|
} : void 0;
|
|
6255
|
-
if (!msgLibInfo.exists) {
|
|
6256
|
-
return {
|
|
6257
|
-
programId: void 0,
|
|
6258
|
-
msgLib,
|
|
6259
|
-
isDefault,
|
|
6260
|
-
timeout: receiveTimeout
|
|
6261
|
-
};
|
|
6262
|
-
}
|
|
6263
6259
|
return {
|
|
6264
|
-
programId:
|
|
6260
|
+
programId: msgLibProgram,
|
|
6265
6261
|
msgLib,
|
|
6266
6262
|
isDefault,
|
|
6267
6263
|
timeout: receiveTimeout
|
|
@@ -6378,6 +6374,12 @@ var Endpoint = class {
|
|
|
6378
6374
|
}
|
|
6379
6375
|
).items[0];
|
|
6380
6376
|
}
|
|
6377
|
+
static checkIfBlockedMessageLib(msgLib) {
|
|
6378
|
+
const [blockedMessageLib] = new MessageLibPDA(
|
|
6379
|
+
blocked_messagelib_exports.BLOCKED_MESSAGELIB_PROGRAM_ID
|
|
6380
|
+
).messageLib();
|
|
6381
|
+
return msgLib.toString() === blockedMessageLib.toString();
|
|
6382
|
+
}
|
|
6381
6383
|
};
|
|
6382
6384
|
|
|
6383
6385
|
// src/simple-message-lib.ts
|
|
@@ -10842,7 +10844,7 @@ async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0,
|
|
|
10842
10844
|
};
|
|
10843
10845
|
const receiverPubkey = umi.publicKey(receiverBytes);
|
|
10844
10846
|
const receiverInfo = await rpc.getAccount(receiverPubkey, { commitment });
|
|
10845
|
-
|
|
10847
|
+
invariant3__default.default(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
|
|
10846
10848
|
const receiverProgram = umi.publicKey(receiverInfo.owner);
|
|
10847
10849
|
let version4 = 1;
|
|
10848
10850
|
let receiveTypesAccounts;
|
|
@@ -13140,9 +13142,9 @@ var Uln = class {
|
|
|
13140
13142
|
}
|
|
13141
13143
|
).items[0];
|
|
13142
13144
|
} else {
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13145
|
+
invariant3__default.default(umi.isSome(sendUlnConfig), "sendUlnConfig is required");
|
|
13146
|
+
invariant3__default.default(umi.isSome(receiveUlnConfig), "receiveUlnConfig is required");
|
|
13147
|
+
invariant3__default.default(umi.isSome(executorConfig), "executorConfig is required");
|
|
13146
13148
|
return initDefaultConfig2(
|
|
13147
13149
|
{ programs: this.programRepo },
|
|
13148
13150
|
{
|
|
@@ -13296,9 +13298,9 @@ var Uln = class {
|
|
|
13296
13298
|
const { payer, tokenMint, tokenSource } = accounts;
|
|
13297
13299
|
const { sender, dstEid } = path;
|
|
13298
13300
|
const ulnState = await this.getSetting(rpc, commitment);
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13301
|
+
invariant3__default.default(ulnState !== null, "ULN not initialized");
|
|
13302
|
+
invariant3__default.default(umi.isSome(ulnState.treasury), "treasury not set");
|
|
13303
|
+
invariant3__default.default(umi.isSome(ulnState.treasury.value.lzToken), "lzToken treasury not set");
|
|
13302
13304
|
const lzTokenTreasury = ulnState.treasury.value.lzToken.value.receiver;
|
|
13303
13305
|
let txBuilder = sendWithLzToken2(
|
|
13304
13306
|
{ payer: umi.createNoopSigner(payer), programs: this.programRepo },
|
|
@@ -13366,7 +13368,7 @@ var Uln = class {
|
|
|
13366
13368
|
});
|
|
13367
13369
|
const priceFeedInfos = await rpc.getAccounts(priceFeeds, { commitment });
|
|
13368
13370
|
const priceFeedDict = priceFeedInfos.reduce((acc, info, i) => {
|
|
13369
|
-
|
|
13371
|
+
invariant3__default.default(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
|
|
13370
13372
|
acc.set(priceFeeds[i], info.owner);
|
|
13371
13373
|
return acc;
|
|
13372
13374
|
}, /* @__PURE__ */ new Map());
|
|
@@ -13402,38 +13404,25 @@ var Uln = class {
|
|
|
13402
13404
|
const [defaultSendConfigBuf, sendConfigBuf] = await rpc.getAccounts([defaultSendConfig, sendConfig], {
|
|
13403
13405
|
commitment
|
|
13404
13406
|
});
|
|
13405
|
-
|
|
13407
|
+
invariant3__default.default(defaultSendConfigBuf.exists, "defaultSendConfig not initialized");
|
|
13406
13408
|
const defaultSendConfigState = deserializeSendConfig(defaultSendConfigBuf);
|
|
13407
|
-
let {
|
|
13408
|
-
executor,
|
|
13409
|
-
uln: { requiredDvns, optionalDvns }
|
|
13410
|
-
} = defaultSendConfigState;
|
|
13411
13409
|
const sendConfigState = sendConfigBuf.exists ? deserializeSendConfig(sendConfigBuf) : null;
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
}
|
|
13415
|
-
|
|
13416
|
-
requiredDvns = sendConfigState.uln.requiredDvns.filter((p) => {
|
|
13417
|
-
return p !== umi.defaultPublicKey();
|
|
13418
|
-
});
|
|
13419
|
-
}
|
|
13420
|
-
if (sendConfigState && sendConfigState.uln.optionalDvns.length > 0) {
|
|
13421
|
-
optionalDvns = sendConfigState.uln.optionalDvns.filter((p) => {
|
|
13422
|
-
return p !== umi.defaultPublicKey();
|
|
13423
|
-
});
|
|
13424
|
-
}
|
|
13410
|
+
const finalConfigState = this.getUlnConfigState(defaultSendConfigState, sendConfigState);
|
|
13411
|
+
const finalExecutorConfigState = this.getExecutorConfigState(defaultSendConfigState, sendConfigState);
|
|
13412
|
+
const { requiredDvns, optionalDvns } = finalConfigState;
|
|
13413
|
+
const { executor } = finalExecutorConfigState;
|
|
13425
13414
|
const dvns = requiredDvns.concat(optionalDvns);
|
|
13426
|
-
const [executorBuf, ...dvnBuf] = await rpc.getAccounts([executor
|
|
13415
|
+
const [executorBuf, ...dvnBuf] = await rpc.getAccounts([executor, ...dvns], {
|
|
13427
13416
|
commitment
|
|
13428
13417
|
});
|
|
13429
|
-
|
|
13418
|
+
invariant3__default.default(executorBuf.exists, `executor:${executor} not initialized`);
|
|
13430
13419
|
return {
|
|
13431
13420
|
executor: {
|
|
13432
13421
|
config: accounts_exports4.deserializeExecutorConfig(executorBuf),
|
|
13433
13422
|
owner: executorBuf.owner
|
|
13434
13423
|
},
|
|
13435
13424
|
dvns: dvnBuf.map((dvn, i) => {
|
|
13436
|
-
|
|
13425
|
+
invariant3__default.default(dvn.exists, `dvn:${dvns[i]} not initialized`);
|
|
13437
13426
|
return {
|
|
13438
13427
|
config: accounts_exports3.deserializeDvnConfig(dvn),
|
|
13439
13428
|
owner: dvn.owner
|
|
@@ -13748,7 +13737,7 @@ var Uln = class {
|
|
|
13748
13737
|
}
|
|
13749
13738
|
const defaultConfigState = deserializeReceiveConfig2(defaultConfigInfo);
|
|
13750
13739
|
const customConfigState = customConfigInfo.exists ? deserializeReceiveConfig2(customConfigInfo) : null;
|
|
13751
|
-
return this.
|
|
13740
|
+
return this.getUlnConfigState(defaultConfigState, customConfigState);
|
|
13752
13741
|
}
|
|
13753
13742
|
async getFinalSendConfigState(rpc, sender, eid, commitment = "confirmed") {
|
|
13754
13743
|
const [defaultConfig] = this.pda.defaultSendConfig(eid);
|
|
@@ -13761,9 +13750,9 @@ var Uln = class {
|
|
|
13761
13750
|
}
|
|
13762
13751
|
const defaultConfigState = deserializeSendConfig(defaultConfigInfo);
|
|
13763
13752
|
const customConfigState = customConfigInfo.exists ? deserializeSendConfig(customConfigInfo) : null;
|
|
13764
|
-
return this.
|
|
13753
|
+
return this.getUlnConfigState(defaultConfigState, customConfigState);
|
|
13765
13754
|
}
|
|
13766
|
-
|
|
13755
|
+
getUlnConfigState(defaultConfigState, customConfigState) {
|
|
13767
13756
|
const NIL_CONFIRMATIONS = "18446744073709551615";
|
|
13768
13757
|
const NIL_DVN_COUNT = "255";
|
|
13769
13758
|
const rtn_config = {
|
|
@@ -13804,6 +13793,23 @@ var Uln = class {
|
|
|
13804
13793
|
}
|
|
13805
13794
|
return rtn_config;
|
|
13806
13795
|
}
|
|
13796
|
+
getExecutorConfigState(defaultConfigState, customConfigState) {
|
|
13797
|
+
const rtn_config = {
|
|
13798
|
+
maxMessageSize: 0,
|
|
13799
|
+
executor: umi.defaultPublicKey()
|
|
13800
|
+
};
|
|
13801
|
+
if (customConfigState == null || customConfigState.executor.executor === umi.defaultPublicKey()) {
|
|
13802
|
+
rtn_config.executor = defaultConfigState.executor.executor;
|
|
13803
|
+
} else {
|
|
13804
|
+
rtn_config.executor = customConfigState.executor.executor;
|
|
13805
|
+
}
|
|
13806
|
+
if (customConfigState == null || customConfigState.executor.maxMessageSize === 0) {
|
|
13807
|
+
rtn_config.maxMessageSize = defaultConfigState.executor.maxMessageSize;
|
|
13808
|
+
} else {
|
|
13809
|
+
rtn_config.maxMessageSize = customConfigState.executor.maxMessageSize;
|
|
13810
|
+
}
|
|
13811
|
+
return rtn_config;
|
|
13812
|
+
}
|
|
13807
13813
|
};
|
|
13808
13814
|
|
|
13809
13815
|
// src/pricefeed.ts
|
|
@@ -14831,7 +14837,7 @@ var SendHelper = class {
|
|
|
14831
14837
|
[sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
|
|
14832
14838
|
commitment
|
|
14833
14839
|
);
|
|
14834
|
-
|
|
14840
|
+
invariant3__default.default(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
|
|
14835
14841
|
const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
|
|
14836
14842
|
const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
|
|
14837
14843
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
@@ -14897,7 +14903,7 @@ var SendHelper = class {
|
|
|
14897
14903
|
[sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
|
|
14898
14904
|
commitment
|
|
14899
14905
|
);
|
|
14900
|
-
|
|
14906
|
+
invariant3__default.default(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
|
|
14901
14907
|
const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
|
|
14902
14908
|
const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
|
|
14903
14909
|
const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
|
|
@@ -15080,7 +15086,7 @@ var SendHelper = class {
|
|
|
15080
15086
|
* @returns {Promise<AccountMeta[]>} A promise that resolves to an array of account metadata.
|
|
15081
15087
|
*/
|
|
15082
15088
|
async getUlnAccounts(rpc, payer, ulnInfo, ulnDefaultSendConfigInfo, ulnSendConfigInfo, quoteOrSend, commitment = "confirmed") {
|
|
15083
|
-
|
|
15089
|
+
invariant3__default.default(
|
|
15084
15090
|
ulnInfo.accountInfo.exists && ulnDefaultSendConfigInfo.accountInfo.exists,
|
|
15085
15091
|
"uln send library not initialized"
|
|
15086
15092
|
);
|
|
@@ -15110,7 +15116,7 @@ var SendHelper = class {
|
|
|
15110
15116
|
[executor.executor, ...dvnsKey],
|
|
15111
15117
|
commitment
|
|
15112
15118
|
);
|
|
15113
|
-
|
|
15119
|
+
invariant3__default.default(executorBuf.exists, `executor:${executor.executor} not initialized`);
|
|
15114
15120
|
let executorAccounts, dvnAccounts;
|
|
15115
15121
|
{
|
|
15116
15122
|
const executor2 = {
|
|
@@ -15118,7 +15124,7 @@ var SendHelper = class {
|
|
|
15118
15124
|
owner: executorBuf.owner
|
|
15119
15125
|
};
|
|
15120
15126
|
const dvns = dvnBuf.map((dvn, i) => {
|
|
15121
|
-
|
|
15127
|
+
invariant3__default.default(dvn.exists, `dvn:${dvnsKey[i]} not initialized`);
|
|
15122
15128
|
return {
|
|
15123
15129
|
config: accounts_exports3.deserializeDvnConfig(dvn),
|
|
15124
15130
|
owner: dvn.owner
|
|
@@ -15130,10 +15136,10 @@ var SendHelper = class {
|
|
|
15130
15136
|
});
|
|
15131
15137
|
const priceFeedInfos = await this.getMultipleAccountsInfo(rpc, priceFeeds, commitment);
|
|
15132
15138
|
priceFeedInfos.forEach((info, i) => {
|
|
15133
|
-
|
|
15139
|
+
invariant3__default.default(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
|
|
15134
15140
|
});
|
|
15135
15141
|
const executorPriceFeed = await this.getMultipleAccountsInfo(rpc, [executor2.config.priceFeed], commitment);
|
|
15136
|
-
|
|
15142
|
+
invariant3__default.default(executorPriceFeed[0].exists, `executor priceFeed:${executor2.config.priceFeed} not initialized`);
|
|
15137
15143
|
executorAccounts = new Executor(executor2.owner).getQuoteIXAccountMetaForCPI(
|
|
15138
15144
|
executor2.config.priceFeed,
|
|
15139
15145
|
executorPriceFeed[0].owner,
|
|
@@ -15142,7 +15148,7 @@ var SendHelper = class {
|
|
|
15142
15148
|
dvnAccounts = (await Promise.all(
|
|
15143
15149
|
dvns.map(async (p, i) => {
|
|
15144
15150
|
const dvnPriceFeed = await this.getMultipleAccountsInfo(rpc, [p.config.priceFeed], commitment);
|
|
15145
|
-
|
|
15151
|
+
invariant3__default.default(dvnPriceFeed[0].exists, `dvn priceFeed:${p.config.priceFeed} not initialized`);
|
|
15146
15152
|
return new DVN(p.owner).getQuoteIXAccountMetaForCPI(
|
|
15147
15153
|
p.config.priceFeed,
|
|
15148
15154
|
dvnPriceFeed[0].owner,
|