@layerzerolabs/lz-solana-sdk-v2 2.3.43 → 2.3.45-initia-oft.5
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 +664 -0
- package/deployments/solana-sandbox-local/oft.json +1 -1
- package/deployments/solana-testnet/oft.json +1 -1
- package/dist/index.cjs +89 -3174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1230 -3274
- package/dist/index.d.ts +1230 -3274
- package/dist/index.mjs +91 -3173
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var web314 = require('@solana/web3.js');
|
|
|
4
4
|
var BN = require('bn.js');
|
|
5
5
|
var bytes = require('@ethersproject/bytes');
|
|
6
6
|
var keccak256 = require('@ethersproject/keccak256');
|
|
7
|
-
var
|
|
7
|
+
var invariant4 = require('tiny-invariant');
|
|
8
8
|
var address = require('@ethersproject/address');
|
|
9
9
|
var base58 = require('bs58');
|
|
10
10
|
require('@ethersproject/abi');
|
|
@@ -39,7 +39,7 @@ function _interopNamespace(e) {
|
|
|
39
39
|
|
|
40
40
|
var web314__namespace = /*#__PURE__*/_interopNamespace(web314);
|
|
41
41
|
var BN__default = /*#__PURE__*/_interopDefault(BN);
|
|
42
|
-
var
|
|
42
|
+
var invariant4__default = /*#__PURE__*/_interopDefault(invariant4);
|
|
43
43
|
var base58__default = /*#__PURE__*/_interopDefault(base58);
|
|
44
44
|
var beet159__namespace = /*#__PURE__*/_interopNamespace(beet159);
|
|
45
45
|
var beetSolana85__namespace = /*#__PURE__*/_interopNamespace(beetSolana85);
|
|
@@ -87,7 +87,6 @@ var DVN_CONFIG_SEED = "DvnConfig";
|
|
|
87
87
|
var EVENT_SEED = "__event_authority";
|
|
88
88
|
var EXECUTOR_CONFIG_SEED = "ExecutorConfig";
|
|
89
89
|
var PRICE_FEED_SEED = "PriceFeed";
|
|
90
|
-
var OFT_SEED = "Oft";
|
|
91
90
|
var PEER_SEED = "Peer";
|
|
92
91
|
var MINT_SEED = "Mint";
|
|
93
92
|
var ENFORCED_OPTIONS_SEED = "EnforcedOptions";
|
|
@@ -342,35 +341,6 @@ var PriceFeedPDADeriver = class {
|
|
|
342
341
|
return web314.PublicKey.findProgramAddressSync([Buffer.from(PRICE_FEED_SEED, "utf8")], this.program);
|
|
343
342
|
}
|
|
344
343
|
};
|
|
345
|
-
var OftPDADeriver = class {
|
|
346
|
-
constructor(program) {
|
|
347
|
-
this.program = program;
|
|
348
|
-
}
|
|
349
|
-
config() {
|
|
350
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from("OftConfig", "utf8")], this.program);
|
|
351
|
-
}
|
|
352
|
-
enforcedOptions(oftConfig, eid) {
|
|
353
|
-
return web314.PublicKey.findProgramAddressSync(
|
|
354
|
-
[Buffer.from(ENFORCED_OPTIONS_SEED, "utf8"), oftConfig.toBytes(), new BN__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
355
|
-
this.program
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
peer(oftConfig, eid) {
|
|
359
|
-
return web314.PublicKey.findProgramAddressSync(
|
|
360
|
-
[Buffer.from(PEER_SEED, "utf8"), oftConfig.toBytes(), new BN__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
361
|
-
this.program
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
oftConfig(mintOrEscrow) {
|
|
365
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED, "utf8"), mintOrEscrow.toBuffer()], this.program);
|
|
366
|
-
}
|
|
367
|
-
lzReceiveTypesAccounts(oftConfig) {
|
|
368
|
-
return web314.PublicKey.findProgramAddressSync(
|
|
369
|
-
[Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
|
|
370
|
-
this.program
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
344
|
|
|
375
345
|
// src/endpoint.ts
|
|
376
346
|
var endpoint_exports = {};
|
|
@@ -517,23 +487,6 @@ var PacketV1Codec = class _PacketV1Codec {
|
|
|
517
487
|
};
|
|
518
488
|
}
|
|
519
489
|
};
|
|
520
|
-
var PacketSerializer = class {
|
|
521
|
-
static serialize(packet) {
|
|
522
|
-
return PacketV1Codec.encode(packet);
|
|
523
|
-
}
|
|
524
|
-
static serializeBytes(packet) {
|
|
525
|
-
return PacketV1Codec.encodeBytes(packet);
|
|
526
|
-
}
|
|
527
|
-
static deserialize(bytesLike) {
|
|
528
|
-
let codec;
|
|
529
|
-
if (bytesLike instanceof Uint8Array) {
|
|
530
|
-
codec = PacketV1Codec.fromBytes(bytesLike);
|
|
531
|
-
} else {
|
|
532
|
-
codec = PacketV1Codec.from(bytesLike);
|
|
533
|
-
}
|
|
534
|
-
return codec.toPacket();
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
490
|
|
|
538
491
|
// src/generated/endpoint/accounts/index.ts
|
|
539
492
|
var accounts_exports = {};
|
|
@@ -5921,13 +5874,8 @@ var Endpoint = class {
|
|
|
5921
5874
|
/**
|
|
5922
5875
|
* init endpoint settings, including eid, admin, it also registers the blocked message lib
|
|
5923
5876
|
*/
|
|
5924
|
-
|
|
5877
|
+
initEndpoint(endpointId, payer, admin) {
|
|
5925
5878
|
const [settingPDA] = this.deriver.setting();
|
|
5926
|
-
const initialized = await isAccountInitialized(connection, settingPDA, commitmentOrConfig);
|
|
5927
|
-
if (initialized) {
|
|
5928
|
-
console.warn("endpoint already initialized");
|
|
5929
|
-
return null;
|
|
5930
|
-
}
|
|
5931
5879
|
return createInitEndpointInstruction(
|
|
5932
5880
|
{
|
|
5933
5881
|
payer,
|
|
@@ -5946,13 +5894,9 @@ var Endpoint = class {
|
|
|
5946
5894
|
/***
|
|
5947
5895
|
* call this function after endpoint initialized. Only admin can call this function.
|
|
5948
5896
|
*/
|
|
5949
|
-
|
|
5897
|
+
registerLibrary(admin, messageLibProgram, libType = 2 /* SendAndReceive */) {
|
|
5950
5898
|
const [msgLibPda] = new MessageLibPDADeriver(messageLibProgram).messageLib();
|
|
5951
5899
|
const [msgLibInfoPda] = this.deriver.messageLibraryInfo(msgLibPda);
|
|
5952
|
-
const info = await connection.getAccountInfo(msgLibInfoPda, commitmentOrConfig);
|
|
5953
|
-
if (info) {
|
|
5954
|
-
return null;
|
|
5955
|
-
}
|
|
5956
5900
|
const [settingPDA] = this.deriver.setting();
|
|
5957
5901
|
return createRegisterLibraryInstruction(
|
|
5958
5902
|
{
|
|
@@ -6077,7 +6021,7 @@ var Endpoint = class {
|
|
|
6077
6021
|
);
|
|
6078
6022
|
}
|
|
6079
6023
|
}
|
|
6080
|
-
|
|
6024
|
+
initOAppConfig(delegate, msgLibSDK, payer, oappID, eid) {
|
|
6081
6025
|
const [msgLib] = new MessageLibPDADeriver(msgLibSDK.program).messageLib();
|
|
6082
6026
|
const [oappRegistry] = this.deriver.oappRegistry(oappID);
|
|
6083
6027
|
const [msgLibInfo] = this.deriver.messageLibraryInfo(msgLib);
|
|
@@ -6088,7 +6032,7 @@ var Endpoint = class {
|
|
|
6088
6032
|
messageLib: msgLib,
|
|
6089
6033
|
messageLibInfo: msgLibInfo,
|
|
6090
6034
|
messageLibProgram: msgLibSDK.program,
|
|
6091
|
-
anchorRemainingAccounts:
|
|
6035
|
+
anchorRemainingAccounts: msgLibSDK.getInitConfigIXAccountMetaForCPI(payer, oappID, eid)
|
|
6092
6036
|
},
|
|
6093
6037
|
{
|
|
6094
6038
|
params: {
|
|
@@ -6099,15 +6043,7 @@ var Endpoint = class {
|
|
|
6099
6043
|
this.program
|
|
6100
6044
|
);
|
|
6101
6045
|
}
|
|
6102
|
-
|
|
6103
|
-
const [nonce] = this.deriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
6104
|
-
const info = await connection.getAccountInfo(nonce);
|
|
6105
|
-
if (info) {
|
|
6106
|
-
return null;
|
|
6107
|
-
}
|
|
6108
|
-
return this.initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr);
|
|
6109
|
-
}
|
|
6110
|
-
initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr) {
|
|
6046
|
+
initOAppNonce(delegate, dstEid, oappIDPDA2, remoteOappAddr) {
|
|
6111
6047
|
const [nonce] = this.deriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
6112
6048
|
const [pendingNonce] = this.deriver.pendingNonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
6113
6049
|
const [oappRegistry] = this.deriver.oappRegistry(oappIDPDA2);
|
|
@@ -6128,15 +6064,7 @@ var Endpoint = class {
|
|
|
6128
6064
|
this.program
|
|
6129
6065
|
);
|
|
6130
6066
|
}
|
|
6131
|
-
|
|
6132
|
-
const [sendLibraryConfig] = this.deriver.sendLibraryConfig(sender, dstEid);
|
|
6133
|
-
const info = await connection.getAccountInfo(sendLibraryConfig, commitmentOrConfig);
|
|
6134
|
-
if (info) {
|
|
6135
|
-
return null;
|
|
6136
|
-
}
|
|
6137
|
-
return this.initSendLibraryWithoutChecks(delegate, sender, dstEid);
|
|
6138
|
-
}
|
|
6139
|
-
initSendLibraryWithoutChecks(delegate, sender, dstEid) {
|
|
6067
|
+
initSendLibrary(delegate, sender, dstEid) {
|
|
6140
6068
|
const [oappRegistry] = this.deriver.oappRegistry(sender);
|
|
6141
6069
|
const [sendLibraryConfig] = this.deriver.sendLibraryConfig(sender, dstEid);
|
|
6142
6070
|
return createInitSendLibraryInstruction(
|
|
@@ -6154,7 +6082,7 @@ var Endpoint = class {
|
|
|
6154
6082
|
this.program
|
|
6155
6083
|
);
|
|
6156
6084
|
}
|
|
6157
|
-
|
|
6085
|
+
setSendLibrary(oappAdmin, oappIDPDA2, newSendLibProgram, dstEid) {
|
|
6158
6086
|
const [newSendLib] = new MessageLibPDADeriver(newSendLibProgram).messageLib();
|
|
6159
6087
|
const [sendLibraryConfig] = this.deriver.sendLibraryConfig(oappIDPDA2, dstEid);
|
|
6160
6088
|
const [sendLibraryInfo] = this.deriver.messageLibraryInfo(newSendLib);
|
|
@@ -6177,17 +6105,9 @@ var Endpoint = class {
|
|
|
6177
6105
|
},
|
|
6178
6106
|
this.program
|
|
6179
6107
|
);
|
|
6180
|
-
return
|
|
6181
|
-
}
|
|
6182
|
-
async initReceiveLibrary(connection, delegate, receiver, srcEid, commitmentOrConfig) {
|
|
6183
|
-
const [receiveLibraryConfig] = this.deriver.receiveLibraryConfig(receiver, srcEid);
|
|
6184
|
-
const info = await connection.getAccountInfo(receiveLibraryConfig, commitmentOrConfig);
|
|
6185
|
-
if (info) {
|
|
6186
|
-
return null;
|
|
6187
|
-
}
|
|
6188
|
-
return this.initReceiveLibraryWithoutChecks(delegate, receiver, srcEid);
|
|
6108
|
+
return ix;
|
|
6189
6109
|
}
|
|
6190
|
-
|
|
6110
|
+
initReceiveLibrary(delegate, receiver, srcEid) {
|
|
6191
6111
|
const [oappRegistry] = this.deriver.oappRegistry(receiver);
|
|
6192
6112
|
const [receiveLibraryConfig] = this.deriver.receiveLibraryConfig(receiver, srcEid);
|
|
6193
6113
|
return createInitReceiveLibraryInstruction(
|
|
@@ -6205,7 +6125,7 @@ var Endpoint = class {
|
|
|
6205
6125
|
this.program
|
|
6206
6126
|
);
|
|
6207
6127
|
}
|
|
6208
|
-
|
|
6128
|
+
setReceiveLibrary(oappAdmin, oappIDPDA2, newReceiveLibProgram, srcEid, gracePeriod) {
|
|
6209
6129
|
const [newReceiveLib] = new MessageLibPDADeriver(newReceiveLibProgram).messageLib();
|
|
6210
6130
|
const [receiveLibraryConfig] = this.deriver.receiveLibraryConfig(oappIDPDA2, srcEid);
|
|
6211
6131
|
const [receiveLibraryInfo] = this.deriver.messageLibraryInfo(newReceiveLib);
|
|
@@ -6224,12 +6144,12 @@ var Endpoint = class {
|
|
|
6224
6144
|
receiver: oappIDPDA2,
|
|
6225
6145
|
eid: srcEid,
|
|
6226
6146
|
newLib: newReceiveLib,
|
|
6227
|
-
gracePeriod: gracePeriod
|
|
6147
|
+
gracePeriod: gracePeriod === void 0 ? 0 : new BN__default.default(gracePeriod.toString())
|
|
6228
6148
|
}
|
|
6229
6149
|
},
|
|
6230
6150
|
this.program
|
|
6231
6151
|
);
|
|
6232
|
-
return
|
|
6152
|
+
return ix;
|
|
6233
6153
|
}
|
|
6234
6154
|
async setOappConfig(connection, oappDelegate, oappID, msgLibProgram, eid, config, commitment = "confirmed") {
|
|
6235
6155
|
const [msgLib] = new MessageLibPDADeriver(msgLibProgram).messageLib();
|
|
@@ -6751,7 +6671,7 @@ var Endpoint = class {
|
|
|
6751
6671
|
* get app configured send library
|
|
6752
6672
|
* 2 RPC calls
|
|
6753
6673
|
*/
|
|
6754
|
-
async getSendLibrary(connection, oappPda, dstEid, commitmentOrConfig) {
|
|
6674
|
+
async getSendLibrary(connection, oappPda, dstEid, commitmentOrConfig = "confirmed") {
|
|
6755
6675
|
const [sendLibConfig] = this.deriver.sendLibraryConfig(oappPda, dstEid);
|
|
6756
6676
|
const [defaultSendLibConfig] = this.deriver.defaultSendLibraryConfig(dstEid);
|
|
6757
6677
|
const [defaultSendLibConfigBuf, sendLibConfigBuf] = await connection.getMultipleAccountsInfo(
|
|
@@ -6818,7 +6738,7 @@ var Endpoint = class {
|
|
|
6818
6738
|
};
|
|
6819
6739
|
}
|
|
6820
6740
|
const messageLibInfo = await connection.getAccountInfo(info.messageLib, commitmentOrConfig);
|
|
6821
|
-
|
|
6741
|
+
invariant4__default.default(messageLibInfo, "messageLibInfo should not be null");
|
|
6822
6742
|
const { timeout } = info;
|
|
6823
6743
|
if (timeout) {
|
|
6824
6744
|
return {
|
|
@@ -8826,12 +8746,8 @@ var SimpleMessageLib = class {
|
|
|
8826
8746
|
this.program = program;
|
|
8827
8747
|
this.deriver = new MessageLibPDADeriver(program);
|
|
8828
8748
|
}
|
|
8829
|
-
|
|
8749
|
+
initSimpleMessageLib(endpointProgram, payer, admin, eid, nativeFee, lzTokenFee = 0) {
|
|
8830
8750
|
const [messageLibPda] = this.deriver.messageLib();
|
|
8831
|
-
const info = await connection.getAccountInfo(messageLibPda);
|
|
8832
|
-
if (info) {
|
|
8833
|
-
return null;
|
|
8834
|
-
}
|
|
8835
8751
|
const [endpointAuth] = new EndpointPDADeriver(endpointProgram).messageLibraryInfo(messageLibPda);
|
|
8836
8752
|
return createInitMessageLibInstruction(
|
|
8837
8753
|
{
|
|
@@ -8935,7 +8851,7 @@ var SimpleMessageLib = class {
|
|
|
8935
8851
|
/***
|
|
8936
8852
|
* Get the account meta of the send instruction for CPI(Cross-Program Invocation )
|
|
8937
8853
|
*/
|
|
8938
|
-
|
|
8854
|
+
getInitConfigIXAccountMetaForCPI(payer, oappID, eid) {
|
|
8939
8855
|
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
8940
8856
|
const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
|
|
8941
8857
|
const [messageLib] = this.deriver.messageLib();
|
|
@@ -8955,7 +8871,7 @@ var SimpleMessageLib = class {
|
|
|
8955
8871
|
key.isSigner = false;
|
|
8956
8872
|
}
|
|
8957
8873
|
});
|
|
8958
|
-
return
|
|
8874
|
+
return keys.slice(1);
|
|
8959
8875
|
}
|
|
8960
8876
|
async getSetConfigIXAccountMetaForCPI(endpointProgram, oappID, eid) {
|
|
8961
8877
|
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
@@ -12805,8 +12721,8 @@ async function extractEventFromTransactionSignature(connection, program, signatu
|
|
|
12805
12721
|
}
|
|
12806
12722
|
const dataBuffer = Buffer.from(decoded.subarray(16, decoded.length));
|
|
12807
12723
|
if (eventBeet instanceof beet159__namespace.FixableBeetArgsStruct) {
|
|
12808
|
-
const
|
|
12809
|
-
events.push(
|
|
12724
|
+
const beet260 = eventBeet.toFixedFromData(dataBuffer, 0);
|
|
12725
|
+
events.push(beet260.read(dataBuffer, 0));
|
|
12810
12726
|
} else {
|
|
12811
12727
|
events.push(eventBeet.read(dataBuffer, 0));
|
|
12812
12728
|
}
|
|
@@ -12952,7 +12868,7 @@ async function simulateTransaction(connection, instructions, programId, payer, c
|
|
|
12952
12868
|
}
|
|
12953
12869
|
|
|
12954
12870
|
// src/recevie.ts
|
|
12955
|
-
async function lzReceive(connection, payer, packet, callerParams = Uint8Array.from([0, 0]), commitmentOrConfig) {
|
|
12871
|
+
async function lzReceive(connection, payer, packet, callerParams = Uint8Array.from([0, 0]), commitmentOrConfig = "confirmed") {
|
|
12956
12872
|
const { message: message_, sender, srcEid, guid, receiver: receiver_ } = packet;
|
|
12957
12873
|
const receiver = new web314.PublicKey(addressToBytes32(receiver_));
|
|
12958
12874
|
const message = bytes.arrayify(message_);
|
|
@@ -13376,12 +13292,8 @@ var Executor = class {
|
|
|
13376
13292
|
this.deriver = new ExecutorPDADeriver(this.program);
|
|
13377
13293
|
}
|
|
13378
13294
|
// owner methods
|
|
13379
|
-
|
|
13295
|
+
initExecutor(payer, owner, admins, executors, msglibs, priceFeed) {
|
|
13380
13296
|
const [configAccount] = this.deriver.config();
|
|
13381
|
-
const info = await connection.getAccountInfo(configAccount, commitmentOrConfig);
|
|
13382
|
-
if (info) {
|
|
13383
|
-
throw new Error("Executor already initialized");
|
|
13384
|
-
}
|
|
13385
13297
|
return createInitExecutorInstruction(
|
|
13386
13298
|
{
|
|
13387
13299
|
payer,
|
|
@@ -16529,14 +16441,10 @@ var Uln = class {
|
|
|
16529
16441
|
const [eventAuthorityPDA] = new EventPDADeriver(program).eventAuthority();
|
|
16530
16442
|
this.eventAuthorityPDA = eventAuthorityPDA;
|
|
16531
16443
|
}
|
|
16532
|
-
|
|
16444
|
+
initUln(endpointProgram, payer, admin, eid) {
|
|
16533
16445
|
const [setting] = this.deriver.setting();
|
|
16534
16446
|
const [msgLib] = this.deriver.messageLib();
|
|
16535
16447
|
const [endpointAuth] = new EndpointPDADeriver(endpointProgram).messageLibraryInfo(msgLib);
|
|
16536
|
-
const info = await connection.getAccountInfo(setting, commitmentOrConfig);
|
|
16537
|
-
if (info) {
|
|
16538
|
-
throw new Error("uln already initialized");
|
|
16539
|
-
}
|
|
16540
16448
|
return createInitUlnInstruction(
|
|
16541
16449
|
{
|
|
16542
16450
|
payer,
|
|
@@ -16726,7 +16634,7 @@ var Uln = class {
|
|
|
16726
16634
|
});
|
|
16727
16635
|
const priceFeedInfos = await connection.getMultipleAccountsInfo(priceFeeds, commitment);
|
|
16728
16636
|
const priceFeedDict = priceFeedInfos.reduce((acc, info, i) => {
|
|
16729
|
-
|
|
16637
|
+
invariant4__default.default(info, `priceFeed:${priceFeeds[i].toBase58()} not initialized`);
|
|
16730
16638
|
acc.set(priceFeeds[i].toBase58(), info.owner);
|
|
16731
16639
|
return acc;
|
|
16732
16640
|
}, /* @__PURE__ */ new Map());
|
|
@@ -16757,7 +16665,7 @@ var Uln = class {
|
|
|
16757
16665
|
[defaultSendConfig, sendConfig],
|
|
16758
16666
|
commitment
|
|
16759
16667
|
);
|
|
16760
|
-
|
|
16668
|
+
invariant4__default.default(defaultSendConfigBuf, "defaultSendConfig not initialized");
|
|
16761
16669
|
const [defaultSendConfigState] = SendConfig.fromAccountInfo(defaultSendConfigBuf);
|
|
16762
16670
|
let {
|
|
16763
16671
|
executor,
|
|
@@ -16782,14 +16690,14 @@ var Uln = class {
|
|
|
16782
16690
|
[executor.executor, ...dvns],
|
|
16783
16691
|
commitment
|
|
16784
16692
|
);
|
|
16785
|
-
|
|
16693
|
+
invariant4__default.default(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
|
|
16786
16694
|
return {
|
|
16787
16695
|
executor: {
|
|
16788
16696
|
config: accounts_exports4.ExecutorConfig.fromAccountInfo(executorBuf)[0],
|
|
16789
16697
|
owner: executorBuf.owner
|
|
16790
16698
|
},
|
|
16791
16699
|
dvns: dvnBuf.map((dvn, i) => {
|
|
16792
|
-
|
|
16700
|
+
invariant4__default.default(dvn, `dvn:${dvns[i].toBase58()} not initialized`);
|
|
16793
16701
|
return {
|
|
16794
16702
|
config: accounts_exports3.DvnConfig.fromAccountInfo(dvn)[0],
|
|
16795
16703
|
owner: dvn.owner
|
|
@@ -16953,7 +16861,7 @@ var Uln = class {
|
|
|
16953
16861
|
/***
|
|
16954
16862
|
* Get the account meta of the send instruction for CPI(Cross-Program Invocation )
|
|
16955
16863
|
*/
|
|
16956
|
-
|
|
16864
|
+
getInitConfigIXAccountMetaForCPI(payer, oappID, eid) {
|
|
16957
16865
|
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
16958
16866
|
const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
|
|
16959
16867
|
const [setting] = this.deriver.setting();
|
|
@@ -16973,7 +16881,7 @@ var Uln = class {
|
|
|
16973
16881
|
key.isSigner = false;
|
|
16974
16882
|
}
|
|
16975
16883
|
});
|
|
16976
|
-
return
|
|
16884
|
+
return accounts.slice(1);
|
|
16977
16885
|
}
|
|
16978
16886
|
static constructSetConfigData(configType, configData) {
|
|
16979
16887
|
switch (configType) {
|
|
@@ -17059,7 +16967,7 @@ var Uln = class {
|
|
|
17059
16967
|
return null;
|
|
17060
16968
|
}
|
|
17061
16969
|
}
|
|
17062
|
-
async getFinalReceiveConfigState(connection, receiver, eid, commitmentOrConfig) {
|
|
16970
|
+
async getFinalReceiveConfigState(connection, receiver, eid, commitmentOrConfig = "confirmed") {
|
|
17063
16971
|
const NIL_CONFIRMATIONS = "18446744073709551615";
|
|
17064
16972
|
const NIL_DVN_COUNT = "255";
|
|
17065
16973
|
const rtn_config = {
|
|
@@ -17993,3039 +17901,50 @@ var PriceFeed2 = class {
|
|
|
17993
17901
|
}
|
|
17994
17902
|
}
|
|
17995
17903
|
};
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
createInitAdapterOftIx: () => createInitAdapterOftIx,
|
|
18002
|
-
createInitConfigIx: () => createInitConfigIx,
|
|
18003
|
-
createInitNativeOftIx: () => createInitNativeOftIx,
|
|
18004
|
-
createInitNonceIx: () => createInitNonceIx,
|
|
18005
|
-
createInitReceiveLibraryIx: () => createInitReceiveLibraryIx,
|
|
18006
|
-
createInitSendLibraryIx: () => createInitSendLibraryIx,
|
|
18007
|
-
createMintToIx: () => createMintToIx,
|
|
18008
|
-
createNonceTx: () => createNonceTx,
|
|
18009
|
-
createSetConfigIx: () => createSetConfigIx,
|
|
18010
|
-
createSetDelegateIx: () => createSetDelegateIx,
|
|
18011
|
-
createSetEnforcedOptionsIx: () => createSetEnforcedOptionsIx,
|
|
18012
|
-
createSetMintAuthorityIx: () => createSetMintAuthorityIx,
|
|
18013
|
-
createSetPeerIx: () => createSetPeerIx,
|
|
18014
|
-
createSetRateLimitIx: () => createSetRateLimitIx,
|
|
18015
|
-
createSetReceiveLibraryIx: () => createSetReceiveLibraryIx,
|
|
18016
|
-
createSetSendLibraryIx: () => createSetSendLibraryIx,
|
|
18017
|
-
createTransferAdminIx: () => createTransferAdminIx,
|
|
18018
|
-
getDelegate: () => getDelegate,
|
|
18019
|
-
getEndpointConfig: () => getEndpointConfig,
|
|
18020
|
-
getEnforcedOptions: () => getEnforcedOptions,
|
|
18021
|
-
getPeerAddress: () => getPeerAddress,
|
|
18022
|
-
quoteOft: () => quoteOft,
|
|
18023
|
-
quoteWithUln: () => quoteWithUln,
|
|
18024
|
-
sendWithUln: () => sendWithUln
|
|
18025
|
-
});
|
|
18026
|
-
|
|
18027
|
-
// src/oft.ts
|
|
18028
|
-
var oft_exports = {};
|
|
18029
|
-
__export(oft_exports, {
|
|
18030
|
-
OFT_DECIMALS: () => OFT_DECIMALS,
|
|
18031
|
-
Oft: () => Oft,
|
|
18032
|
-
accounts: () => accounts_exports7,
|
|
18033
|
-
instructions: () => instructions_exports7,
|
|
18034
|
-
types: () => types_exports7
|
|
18035
|
-
});
|
|
18036
|
-
|
|
18037
|
-
// src/generated/oft/accounts/index.ts
|
|
18038
|
-
var accounts_exports7 = {};
|
|
18039
|
-
__export(accounts_exports7, {
|
|
18040
|
-
EnforcedOptions: () => EnforcedOptions,
|
|
18041
|
-
LzReceiveTypesAccounts: () => LzReceiveTypesAccounts,
|
|
18042
|
-
OftConfig: () => OftConfig,
|
|
18043
|
-
Peer: () => Peer,
|
|
18044
|
-
accountProviders: () => accountProviders7,
|
|
18045
|
-
enforcedOptionsBeet: () => enforcedOptionsBeet,
|
|
18046
|
-
enforcedOptionsDiscriminator: () => enforcedOptionsDiscriminator,
|
|
18047
|
-
lzReceiveTypesAccountsBeet: () => lzReceiveTypesAccountsBeet,
|
|
18048
|
-
lzReceiveTypesAccountsDiscriminator: () => lzReceiveTypesAccountsDiscriminator,
|
|
18049
|
-
oftConfigBeet: () => oftConfigBeet,
|
|
18050
|
-
oftConfigDiscriminator: () => oftConfigDiscriminator,
|
|
18051
|
-
peerBeet: () => peerBeet,
|
|
18052
|
-
peerDiscriminator: () => peerDiscriminator
|
|
18053
|
-
});
|
|
18054
|
-
var enforcedOptionsDiscriminator = [114, 221, 43, 174, 5, 37, 8, 20];
|
|
18055
|
-
var EnforcedOptions = class _EnforcedOptions {
|
|
18056
|
-
constructor(send, sendAndCall, bump) {
|
|
18057
|
-
this.send = send;
|
|
18058
|
-
this.sendAndCall = sendAndCall;
|
|
18059
|
-
this.bump = bump;
|
|
18060
|
-
}
|
|
18061
|
-
/**
|
|
18062
|
-
* Creates a {@link EnforcedOptions} instance from the provided args.
|
|
18063
|
-
*/
|
|
18064
|
-
static fromArgs(args) {
|
|
18065
|
-
return new _EnforcedOptions(args.send, args.sendAndCall, args.bump);
|
|
18066
|
-
}
|
|
18067
|
-
/**
|
|
18068
|
-
* Deserializes the {@link EnforcedOptions} from the data of the provided {@link web3.AccountInfo}.
|
|
18069
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18070
|
-
*/
|
|
18071
|
-
static fromAccountInfo(accountInfo, offset = 0) {
|
|
18072
|
-
return _EnforcedOptions.deserialize(accountInfo.data, offset);
|
|
18073
|
-
}
|
|
18074
|
-
/**
|
|
18075
|
-
* Retrieves the account info from the provided address and deserializes
|
|
18076
|
-
* the {@link EnforcedOptions} from its data.
|
|
18077
|
-
*
|
|
18078
|
-
* @throws Error if no account info is found at the address or if deserialization fails
|
|
18079
|
-
*/
|
|
18080
|
-
static async fromAccountAddress(connection, address, commitmentOrConfig) {
|
|
18081
|
-
const accountInfo = await connection.getAccountInfo(
|
|
18082
|
-
address,
|
|
18083
|
-
commitmentOrConfig
|
|
17904
|
+
function oappIDPDA(program, seed = COUNT_SEED, id) {
|
|
17905
|
+
if (id != void 0) {
|
|
17906
|
+
return web314.PublicKey.findProgramAddressSync(
|
|
17907
|
+
[Buffer.from(seed, "utf8"), new BN__default.default(id).toArrayLike(Buffer, "be", 1)],
|
|
17908
|
+
program
|
|
18084
17909
|
);
|
|
18085
|
-
|
|
18086
|
-
|
|
18087
|
-
}
|
|
18088
|
-
return _EnforcedOptions.fromAccountInfo(accountInfo, 0)[0];
|
|
18089
|
-
}
|
|
18090
|
-
/**
|
|
18091
|
-
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
18092
|
-
* to fetch accounts matching filters that can be specified via that builder.
|
|
18093
|
-
*
|
|
18094
|
-
* @param programId - the program that owns the accounts we are filtering
|
|
18095
|
-
*/
|
|
18096
|
-
static gpaBuilder(programId) {
|
|
18097
|
-
return beetSolana85__namespace.GpaBuilder.fromStruct(programId, enforcedOptionsBeet);
|
|
18098
|
-
}
|
|
18099
|
-
/**
|
|
18100
|
-
* Deserializes the {@link EnforcedOptions} from the provided data Buffer.
|
|
18101
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18102
|
-
*/
|
|
18103
|
-
static deserialize(buf, offset = 0) {
|
|
18104
|
-
return enforcedOptionsBeet.deserialize(buf, offset);
|
|
18105
|
-
}
|
|
18106
|
-
/**
|
|
18107
|
-
* Serializes the {@link EnforcedOptions} into a Buffer.
|
|
18108
|
-
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
18109
|
-
*/
|
|
18110
|
-
serialize() {
|
|
18111
|
-
return enforcedOptionsBeet.serialize({
|
|
18112
|
-
accountDiscriminator: enforcedOptionsDiscriminator,
|
|
18113
|
-
...this
|
|
18114
|
-
});
|
|
17910
|
+
} else {
|
|
17911
|
+
return web314.PublicKey.findProgramAddressSync([Buffer.from(seed, "utf8")], program);
|
|
18115
17912
|
}
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
|
|
18119
|
-
|
|
18120
|
-
* @param args need to be provided since the byte size for this account
|
|
18121
|
-
* depends on them
|
|
18122
|
-
*/
|
|
18123
|
-
static byteSize(args) {
|
|
18124
|
-
const instance = _EnforcedOptions.fromArgs(args);
|
|
18125
|
-
return enforcedOptionsBeet.toFixedFromValue({
|
|
18126
|
-
accountDiscriminator: enforcedOptionsDiscriminator,
|
|
18127
|
-
...instance
|
|
18128
|
-
}).byteSize;
|
|
17913
|
+
}
|
|
17914
|
+
function deriveLzReceiveTypesAccountsPDA(program, oappId) {
|
|
17915
|
+
if (oappId != void 0) {
|
|
17916
|
+
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
|
|
18129
17917
|
}
|
|
18130
|
-
|
|
18131
|
-
|
|
18132
|
-
|
|
18133
|
-
|
|
18134
|
-
|
|
18135
|
-
* depends on them
|
|
18136
|
-
* @param connection used to retrieve the rent exemption information
|
|
18137
|
-
*/
|
|
18138
|
-
static async getMinimumBalanceForRentExemption(args, connection, commitment) {
|
|
18139
|
-
return connection.getMinimumBalanceForRentExemption(
|
|
18140
|
-
_EnforcedOptions.byteSize(args),
|
|
18141
|
-
commitment
|
|
18142
|
-
);
|
|
17918
|
+
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8")], program);
|
|
17919
|
+
}
|
|
17920
|
+
function deriveLzComposeTypesAccountsPDA(program, oappId) {
|
|
17921
|
+
if (oappId != void 0) {
|
|
17922
|
+
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
|
|
18143
17923
|
}
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18150
|
-
send: this.send,
|
|
18151
|
-
sendAndCall: this.sendAndCall,
|
|
18152
|
-
bump: this.bump
|
|
18153
|
-
};
|
|
17924
|
+
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8")], program);
|
|
17925
|
+
}
|
|
17926
|
+
var BaseOApp = class {
|
|
17927
|
+
constructor(program) {
|
|
17928
|
+
this.program = program;
|
|
17929
|
+
this.oappBaseDeriver = new OAppBasePDADeriver(program);
|
|
18154
17930
|
}
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
[
|
|
18158
|
-
["accountDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18159
|
-
["send", beet159__namespace.bytes],
|
|
18160
|
-
["sendAndCall", beet159__namespace.bytes],
|
|
18161
|
-
["bump", beet159__namespace.u8]
|
|
18162
|
-
],
|
|
18163
|
-
EnforcedOptions.fromArgs,
|
|
18164
|
-
"EnforcedOptions"
|
|
18165
|
-
);
|
|
18166
|
-
var lzReceiveTypesAccountsDiscriminator = [
|
|
18167
|
-
248,
|
|
18168
|
-
87,
|
|
18169
|
-
167,
|
|
18170
|
-
117,
|
|
18171
|
-
5,
|
|
18172
|
-
251,
|
|
18173
|
-
21,
|
|
18174
|
-
126
|
|
18175
|
-
];
|
|
18176
|
-
var LzReceiveTypesAccounts = class _LzReceiveTypesAccounts {
|
|
18177
|
-
constructor(oftConfig, tokenMint) {
|
|
18178
|
-
this.oftConfig = oftConfig;
|
|
18179
|
-
this.tokenMint = tokenMint;
|
|
17931
|
+
async queryIDPDAInfo(connection, commitmentOrConfig) {
|
|
17932
|
+
return this.queryPDAInfo(connection, this.idPDA()[0], commitmentOrConfig);
|
|
18180
17933
|
}
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
*/
|
|
18184
|
-
static fromArgs(args) {
|
|
18185
|
-
return new _LzReceiveTypesAccounts(args.oftConfig, args.tokenMint);
|
|
17934
|
+
async queryPDAInfo(connection, pda, commitmentOrConfig) {
|
|
17935
|
+
return connection.getAccountInfo(pda, commitmentOrConfig);
|
|
18186
17936
|
}
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18190
|
-
*/
|
|
18191
|
-
static fromAccountInfo(accountInfo, offset = 0) {
|
|
18192
|
-
return _LzReceiveTypesAccounts.deserialize(accountInfo.data, offset);
|
|
17937
|
+
idPDA() {
|
|
17938
|
+
return oappIDPDA(this.program);
|
|
18193
17939
|
}
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
static async fromAccountAddress(connection, address, commitmentOrConfig) {
|
|
18201
|
-
const accountInfo = await connection.getAccountInfo(
|
|
18202
|
-
address,
|
|
18203
|
-
commitmentOrConfig
|
|
18204
|
-
);
|
|
18205
|
-
if (accountInfo == null) {
|
|
18206
|
-
throw new Error(
|
|
18207
|
-
`Unable to find LzReceiveTypesAccounts account at ${address}`
|
|
18208
|
-
);
|
|
17940
|
+
async getRemote(connection, dstEid, commitmentOrConfig) {
|
|
17941
|
+
const [remotePDA] = this.oappBaseDeriver.remote(dstEid);
|
|
17942
|
+
const info = await this.queryPDAInfo(connection, remotePDA, commitmentOrConfig);
|
|
17943
|
+
if (info) {
|
|
17944
|
+
const result = AddressType.read(info.data, 8);
|
|
17945
|
+
return Uint8Array.from(result);
|
|
18209
17946
|
}
|
|
18210
|
-
return
|
|
18211
|
-
}
|
|
18212
|
-
/**
|
|
18213
|
-
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
18214
|
-
* to fetch accounts matching filters that can be specified via that builder.
|
|
18215
|
-
*
|
|
18216
|
-
* @param programId - the program that owns the accounts we are filtering
|
|
18217
|
-
*/
|
|
18218
|
-
static gpaBuilder(programId) {
|
|
18219
|
-
return beetSolana85__namespace.GpaBuilder.fromStruct(
|
|
18220
|
-
programId,
|
|
18221
|
-
lzReceiveTypesAccountsBeet
|
|
18222
|
-
);
|
|
18223
|
-
}
|
|
18224
|
-
/**
|
|
18225
|
-
* Deserializes the {@link LzReceiveTypesAccounts} from the provided data Buffer.
|
|
18226
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18227
|
-
*/
|
|
18228
|
-
static deserialize(buf, offset = 0) {
|
|
18229
|
-
return lzReceiveTypesAccountsBeet.deserialize(buf, offset);
|
|
18230
|
-
}
|
|
18231
|
-
/**
|
|
18232
|
-
* Serializes the {@link LzReceiveTypesAccounts} into a Buffer.
|
|
18233
|
-
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
18234
|
-
*/
|
|
18235
|
-
serialize() {
|
|
18236
|
-
return lzReceiveTypesAccountsBeet.serialize({
|
|
18237
|
-
accountDiscriminator: lzReceiveTypesAccountsDiscriminator,
|
|
18238
|
-
...this
|
|
18239
|
-
});
|
|
18240
|
-
}
|
|
18241
|
-
/**
|
|
18242
|
-
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
18243
|
-
* {@link LzReceiveTypesAccounts}
|
|
18244
|
-
*/
|
|
18245
|
-
static get byteSize() {
|
|
18246
|
-
return lzReceiveTypesAccountsBeet.byteSize;
|
|
18247
|
-
}
|
|
18248
|
-
/**
|
|
18249
|
-
* Fetches the minimum balance needed to exempt an account holding
|
|
18250
|
-
* {@link LzReceiveTypesAccounts} data from rent
|
|
18251
|
-
*
|
|
18252
|
-
* @param connection used to retrieve the rent exemption information
|
|
18253
|
-
*/
|
|
18254
|
-
static async getMinimumBalanceForRentExemption(connection, commitment) {
|
|
18255
|
-
return connection.getMinimumBalanceForRentExemption(
|
|
18256
|
-
_LzReceiveTypesAccounts.byteSize,
|
|
18257
|
-
commitment
|
|
18258
|
-
);
|
|
18259
|
-
}
|
|
18260
|
-
/**
|
|
18261
|
-
* Determines if the provided {@link Buffer} has the correct byte size to
|
|
18262
|
-
* hold {@link LzReceiveTypesAccounts} data.
|
|
18263
|
-
*/
|
|
18264
|
-
static hasCorrectByteSize(buf, offset = 0) {
|
|
18265
|
-
return buf.byteLength - offset === _LzReceiveTypesAccounts.byteSize;
|
|
18266
|
-
}
|
|
18267
|
-
/**
|
|
18268
|
-
* Returns a readable version of {@link LzReceiveTypesAccounts} properties
|
|
18269
|
-
* and can be used to convert to JSON and/or logging
|
|
18270
|
-
*/
|
|
18271
|
-
pretty() {
|
|
18272
|
-
return {
|
|
18273
|
-
oftConfig: this.oftConfig.toBase58(),
|
|
18274
|
-
tokenMint: this.tokenMint.toBase58()
|
|
18275
|
-
};
|
|
18276
|
-
}
|
|
18277
|
-
};
|
|
18278
|
-
var lzReceiveTypesAccountsBeet = new beet159__namespace.BeetStruct(
|
|
18279
|
-
[
|
|
18280
|
-
["accountDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18281
|
-
["oftConfig", beetSolana85__namespace.publicKey],
|
|
18282
|
-
["tokenMint", beetSolana85__namespace.publicKey]
|
|
18283
|
-
],
|
|
18284
|
-
LzReceiveTypesAccounts.fromArgs,
|
|
18285
|
-
"LzReceiveTypesAccounts"
|
|
18286
|
-
);
|
|
18287
|
-
var isOftConfigExtNative = (x) => x.__kind === "Native";
|
|
18288
|
-
var isOftConfigExtAdapter = (x) => x.__kind === "Adapter";
|
|
18289
|
-
var oftConfigExtBeet = beet159__namespace.dataEnum([
|
|
18290
|
-
[
|
|
18291
|
-
"Native",
|
|
18292
|
-
new beet159__namespace.FixableBeetArgsStruct(
|
|
18293
|
-
[["fields", beet159__namespace.tuple([beet159__namespace.coption(beetSolana85__namespace.publicKey)])]],
|
|
18294
|
-
'OftConfigExtRecord["Native"]'
|
|
18295
|
-
)
|
|
18296
|
-
],
|
|
18297
|
-
[
|
|
18298
|
-
"Adapter",
|
|
18299
|
-
new beet159__namespace.BeetArgsStruct(
|
|
18300
|
-
[["fields", beet159__namespace.fixedSizeTuple([beetSolana85__namespace.publicKey])]],
|
|
18301
|
-
'OftConfigExtRecord["Adapter"]'
|
|
18302
|
-
)
|
|
18303
|
-
]
|
|
18304
|
-
]);
|
|
18305
|
-
|
|
18306
|
-
// src/generated/oft/accounts/OftConfig.ts
|
|
18307
|
-
var oftConfigDiscriminator = [50, 97, 89, 128, 99, 15, 107, 27];
|
|
18308
|
-
var OftConfig = class _OftConfig {
|
|
18309
|
-
constructor(ld2sdRate, tokenMint, tokenProgram, endpointProgram, bump, admin, ext) {
|
|
18310
|
-
this.ld2sdRate = ld2sdRate;
|
|
18311
|
-
this.tokenMint = tokenMint;
|
|
18312
|
-
this.tokenProgram = tokenProgram;
|
|
18313
|
-
this.endpointProgram = endpointProgram;
|
|
18314
|
-
this.bump = bump;
|
|
18315
|
-
this.admin = admin;
|
|
18316
|
-
this.ext = ext;
|
|
18317
|
-
}
|
|
18318
|
-
/**
|
|
18319
|
-
* Creates a {@link OftConfig} instance from the provided args.
|
|
18320
|
-
*/
|
|
18321
|
-
static fromArgs(args) {
|
|
18322
|
-
return new _OftConfig(
|
|
18323
|
-
args.ld2sdRate,
|
|
18324
|
-
args.tokenMint,
|
|
18325
|
-
args.tokenProgram,
|
|
18326
|
-
args.endpointProgram,
|
|
18327
|
-
args.bump,
|
|
18328
|
-
args.admin,
|
|
18329
|
-
args.ext
|
|
18330
|
-
);
|
|
18331
|
-
}
|
|
18332
|
-
/**
|
|
18333
|
-
* Deserializes the {@link OftConfig} from the data of the provided {@link web3.AccountInfo}.
|
|
18334
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18335
|
-
*/
|
|
18336
|
-
static fromAccountInfo(accountInfo, offset = 0) {
|
|
18337
|
-
return _OftConfig.deserialize(accountInfo.data, offset);
|
|
18338
|
-
}
|
|
18339
|
-
/**
|
|
18340
|
-
* Retrieves the account info from the provided address and deserializes
|
|
18341
|
-
* the {@link OftConfig} from its data.
|
|
18342
|
-
*
|
|
18343
|
-
* @throws Error if no account info is found at the address or if deserialization fails
|
|
18344
|
-
*/
|
|
18345
|
-
static async fromAccountAddress(connection, address, commitmentOrConfig) {
|
|
18346
|
-
const accountInfo = await connection.getAccountInfo(
|
|
18347
|
-
address,
|
|
18348
|
-
commitmentOrConfig
|
|
18349
|
-
);
|
|
18350
|
-
if (accountInfo == null) {
|
|
18351
|
-
throw new Error(`Unable to find OftConfig account at ${address}`);
|
|
18352
|
-
}
|
|
18353
|
-
return _OftConfig.fromAccountInfo(accountInfo, 0)[0];
|
|
18354
|
-
}
|
|
18355
|
-
/**
|
|
18356
|
-
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
18357
|
-
* to fetch accounts matching filters that can be specified via that builder.
|
|
18358
|
-
*
|
|
18359
|
-
* @param programId - the program that owns the accounts we are filtering
|
|
18360
|
-
*/
|
|
18361
|
-
static gpaBuilder(programId) {
|
|
18362
|
-
return beetSolana85__namespace.GpaBuilder.fromStruct(programId, oftConfigBeet);
|
|
18363
|
-
}
|
|
18364
|
-
/**
|
|
18365
|
-
* Deserializes the {@link OftConfig} from the provided data Buffer.
|
|
18366
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18367
|
-
*/
|
|
18368
|
-
static deserialize(buf, offset = 0) {
|
|
18369
|
-
return oftConfigBeet.deserialize(buf, offset);
|
|
18370
|
-
}
|
|
18371
|
-
/**
|
|
18372
|
-
* Serializes the {@link OftConfig} into a Buffer.
|
|
18373
|
-
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
18374
|
-
*/
|
|
18375
|
-
serialize() {
|
|
18376
|
-
return oftConfigBeet.serialize({
|
|
18377
|
-
accountDiscriminator: oftConfigDiscriminator,
|
|
18378
|
-
...this
|
|
18379
|
-
});
|
|
18380
|
-
}
|
|
18381
|
-
/**
|
|
18382
|
-
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
18383
|
-
* {@link OftConfig} for the provided args.
|
|
18384
|
-
*
|
|
18385
|
-
* @param args need to be provided since the byte size for this account
|
|
18386
|
-
* depends on them
|
|
18387
|
-
*/
|
|
18388
|
-
static byteSize(args) {
|
|
18389
|
-
const instance = _OftConfig.fromArgs(args);
|
|
18390
|
-
return oftConfigBeet.toFixedFromValue({
|
|
18391
|
-
accountDiscriminator: oftConfigDiscriminator,
|
|
18392
|
-
...instance
|
|
18393
|
-
}).byteSize;
|
|
18394
|
-
}
|
|
18395
|
-
/**
|
|
18396
|
-
* Fetches the minimum balance needed to exempt an account holding
|
|
18397
|
-
* {@link OftConfig} data from rent
|
|
18398
|
-
*
|
|
18399
|
-
* @param args need to be provided since the byte size for this account
|
|
18400
|
-
* depends on them
|
|
18401
|
-
* @param connection used to retrieve the rent exemption information
|
|
18402
|
-
*/
|
|
18403
|
-
static async getMinimumBalanceForRentExemption(args, connection, commitment) {
|
|
18404
|
-
return connection.getMinimumBalanceForRentExemption(
|
|
18405
|
-
_OftConfig.byteSize(args),
|
|
18406
|
-
commitment
|
|
18407
|
-
);
|
|
18408
|
-
}
|
|
18409
|
-
/**
|
|
18410
|
-
* Returns a readable version of {@link OftConfig} properties
|
|
18411
|
-
* and can be used to convert to JSON and/or logging
|
|
18412
|
-
*/
|
|
18413
|
-
pretty() {
|
|
18414
|
-
return {
|
|
18415
|
-
ld2sdRate: (() => {
|
|
18416
|
-
const x = this.ld2sdRate;
|
|
18417
|
-
if (typeof x.toNumber === "function") {
|
|
18418
|
-
try {
|
|
18419
|
-
return x.toNumber();
|
|
18420
|
-
} catch (_) {
|
|
18421
|
-
return x;
|
|
18422
|
-
}
|
|
18423
|
-
}
|
|
18424
|
-
return x;
|
|
18425
|
-
})(),
|
|
18426
|
-
tokenMint: this.tokenMint.toBase58(),
|
|
18427
|
-
tokenProgram: this.tokenProgram.toBase58(),
|
|
18428
|
-
endpointProgram: this.endpointProgram.toBase58(),
|
|
18429
|
-
bump: this.bump,
|
|
18430
|
-
admin: this.admin.toBase58(),
|
|
18431
|
-
ext: this.ext.__kind
|
|
18432
|
-
};
|
|
18433
|
-
}
|
|
18434
|
-
};
|
|
18435
|
-
var oftConfigBeet = new beet159__namespace.FixableBeetStruct(
|
|
18436
|
-
[
|
|
18437
|
-
["accountDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18438
|
-
["ld2sdRate", beet159__namespace.u64],
|
|
18439
|
-
["tokenMint", beetSolana85__namespace.publicKey],
|
|
18440
|
-
["tokenProgram", beetSolana85__namespace.publicKey],
|
|
18441
|
-
["endpointProgram", beetSolana85__namespace.publicKey],
|
|
18442
|
-
["bump", beet159__namespace.u8],
|
|
18443
|
-
["admin", beetSolana85__namespace.publicKey],
|
|
18444
|
-
["ext", oftConfigExtBeet]
|
|
18445
|
-
],
|
|
18446
|
-
OftConfig.fromArgs,
|
|
18447
|
-
"OftConfig"
|
|
18448
|
-
);
|
|
18449
|
-
var rateLimiterBeet = new beet159__namespace.BeetArgsStruct(
|
|
18450
|
-
[
|
|
18451
|
-
["capacity", beet159__namespace.u64],
|
|
18452
|
-
["tokens", beet159__namespace.u64],
|
|
18453
|
-
["refillPerSecond", beet159__namespace.u64],
|
|
18454
|
-
["lastRefillTime", beet159__namespace.u64]
|
|
18455
|
-
],
|
|
18456
|
-
"RateLimiter"
|
|
18457
|
-
);
|
|
18458
|
-
|
|
18459
|
-
// src/generated/oft/accounts/Peer.ts
|
|
18460
|
-
var peerDiscriminator = [50, 8, 19, 55, 40, 253, 37, 58];
|
|
18461
|
-
var Peer = class _Peer {
|
|
18462
|
-
constructor(address, rateLimiter, bump) {
|
|
18463
|
-
this.address = address;
|
|
18464
|
-
this.rateLimiter = rateLimiter;
|
|
18465
|
-
this.bump = bump;
|
|
18466
|
-
}
|
|
18467
|
-
/**
|
|
18468
|
-
* Creates a {@link Peer} instance from the provided args.
|
|
18469
|
-
*/
|
|
18470
|
-
static fromArgs(args) {
|
|
18471
|
-
return new _Peer(args.address, args.rateLimiter, args.bump);
|
|
18472
|
-
}
|
|
18473
|
-
/**
|
|
18474
|
-
* Deserializes the {@link Peer} from the data of the provided {@link web3.AccountInfo}.
|
|
18475
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18476
|
-
*/
|
|
18477
|
-
static fromAccountInfo(accountInfo, offset = 0) {
|
|
18478
|
-
return _Peer.deserialize(accountInfo.data, offset);
|
|
18479
|
-
}
|
|
18480
|
-
/**
|
|
18481
|
-
* Retrieves the account info from the provided address and deserializes
|
|
18482
|
-
* the {@link Peer} from its data.
|
|
18483
|
-
*
|
|
18484
|
-
* @throws Error if no account info is found at the address or if deserialization fails
|
|
18485
|
-
*/
|
|
18486
|
-
static async fromAccountAddress(connection, address, commitmentOrConfig) {
|
|
18487
|
-
const accountInfo = await connection.getAccountInfo(
|
|
18488
|
-
address,
|
|
18489
|
-
commitmentOrConfig
|
|
18490
|
-
);
|
|
18491
|
-
if (accountInfo == null) {
|
|
18492
|
-
throw new Error(`Unable to find Peer account at ${address}`);
|
|
18493
|
-
}
|
|
18494
|
-
return _Peer.fromAccountInfo(accountInfo, 0)[0];
|
|
18495
|
-
}
|
|
18496
|
-
/**
|
|
18497
|
-
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
18498
|
-
* to fetch accounts matching filters that can be specified via that builder.
|
|
18499
|
-
*
|
|
18500
|
-
* @param programId - the program that owns the accounts we are filtering
|
|
18501
|
-
*/
|
|
18502
|
-
static gpaBuilder(programId) {
|
|
18503
|
-
return beetSolana85__namespace.GpaBuilder.fromStruct(programId, peerBeet);
|
|
18504
|
-
}
|
|
18505
|
-
/**
|
|
18506
|
-
* Deserializes the {@link Peer} from the provided data Buffer.
|
|
18507
|
-
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
18508
|
-
*/
|
|
18509
|
-
static deserialize(buf, offset = 0) {
|
|
18510
|
-
return peerBeet.deserialize(buf, offset);
|
|
18511
|
-
}
|
|
18512
|
-
/**
|
|
18513
|
-
* Serializes the {@link Peer} into a Buffer.
|
|
18514
|
-
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
18515
|
-
*/
|
|
18516
|
-
serialize() {
|
|
18517
|
-
return peerBeet.serialize({
|
|
18518
|
-
accountDiscriminator: peerDiscriminator,
|
|
18519
|
-
...this
|
|
18520
|
-
});
|
|
18521
|
-
}
|
|
18522
|
-
/**
|
|
18523
|
-
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
18524
|
-
* {@link Peer} for the provided args.
|
|
18525
|
-
*
|
|
18526
|
-
* @param args need to be provided since the byte size for this account
|
|
18527
|
-
* depends on them
|
|
18528
|
-
*/
|
|
18529
|
-
static byteSize(args) {
|
|
18530
|
-
const instance = _Peer.fromArgs(args);
|
|
18531
|
-
return peerBeet.toFixedFromValue({
|
|
18532
|
-
accountDiscriminator: peerDiscriminator,
|
|
18533
|
-
...instance
|
|
18534
|
-
}).byteSize;
|
|
18535
|
-
}
|
|
18536
|
-
/**
|
|
18537
|
-
* Fetches the minimum balance needed to exempt an account holding
|
|
18538
|
-
* {@link Peer} data from rent
|
|
18539
|
-
*
|
|
18540
|
-
* @param args need to be provided since the byte size for this account
|
|
18541
|
-
* depends on them
|
|
18542
|
-
* @param connection used to retrieve the rent exemption information
|
|
18543
|
-
*/
|
|
18544
|
-
static async getMinimumBalanceForRentExemption(args, connection, commitment) {
|
|
18545
|
-
return connection.getMinimumBalanceForRentExemption(
|
|
18546
|
-
_Peer.byteSize(args),
|
|
18547
|
-
commitment
|
|
18548
|
-
);
|
|
18549
|
-
}
|
|
18550
|
-
/**
|
|
18551
|
-
* Returns a readable version of {@link Peer} properties
|
|
18552
|
-
* and can be used to convert to JSON and/or logging
|
|
18553
|
-
*/
|
|
18554
|
-
pretty() {
|
|
18555
|
-
return {
|
|
18556
|
-
address: this.address,
|
|
18557
|
-
rateLimiter: this.rateLimiter,
|
|
18558
|
-
bump: this.bump
|
|
18559
|
-
};
|
|
18560
|
-
}
|
|
18561
|
-
};
|
|
18562
|
-
var peerBeet = new beet159__namespace.FixableBeetStruct(
|
|
18563
|
-
[
|
|
18564
|
-
["accountDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18565
|
-
["address", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
18566
|
-
["rateLimiter", beet159__namespace.coption(rateLimiterBeet)],
|
|
18567
|
-
["bump", beet159__namespace.u8]
|
|
18568
|
-
],
|
|
18569
|
-
Peer.fromArgs,
|
|
18570
|
-
"Peer"
|
|
18571
|
-
);
|
|
18572
|
-
|
|
18573
|
-
// src/generated/oft/accounts/index.ts
|
|
18574
|
-
var accountProviders7 = {
|
|
18575
|
-
EnforcedOptions,
|
|
18576
|
-
LzReceiveTypesAccounts,
|
|
18577
|
-
OftConfig,
|
|
18578
|
-
Peer
|
|
18579
|
-
};
|
|
18580
|
-
|
|
18581
|
-
// src/generated/oft/instructions/index.ts
|
|
18582
|
-
var instructions_exports7 = {};
|
|
18583
|
-
__export(instructions_exports7, {
|
|
18584
|
-
createInitAdapterOftInstruction: () => createInitAdapterOftInstruction,
|
|
18585
|
-
createInitAdapterOftInstructionAccounts: () => createInitAdapterOftInstructionAccounts,
|
|
18586
|
-
createInitOftInstruction: () => createInitOftInstruction,
|
|
18587
|
-
createInitOftInstructionAccounts: () => createInitOftInstructionAccounts,
|
|
18588
|
-
createLzReceiveInstruction: () => createLzReceiveInstruction,
|
|
18589
|
-
createLzReceiveInstructionAccounts: () => createLzReceiveInstructionAccounts,
|
|
18590
|
-
createLzReceiveTypesInstruction: () => createLzReceiveTypesInstruction,
|
|
18591
|
-
createLzReceiveTypesInstructionAccounts: () => createLzReceiveTypesInstructionAccounts,
|
|
18592
|
-
createMintToInstruction: () => createMintToInstruction,
|
|
18593
|
-
createMintToInstructionAccounts: () => createMintToInstructionAccounts,
|
|
18594
|
-
createQuoteInstruction: () => createQuoteInstruction4,
|
|
18595
|
-
createQuoteInstructionAccounts: () => createQuoteInstructionAccounts4,
|
|
18596
|
-
createQuoteOftInstruction: () => createQuoteOftInstruction,
|
|
18597
|
-
createQuoteOftInstructionAccounts: () => createQuoteOftInstructionAccounts,
|
|
18598
|
-
createSendInstruction: () => createSendInstruction4,
|
|
18599
|
-
createSendInstructionAccounts: () => createSendInstructionAccounts4,
|
|
18600
|
-
createSetDelegateInstruction: () => createSetDelegateInstruction2,
|
|
18601
|
-
createSetDelegateInstructionAccounts: () => createSetDelegateInstructionAccounts2,
|
|
18602
|
-
createSetEnforcedOptionsInstruction: () => createSetEnforcedOptionsInstruction,
|
|
18603
|
-
createSetEnforcedOptionsInstructionAccounts: () => createSetEnforcedOptionsInstructionAccounts,
|
|
18604
|
-
createSetMintAuthorityInstruction: () => createSetMintAuthorityInstruction,
|
|
18605
|
-
createSetMintAuthorityInstructionAccounts: () => createSetMintAuthorityInstructionAccounts,
|
|
18606
|
-
createSetPeerInstruction: () => createSetPeerInstruction,
|
|
18607
|
-
createSetPeerInstructionAccounts: () => createSetPeerInstructionAccounts,
|
|
18608
|
-
createSetRateLimitInstruction: () => createSetRateLimitInstruction,
|
|
18609
|
-
createSetRateLimitInstructionAccounts: () => createSetRateLimitInstructionAccounts,
|
|
18610
|
-
createTransferAdminInstruction: () => createTransferAdminInstruction5,
|
|
18611
|
-
createTransferAdminInstructionAccounts: () => createTransferAdminInstructionAccounts5,
|
|
18612
|
-
createVersionInstruction: () => createVersionInstruction3,
|
|
18613
|
-
createVersionInstructionAccounts: () => createVersionInstructionAccounts3,
|
|
18614
|
-
initAdapterOftInstructionDiscriminator: () => initAdapterOftInstructionDiscriminator,
|
|
18615
|
-
initAdapterOftStruct: () => initAdapterOftStruct,
|
|
18616
|
-
initOftInstructionDiscriminator: () => initOftInstructionDiscriminator,
|
|
18617
|
-
initOftStruct: () => initOftStruct,
|
|
18618
|
-
lzReceiveInstructionDiscriminator: () => lzReceiveInstructionDiscriminator,
|
|
18619
|
-
lzReceiveStruct: () => lzReceiveStruct,
|
|
18620
|
-
lzReceiveTypesInstructionDiscriminator: () => lzReceiveTypesInstructionDiscriminator,
|
|
18621
|
-
lzReceiveTypesStruct: () => lzReceiveTypesStruct,
|
|
18622
|
-
mintToInstructionDiscriminator: () => mintToInstructionDiscriminator,
|
|
18623
|
-
mintToStruct: () => mintToStruct,
|
|
18624
|
-
quoteInstructionDiscriminator: () => quoteInstructionDiscriminator4,
|
|
18625
|
-
quoteOftInstructionDiscriminator: () => quoteOftInstructionDiscriminator,
|
|
18626
|
-
quoteOftStruct: () => quoteOftStruct,
|
|
18627
|
-
quoteStruct: () => quoteStruct4,
|
|
18628
|
-
sendInstructionDiscriminator: () => sendInstructionDiscriminator4,
|
|
18629
|
-
sendStruct: () => sendStruct4,
|
|
18630
|
-
setDelegateInstructionDiscriminator: () => setDelegateInstructionDiscriminator2,
|
|
18631
|
-
setDelegateStruct: () => setDelegateStruct2,
|
|
18632
|
-
setEnforcedOptionsInstructionDiscriminator: () => setEnforcedOptionsInstructionDiscriminator,
|
|
18633
|
-
setEnforcedOptionsStruct: () => setEnforcedOptionsStruct,
|
|
18634
|
-
setMintAuthorityInstructionDiscriminator: () => setMintAuthorityInstructionDiscriminator,
|
|
18635
|
-
setMintAuthorityStruct: () => setMintAuthorityStruct,
|
|
18636
|
-
setPeerInstructionDiscriminator: () => setPeerInstructionDiscriminator,
|
|
18637
|
-
setPeerStruct: () => setPeerStruct,
|
|
18638
|
-
setRateLimitInstructionDiscriminator: () => setRateLimitInstructionDiscriminator,
|
|
18639
|
-
setRateLimitStruct: () => setRateLimitStruct,
|
|
18640
|
-
transferAdminInstructionDiscriminator: () => transferAdminInstructionDiscriminator5,
|
|
18641
|
-
transferAdminStruct: () => transferAdminStruct5,
|
|
18642
|
-
versionInstructionDiscriminator: () => versionInstructionDiscriminator3,
|
|
18643
|
-
versionStruct: () => versionStruct3
|
|
18644
|
-
});
|
|
18645
|
-
var initAdapterOftParamsBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
18646
|
-
[
|
|
18647
|
-
["admin", beetSolana85__namespace.publicKey],
|
|
18648
|
-
["sharedDecimals", beet159__namespace.u8],
|
|
18649
|
-
["endpointProgram", beet159__namespace.coption(beetSolana85__namespace.publicKey)]
|
|
18650
|
-
],
|
|
18651
|
-
"InitAdapterOftParams"
|
|
18652
|
-
);
|
|
18653
|
-
|
|
18654
|
-
// src/generated/oft/instructions/initAdapterOft.ts
|
|
18655
|
-
var initAdapterOftStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
18656
|
-
[
|
|
18657
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18658
|
-
["params", initAdapterOftParamsBeet]
|
|
18659
|
-
],
|
|
18660
|
-
"InitAdapterOftInstructionArgs"
|
|
18661
|
-
);
|
|
18662
|
-
var initAdapterOftInstructionDiscriminator = [
|
|
18663
|
-
92,
|
|
18664
|
-
52,
|
|
18665
|
-
111,
|
|
18666
|
-
30,
|
|
18667
|
-
206,
|
|
18668
|
-
84,
|
|
18669
|
-
108,
|
|
18670
|
-
137
|
|
18671
|
-
];
|
|
18672
|
-
function createInitAdapterOftInstruction(accounts, args, programId) {
|
|
18673
|
-
const [data] = initAdapterOftStruct.serialize({
|
|
18674
|
-
instructionDiscriminator: initAdapterOftInstructionDiscriminator,
|
|
18675
|
-
...args
|
|
18676
|
-
});
|
|
18677
|
-
const keys = [
|
|
18678
|
-
{
|
|
18679
|
-
pubkey: accounts.payer,
|
|
18680
|
-
isWritable: true,
|
|
18681
|
-
isSigner: true
|
|
18682
|
-
},
|
|
18683
|
-
{
|
|
18684
|
-
pubkey: accounts.oftConfig,
|
|
18685
|
-
isWritable: true,
|
|
18686
|
-
isSigner: false
|
|
18687
|
-
},
|
|
18688
|
-
{
|
|
18689
|
-
pubkey: accounts.lzReceiveTypesAccounts,
|
|
18690
|
-
isWritable: true,
|
|
18691
|
-
isSigner: false
|
|
18692
|
-
},
|
|
18693
|
-
{
|
|
18694
|
-
pubkey: accounts.tokenMint,
|
|
18695
|
-
isWritable: false,
|
|
18696
|
-
isSigner: false
|
|
18697
|
-
},
|
|
18698
|
-
{
|
|
18699
|
-
pubkey: accounts.tokenEscrow,
|
|
18700
|
-
isWritable: true,
|
|
18701
|
-
isSigner: true
|
|
18702
|
-
},
|
|
18703
|
-
{
|
|
18704
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
18705
|
-
isWritable: false,
|
|
18706
|
-
isSigner: false
|
|
18707
|
-
},
|
|
18708
|
-
{
|
|
18709
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
18710
|
-
isWritable: false,
|
|
18711
|
-
isSigner: false
|
|
18712
|
-
}
|
|
18713
|
-
];
|
|
18714
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
18715
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
18716
|
-
keys.push(acc);
|
|
18717
|
-
}
|
|
18718
|
-
}
|
|
18719
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
18720
|
-
programId,
|
|
18721
|
-
keys,
|
|
18722
|
-
data
|
|
18723
|
-
});
|
|
18724
|
-
return ix;
|
|
18725
|
-
}
|
|
18726
|
-
function createInitAdapterOftInstructionAccounts(accounts, programId) {
|
|
18727
|
-
const keys = [
|
|
18728
|
-
{
|
|
18729
|
-
pubkey: accounts.payer,
|
|
18730
|
-
isWritable: true,
|
|
18731
|
-
isSigner: true
|
|
18732
|
-
},
|
|
18733
|
-
{
|
|
18734
|
-
pubkey: accounts.oftConfig,
|
|
18735
|
-
isWritable: true,
|
|
18736
|
-
isSigner: false
|
|
18737
|
-
},
|
|
18738
|
-
{
|
|
18739
|
-
pubkey: accounts.lzReceiveTypesAccounts,
|
|
18740
|
-
isWritable: true,
|
|
18741
|
-
isSigner: false
|
|
18742
|
-
},
|
|
18743
|
-
{
|
|
18744
|
-
pubkey: accounts.tokenMint,
|
|
18745
|
-
isWritable: false,
|
|
18746
|
-
isSigner: false
|
|
18747
|
-
},
|
|
18748
|
-
{
|
|
18749
|
-
pubkey: accounts.tokenEscrow,
|
|
18750
|
-
isWritable: true,
|
|
18751
|
-
isSigner: true
|
|
18752
|
-
},
|
|
18753
|
-
{
|
|
18754
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
18755
|
-
isWritable: false,
|
|
18756
|
-
isSigner: false
|
|
18757
|
-
},
|
|
18758
|
-
{
|
|
18759
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
18760
|
-
isWritable: false,
|
|
18761
|
-
isSigner: false
|
|
18762
|
-
}
|
|
18763
|
-
];
|
|
18764
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
18765
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
18766
|
-
keys.push(acc);
|
|
18767
|
-
}
|
|
18768
|
-
}
|
|
18769
|
-
return keys;
|
|
18770
|
-
}
|
|
18771
|
-
var initOftParamsBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
18772
|
-
[
|
|
18773
|
-
["admin", beetSolana85__namespace.publicKey],
|
|
18774
|
-
["sharedDecimals", beet159__namespace.u8],
|
|
18775
|
-
["endpointProgram", beet159__namespace.coption(beetSolana85__namespace.publicKey)],
|
|
18776
|
-
["mintAuthority", beet159__namespace.coption(beetSolana85__namespace.publicKey)]
|
|
18777
|
-
],
|
|
18778
|
-
"InitOftParams"
|
|
18779
|
-
);
|
|
18780
|
-
|
|
18781
|
-
// src/generated/oft/instructions/initOft.ts
|
|
18782
|
-
var initOftStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
18783
|
-
[
|
|
18784
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18785
|
-
["params", initOftParamsBeet]
|
|
18786
|
-
],
|
|
18787
|
-
"InitOftInstructionArgs"
|
|
18788
|
-
);
|
|
18789
|
-
var initOftInstructionDiscriminator = [
|
|
18790
|
-
182,
|
|
18791
|
-
169,
|
|
18792
|
-
147,
|
|
18793
|
-
16,
|
|
18794
|
-
201,
|
|
18795
|
-
45,
|
|
18796
|
-
76,
|
|
18797
|
-
23
|
|
18798
|
-
];
|
|
18799
|
-
function createInitOftInstruction(accounts, args, programId) {
|
|
18800
|
-
const [data] = initOftStruct.serialize({
|
|
18801
|
-
instructionDiscriminator: initOftInstructionDiscriminator,
|
|
18802
|
-
...args
|
|
18803
|
-
});
|
|
18804
|
-
const keys = [
|
|
18805
|
-
{
|
|
18806
|
-
pubkey: accounts.payer,
|
|
18807
|
-
isWritable: true,
|
|
18808
|
-
isSigner: true
|
|
18809
|
-
},
|
|
18810
|
-
{
|
|
18811
|
-
pubkey: accounts.oftConfig,
|
|
18812
|
-
isWritable: true,
|
|
18813
|
-
isSigner: false
|
|
18814
|
-
},
|
|
18815
|
-
{
|
|
18816
|
-
pubkey: accounts.lzReceiveTypesAccounts,
|
|
18817
|
-
isWritable: true,
|
|
18818
|
-
isSigner: false
|
|
18819
|
-
},
|
|
18820
|
-
{
|
|
18821
|
-
pubkey: accounts.tokenMint,
|
|
18822
|
-
isWritable: false,
|
|
18823
|
-
isSigner: false
|
|
18824
|
-
},
|
|
18825
|
-
{
|
|
18826
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
18827
|
-
isWritable: false,
|
|
18828
|
-
isSigner: false
|
|
18829
|
-
},
|
|
18830
|
-
{
|
|
18831
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
18832
|
-
isWritable: false,
|
|
18833
|
-
isSigner: false
|
|
18834
|
-
}
|
|
18835
|
-
];
|
|
18836
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
18837
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
18838
|
-
keys.push(acc);
|
|
18839
|
-
}
|
|
18840
|
-
}
|
|
18841
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
18842
|
-
programId,
|
|
18843
|
-
keys,
|
|
18844
|
-
data
|
|
18845
|
-
});
|
|
18846
|
-
return ix;
|
|
18847
|
-
}
|
|
18848
|
-
function createInitOftInstructionAccounts(accounts, programId) {
|
|
18849
|
-
const keys = [
|
|
18850
|
-
{
|
|
18851
|
-
pubkey: accounts.payer,
|
|
18852
|
-
isWritable: true,
|
|
18853
|
-
isSigner: true
|
|
18854
|
-
},
|
|
18855
|
-
{
|
|
18856
|
-
pubkey: accounts.oftConfig,
|
|
18857
|
-
isWritable: true,
|
|
18858
|
-
isSigner: false
|
|
18859
|
-
},
|
|
18860
|
-
{
|
|
18861
|
-
pubkey: accounts.lzReceiveTypesAccounts,
|
|
18862
|
-
isWritable: true,
|
|
18863
|
-
isSigner: false
|
|
18864
|
-
},
|
|
18865
|
-
{
|
|
18866
|
-
pubkey: accounts.tokenMint,
|
|
18867
|
-
isWritable: false,
|
|
18868
|
-
isSigner: false
|
|
18869
|
-
},
|
|
18870
|
-
{
|
|
18871
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
18872
|
-
isWritable: false,
|
|
18873
|
-
isSigner: false
|
|
18874
|
-
},
|
|
18875
|
-
{
|
|
18876
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
18877
|
-
isWritable: false,
|
|
18878
|
-
isSigner: false
|
|
18879
|
-
}
|
|
18880
|
-
];
|
|
18881
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
18882
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
18883
|
-
keys.push(acc);
|
|
18884
|
-
}
|
|
18885
|
-
}
|
|
18886
|
-
return keys;
|
|
18887
|
-
}
|
|
18888
|
-
var lzReceiveParamsBeet2 = new beet159__namespace.FixableBeetArgsStruct(
|
|
18889
|
-
[
|
|
18890
|
-
["srcEid", beet159__namespace.u32],
|
|
18891
|
-
["sender", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
18892
|
-
["nonce", beet159__namespace.u64],
|
|
18893
|
-
["guid", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
18894
|
-
["message", beet159__namespace.bytes],
|
|
18895
|
-
["extraData", beet159__namespace.bytes]
|
|
18896
|
-
],
|
|
18897
|
-
"LzReceiveParams"
|
|
18898
|
-
);
|
|
18899
|
-
|
|
18900
|
-
// src/generated/oft/instructions/lzReceive.ts
|
|
18901
|
-
var lzReceiveStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
18902
|
-
[
|
|
18903
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
18904
|
-
["params", lzReceiveParamsBeet2]
|
|
18905
|
-
],
|
|
18906
|
-
"LzReceiveInstructionArgs"
|
|
18907
|
-
);
|
|
18908
|
-
var lzReceiveInstructionDiscriminator = [
|
|
18909
|
-
8,
|
|
18910
|
-
179,
|
|
18911
|
-
120,
|
|
18912
|
-
109,
|
|
18913
|
-
33,
|
|
18914
|
-
118,
|
|
18915
|
-
189,
|
|
18916
|
-
80
|
|
18917
|
-
];
|
|
18918
|
-
function createLzReceiveInstruction(accounts, args, programId) {
|
|
18919
|
-
const [data] = lzReceiveStruct.serialize({
|
|
18920
|
-
instructionDiscriminator: lzReceiveInstructionDiscriminator,
|
|
18921
|
-
...args
|
|
18922
|
-
});
|
|
18923
|
-
const keys = [
|
|
18924
|
-
{
|
|
18925
|
-
pubkey: accounts.payer,
|
|
18926
|
-
isWritable: true,
|
|
18927
|
-
isSigner: true
|
|
18928
|
-
},
|
|
18929
|
-
{
|
|
18930
|
-
pubkey: accounts.peer,
|
|
18931
|
-
isWritable: true,
|
|
18932
|
-
isSigner: false
|
|
18933
|
-
},
|
|
18934
|
-
{
|
|
18935
|
-
pubkey: accounts.oftConfig,
|
|
18936
|
-
isWritable: false,
|
|
18937
|
-
isSigner: false
|
|
18938
|
-
},
|
|
18939
|
-
{
|
|
18940
|
-
pubkey: accounts.tokenEscrow ?? programId,
|
|
18941
|
-
isWritable: accounts.tokenEscrow != null,
|
|
18942
|
-
isSigner: false
|
|
18943
|
-
},
|
|
18944
|
-
{
|
|
18945
|
-
pubkey: accounts.toAddress,
|
|
18946
|
-
isWritable: false,
|
|
18947
|
-
isSigner: false
|
|
18948
|
-
},
|
|
18949
|
-
{
|
|
18950
|
-
pubkey: accounts.tokenDest,
|
|
18951
|
-
isWritable: true,
|
|
18952
|
-
isSigner: false
|
|
18953
|
-
},
|
|
18954
|
-
{
|
|
18955
|
-
pubkey: accounts.tokenMint,
|
|
18956
|
-
isWritable: true,
|
|
18957
|
-
isSigner: false
|
|
18958
|
-
},
|
|
18959
|
-
{
|
|
18960
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
18961
|
-
isWritable: false,
|
|
18962
|
-
isSigner: false
|
|
18963
|
-
},
|
|
18964
|
-
{
|
|
18965
|
-
pubkey: accounts.associatedTokenProgram,
|
|
18966
|
-
isWritable: false,
|
|
18967
|
-
isSigner: false
|
|
18968
|
-
},
|
|
18969
|
-
{
|
|
18970
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
18971
|
-
isWritable: false,
|
|
18972
|
-
isSigner: false
|
|
18973
|
-
},
|
|
18974
|
-
{
|
|
18975
|
-
pubkey: accounts.eventAuthority,
|
|
18976
|
-
isWritable: false,
|
|
18977
|
-
isSigner: false
|
|
18978
|
-
},
|
|
18979
|
-
{
|
|
18980
|
-
pubkey: accounts.program,
|
|
18981
|
-
isWritable: false,
|
|
18982
|
-
isSigner: false
|
|
18983
|
-
}
|
|
18984
|
-
];
|
|
18985
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
18986
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
18987
|
-
keys.push(acc);
|
|
18988
|
-
}
|
|
18989
|
-
}
|
|
18990
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
18991
|
-
programId,
|
|
18992
|
-
keys,
|
|
18993
|
-
data
|
|
18994
|
-
});
|
|
18995
|
-
return ix;
|
|
18996
|
-
}
|
|
18997
|
-
function createLzReceiveInstructionAccounts(accounts, programId) {
|
|
18998
|
-
const keys = [
|
|
18999
|
-
{
|
|
19000
|
-
pubkey: accounts.payer,
|
|
19001
|
-
isWritable: true,
|
|
19002
|
-
isSigner: true
|
|
19003
|
-
},
|
|
19004
|
-
{
|
|
19005
|
-
pubkey: accounts.peer,
|
|
19006
|
-
isWritable: true,
|
|
19007
|
-
isSigner: false
|
|
19008
|
-
},
|
|
19009
|
-
{
|
|
19010
|
-
pubkey: accounts.oftConfig,
|
|
19011
|
-
isWritable: false,
|
|
19012
|
-
isSigner: false
|
|
19013
|
-
},
|
|
19014
|
-
{
|
|
19015
|
-
pubkey: accounts.tokenEscrow ?? programId,
|
|
19016
|
-
isWritable: accounts.tokenEscrow != null,
|
|
19017
|
-
isSigner: false
|
|
19018
|
-
},
|
|
19019
|
-
{
|
|
19020
|
-
pubkey: accounts.toAddress,
|
|
19021
|
-
isWritable: false,
|
|
19022
|
-
isSigner: false
|
|
19023
|
-
},
|
|
19024
|
-
{
|
|
19025
|
-
pubkey: accounts.tokenDest,
|
|
19026
|
-
isWritable: true,
|
|
19027
|
-
isSigner: false
|
|
19028
|
-
},
|
|
19029
|
-
{
|
|
19030
|
-
pubkey: accounts.tokenMint,
|
|
19031
|
-
isWritable: true,
|
|
19032
|
-
isSigner: false
|
|
19033
|
-
},
|
|
19034
|
-
{
|
|
19035
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
19036
|
-
isWritable: false,
|
|
19037
|
-
isSigner: false
|
|
19038
|
-
},
|
|
19039
|
-
{
|
|
19040
|
-
pubkey: accounts.associatedTokenProgram,
|
|
19041
|
-
isWritable: false,
|
|
19042
|
-
isSigner: false
|
|
19043
|
-
},
|
|
19044
|
-
{
|
|
19045
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
19046
|
-
isWritable: false,
|
|
19047
|
-
isSigner: false
|
|
19048
|
-
},
|
|
19049
|
-
{
|
|
19050
|
-
pubkey: accounts.eventAuthority,
|
|
19051
|
-
isWritable: false,
|
|
19052
|
-
isSigner: false
|
|
19053
|
-
},
|
|
19054
|
-
{
|
|
19055
|
-
pubkey: accounts.program,
|
|
19056
|
-
isWritable: false,
|
|
19057
|
-
isSigner: false
|
|
19058
|
-
}
|
|
19059
|
-
];
|
|
19060
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19061
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19062
|
-
keys.push(acc);
|
|
19063
|
-
}
|
|
19064
|
-
}
|
|
19065
|
-
return keys;
|
|
19066
|
-
}
|
|
19067
|
-
var lzReceiveTypesStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
19068
|
-
[
|
|
19069
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19070
|
-
["params", lzReceiveParamsBeet2]
|
|
19071
|
-
],
|
|
19072
|
-
"LzReceiveTypesInstructionArgs"
|
|
19073
|
-
);
|
|
19074
|
-
var lzReceiveTypesInstructionDiscriminator = [
|
|
19075
|
-
221,
|
|
19076
|
-
17,
|
|
19077
|
-
246,
|
|
19078
|
-
159,
|
|
19079
|
-
248,
|
|
19080
|
-
128,
|
|
19081
|
-
31,
|
|
19082
|
-
96
|
|
19083
|
-
];
|
|
19084
|
-
function createLzReceiveTypesInstruction(accounts, args, programId) {
|
|
19085
|
-
const [data] = lzReceiveTypesStruct.serialize({
|
|
19086
|
-
instructionDiscriminator: lzReceiveTypesInstructionDiscriminator,
|
|
19087
|
-
...args
|
|
19088
|
-
});
|
|
19089
|
-
const keys = [
|
|
19090
|
-
{
|
|
19091
|
-
pubkey: accounts.oftConfig,
|
|
19092
|
-
isWritable: false,
|
|
19093
|
-
isSigner: false
|
|
19094
|
-
},
|
|
19095
|
-
{
|
|
19096
|
-
pubkey: accounts.tokenMint,
|
|
19097
|
-
isWritable: false,
|
|
19098
|
-
isSigner: false
|
|
19099
|
-
}
|
|
19100
|
-
];
|
|
19101
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19102
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19103
|
-
keys.push(acc);
|
|
19104
|
-
}
|
|
19105
|
-
}
|
|
19106
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19107
|
-
programId,
|
|
19108
|
-
keys,
|
|
19109
|
-
data
|
|
19110
|
-
});
|
|
19111
|
-
return ix;
|
|
19112
|
-
}
|
|
19113
|
-
function createLzReceiveTypesInstructionAccounts(accounts, programId) {
|
|
19114
|
-
const keys = [
|
|
19115
|
-
{
|
|
19116
|
-
pubkey: accounts.oftConfig,
|
|
19117
|
-
isWritable: false,
|
|
19118
|
-
isSigner: false
|
|
19119
|
-
},
|
|
19120
|
-
{
|
|
19121
|
-
pubkey: accounts.tokenMint,
|
|
19122
|
-
isWritable: false,
|
|
19123
|
-
isSigner: false
|
|
19124
|
-
}
|
|
19125
|
-
];
|
|
19126
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19127
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19128
|
-
keys.push(acc);
|
|
19129
|
-
}
|
|
19130
|
-
}
|
|
19131
|
-
return keys;
|
|
19132
|
-
}
|
|
19133
|
-
var mintToParamsBeet = new beet159__namespace.BeetArgsStruct(
|
|
19134
|
-
[["amount", beet159__namespace.u64]],
|
|
19135
|
-
"MintToParams"
|
|
19136
|
-
);
|
|
19137
|
-
|
|
19138
|
-
// src/generated/oft/instructions/mintTo.ts
|
|
19139
|
-
var mintToStruct = new beet159__namespace.BeetArgsStruct(
|
|
19140
|
-
[
|
|
19141
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19142
|
-
["params", mintToParamsBeet]
|
|
19143
|
-
],
|
|
19144
|
-
"MintToInstructionArgs"
|
|
19145
|
-
);
|
|
19146
|
-
var mintToInstructionDiscriminator = [
|
|
19147
|
-
241,
|
|
19148
|
-
34,
|
|
19149
|
-
48,
|
|
19150
|
-
186,
|
|
19151
|
-
37,
|
|
19152
|
-
179,
|
|
19153
|
-
123,
|
|
19154
|
-
192
|
|
19155
|
-
];
|
|
19156
|
-
function createMintToInstruction(accounts, args, programId) {
|
|
19157
|
-
const [data] = mintToStruct.serialize({
|
|
19158
|
-
instructionDiscriminator: mintToInstructionDiscriminator,
|
|
19159
|
-
...args
|
|
19160
|
-
});
|
|
19161
|
-
const keys = [
|
|
19162
|
-
{
|
|
19163
|
-
pubkey: accounts.minter,
|
|
19164
|
-
isWritable: false,
|
|
19165
|
-
isSigner: true
|
|
19166
|
-
},
|
|
19167
|
-
{
|
|
19168
|
-
pubkey: accounts.oftConfig,
|
|
19169
|
-
isWritable: false,
|
|
19170
|
-
isSigner: false
|
|
19171
|
-
},
|
|
19172
|
-
{
|
|
19173
|
-
pubkey: accounts.tokenDest,
|
|
19174
|
-
isWritable: true,
|
|
19175
|
-
isSigner: false
|
|
19176
|
-
},
|
|
19177
|
-
{
|
|
19178
|
-
pubkey: accounts.tokenMint,
|
|
19179
|
-
isWritable: true,
|
|
19180
|
-
isSigner: false
|
|
19181
|
-
},
|
|
19182
|
-
{
|
|
19183
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
19184
|
-
isWritable: false,
|
|
19185
|
-
isSigner: false
|
|
19186
|
-
}
|
|
19187
|
-
];
|
|
19188
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19189
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19190
|
-
keys.push(acc);
|
|
19191
|
-
}
|
|
19192
|
-
}
|
|
19193
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19194
|
-
programId,
|
|
19195
|
-
keys,
|
|
19196
|
-
data
|
|
19197
|
-
});
|
|
19198
|
-
return ix;
|
|
19199
|
-
}
|
|
19200
|
-
function createMintToInstructionAccounts(accounts, programId) {
|
|
19201
|
-
const keys = [
|
|
19202
|
-
{
|
|
19203
|
-
pubkey: accounts.minter,
|
|
19204
|
-
isWritable: false,
|
|
19205
|
-
isSigner: true
|
|
19206
|
-
},
|
|
19207
|
-
{
|
|
19208
|
-
pubkey: accounts.oftConfig,
|
|
19209
|
-
isWritable: false,
|
|
19210
|
-
isSigner: false
|
|
19211
|
-
},
|
|
19212
|
-
{
|
|
19213
|
-
pubkey: accounts.tokenDest,
|
|
19214
|
-
isWritable: true,
|
|
19215
|
-
isSigner: false
|
|
19216
|
-
},
|
|
19217
|
-
{
|
|
19218
|
-
pubkey: accounts.tokenMint,
|
|
19219
|
-
isWritable: true,
|
|
19220
|
-
isSigner: false
|
|
19221
|
-
},
|
|
19222
|
-
{
|
|
19223
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
19224
|
-
isWritable: false,
|
|
19225
|
-
isSigner: false
|
|
19226
|
-
}
|
|
19227
|
-
];
|
|
19228
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19229
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19230
|
-
keys.push(acc);
|
|
19231
|
-
}
|
|
19232
|
-
}
|
|
19233
|
-
return keys;
|
|
19234
|
-
}
|
|
19235
|
-
var quoteParamsBeet4 = new beet159__namespace.FixableBeetArgsStruct(
|
|
19236
|
-
[
|
|
19237
|
-
["dstEid", beet159__namespace.u32],
|
|
19238
|
-
["to", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
19239
|
-
["amountLd", beet159__namespace.u64],
|
|
19240
|
-
["minAmountLd", beet159__namespace.u64],
|
|
19241
|
-
["options", beet159__namespace.bytes],
|
|
19242
|
-
["composeMsg", beet159__namespace.coption(beet159__namespace.bytes)],
|
|
19243
|
-
["payInLzToken", beet159__namespace.bool]
|
|
19244
|
-
],
|
|
19245
|
-
"QuoteParams"
|
|
19246
|
-
);
|
|
19247
|
-
|
|
19248
|
-
// src/generated/oft/instructions/quote.ts
|
|
19249
|
-
var quoteStruct4 = new beet159__namespace.FixableBeetArgsStruct(
|
|
19250
|
-
[
|
|
19251
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19252
|
-
["params", quoteParamsBeet4]
|
|
19253
|
-
],
|
|
19254
|
-
"QuoteInstructionArgs"
|
|
19255
|
-
);
|
|
19256
|
-
var quoteInstructionDiscriminator4 = [
|
|
19257
|
-
149,
|
|
19258
|
-
42,
|
|
19259
|
-
109,
|
|
19260
|
-
247,
|
|
19261
|
-
134,
|
|
19262
|
-
146,
|
|
19263
|
-
213,
|
|
19264
|
-
123
|
|
19265
|
-
];
|
|
19266
|
-
function createQuoteInstruction4(accounts, args, programId) {
|
|
19267
|
-
const [data] = quoteStruct4.serialize({
|
|
19268
|
-
instructionDiscriminator: quoteInstructionDiscriminator4,
|
|
19269
|
-
...args
|
|
19270
|
-
});
|
|
19271
|
-
const keys = [
|
|
19272
|
-
{
|
|
19273
|
-
pubkey: accounts.oftConfig,
|
|
19274
|
-
isWritable: false,
|
|
19275
|
-
isSigner: false
|
|
19276
|
-
},
|
|
19277
|
-
{
|
|
19278
|
-
pubkey: accounts.peer,
|
|
19279
|
-
isWritable: false,
|
|
19280
|
-
isSigner: false
|
|
19281
|
-
},
|
|
19282
|
-
{
|
|
19283
|
-
pubkey: accounts.enforcedOptions,
|
|
19284
|
-
isWritable: false,
|
|
19285
|
-
isSigner: false
|
|
19286
|
-
},
|
|
19287
|
-
{
|
|
19288
|
-
pubkey: accounts.tokenMint,
|
|
19289
|
-
isWritable: false,
|
|
19290
|
-
isSigner: false
|
|
19291
|
-
}
|
|
19292
|
-
];
|
|
19293
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19294
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19295
|
-
keys.push(acc);
|
|
19296
|
-
}
|
|
19297
|
-
}
|
|
19298
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19299
|
-
programId,
|
|
19300
|
-
keys,
|
|
19301
|
-
data
|
|
19302
|
-
});
|
|
19303
|
-
return ix;
|
|
19304
|
-
}
|
|
19305
|
-
function createQuoteInstructionAccounts4(accounts, programId) {
|
|
19306
|
-
const keys = [
|
|
19307
|
-
{
|
|
19308
|
-
pubkey: accounts.oftConfig,
|
|
19309
|
-
isWritable: false,
|
|
19310
|
-
isSigner: false
|
|
19311
|
-
},
|
|
19312
|
-
{
|
|
19313
|
-
pubkey: accounts.peer,
|
|
19314
|
-
isWritable: false,
|
|
19315
|
-
isSigner: false
|
|
19316
|
-
},
|
|
19317
|
-
{
|
|
19318
|
-
pubkey: accounts.enforcedOptions,
|
|
19319
|
-
isWritable: false,
|
|
19320
|
-
isSigner: false
|
|
19321
|
-
},
|
|
19322
|
-
{
|
|
19323
|
-
pubkey: accounts.tokenMint,
|
|
19324
|
-
isWritable: false,
|
|
19325
|
-
isSigner: false
|
|
19326
|
-
}
|
|
19327
|
-
];
|
|
19328
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19329
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19330
|
-
keys.push(acc);
|
|
19331
|
-
}
|
|
19332
|
-
}
|
|
19333
|
-
return keys;
|
|
19334
|
-
}
|
|
19335
|
-
var quoteOftParamsBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
19336
|
-
[
|
|
19337
|
-
["dstEid", beet159__namespace.u32],
|
|
19338
|
-
["to", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
19339
|
-
["amountLd", beet159__namespace.u64],
|
|
19340
|
-
["minAmountLd", beet159__namespace.u64],
|
|
19341
|
-
["options", beet159__namespace.bytes],
|
|
19342
|
-
["composeMsg", beet159__namespace.coption(beet159__namespace.bytes)],
|
|
19343
|
-
["payInLzToken", beet159__namespace.bool]
|
|
19344
|
-
],
|
|
19345
|
-
"QuoteOftParams"
|
|
19346
|
-
);
|
|
19347
|
-
|
|
19348
|
-
// src/generated/oft/instructions/quoteOft.ts
|
|
19349
|
-
var quoteOftStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
19350
|
-
[
|
|
19351
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19352
|
-
["params", quoteOftParamsBeet]
|
|
19353
|
-
],
|
|
19354
|
-
"QuoteOftInstructionArgs"
|
|
19355
|
-
);
|
|
19356
|
-
var quoteOftInstructionDiscriminator = [
|
|
19357
|
-
179,
|
|
19358
|
-
255,
|
|
19359
|
-
92,
|
|
19360
|
-
202,
|
|
19361
|
-
251,
|
|
19362
|
-
82,
|
|
19363
|
-
82,
|
|
19364
|
-
118
|
|
19365
|
-
];
|
|
19366
|
-
function createQuoteOftInstruction(accounts, args, programId) {
|
|
19367
|
-
const [data] = quoteOftStruct.serialize({
|
|
19368
|
-
instructionDiscriminator: quoteOftInstructionDiscriminator,
|
|
19369
|
-
...args
|
|
19370
|
-
});
|
|
19371
|
-
const keys = [
|
|
19372
|
-
{
|
|
19373
|
-
pubkey: accounts.oftConfig,
|
|
19374
|
-
isWritable: false,
|
|
19375
|
-
isSigner: false
|
|
19376
|
-
},
|
|
19377
|
-
{
|
|
19378
|
-
pubkey: accounts.peer,
|
|
19379
|
-
isWritable: false,
|
|
19380
|
-
isSigner: false
|
|
19381
|
-
},
|
|
19382
|
-
{
|
|
19383
|
-
pubkey: accounts.tokenMint,
|
|
19384
|
-
isWritable: false,
|
|
19385
|
-
isSigner: false
|
|
19386
|
-
}
|
|
19387
|
-
];
|
|
19388
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19389
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19390
|
-
keys.push(acc);
|
|
19391
|
-
}
|
|
19392
|
-
}
|
|
19393
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19394
|
-
programId,
|
|
19395
|
-
keys,
|
|
19396
|
-
data
|
|
19397
|
-
});
|
|
19398
|
-
return ix;
|
|
19399
|
-
}
|
|
19400
|
-
function createQuoteOftInstructionAccounts(accounts, programId) {
|
|
19401
|
-
const keys = [
|
|
19402
|
-
{
|
|
19403
|
-
pubkey: accounts.oftConfig,
|
|
19404
|
-
isWritable: false,
|
|
19405
|
-
isSigner: false
|
|
19406
|
-
},
|
|
19407
|
-
{
|
|
19408
|
-
pubkey: accounts.peer,
|
|
19409
|
-
isWritable: false,
|
|
19410
|
-
isSigner: false
|
|
19411
|
-
},
|
|
19412
|
-
{
|
|
19413
|
-
pubkey: accounts.tokenMint,
|
|
19414
|
-
isWritable: false,
|
|
19415
|
-
isSigner: false
|
|
19416
|
-
}
|
|
19417
|
-
];
|
|
19418
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19419
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19420
|
-
keys.push(acc);
|
|
19421
|
-
}
|
|
19422
|
-
}
|
|
19423
|
-
return keys;
|
|
19424
|
-
}
|
|
19425
|
-
var sendParamsBeet4 = new beet159__namespace.FixableBeetArgsStruct(
|
|
19426
|
-
[
|
|
19427
|
-
["dstEid", beet159__namespace.u32],
|
|
19428
|
-
["to", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
19429
|
-
["amountLd", beet159__namespace.u64],
|
|
19430
|
-
["minAmountLd", beet159__namespace.u64],
|
|
19431
|
-
["options", beet159__namespace.bytes],
|
|
19432
|
-
["composeMsg", beet159__namespace.coption(beet159__namespace.bytes)],
|
|
19433
|
-
["nativeFee", beet159__namespace.u64],
|
|
19434
|
-
["lzTokenFee", beet159__namespace.u64]
|
|
19435
|
-
],
|
|
19436
|
-
"SendParams"
|
|
19437
|
-
);
|
|
19438
|
-
|
|
19439
|
-
// src/generated/oft/instructions/send.ts
|
|
19440
|
-
var sendStruct4 = new beet159__namespace.FixableBeetArgsStruct(
|
|
19441
|
-
[
|
|
19442
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19443
|
-
["params", sendParamsBeet4]
|
|
19444
|
-
],
|
|
19445
|
-
"SendInstructionArgs"
|
|
19446
|
-
);
|
|
19447
|
-
var sendInstructionDiscriminator4 = [102, 251, 20, 187, 65, 75, 12, 69];
|
|
19448
|
-
function createSendInstruction4(accounts, args, programId) {
|
|
19449
|
-
const [data] = sendStruct4.serialize({
|
|
19450
|
-
instructionDiscriminator: sendInstructionDiscriminator4,
|
|
19451
|
-
...args
|
|
19452
|
-
});
|
|
19453
|
-
const keys = [
|
|
19454
|
-
{
|
|
19455
|
-
pubkey: accounts.signer,
|
|
19456
|
-
isWritable: false,
|
|
19457
|
-
isSigner: true
|
|
19458
|
-
},
|
|
19459
|
-
{
|
|
19460
|
-
pubkey: accounts.peer,
|
|
19461
|
-
isWritable: true,
|
|
19462
|
-
isSigner: false
|
|
19463
|
-
},
|
|
19464
|
-
{
|
|
19465
|
-
pubkey: accounts.enforcedOptions,
|
|
19466
|
-
isWritable: false,
|
|
19467
|
-
isSigner: false
|
|
19468
|
-
},
|
|
19469
|
-
{
|
|
19470
|
-
pubkey: accounts.oftConfig,
|
|
19471
|
-
isWritable: false,
|
|
19472
|
-
isSigner: false
|
|
19473
|
-
},
|
|
19474
|
-
{
|
|
19475
|
-
pubkey: accounts.tokenSource,
|
|
19476
|
-
isWritable: true,
|
|
19477
|
-
isSigner: false
|
|
19478
|
-
},
|
|
19479
|
-
{
|
|
19480
|
-
pubkey: accounts.tokenEscrow ?? programId,
|
|
19481
|
-
isWritable: accounts.tokenEscrow != null,
|
|
19482
|
-
isSigner: false
|
|
19483
|
-
},
|
|
19484
|
-
{
|
|
19485
|
-
pubkey: accounts.tokenMint,
|
|
19486
|
-
isWritable: true,
|
|
19487
|
-
isSigner: false
|
|
19488
|
-
},
|
|
19489
|
-
{
|
|
19490
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
19491
|
-
isWritable: false,
|
|
19492
|
-
isSigner: false
|
|
19493
|
-
},
|
|
19494
|
-
{
|
|
19495
|
-
pubkey: accounts.eventAuthority,
|
|
19496
|
-
isWritable: false,
|
|
19497
|
-
isSigner: false
|
|
19498
|
-
},
|
|
19499
|
-
{
|
|
19500
|
-
pubkey: accounts.program,
|
|
19501
|
-
isWritable: false,
|
|
19502
|
-
isSigner: false
|
|
19503
|
-
}
|
|
19504
|
-
];
|
|
19505
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19506
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19507
|
-
keys.push(acc);
|
|
19508
|
-
}
|
|
19509
|
-
}
|
|
19510
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19511
|
-
programId,
|
|
19512
|
-
keys,
|
|
19513
|
-
data
|
|
19514
|
-
});
|
|
19515
|
-
return ix;
|
|
19516
|
-
}
|
|
19517
|
-
function createSendInstructionAccounts4(accounts, programId) {
|
|
19518
|
-
const keys = [
|
|
19519
|
-
{
|
|
19520
|
-
pubkey: accounts.signer,
|
|
19521
|
-
isWritable: false,
|
|
19522
|
-
isSigner: true
|
|
19523
|
-
},
|
|
19524
|
-
{
|
|
19525
|
-
pubkey: accounts.peer,
|
|
19526
|
-
isWritable: true,
|
|
19527
|
-
isSigner: false
|
|
19528
|
-
},
|
|
19529
|
-
{
|
|
19530
|
-
pubkey: accounts.enforcedOptions,
|
|
19531
|
-
isWritable: false,
|
|
19532
|
-
isSigner: false
|
|
19533
|
-
},
|
|
19534
|
-
{
|
|
19535
|
-
pubkey: accounts.oftConfig,
|
|
19536
|
-
isWritable: false,
|
|
19537
|
-
isSigner: false
|
|
19538
|
-
},
|
|
19539
|
-
{
|
|
19540
|
-
pubkey: accounts.tokenSource,
|
|
19541
|
-
isWritable: true,
|
|
19542
|
-
isSigner: false
|
|
19543
|
-
},
|
|
19544
|
-
{
|
|
19545
|
-
pubkey: accounts.tokenEscrow ?? programId,
|
|
19546
|
-
isWritable: accounts.tokenEscrow != null,
|
|
19547
|
-
isSigner: false
|
|
19548
|
-
},
|
|
19549
|
-
{
|
|
19550
|
-
pubkey: accounts.tokenMint,
|
|
19551
|
-
isWritable: true,
|
|
19552
|
-
isSigner: false
|
|
19553
|
-
},
|
|
19554
|
-
{
|
|
19555
|
-
pubkey: accounts.tokenProgram ?? splToken__namespace.TOKEN_PROGRAM_ID,
|
|
19556
|
-
isWritable: false,
|
|
19557
|
-
isSigner: false
|
|
19558
|
-
},
|
|
19559
|
-
{
|
|
19560
|
-
pubkey: accounts.eventAuthority,
|
|
19561
|
-
isWritable: false,
|
|
19562
|
-
isSigner: false
|
|
19563
|
-
},
|
|
19564
|
-
{
|
|
19565
|
-
pubkey: accounts.program,
|
|
19566
|
-
isWritable: false,
|
|
19567
|
-
isSigner: false
|
|
19568
|
-
}
|
|
19569
|
-
];
|
|
19570
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19571
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19572
|
-
keys.push(acc);
|
|
19573
|
-
}
|
|
19574
|
-
}
|
|
19575
|
-
return keys;
|
|
19576
|
-
}
|
|
19577
|
-
var setDelegateParamsBeet2 = new beet159__namespace.BeetArgsStruct(
|
|
19578
|
-
[["delegate", beetSolana85__namespace.publicKey]],
|
|
19579
|
-
"SetDelegateParams"
|
|
19580
|
-
);
|
|
19581
|
-
|
|
19582
|
-
// src/generated/oft/instructions/setDelegate.ts
|
|
19583
|
-
var setDelegateStruct2 = new beet159__namespace.BeetArgsStruct(
|
|
19584
|
-
[
|
|
19585
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19586
|
-
["params", setDelegateParamsBeet2]
|
|
19587
|
-
],
|
|
19588
|
-
"SetDelegateInstructionArgs"
|
|
19589
|
-
);
|
|
19590
|
-
var setDelegateInstructionDiscriminator2 = [
|
|
19591
|
-
242,
|
|
19592
|
-
30,
|
|
19593
|
-
46,
|
|
19594
|
-
76,
|
|
19595
|
-
108,
|
|
19596
|
-
235,
|
|
19597
|
-
128,
|
|
19598
|
-
181
|
|
19599
|
-
];
|
|
19600
|
-
function createSetDelegateInstruction2(accounts, args, programId) {
|
|
19601
|
-
const [data] = setDelegateStruct2.serialize({
|
|
19602
|
-
instructionDiscriminator: setDelegateInstructionDiscriminator2,
|
|
19603
|
-
...args
|
|
19604
|
-
});
|
|
19605
|
-
const keys = [
|
|
19606
|
-
{
|
|
19607
|
-
pubkey: accounts.admin,
|
|
19608
|
-
isWritable: false,
|
|
19609
|
-
isSigner: true
|
|
19610
|
-
},
|
|
19611
|
-
{
|
|
19612
|
-
pubkey: accounts.oftConfig,
|
|
19613
|
-
isWritable: false,
|
|
19614
|
-
isSigner: false
|
|
19615
|
-
}
|
|
19616
|
-
];
|
|
19617
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19618
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19619
|
-
keys.push(acc);
|
|
19620
|
-
}
|
|
19621
|
-
}
|
|
19622
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19623
|
-
programId,
|
|
19624
|
-
keys,
|
|
19625
|
-
data
|
|
19626
|
-
});
|
|
19627
|
-
return ix;
|
|
19628
|
-
}
|
|
19629
|
-
function createSetDelegateInstructionAccounts2(accounts, programId) {
|
|
19630
|
-
const keys = [
|
|
19631
|
-
{
|
|
19632
|
-
pubkey: accounts.admin,
|
|
19633
|
-
isWritable: false,
|
|
19634
|
-
isSigner: true
|
|
19635
|
-
},
|
|
19636
|
-
{
|
|
19637
|
-
pubkey: accounts.oftConfig,
|
|
19638
|
-
isWritable: false,
|
|
19639
|
-
isSigner: false
|
|
19640
|
-
}
|
|
19641
|
-
];
|
|
19642
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19643
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19644
|
-
keys.push(acc);
|
|
19645
|
-
}
|
|
19646
|
-
}
|
|
19647
|
-
return keys;
|
|
19648
|
-
}
|
|
19649
|
-
var setEnforcedOptionsParamsBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
19650
|
-
[
|
|
19651
|
-
["dstEid", beet159__namespace.u32],
|
|
19652
|
-
["send", beet159__namespace.bytes],
|
|
19653
|
-
["sendAndCall", beet159__namespace.bytes]
|
|
19654
|
-
],
|
|
19655
|
-
"SetEnforcedOptionsParams"
|
|
19656
|
-
);
|
|
19657
|
-
|
|
19658
|
-
// src/generated/oft/instructions/setEnforcedOptions.ts
|
|
19659
|
-
var setEnforcedOptionsStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
19660
|
-
[
|
|
19661
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19662
|
-
["params", setEnforcedOptionsParamsBeet]
|
|
19663
|
-
],
|
|
19664
|
-
"SetEnforcedOptionsInstructionArgs"
|
|
19665
|
-
);
|
|
19666
|
-
var setEnforcedOptionsInstructionDiscriminator = [
|
|
19667
|
-
232,
|
|
19668
|
-
250,
|
|
19669
|
-
49,
|
|
19670
|
-
125,
|
|
19671
|
-
166,
|
|
19672
|
-
188,
|
|
19673
|
-
118,
|
|
19674
|
-
146
|
|
19675
|
-
];
|
|
19676
|
-
function createSetEnforcedOptionsInstruction(accounts, args, programId) {
|
|
19677
|
-
const [data] = setEnforcedOptionsStruct.serialize({
|
|
19678
|
-
instructionDiscriminator: setEnforcedOptionsInstructionDiscriminator,
|
|
19679
|
-
...args
|
|
19680
|
-
});
|
|
19681
|
-
const keys = [
|
|
19682
|
-
{
|
|
19683
|
-
pubkey: accounts.admin,
|
|
19684
|
-
isWritable: true,
|
|
19685
|
-
isSigner: true
|
|
19686
|
-
},
|
|
19687
|
-
{
|
|
19688
|
-
pubkey: accounts.enforcedOptions,
|
|
19689
|
-
isWritable: true,
|
|
19690
|
-
isSigner: false
|
|
19691
|
-
},
|
|
19692
|
-
{
|
|
19693
|
-
pubkey: accounts.oftConfig,
|
|
19694
|
-
isWritable: false,
|
|
19695
|
-
isSigner: false
|
|
19696
|
-
},
|
|
19697
|
-
{
|
|
19698
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
19699
|
-
isWritable: false,
|
|
19700
|
-
isSigner: false
|
|
19701
|
-
}
|
|
19702
|
-
];
|
|
19703
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19704
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19705
|
-
keys.push(acc);
|
|
19706
|
-
}
|
|
19707
|
-
}
|
|
19708
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19709
|
-
programId,
|
|
19710
|
-
keys,
|
|
19711
|
-
data
|
|
19712
|
-
});
|
|
19713
|
-
return ix;
|
|
19714
|
-
}
|
|
19715
|
-
function createSetEnforcedOptionsInstructionAccounts(accounts, programId) {
|
|
19716
|
-
const keys = [
|
|
19717
|
-
{
|
|
19718
|
-
pubkey: accounts.admin,
|
|
19719
|
-
isWritable: true,
|
|
19720
|
-
isSigner: true
|
|
19721
|
-
},
|
|
19722
|
-
{
|
|
19723
|
-
pubkey: accounts.enforcedOptions,
|
|
19724
|
-
isWritable: true,
|
|
19725
|
-
isSigner: false
|
|
19726
|
-
},
|
|
19727
|
-
{
|
|
19728
|
-
pubkey: accounts.oftConfig,
|
|
19729
|
-
isWritable: false,
|
|
19730
|
-
isSigner: false
|
|
19731
|
-
},
|
|
19732
|
-
{
|
|
19733
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
19734
|
-
isWritable: false,
|
|
19735
|
-
isSigner: false
|
|
19736
|
-
}
|
|
19737
|
-
];
|
|
19738
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19739
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19740
|
-
keys.push(acc);
|
|
19741
|
-
}
|
|
19742
|
-
}
|
|
19743
|
-
return keys;
|
|
19744
|
-
}
|
|
19745
|
-
var setMintAuthorityParamsBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
19746
|
-
[["mintAuthority", beet159__namespace.coption(beetSolana85__namespace.publicKey)]],
|
|
19747
|
-
"SetMintAuthorityParams"
|
|
19748
|
-
);
|
|
19749
|
-
|
|
19750
|
-
// src/generated/oft/instructions/setMintAuthority.ts
|
|
19751
|
-
var setMintAuthorityStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
19752
|
-
[
|
|
19753
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19754
|
-
["params", setMintAuthorityParamsBeet]
|
|
19755
|
-
],
|
|
19756
|
-
"SetMintAuthorityInstructionArgs"
|
|
19757
|
-
);
|
|
19758
|
-
var setMintAuthorityInstructionDiscriminator = [
|
|
19759
|
-
67,
|
|
19760
|
-
127,
|
|
19761
|
-
155,
|
|
19762
|
-
187,
|
|
19763
|
-
100,
|
|
19764
|
-
174,
|
|
19765
|
-
103,
|
|
19766
|
-
121
|
|
19767
|
-
];
|
|
19768
|
-
function createSetMintAuthorityInstruction(accounts, args, programId) {
|
|
19769
|
-
const [data] = setMintAuthorityStruct.serialize({
|
|
19770
|
-
instructionDiscriminator: setMintAuthorityInstructionDiscriminator,
|
|
19771
|
-
...args
|
|
19772
|
-
});
|
|
19773
|
-
const keys = [
|
|
19774
|
-
{
|
|
19775
|
-
pubkey: accounts.signer,
|
|
19776
|
-
isWritable: false,
|
|
19777
|
-
isSigner: true
|
|
19778
|
-
},
|
|
19779
|
-
{
|
|
19780
|
-
pubkey: accounts.oftConfig,
|
|
19781
|
-
isWritable: true,
|
|
19782
|
-
isSigner: false
|
|
19783
|
-
}
|
|
19784
|
-
];
|
|
19785
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19786
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19787
|
-
keys.push(acc);
|
|
19788
|
-
}
|
|
19789
|
-
}
|
|
19790
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19791
|
-
programId,
|
|
19792
|
-
keys,
|
|
19793
|
-
data
|
|
19794
|
-
});
|
|
19795
|
-
return ix;
|
|
19796
|
-
}
|
|
19797
|
-
function createSetMintAuthorityInstructionAccounts(accounts, programId) {
|
|
19798
|
-
const keys = [
|
|
19799
|
-
{
|
|
19800
|
-
pubkey: accounts.signer,
|
|
19801
|
-
isWritable: false,
|
|
19802
|
-
isSigner: true
|
|
19803
|
-
},
|
|
19804
|
-
{
|
|
19805
|
-
pubkey: accounts.oftConfig,
|
|
19806
|
-
isWritable: true,
|
|
19807
|
-
isSigner: false
|
|
19808
|
-
}
|
|
19809
|
-
];
|
|
19810
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19811
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19812
|
-
keys.push(acc);
|
|
19813
|
-
}
|
|
19814
|
-
}
|
|
19815
|
-
return keys;
|
|
19816
|
-
}
|
|
19817
|
-
var setPeerParamsBeet = new beet159__namespace.BeetArgsStruct(
|
|
19818
|
-
[
|
|
19819
|
-
["dstEid", beet159__namespace.u32],
|
|
19820
|
-
["peer", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)]
|
|
19821
|
-
],
|
|
19822
|
-
"SetPeerParams"
|
|
19823
|
-
);
|
|
19824
|
-
|
|
19825
|
-
// src/generated/oft/instructions/setPeer.ts
|
|
19826
|
-
var setPeerStruct = new beet159__namespace.BeetArgsStruct(
|
|
19827
|
-
[
|
|
19828
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19829
|
-
["params", setPeerParamsBeet]
|
|
19830
|
-
],
|
|
19831
|
-
"SetPeerInstructionArgs"
|
|
19832
|
-
);
|
|
19833
|
-
var setPeerInstructionDiscriminator = [
|
|
19834
|
-
32,
|
|
19835
|
-
70,
|
|
19836
|
-
184,
|
|
19837
|
-
229,
|
|
19838
|
-
200,
|
|
19839
|
-
115,
|
|
19840
|
-
227,
|
|
19841
|
-
177
|
|
19842
|
-
];
|
|
19843
|
-
function createSetPeerInstruction(accounts, args, programId) {
|
|
19844
|
-
const [data] = setPeerStruct.serialize({
|
|
19845
|
-
instructionDiscriminator: setPeerInstructionDiscriminator,
|
|
19846
|
-
...args
|
|
19847
|
-
});
|
|
19848
|
-
const keys = [
|
|
19849
|
-
{
|
|
19850
|
-
pubkey: accounts.admin,
|
|
19851
|
-
isWritable: true,
|
|
19852
|
-
isSigner: true
|
|
19853
|
-
},
|
|
19854
|
-
{
|
|
19855
|
-
pubkey: accounts.peer,
|
|
19856
|
-
isWritable: true,
|
|
19857
|
-
isSigner: false
|
|
19858
|
-
},
|
|
19859
|
-
{
|
|
19860
|
-
pubkey: accounts.oftConfig,
|
|
19861
|
-
isWritable: false,
|
|
19862
|
-
isSigner: false
|
|
19863
|
-
},
|
|
19864
|
-
{
|
|
19865
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
19866
|
-
isWritable: false,
|
|
19867
|
-
isSigner: false
|
|
19868
|
-
}
|
|
19869
|
-
];
|
|
19870
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19871
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19872
|
-
keys.push(acc);
|
|
19873
|
-
}
|
|
19874
|
-
}
|
|
19875
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19876
|
-
programId,
|
|
19877
|
-
keys,
|
|
19878
|
-
data
|
|
19879
|
-
});
|
|
19880
|
-
return ix;
|
|
19881
|
-
}
|
|
19882
|
-
function createSetPeerInstructionAccounts(accounts, programId) {
|
|
19883
|
-
const keys = [
|
|
19884
|
-
{
|
|
19885
|
-
pubkey: accounts.admin,
|
|
19886
|
-
isWritable: true,
|
|
19887
|
-
isSigner: true
|
|
19888
|
-
},
|
|
19889
|
-
{
|
|
19890
|
-
pubkey: accounts.peer,
|
|
19891
|
-
isWritable: true,
|
|
19892
|
-
isSigner: false
|
|
19893
|
-
},
|
|
19894
|
-
{
|
|
19895
|
-
pubkey: accounts.oftConfig,
|
|
19896
|
-
isWritable: false,
|
|
19897
|
-
isSigner: false
|
|
19898
|
-
},
|
|
19899
|
-
{
|
|
19900
|
-
pubkey: accounts.systemProgram ?? web314__namespace.SystemProgram.programId,
|
|
19901
|
-
isWritable: false,
|
|
19902
|
-
isSigner: false
|
|
19903
|
-
}
|
|
19904
|
-
];
|
|
19905
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19906
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19907
|
-
keys.push(acc);
|
|
19908
|
-
}
|
|
19909
|
-
}
|
|
19910
|
-
return keys;
|
|
19911
|
-
}
|
|
19912
|
-
var setRateLimitParamsBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
19913
|
-
[
|
|
19914
|
-
["dstEid", beet159__namespace.u32],
|
|
19915
|
-
["refillPerSecond", beet159__namespace.coption(beet159__namespace.u64)],
|
|
19916
|
-
["capacity", beet159__namespace.coption(beet159__namespace.u64)],
|
|
19917
|
-
["enabled", beet159__namespace.bool]
|
|
19918
|
-
],
|
|
19919
|
-
"SetRateLimitParams"
|
|
19920
|
-
);
|
|
19921
|
-
|
|
19922
|
-
// src/generated/oft/instructions/setRateLimit.ts
|
|
19923
|
-
var setRateLimitStruct = new beet159__namespace.FixableBeetArgsStruct(
|
|
19924
|
-
[
|
|
19925
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
19926
|
-
["params", setRateLimitParamsBeet]
|
|
19927
|
-
],
|
|
19928
|
-
"SetRateLimitInstructionArgs"
|
|
19929
|
-
);
|
|
19930
|
-
var setRateLimitInstructionDiscriminator = [
|
|
19931
|
-
42,
|
|
19932
|
-
212,
|
|
19933
|
-
44,
|
|
19934
|
-
91,
|
|
19935
|
-
198,
|
|
19936
|
-
58,
|
|
19937
|
-
60,
|
|
19938
|
-
239
|
|
19939
|
-
];
|
|
19940
|
-
function createSetRateLimitInstruction(accounts, args, programId) {
|
|
19941
|
-
const [data] = setRateLimitStruct.serialize({
|
|
19942
|
-
instructionDiscriminator: setRateLimitInstructionDiscriminator,
|
|
19943
|
-
...args
|
|
19944
|
-
});
|
|
19945
|
-
const keys = [
|
|
19946
|
-
{
|
|
19947
|
-
pubkey: accounts.admin,
|
|
19948
|
-
isWritable: false,
|
|
19949
|
-
isSigner: true
|
|
19950
|
-
},
|
|
19951
|
-
{
|
|
19952
|
-
pubkey: accounts.peer,
|
|
19953
|
-
isWritable: true,
|
|
19954
|
-
isSigner: false
|
|
19955
|
-
},
|
|
19956
|
-
{
|
|
19957
|
-
pubkey: accounts.oftConfig,
|
|
19958
|
-
isWritable: false,
|
|
19959
|
-
isSigner: false
|
|
19960
|
-
}
|
|
19961
|
-
];
|
|
19962
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19963
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19964
|
-
keys.push(acc);
|
|
19965
|
-
}
|
|
19966
|
-
}
|
|
19967
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
19968
|
-
programId,
|
|
19969
|
-
keys,
|
|
19970
|
-
data
|
|
19971
|
-
});
|
|
19972
|
-
return ix;
|
|
19973
|
-
}
|
|
19974
|
-
function createSetRateLimitInstructionAccounts(accounts, programId) {
|
|
19975
|
-
const keys = [
|
|
19976
|
-
{
|
|
19977
|
-
pubkey: accounts.admin,
|
|
19978
|
-
isWritable: false,
|
|
19979
|
-
isSigner: true
|
|
19980
|
-
},
|
|
19981
|
-
{
|
|
19982
|
-
pubkey: accounts.peer,
|
|
19983
|
-
isWritable: true,
|
|
19984
|
-
isSigner: false
|
|
19985
|
-
},
|
|
19986
|
-
{
|
|
19987
|
-
pubkey: accounts.oftConfig,
|
|
19988
|
-
isWritable: false,
|
|
19989
|
-
isSigner: false
|
|
19990
|
-
}
|
|
19991
|
-
];
|
|
19992
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
19993
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
19994
|
-
keys.push(acc);
|
|
19995
|
-
}
|
|
19996
|
-
}
|
|
19997
|
-
return keys;
|
|
19998
|
-
}
|
|
19999
|
-
var transferAdminParamsBeet5 = new beet159__namespace.BeetArgsStruct(
|
|
20000
|
-
[["admin", beetSolana85__namespace.publicKey]],
|
|
20001
|
-
"TransferAdminParams"
|
|
20002
|
-
);
|
|
20003
|
-
|
|
20004
|
-
// src/generated/oft/instructions/transferAdmin.ts
|
|
20005
|
-
var transferAdminStruct5 = new beet159__namespace.BeetArgsStruct(
|
|
20006
|
-
[
|
|
20007
|
-
["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)],
|
|
20008
|
-
["params", transferAdminParamsBeet5]
|
|
20009
|
-
],
|
|
20010
|
-
"TransferAdminInstructionArgs"
|
|
20011
|
-
);
|
|
20012
|
-
var transferAdminInstructionDiscriminator5 = [
|
|
20013
|
-
42,
|
|
20014
|
-
242,
|
|
20015
|
-
66,
|
|
20016
|
-
106,
|
|
20017
|
-
228,
|
|
20018
|
-
10,
|
|
20019
|
-
111,
|
|
20020
|
-
156
|
|
20021
|
-
];
|
|
20022
|
-
function createTransferAdminInstruction5(accounts, args, programId) {
|
|
20023
|
-
const [data] = transferAdminStruct5.serialize({
|
|
20024
|
-
instructionDiscriminator: transferAdminInstructionDiscriminator5,
|
|
20025
|
-
...args
|
|
20026
|
-
});
|
|
20027
|
-
const keys = [
|
|
20028
|
-
{
|
|
20029
|
-
pubkey: accounts.admin,
|
|
20030
|
-
isWritable: false,
|
|
20031
|
-
isSigner: true
|
|
20032
|
-
},
|
|
20033
|
-
{
|
|
20034
|
-
pubkey: accounts.oftConfig,
|
|
20035
|
-
isWritable: true,
|
|
20036
|
-
isSigner: false
|
|
20037
|
-
}
|
|
20038
|
-
];
|
|
20039
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
20040
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
20041
|
-
keys.push(acc);
|
|
20042
|
-
}
|
|
20043
|
-
}
|
|
20044
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
20045
|
-
programId,
|
|
20046
|
-
keys,
|
|
20047
|
-
data
|
|
20048
|
-
});
|
|
20049
|
-
return ix;
|
|
20050
|
-
}
|
|
20051
|
-
function createTransferAdminInstructionAccounts5(accounts, programId) {
|
|
20052
|
-
const keys = [
|
|
20053
|
-
{
|
|
20054
|
-
pubkey: accounts.admin,
|
|
20055
|
-
isWritable: false,
|
|
20056
|
-
isSigner: true
|
|
20057
|
-
},
|
|
20058
|
-
{
|
|
20059
|
-
pubkey: accounts.oftConfig,
|
|
20060
|
-
isWritable: true,
|
|
20061
|
-
isSigner: false
|
|
20062
|
-
}
|
|
20063
|
-
];
|
|
20064
|
-
if (accounts.anchorRemainingAccounts != null) {
|
|
20065
|
-
for (const acc of accounts.anchorRemainingAccounts) {
|
|
20066
|
-
keys.push(acc);
|
|
20067
|
-
}
|
|
20068
|
-
}
|
|
20069
|
-
return keys;
|
|
20070
|
-
}
|
|
20071
|
-
var versionStruct3 = new beet159__namespace.BeetArgsStruct(
|
|
20072
|
-
[["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)]],
|
|
20073
|
-
"VersionInstructionArgs"
|
|
20074
|
-
);
|
|
20075
|
-
var versionInstructionDiscriminator3 = [
|
|
20076
|
-
118,
|
|
20077
|
-
65,
|
|
20078
|
-
195,
|
|
20079
|
-
198,
|
|
20080
|
-
129,
|
|
20081
|
-
216,
|
|
20082
|
-
252,
|
|
20083
|
-
192
|
|
20084
|
-
];
|
|
20085
|
-
function createVersionInstruction3(programId) {
|
|
20086
|
-
const [data] = versionStruct3.serialize({
|
|
20087
|
-
instructionDiscriminator: versionInstructionDiscriminator3
|
|
20088
|
-
});
|
|
20089
|
-
const keys = [];
|
|
20090
|
-
const ix = new web314__namespace.TransactionInstruction({
|
|
20091
|
-
programId,
|
|
20092
|
-
keys,
|
|
20093
|
-
data
|
|
20094
|
-
});
|
|
20095
|
-
return ix;
|
|
20096
|
-
}
|
|
20097
|
-
function createVersionInstructionAccounts3(programId) {
|
|
20098
|
-
const keys = [];
|
|
20099
|
-
return keys;
|
|
20100
|
-
}
|
|
20101
|
-
|
|
20102
|
-
// src/generated/oft/types/index.ts
|
|
20103
|
-
var types_exports7 = {};
|
|
20104
|
-
__export(types_exports7, {
|
|
20105
|
-
initAdapterOftParamsBeet: () => initAdapterOftParamsBeet,
|
|
20106
|
-
initOftParamsBeet: () => initOftParamsBeet,
|
|
20107
|
-
isOftConfigExtAdapter: () => isOftConfigExtAdapter,
|
|
20108
|
-
isOftConfigExtNative: () => isOftConfigExtNative,
|
|
20109
|
-
lzAccountBeet: () => lzAccountBeet,
|
|
20110
|
-
lzReceiveParamsBeet: () => lzReceiveParamsBeet2,
|
|
20111
|
-
messagingFeeBeet: () => messagingFeeBeet4,
|
|
20112
|
-
messagingReceiptBeet: () => messagingReceiptBeet2,
|
|
20113
|
-
mintToParamsBeet: () => mintToParamsBeet,
|
|
20114
|
-
oFTFeeDetailBeet: () => oFTFeeDetailBeet,
|
|
20115
|
-
oFTLimitsBeet: () => oFTLimitsBeet,
|
|
20116
|
-
oFTReceiptBeet: () => oFTReceiptBeet,
|
|
20117
|
-
oftConfigExtBeet: () => oftConfigExtBeet,
|
|
20118
|
-
quoteOftParamsBeet: () => quoteOftParamsBeet,
|
|
20119
|
-
quoteOftResultBeet: () => quoteOftResultBeet,
|
|
20120
|
-
quoteParamsBeet: () => quoteParamsBeet4,
|
|
20121
|
-
rateLimiterBeet: () => rateLimiterBeet,
|
|
20122
|
-
sendParamsBeet: () => sendParamsBeet4,
|
|
20123
|
-
setDelegateParamsBeet: () => setDelegateParamsBeet2,
|
|
20124
|
-
setEnforcedOptionsParamsBeet: () => setEnforcedOptionsParamsBeet,
|
|
20125
|
-
setMintAuthorityParamsBeet: () => setMintAuthorityParamsBeet,
|
|
20126
|
-
setPeerParamsBeet: () => setPeerParamsBeet,
|
|
20127
|
-
setRateLimitParamsBeet: () => setRateLimitParamsBeet,
|
|
20128
|
-
transferAdminParamsBeet: () => transferAdminParamsBeet5,
|
|
20129
|
-
versionBeet: () => versionBeet3
|
|
20130
|
-
});
|
|
20131
|
-
var lzAccountBeet = new beet159__namespace.BeetArgsStruct(
|
|
20132
|
-
[
|
|
20133
|
-
["pubkey", beetSolana85__namespace.publicKey],
|
|
20134
|
-
["isSigner", beet159__namespace.bool],
|
|
20135
|
-
["isWritable", beet159__namespace.bool]
|
|
20136
|
-
],
|
|
20137
|
-
"LzAccount"
|
|
20138
|
-
);
|
|
20139
|
-
var messagingFeeBeet4 = new beet159__namespace.BeetArgsStruct(
|
|
20140
|
-
[
|
|
20141
|
-
["nativeFee", beet159__namespace.u64],
|
|
20142
|
-
["lzTokenFee", beet159__namespace.u64]
|
|
20143
|
-
],
|
|
20144
|
-
"MessagingFee"
|
|
20145
|
-
);
|
|
20146
|
-
var messagingReceiptBeet2 = new beet159__namespace.BeetArgsStruct(
|
|
20147
|
-
[
|
|
20148
|
-
["guid", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 32)],
|
|
20149
|
-
["nonce", beet159__namespace.u64],
|
|
20150
|
-
["fee", messagingFeeBeet4]
|
|
20151
|
-
],
|
|
20152
|
-
"MessagingReceipt"
|
|
20153
|
-
);
|
|
20154
|
-
var oFTFeeDetailBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
20155
|
-
[
|
|
20156
|
-
["feeAmountLd", beet159__namespace.u64],
|
|
20157
|
-
["description", beet159__namespace.utf8String]
|
|
20158
|
-
],
|
|
20159
|
-
"OFTFeeDetail"
|
|
20160
|
-
);
|
|
20161
|
-
var oFTLimitsBeet = new beet159__namespace.BeetArgsStruct(
|
|
20162
|
-
[
|
|
20163
|
-
["minAmountLd", beet159__namespace.u64],
|
|
20164
|
-
["maxAmountLd", beet159__namespace.u64]
|
|
20165
|
-
],
|
|
20166
|
-
"OFTLimits"
|
|
20167
|
-
);
|
|
20168
|
-
var oFTReceiptBeet = new beet159__namespace.BeetArgsStruct(
|
|
20169
|
-
[
|
|
20170
|
-
["amountSentLd", beet159__namespace.u64],
|
|
20171
|
-
["amountReceivedLd", beet159__namespace.u64]
|
|
20172
|
-
],
|
|
20173
|
-
"OFTReceipt"
|
|
20174
|
-
);
|
|
20175
|
-
var quoteOftResultBeet = new beet159__namespace.FixableBeetArgsStruct(
|
|
20176
|
-
[
|
|
20177
|
-
["oftLimits", oFTLimitsBeet],
|
|
20178
|
-
["oftFeeDetails", beet159__namespace.array(oFTFeeDetailBeet)],
|
|
20179
|
-
["oftReceipt", oFTReceiptBeet]
|
|
20180
|
-
],
|
|
20181
|
-
"QuoteOftResult"
|
|
20182
|
-
);
|
|
20183
|
-
var versionBeet3 = new beet159__namespace.BeetArgsStruct(
|
|
20184
|
-
[
|
|
20185
|
-
["sdkVersion", beet159__namespace.u64],
|
|
20186
|
-
["oftVersion", beet159__namespace.u64]
|
|
20187
|
-
],
|
|
20188
|
-
"Version"
|
|
20189
|
-
);
|
|
20190
|
-
|
|
20191
|
-
// src/oft.ts
|
|
20192
|
-
var OFT_DECIMALS = 6;
|
|
20193
|
-
var Oft = class {
|
|
20194
|
-
constructor(program, endpointProgram, _tokenProgram, mintKp, escrowKp) {
|
|
20195
|
-
this.program = program;
|
|
20196
|
-
this.endpointProgram = endpointProgram;
|
|
20197
|
-
this.deriver = new OftPDADeriver(this.program);
|
|
20198
|
-
this.endpoint = new endpoint_exports.Endpoint(endpointProgram);
|
|
20199
|
-
const [eventAuthorityPDA] = new EventPDADeriver(this.program).eventAuthority();
|
|
20200
|
-
this.eventAuthorityPDA = eventAuthorityPDA;
|
|
20201
|
-
this.mintKp = mintKp;
|
|
20202
|
-
this.escrowKp = escrowKp;
|
|
20203
|
-
this.isAdapter = escrowKp !== void 0;
|
|
20204
|
-
this.tokenProgram = _tokenProgram;
|
|
20205
|
-
}
|
|
20206
|
-
getOftConfig() {
|
|
20207
|
-
if (this.isAdapter) {
|
|
20208
|
-
return this.deriver.oftConfig(this.escrowKp)[0];
|
|
20209
|
-
}
|
|
20210
|
-
return this.deriver.oftConfig(this.mintKp)[0];
|
|
20211
|
-
}
|
|
20212
|
-
async getVersion() {
|
|
20213
|
-
return Promise.resolve([createVersionInstruction3(this.program)]);
|
|
20214
|
-
}
|
|
20215
|
-
async setDelegate(admin, delegate) {
|
|
20216
|
-
const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
|
|
20217
|
-
const oftConfig = this.getOftConfig();
|
|
20218
|
-
const [oAppRegistry] = this.endpoint.deriver.oappRegistry(oftConfig);
|
|
20219
|
-
const endpointSetDelegateKeys = endpoint_exports.instructions.createSetDelegateInstructionAccounts(
|
|
20220
|
-
{
|
|
20221
|
-
oapp: oftConfig,
|
|
20222
|
-
oappRegistry: oAppRegistry,
|
|
20223
|
-
eventAuthority: endpointEventAuthority,
|
|
20224
|
-
program: this.endpointProgram
|
|
20225
|
-
},
|
|
20226
|
-
this.endpointProgram
|
|
20227
|
-
);
|
|
20228
|
-
for (const acc of endpointSetDelegateKeys) {
|
|
20229
|
-
acc.isSigner = false;
|
|
20230
|
-
}
|
|
20231
|
-
const ix = createSetDelegateInstruction2(
|
|
20232
|
-
{
|
|
20233
|
-
admin,
|
|
20234
|
-
oftConfig: this.getOftConfig(),
|
|
20235
|
-
anchorRemainingAccounts: [
|
|
20236
|
-
{
|
|
20237
|
-
pubkey: this.endpointProgram,
|
|
20238
|
-
isSigner: false,
|
|
20239
|
-
isWritable: false
|
|
20240
|
-
},
|
|
20241
|
-
...endpointSetDelegateKeys
|
|
20242
|
-
]
|
|
20243
|
-
},
|
|
20244
|
-
{
|
|
20245
|
-
params: {
|
|
20246
|
-
delegate
|
|
20247
|
-
}
|
|
20248
|
-
},
|
|
20249
|
-
this.program
|
|
20250
|
-
);
|
|
20251
|
-
return Promise.resolve(ix);
|
|
20252
|
-
}
|
|
20253
|
-
async initOft(connection, payer, admin) {
|
|
20254
|
-
const oftConfig = this.getOftConfig();
|
|
20255
|
-
const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
|
|
20256
|
-
const [oAppRegistry] = this.endpoint.deriver.oappRegistry(oftConfig);
|
|
20257
|
-
const [lzReceiveTypes] = web314.PublicKey.findProgramAddressSync(
|
|
20258
|
-
[Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
|
|
20259
|
-
this.program
|
|
20260
|
-
);
|
|
20261
|
-
const registerOappIxKeys = endpoint_exports.instructions.createRegisterOappInstructionAccounts(
|
|
20262
|
-
{
|
|
20263
|
-
payer: admin,
|
|
20264
|
-
oapp: oftConfig,
|
|
20265
|
-
oappRegistry: oAppRegistry,
|
|
20266
|
-
eventAuthority: endpointEventAuthority,
|
|
20267
|
-
program: this.endpointProgram
|
|
20268
|
-
},
|
|
20269
|
-
this.endpointProgram
|
|
20270
|
-
);
|
|
20271
|
-
for (const acc of registerOappIxKeys) {
|
|
20272
|
-
acc.isSigner = false;
|
|
20273
|
-
}
|
|
20274
|
-
const ret = [
|
|
20275
|
-
web314.SystemProgram.createAccount({
|
|
20276
|
-
fromPubkey: admin,
|
|
20277
|
-
newAccountPubkey: this.mintKp,
|
|
20278
|
-
space: splToken.getMintLen([]),
|
|
20279
|
-
lamports: await connection.getMinimumBalanceForRentExemption(splToken.getMintLen([])),
|
|
20280
|
-
programId: this.tokenProgram
|
|
20281
|
-
}),
|
|
20282
|
-
splToken.createInitializeMintInstruction(
|
|
20283
|
-
this.mintKp,
|
|
20284
|
-
OFT_DECIMALS,
|
|
20285
|
-
this.isAdapter ? admin : oftConfig,
|
|
20286
|
-
null,
|
|
20287
|
-
this.tokenProgram
|
|
20288
|
-
)
|
|
20289
|
-
];
|
|
20290
|
-
if (this.isAdapter) {
|
|
20291
|
-
return ret.concat(
|
|
20292
|
-
createInitAdapterOftInstruction(
|
|
20293
|
-
{
|
|
20294
|
-
payer,
|
|
20295
|
-
oftConfig,
|
|
20296
|
-
tokenMint: this.mintKp,
|
|
20297
|
-
tokenEscrow: this.escrowKp,
|
|
20298
|
-
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20299
|
-
tokenProgram: this.tokenProgram,
|
|
20300
|
-
anchorRemainingAccounts: [
|
|
20301
|
-
{
|
|
20302
|
-
pubkey: this.endpointProgram,
|
|
20303
|
-
isSigner: false,
|
|
20304
|
-
isWritable: false
|
|
20305
|
-
},
|
|
20306
|
-
...registerOappIxKeys
|
|
20307
|
-
]
|
|
20308
|
-
},
|
|
20309
|
-
{
|
|
20310
|
-
params: {
|
|
20311
|
-
admin,
|
|
20312
|
-
sharedDecimals: OFT_DECIMALS,
|
|
20313
|
-
endpointProgram: this.endpointProgram
|
|
20314
|
-
}
|
|
20315
|
-
},
|
|
20316
|
-
this.program
|
|
20317
|
-
)
|
|
20318
|
-
);
|
|
20319
|
-
} else {
|
|
20320
|
-
return ret.concat(
|
|
20321
|
-
createInitOftInstruction(
|
|
20322
|
-
{
|
|
20323
|
-
payer,
|
|
20324
|
-
oftConfig,
|
|
20325
|
-
tokenMint: this.mintKp,
|
|
20326
|
-
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20327
|
-
tokenProgram: this.tokenProgram,
|
|
20328
|
-
anchorRemainingAccounts: [
|
|
20329
|
-
{
|
|
20330
|
-
pubkey: this.endpointProgram,
|
|
20331
|
-
isSigner: false,
|
|
20332
|
-
isWritable: false
|
|
20333
|
-
},
|
|
20334
|
-
...registerOappIxKeys
|
|
20335
|
-
]
|
|
20336
|
-
},
|
|
20337
|
-
{
|
|
20338
|
-
params: {
|
|
20339
|
-
admin,
|
|
20340
|
-
sharedDecimals: OFT_DECIMALS,
|
|
20341
|
-
endpointProgram: this.endpointProgram,
|
|
20342
|
-
mintAuthority: admin
|
|
20343
|
-
}
|
|
20344
|
-
},
|
|
20345
|
-
this.program
|
|
20346
|
-
)
|
|
20347
|
-
);
|
|
20348
|
-
}
|
|
20349
|
-
}
|
|
20350
|
-
getAddressB32() {
|
|
20351
|
-
const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
|
|
20352
|
-
const ret = new Uint8Array(32);
|
|
20353
|
-
ret.fill(0).set(oftConfig.toBytes());
|
|
20354
|
-
return ret;
|
|
20355
|
-
}
|
|
20356
|
-
async mint_to(signer, to, amount) {
|
|
20357
|
-
const ix = createMintToInstruction(
|
|
20358
|
-
{
|
|
20359
|
-
minter: signer,
|
|
20360
|
-
oftConfig: this.getOftConfig(),
|
|
20361
|
-
tokenDest: to,
|
|
20362
|
-
tokenMint: this.mintKp,
|
|
20363
|
-
tokenProgram: this.tokenProgram
|
|
20364
|
-
},
|
|
20365
|
-
{
|
|
20366
|
-
params: {
|
|
20367
|
-
amount: new BN__default.default(amount.toString())
|
|
20368
|
-
}
|
|
20369
|
-
},
|
|
20370
|
-
this.program
|
|
20371
|
-
);
|
|
20372
|
-
return Promise.resolve(ix);
|
|
20373
|
-
}
|
|
20374
|
-
async setPeer(_peer, admin, dstEid) {
|
|
20375
|
-
const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
|
|
20376
|
-
const [peer] = this.deriver.peer(oftConfig, dstEid);
|
|
20377
|
-
const ix = createSetPeerInstruction(
|
|
20378
|
-
{
|
|
20379
|
-
admin,
|
|
20380
|
-
peer,
|
|
20381
|
-
oftConfig
|
|
20382
|
-
},
|
|
20383
|
-
{
|
|
20384
|
-
params: {
|
|
20385
|
-
dstEid,
|
|
20386
|
-
peer: new Array(32 - _peer.length).fill(0).concat(_peer)
|
|
20387
|
-
}
|
|
20388
|
-
},
|
|
20389
|
-
this.program
|
|
20390
|
-
);
|
|
20391
|
-
return Promise.resolve(ix);
|
|
20392
|
-
}
|
|
20393
|
-
async setEnforcedOptions(admin, send, sendAndCall, dstEid) {
|
|
20394
|
-
const oftConfig = this.getOftConfig();
|
|
20395
|
-
const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
|
|
20396
|
-
const ix = createSetEnforcedOptionsInstruction(
|
|
20397
|
-
{
|
|
20398
|
-
admin,
|
|
20399
|
-
enforcedOptions,
|
|
20400
|
-
oftConfig
|
|
20401
|
-
},
|
|
20402
|
-
{
|
|
20403
|
-
params: {
|
|
20404
|
-
dstEid,
|
|
20405
|
-
send,
|
|
20406
|
-
sendAndCall
|
|
20407
|
-
}
|
|
20408
|
-
},
|
|
20409
|
-
this.program
|
|
20410
|
-
);
|
|
20411
|
-
return Promise.resolve(ix);
|
|
20412
|
-
}
|
|
20413
|
-
async send(connection, payer, tokenSource, to, dstEid, amountLd, minAmountLd, fee, options = new Uint8Array(), composeMsg, peerAddr, remainingAccounts, commitmentOrConfig = "confirmed") {
|
|
20414
|
-
const oftConfig = this.getOftConfig();
|
|
20415
|
-
const [peer] = this.deriver.peer(oftConfig, dstEid);
|
|
20416
|
-
const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
|
|
20417
|
-
if (peerAddr == null) {
|
|
20418
|
-
const peerInfo = await Peer.fromAccountAddress(connection, peer);
|
|
20419
|
-
peerAddr = peerInfo.address;
|
|
20420
|
-
}
|
|
20421
|
-
if (remainingAccounts === void 0 || remainingAccounts.length === 0) {
|
|
20422
|
-
const msgLibProgram = await this.getSendLibraryProgram(connection, payer, dstEid);
|
|
20423
|
-
const [endpointSettings] = this.endpoint.deriver.setting();
|
|
20424
|
-
const packetPath = {
|
|
20425
|
-
srcEid: 0,
|
|
20426
|
-
dstEid,
|
|
20427
|
-
sender: bytes.hexlify(oftConfig.toBytes()),
|
|
20428
|
-
receiver: bytes.hexlify(peerAddr)
|
|
20429
|
-
};
|
|
20430
|
-
invariant5__default.default(
|
|
20431
|
-
await isAccountInitialized(connection, endpointSettings),
|
|
20432
|
-
"endpointSettings account not initialized"
|
|
20433
|
-
);
|
|
20434
|
-
invariant5__default.default(await isAccountInitialized(connection, peer), "peer account not initialized");
|
|
20435
|
-
invariant5__default.default(
|
|
20436
|
-
await isAccountInitialized(connection, enforcedOptions),
|
|
20437
|
-
"enforcedOptions account not initialized"
|
|
20438
|
-
);
|
|
20439
|
-
invariant5__default.default(await isAccountInitialized(connection, payer), "payer account not initialized");
|
|
20440
|
-
invariant5__default.default(
|
|
20441
|
-
await isAccountInitialized(
|
|
20442
|
-
connection,
|
|
20443
|
-
this.endpoint.deriver.nonce(oftConfig, dstEid, Uint8Array.from(peerAddr))[0]
|
|
20444
|
-
),
|
|
20445
|
-
"nonce account not initialized"
|
|
20446
|
-
);
|
|
20447
|
-
remainingAccounts = await this.endpoint.getSendIXAccountMetaForCPI(
|
|
20448
|
-
connection,
|
|
20449
|
-
payer,
|
|
20450
|
-
packetPath,
|
|
20451
|
-
msgLibProgram,
|
|
20452
|
-
commitmentOrConfig
|
|
20453
|
-
);
|
|
20454
|
-
}
|
|
20455
|
-
return createSendInstruction4(
|
|
20456
|
-
{
|
|
20457
|
-
signer: payer,
|
|
20458
|
-
peer,
|
|
20459
|
-
enforcedOptions,
|
|
20460
|
-
oftConfig,
|
|
20461
|
-
tokenSource,
|
|
20462
|
-
tokenEscrow: this.escrowKp,
|
|
20463
|
-
tokenMint: this.mintKp,
|
|
20464
|
-
tokenProgram: this.tokenProgram,
|
|
20465
|
-
eventAuthority: this.eventAuthorityPDA,
|
|
20466
|
-
program: this.program,
|
|
20467
|
-
// Get remaining accounts from msgLib(simple_msgLib or uln)
|
|
20468
|
-
anchorRemainingAccounts: remainingAccounts
|
|
20469
|
-
},
|
|
20470
|
-
{
|
|
20471
|
-
params: {
|
|
20472
|
-
dstEid,
|
|
20473
|
-
to,
|
|
20474
|
-
amountLd: new BN__default.default(amountLd.toString()),
|
|
20475
|
-
minAmountLd: new BN__default.default(minAmountLd.toString()),
|
|
20476
|
-
options,
|
|
20477
|
-
composeMsg: composeMsg ?? null,
|
|
20478
|
-
nativeFee: fee.nativeFee,
|
|
20479
|
-
lzTokenFee: fee.lzTokenFee
|
|
20480
|
-
}
|
|
20481
|
-
},
|
|
20482
|
-
this.program
|
|
20483
|
-
);
|
|
20484
|
-
}
|
|
20485
|
-
async setRateLimit(signer, dstEid, capacity, refillPerSecond, enabled) {
|
|
20486
|
-
const [peerPda] = this.deriver.peer(this.getOftConfig(), dstEid);
|
|
20487
|
-
const ix = createSetRateLimitInstruction(
|
|
20488
|
-
{
|
|
20489
|
-
admin: signer,
|
|
20490
|
-
peer: peerPda,
|
|
20491
|
-
oftConfig: this.getOftConfig()
|
|
20492
|
-
},
|
|
20493
|
-
{
|
|
20494
|
-
params: {
|
|
20495
|
-
dstEid,
|
|
20496
|
-
capacity: new BN__default.default(capacity.toString()),
|
|
20497
|
-
refillPerSecond: new BN__default.default(refillPerSecond.toString()),
|
|
20498
|
-
enabled
|
|
20499
|
-
}
|
|
20500
|
-
},
|
|
20501
|
-
this.program
|
|
20502
|
-
);
|
|
20503
|
-
return Promise.resolve(ix);
|
|
20504
|
-
}
|
|
20505
|
-
async lzReceive(connection, payer, packet) {
|
|
20506
|
-
const deserializedPacket = PacketSerializer.deserialize(packet);
|
|
20507
|
-
return lzReceive(connection, payer, deserializedPacket);
|
|
20508
|
-
}
|
|
20509
|
-
async getSendLibraryProgram(connection, payer, dstEid) {
|
|
20510
|
-
const oftConfig = this.getOftConfig();
|
|
20511
|
-
const sendLibInfo = await this.endpoint.getSendLibrary(connection, oftConfig, dstEid);
|
|
20512
|
-
if (!sendLibInfo?.programId) {
|
|
20513
|
-
throw new Error("Send library not initialized or blocked message library");
|
|
20514
|
-
}
|
|
20515
|
-
const { programId: msgLibProgram } = sendLibInfo;
|
|
20516
|
-
const msgLibVersion = await this.endpoint.getMessageLibVersion(connection, payer, msgLibProgram);
|
|
20517
|
-
if (msgLibVersion?.major.toString() === "0" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
|
|
20518
|
-
return new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
|
|
20519
|
-
} else if (msgLibVersion?.major.toString() === "3" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
|
|
20520
|
-
return new uln_exports.Uln(msgLibProgram);
|
|
20521
|
-
}
|
|
20522
|
-
throw new Error(`Unsupported message library version: ${JSON.stringify(msgLibVersion, null, 2)}`);
|
|
20523
|
-
}
|
|
20524
|
-
};
|
|
20525
|
-
|
|
20526
|
-
// src/oft-tools.ts
|
|
20527
|
-
var SOLANA_EID = 1;
|
|
20528
|
-
async function createInitAdapterOftIx(oftProgramId, payer, admin, mint, escrow, sharedDecimals = OFT_DECIMALS, endpointProgram = PROGRAM_ID, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20529
|
-
const deriver = new OftPDADeriver(oftProgramId);
|
|
20530
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20531
|
-
const [oftConfig] = deriver.oftConfig(escrow);
|
|
20532
|
-
const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
|
|
20533
|
-
return instructions_exports7.createInitAdapterOftInstruction(
|
|
20534
|
-
{
|
|
20535
|
-
payer,
|
|
20536
|
-
oftConfig,
|
|
20537
|
-
tokenMint: mint,
|
|
20538
|
-
tokenEscrow: escrow,
|
|
20539
|
-
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20540
|
-
tokenProgram,
|
|
20541
|
-
anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
|
|
20542
|
-
},
|
|
20543
|
-
{
|
|
20544
|
-
params: {
|
|
20545
|
-
admin,
|
|
20546
|
-
sharedDecimals,
|
|
20547
|
-
endpointProgram
|
|
20548
|
-
}
|
|
20549
|
-
},
|
|
20550
|
-
oftProgramId
|
|
20551
|
-
);
|
|
20552
|
-
}
|
|
20553
|
-
async function createNonceTx(connection, nonceAccount, nonceAuthority, instructions, commitmentOrConfig = "confirmed") {
|
|
20554
|
-
const nonceAccountInfo = await connection.getNonce(nonceAccount, commitmentOrConfig);
|
|
20555
|
-
if (nonceAccountInfo === null) {
|
|
20556
|
-
throw new Error("Invalid nonce account");
|
|
20557
|
-
}
|
|
20558
|
-
const { nonce } = nonceAccountInfo;
|
|
20559
|
-
const nonceAdvanceIx = web314.SystemProgram.nonceAdvance({
|
|
20560
|
-
noncePubkey: nonceAccount,
|
|
20561
|
-
authorizedPubkey: nonceAuthority
|
|
20562
|
-
});
|
|
20563
|
-
return new web314.Transaction({
|
|
20564
|
-
recentBlockhash: nonce,
|
|
20565
|
-
nonceInfo: {
|
|
20566
|
-
nonce,
|
|
20567
|
-
nonceInstruction: nonceAdvanceIx
|
|
20568
|
-
}
|
|
20569
|
-
}).add(...instructions);
|
|
20570
|
-
}
|
|
20571
|
-
async function createInitNativeOftIx(oftProgramId, payer, admin, mint, oftMintAuthority, sharedDecimals = OFT_DECIMALS, endpointProgram = PROGRAM_ID, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20572
|
-
const deriver = new OftPDADeriver(oftProgramId);
|
|
20573
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20574
|
-
const [oftConfig] = deriver.oftConfig(mint);
|
|
20575
|
-
const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
|
|
20576
|
-
return instructions_exports7.createInitOftInstruction(
|
|
20577
|
-
{
|
|
20578
|
-
payer,
|
|
20579
|
-
oftConfig,
|
|
20580
|
-
tokenMint: mint,
|
|
20581
|
-
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20582
|
-
tokenProgram,
|
|
20583
|
-
anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
|
|
20584
|
-
},
|
|
20585
|
-
{
|
|
20586
|
-
params: {
|
|
20587
|
-
admin,
|
|
20588
|
-
sharedDecimals,
|
|
20589
|
-
mintAuthority: oftMintAuthority,
|
|
20590
|
-
endpointProgram
|
|
20591
|
-
}
|
|
20592
|
-
},
|
|
20593
|
-
oftProgramId
|
|
20594
|
-
);
|
|
20595
|
-
}
|
|
20596
|
-
async function createSetPeerIx(oftProgramId, admin, oftConfig, dstEid, peer) {
|
|
20597
|
-
if (peer.length !== 32) {
|
|
20598
|
-
throw new Error("Peer must be 32 bytes (left-padded with zeroes)");
|
|
20599
|
-
}
|
|
20600
|
-
if (dstEid % 3e4 == 0) {
|
|
20601
|
-
throw new Error("Invalid dstEid");
|
|
20602
|
-
}
|
|
20603
|
-
const [peerPda] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
|
|
20604
|
-
return instructions_exports7.createSetPeerInstruction(
|
|
20605
|
-
{
|
|
20606
|
-
admin,
|
|
20607
|
-
peer: peerPda,
|
|
20608
|
-
oftConfig
|
|
20609
|
-
},
|
|
20610
|
-
{
|
|
20611
|
-
params: {
|
|
20612
|
-
dstEid,
|
|
20613
|
-
peer: Array.from(peer)
|
|
20614
|
-
}
|
|
20615
|
-
},
|
|
20616
|
-
oftProgramId
|
|
20617
|
-
);
|
|
20618
|
-
}
|
|
20619
|
-
async function createSetDelegateIx(oftProgramId, admin, oftConfig, delegate, endpointProgram = PROGRAM_ID) {
|
|
20620
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20621
|
-
const [oAppRegistry] = endpoint.deriver.oappRegistry(oftConfig);
|
|
20622
|
-
const endpointEventAuthority = endpoint.eventAuthorityPDA;
|
|
20623
|
-
const keys = instructions_exports.createSetDelegateInstructionAccounts(
|
|
20624
|
-
{
|
|
20625
|
-
oapp: oftConfig,
|
|
20626
|
-
oappRegistry: oAppRegistry,
|
|
20627
|
-
eventAuthority: endpointEventAuthority,
|
|
20628
|
-
program: endpointProgram
|
|
20629
|
-
},
|
|
20630
|
-
endpointProgram
|
|
20631
|
-
);
|
|
20632
|
-
for (const acc of keys) {
|
|
20633
|
-
acc.isSigner = false;
|
|
20634
|
-
}
|
|
20635
|
-
return instructions_exports7.createSetDelegateInstruction(
|
|
20636
|
-
{
|
|
20637
|
-
admin,
|
|
20638
|
-
oftConfig,
|
|
20639
|
-
anchorRemainingAccounts: [
|
|
20640
|
-
{
|
|
20641
|
-
pubkey: endpointProgram,
|
|
20642
|
-
isSigner: false,
|
|
20643
|
-
isWritable: false
|
|
20644
|
-
},
|
|
20645
|
-
...keys
|
|
20646
|
-
]
|
|
20647
|
-
},
|
|
20648
|
-
{
|
|
20649
|
-
params: {
|
|
20650
|
-
delegate
|
|
20651
|
-
}
|
|
20652
|
-
},
|
|
20653
|
-
oftProgramId
|
|
20654
|
-
);
|
|
20655
|
-
}
|
|
20656
|
-
async function createInitSendLibraryIx(signer, oftConfig, dstEid, endpointProgram = PROGRAM_ID) {
|
|
20657
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20658
|
-
return endpoint.initSendLibraryWithoutChecks(signer, oftConfig, dstEid);
|
|
20659
|
-
}
|
|
20660
|
-
async function createInitReceiveLibraryIx(signer, oftConfig, remoteEid, endpointProgram = PROGRAM_ID) {
|
|
20661
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20662
|
-
return endpoint.initReceiveLibraryWithoutChecks(signer, oftConfig, remoteEid);
|
|
20663
|
-
}
|
|
20664
|
-
async function createSetSendLibraryIx(signer, oftConfig, sendLibraryProgram, dstEid, endpointProgram = PROGRAM_ID) {
|
|
20665
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20666
|
-
return endpoint.setSendLibrary(signer, oftConfig, sendLibraryProgram, dstEid);
|
|
20667
|
-
}
|
|
20668
|
-
async function createSetReceiveLibraryIx(signer, oftConfig, receiveLibraryProgram, dstEid, gracePeriod, endpointProgram = PROGRAM_ID) {
|
|
20669
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20670
|
-
return endpoint.setReceiveLibrary(
|
|
20671
|
-
signer,
|
|
20672
|
-
oftConfig,
|
|
20673
|
-
receiveLibraryProgram,
|
|
20674
|
-
dstEid,
|
|
20675
|
-
parseInt(gracePeriod.toString())
|
|
20676
|
-
);
|
|
20677
|
-
}
|
|
20678
|
-
async function createMintToIx(oftProgramId, signer, tokenMint, tokenDest, amount, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20679
|
-
const [oftConfig] = new OftPDADeriver(oftProgramId).oftConfig(tokenMint);
|
|
20680
|
-
return instructions_exports7.createMintToInstruction(
|
|
20681
|
-
{
|
|
20682
|
-
minter: signer,
|
|
20683
|
-
oftConfig,
|
|
20684
|
-
tokenDest,
|
|
20685
|
-
tokenMint,
|
|
20686
|
-
tokenProgram
|
|
20687
|
-
},
|
|
20688
|
-
{
|
|
20689
|
-
params: {
|
|
20690
|
-
amount: new BN__default.default(amount.toString())
|
|
20691
|
-
}
|
|
20692
|
-
},
|
|
20693
|
-
oftProgramId
|
|
20694
|
-
);
|
|
20695
|
-
}
|
|
20696
|
-
async function createSetRateLimitIx(oftProgramId, signer, oftConfig, dstEid, capacity, refillPerSecond, enabled) {
|
|
20697
|
-
const [peer] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
|
|
20698
|
-
return instructions_exports7.createSetRateLimitInstruction(
|
|
20699
|
-
{
|
|
20700
|
-
admin: signer,
|
|
20701
|
-
peer,
|
|
20702
|
-
oftConfig
|
|
20703
|
-
},
|
|
20704
|
-
{
|
|
20705
|
-
params: {
|
|
20706
|
-
dstEid,
|
|
20707
|
-
capacity: new BN__default.default(capacity.toString()),
|
|
20708
|
-
refillPerSecond: new BN__default.default(refillPerSecond.toString()),
|
|
20709
|
-
enabled
|
|
20710
|
-
}
|
|
20711
|
-
},
|
|
20712
|
-
oftProgramId
|
|
20713
|
-
);
|
|
20714
|
-
}
|
|
20715
|
-
async function createInitConfigIx(signer, oftConfig, dstEid, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID) {
|
|
20716
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20717
|
-
let msgLib;
|
|
20718
|
-
if (msgLibProgram.toBase58() === simple_message_lib_exports.PROGRAM_ID.toBase58()) {
|
|
20719
|
-
msgLib = new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
|
|
20720
|
-
} else {
|
|
20721
|
-
msgLib = new Uln(msgLibProgram);
|
|
20722
|
-
}
|
|
20723
|
-
return endpoint.initOappConfig(signer, msgLib, signer, oftConfig, dstEid);
|
|
20724
|
-
}
|
|
20725
|
-
async function createSetConfigIx(connection, signer, oftConfig, dstEid, configType, config, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID) {
|
|
20726
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20727
|
-
return endpoint.setOappConfig(connection, signer, oftConfig, msgLibProgram, dstEid, { configType, value: config });
|
|
20728
|
-
}
|
|
20729
|
-
async function createSetEnforcedOptionsIx(oftProgramId, admin, oftConfig, dstEid, sendOptions, sendAndCallOptions) {
|
|
20730
|
-
const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftConfig, dstEid);
|
|
20731
|
-
return instructions_exports7.createSetEnforcedOptionsInstruction(
|
|
20732
|
-
{
|
|
20733
|
-
admin,
|
|
20734
|
-
enforcedOptions,
|
|
20735
|
-
oftConfig
|
|
20736
|
-
},
|
|
20737
|
-
{
|
|
20738
|
-
params: {
|
|
20739
|
-
dstEid,
|
|
20740
|
-
send: sendOptions,
|
|
20741
|
-
sendAndCall: sendAndCallOptions
|
|
20742
|
-
}
|
|
20743
|
-
},
|
|
20744
|
-
oftProgramId
|
|
20745
|
-
);
|
|
20746
|
-
}
|
|
20747
|
-
async function createTransferAdminIx(oftProgramId, signer, oftConfig, newAdmin) {
|
|
20748
|
-
return instructions_exports7.createTransferAdminInstruction(
|
|
20749
|
-
{
|
|
20750
|
-
admin: signer,
|
|
20751
|
-
oftConfig
|
|
20752
|
-
},
|
|
20753
|
-
{
|
|
20754
|
-
params: {
|
|
20755
|
-
admin: newAdmin
|
|
20756
|
-
}
|
|
20757
|
-
},
|
|
20758
|
-
oftProgramId
|
|
20759
|
-
);
|
|
20760
|
-
}
|
|
20761
|
-
async function sendWithUln(connection, oftProgramId, payer, tokenMint, tokenSource, dstEid, amountLd, minAmountLd, options, to, nativeFee, lzTokenFee, tokenEscrow, composeMsg, peerAddr, remainingAccounts, endpointProgram = PROGRAM_ID, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20762
|
-
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20763
|
-
return oft.send(
|
|
20764
|
-
connection,
|
|
20765
|
-
payer,
|
|
20766
|
-
tokenSource,
|
|
20767
|
-
to,
|
|
20768
|
-
dstEid,
|
|
20769
|
-
amountLd,
|
|
20770
|
-
minAmountLd,
|
|
20771
|
-
{
|
|
20772
|
-
nativeFee: new BN__default.default(nativeFee.toString()),
|
|
20773
|
-
lzTokenFee: new BN__default.default(lzTokenFee !== void 0 ? lzTokenFee.toString() : 0)
|
|
20774
|
-
},
|
|
20775
|
-
options,
|
|
20776
|
-
composeMsg,
|
|
20777
|
-
peerAddr,
|
|
20778
|
-
remainingAccounts
|
|
20779
|
-
);
|
|
20780
|
-
}
|
|
20781
|
-
async function createInitNonceIx(delegate, dstEid, oftInstance, remoteOappAddr, endpointProgram = PROGRAM_ID) {
|
|
20782
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20783
|
-
return endpoint.initOAppNonceWithoutChecks(delegate, dstEid, oftInstance, remoteOappAddr);
|
|
20784
|
-
}
|
|
20785
|
-
async function quoteOft(connection, oftProgramId, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, payInLzToken = false, tokenEscrow, composeMsg, tokenProgram = splToken.TOKEN_PROGRAM_ID, endpointProgram = PROGRAM_ID) {
|
|
20786
|
-
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20787
|
-
const oftInstance = oft.getOftConfig();
|
|
20788
|
-
const [peer] = oft.deriver.peer(oftInstance, dstEid);
|
|
20789
|
-
const ix = instructions_exports7.createQuoteOftInstruction(
|
|
20790
|
-
{
|
|
20791
|
-
oftConfig: oftInstance,
|
|
20792
|
-
peer,
|
|
20793
|
-
tokenMint
|
|
20794
|
-
},
|
|
20795
|
-
{
|
|
20796
|
-
params: {
|
|
20797
|
-
dstEid,
|
|
20798
|
-
to,
|
|
20799
|
-
amountLd: new BN__default.default(amountLd.toString()),
|
|
20800
|
-
minAmountLd: new BN__default.default(minAmountLd.toString()),
|
|
20801
|
-
options,
|
|
20802
|
-
payInLzToken,
|
|
20803
|
-
composeMsg: composeMsg ?? null
|
|
20804
|
-
}
|
|
20805
|
-
},
|
|
20806
|
-
oftProgramId
|
|
20807
|
-
);
|
|
20808
|
-
const returnedValues = await simulateTransaction(connection, [ix], ix.programId, payer, "confirmed");
|
|
20809
|
-
const [resultInBeet] = types_exports7.quoteOftResultBeet.deserialize(returnedValues, 0);
|
|
20810
|
-
return {
|
|
20811
|
-
oftLimits: {
|
|
20812
|
-
minAmountLd: BigInt(resultInBeet.oftLimits.minAmountLd.toString()),
|
|
20813
|
-
maxAmountLd: BigInt(resultInBeet.oftLimits.maxAmountLd.toString())
|
|
20814
|
-
},
|
|
20815
|
-
oftFeeDetails: resultInBeet.oftFeeDetails.map((fee) => ({
|
|
20816
|
-
feeAmountLd: BigInt(fee.feeAmountLd.toString()),
|
|
20817
|
-
description: fee.description
|
|
20818
|
-
})),
|
|
20819
|
-
oftReceipt: {
|
|
20820
|
-
amountSentLd: BigInt(resultInBeet.oftReceipt.amountSentLd.toString()),
|
|
20821
|
-
amountReceivedLd: BigInt(resultInBeet.oftReceipt.amountReceivedLd.toString())
|
|
20822
|
-
}
|
|
20823
|
-
};
|
|
20824
|
-
}
|
|
20825
|
-
async function quoteWithUln(connection, oftProgramId, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, payInLzToken = false, tokenEscrow, composeMsg, peerAddr, remainingAccounts, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20826
|
-
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20827
|
-
const oftInstance = oft.getOftConfig();
|
|
20828
|
-
const [enforcedOptions] = oft.deriver.enforcedOptions(oftInstance, dstEid);
|
|
20829
|
-
const [peer] = oft.deriver.peer(oftInstance, dstEid);
|
|
20830
|
-
if (peerAddr === void 0) {
|
|
20831
|
-
const peerInfo = await accounts_exports7.Peer.fromAccountAddress(connection, peer);
|
|
20832
|
-
peerAddr = peerInfo.address;
|
|
20833
|
-
}
|
|
20834
|
-
const messageLib = new Uln(msgLibProgram);
|
|
20835
|
-
const endpoint = new Endpoint(endpointProgram);
|
|
20836
|
-
const ix = instructions_exports7.createQuoteInstruction(
|
|
20837
|
-
{
|
|
20838
|
-
oftConfig: oftInstance,
|
|
20839
|
-
peer,
|
|
20840
|
-
enforcedOptions,
|
|
20841
|
-
tokenMint,
|
|
20842
|
-
anchorRemainingAccounts: remainingAccounts ?? await endpoint.getQuoteIXAccountMetaForCPI(
|
|
20843
|
-
connection,
|
|
20844
|
-
payer,
|
|
20845
|
-
{
|
|
20846
|
-
srcEid: SOLANA_EID,
|
|
20847
|
-
sender: bytes.hexlify(oftInstance.toBytes()),
|
|
20848
|
-
dstEid,
|
|
20849
|
-
receiver: bytes.hexlify(peerAddr)
|
|
20850
|
-
},
|
|
20851
|
-
messageLib
|
|
20852
|
-
)
|
|
20853
|
-
},
|
|
20854
|
-
{
|
|
20855
|
-
params: {
|
|
20856
|
-
dstEid,
|
|
20857
|
-
to,
|
|
20858
|
-
amountLd: new BN__default.default(amountLd.toString()),
|
|
20859
|
-
minAmountLd: new BN__default.default(minAmountLd.toString()),
|
|
20860
|
-
options,
|
|
20861
|
-
payInLzToken,
|
|
20862
|
-
composeMsg: composeMsg ?? null
|
|
20863
|
-
}
|
|
20864
|
-
},
|
|
20865
|
-
oftProgramId
|
|
20866
|
-
);
|
|
20867
|
-
const modifyComputeUnits = web314.ComputeBudgetProgram.setComputeUnitLimit({
|
|
20868
|
-
units: 1e6
|
|
20869
|
-
});
|
|
20870
|
-
const buffer = await simulateTransaction(connection, [modifyComputeUnits, ix], ix.programId, payer, "confirmed");
|
|
20871
|
-
const fee = types_exports.messagingFeeBeet.read(buffer, 0);
|
|
20872
|
-
return { nativeFee: BigInt(fee.nativeFee.toString()), lzTokenFee: BigInt(fee.lzTokenFee.toString()) };
|
|
20873
|
-
}
|
|
20874
|
-
async function createSetMintAuthorityIx(oftProgramId, signer, oftInstance, newAuthority) {
|
|
20875
|
-
return instructions_exports7.createSetMintAuthorityInstruction(
|
|
20876
|
-
{
|
|
20877
|
-
signer,
|
|
20878
|
-
oftConfig: oftInstance
|
|
20879
|
-
},
|
|
20880
|
-
{
|
|
20881
|
-
params: {
|
|
20882
|
-
mintAuthority: newAuthority
|
|
20883
|
-
}
|
|
20884
|
-
},
|
|
20885
|
-
oftProgramId
|
|
20886
|
-
);
|
|
20887
|
-
}
|
|
20888
|
-
async function getEndpointConfig(connection, oftInstance, dstEid, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID) {
|
|
20889
|
-
const endpointDeriver = new EndpointPDADeriver(endpointProgram);
|
|
20890
|
-
const ulnDeriver = new UlnPDADeriver(msgLibProgram);
|
|
20891
|
-
const [sendLib] = endpointDeriver.sendLibraryConfig(oftInstance, dstEid);
|
|
20892
|
-
const [defaultSendLib] = endpointDeriver.defaultSendLibraryConfig(dstEid);
|
|
20893
|
-
const [receiveLib] = endpointDeriver.receiveLibraryConfig(oftInstance, dstEid);
|
|
20894
|
-
const [defaultReceiveLib] = endpointDeriver.defaultReceiveLibraryConfig(dstEid);
|
|
20895
|
-
const [msgLib] = ulnDeriver.messageLib();
|
|
20896
|
-
let sendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, sendLib);
|
|
20897
|
-
let receiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, receiveLib);
|
|
20898
|
-
const defaultSendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, defaultSendLib);
|
|
20899
|
-
const defaultReceiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, defaultReceiveLib);
|
|
20900
|
-
const nil64 = new BN__default.default("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "hex");
|
|
20901
|
-
const nil8 = 255;
|
|
20902
|
-
if (sendLibraryConfig.messageLib.equals(web314.PublicKey.default)) {
|
|
20903
|
-
sendLibraryConfig = defaultSendLibraryConfig;
|
|
20904
|
-
}
|
|
20905
|
-
if (receiveLibraryConfig.messageLib.equals(web314.PublicKey.default)) {
|
|
20906
|
-
receiveLibraryConfig = defaultReceiveLibraryConfig;
|
|
20907
|
-
}
|
|
20908
|
-
if (sendLibraryConfig.messageLib.equals(msgLib)) {
|
|
20909
|
-
const [ulnDefaultSendConfigPDA] = ulnDeriver.defaultSendConfig(dstEid);
|
|
20910
|
-
const [ulnSendConfigPDA] = ulnDeriver.sendConfig(dstEid, oftInstance);
|
|
20911
|
-
const ulnSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(connection, ulnSendConfigPDA);
|
|
20912
|
-
const ulnDefaultSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(
|
|
20913
|
-
connection,
|
|
20914
|
-
ulnDefaultSendConfigPDA
|
|
20915
|
-
);
|
|
20916
|
-
if (nil64.eq(new BN__default.default(ulnSendConfig.uln.confirmations.toString()))) {
|
|
20917
|
-
ulnSendConfig.uln.confirmations = 0;
|
|
20918
|
-
} else if (ulnSendConfig.uln.confirmations == 0) {
|
|
20919
|
-
ulnSendConfig.uln.confirmations = ulnDefaultSendConfig.uln.confirmations;
|
|
20920
|
-
}
|
|
20921
|
-
if (ulnSendConfig.uln.requiredDvnCount == nil8) {
|
|
20922
|
-
ulnSendConfig.uln.requiredDvnCount = 0;
|
|
20923
|
-
} else if (ulnSendConfig.uln.requiredDvnCount == 0) {
|
|
20924
|
-
ulnSendConfig.uln.requiredDvnCount = ulnDefaultSendConfig.uln.requiredDvnCount;
|
|
20925
|
-
ulnSendConfig.uln.requiredDvns = ulnDefaultSendConfig.uln.requiredDvns;
|
|
20926
|
-
}
|
|
20927
|
-
if (ulnSendConfig.uln.optionalDvnCount == nil8) {
|
|
20928
|
-
ulnSendConfig.uln.optionalDvnCount = 0;
|
|
20929
|
-
ulnSendConfig.uln.optionalDvnThreshold = 0;
|
|
20930
|
-
} else if (ulnSendConfig.uln.optionalDvnCount == 0) {
|
|
20931
|
-
ulnSendConfig.uln.optionalDvnCount = ulnDefaultSendConfig.uln.optionalDvnCount;
|
|
20932
|
-
ulnSendConfig.uln.optionalDvnThreshold = ulnDefaultSendConfig.uln.optionalDvnThreshold;
|
|
20933
|
-
ulnSendConfig.uln.optionalDvns = ulnDefaultSendConfig.uln.optionalDvns;
|
|
20934
|
-
}
|
|
20935
|
-
sendLibraryConfig.ulnSendConfig = ulnSendConfig;
|
|
20936
|
-
}
|
|
20937
|
-
if (receiveLibraryConfig.messageLib.equals(msgLib)) {
|
|
20938
|
-
const [ulnDefaultReceiveConfigPDA] = ulnDeriver.defaultReceiveConfig(dstEid);
|
|
20939
|
-
const [ulnReceiveConfigPDA] = ulnDeriver.receiveConfig(dstEid, oftInstance);
|
|
20940
|
-
const ulnReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(connection, ulnReceiveConfigPDA);
|
|
20941
|
-
const ulnDefaultReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(
|
|
20942
|
-
connection,
|
|
20943
|
-
ulnDefaultReceiveConfigPDA
|
|
20944
|
-
);
|
|
20945
|
-
if (nil64.eq(new BN__default.default(ulnReceiveConfig.uln.confirmations.toString()))) {
|
|
20946
|
-
ulnReceiveConfig.uln.confirmations = 0;
|
|
20947
|
-
} else if (ulnReceiveConfig.uln.confirmations == 0) {
|
|
20948
|
-
ulnReceiveConfig.uln.confirmations = ulnDefaultReceiveConfig.uln.confirmations;
|
|
20949
|
-
}
|
|
20950
|
-
if (ulnReceiveConfig.uln.requiredDvnCount == nil8) {
|
|
20951
|
-
ulnReceiveConfig.uln.requiredDvnCount = 0;
|
|
20952
|
-
} else if (ulnReceiveConfig.uln.requiredDvnCount == 0) {
|
|
20953
|
-
ulnReceiveConfig.uln.requiredDvnCount = ulnDefaultReceiveConfig.uln.requiredDvnCount;
|
|
20954
|
-
ulnReceiveConfig.uln.requiredDvns = ulnDefaultReceiveConfig.uln.requiredDvns;
|
|
20955
|
-
}
|
|
20956
|
-
if (ulnReceiveConfig.uln.optionalDvnCount == nil8) {
|
|
20957
|
-
ulnReceiveConfig.uln.optionalDvnCount = 0;
|
|
20958
|
-
ulnReceiveConfig.uln.optionalDvnThreshold = 0;
|
|
20959
|
-
} else if (ulnReceiveConfig.uln.optionalDvnCount == 0) {
|
|
20960
|
-
ulnReceiveConfig.uln.optionalDvnCount = ulnDefaultReceiveConfig.uln.optionalDvnCount;
|
|
20961
|
-
ulnReceiveConfig.uln.optionalDvnThreshold = ulnDefaultReceiveConfig.uln.optionalDvnThreshold;
|
|
20962
|
-
ulnReceiveConfig.uln.optionalDvns = ulnDefaultReceiveConfig.uln.optionalDvns;
|
|
20963
|
-
}
|
|
20964
|
-
receiveLibraryConfig.ulnReceiveConfig = ulnReceiveConfig;
|
|
20965
|
-
}
|
|
20966
|
-
return {
|
|
20967
|
-
sendLibraryConfig,
|
|
20968
|
-
receiveLibraryConfig
|
|
20969
|
-
};
|
|
20970
|
-
}
|
|
20971
|
-
async function getPeerAddress(connection, oftProgramId, oftInstance, dstEid) {
|
|
20972
|
-
const [peer] = new OftPDADeriver(oftProgramId).peer(oftInstance, dstEid);
|
|
20973
|
-
const peerInfo = await accounts_exports7.Peer.fromAccountAddress(connection, peer);
|
|
20974
|
-
return bytes.hexlify(peerInfo.address);
|
|
20975
|
-
}
|
|
20976
|
-
async function getDelegate(connection, oftInstance, endpointProgram = PROGRAM_ID) {
|
|
20977
|
-
const [oAppRegistry] = new EndpointPDADeriver(endpointProgram).oappRegistry(oftInstance);
|
|
20978
|
-
const oAppRegistryInfo = await accounts_exports.OAppRegistry.fromAccountAddress(connection, oAppRegistry);
|
|
20979
|
-
return oAppRegistryInfo.delegate;
|
|
20980
|
-
}
|
|
20981
|
-
async function getEnforcedOptions(connection, oftProgramId, oftInstance, dstEid) {
|
|
20982
|
-
const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftInstance, dstEid);
|
|
20983
|
-
return accounts_exports7.EnforcedOptions.fromAccountAddress(connection, enforcedOptions);
|
|
20984
|
-
}
|
|
20985
|
-
function oappIDPDA(program, seed = COUNT_SEED, id) {
|
|
20986
|
-
if (id != void 0) {
|
|
20987
|
-
return web314.PublicKey.findProgramAddressSync(
|
|
20988
|
-
[Buffer.from(seed, "utf8"), new BN__default.default(id).toArrayLike(Buffer, "be", 1)],
|
|
20989
|
-
program
|
|
20990
|
-
);
|
|
20991
|
-
} else {
|
|
20992
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from(seed, "utf8")], program);
|
|
20993
|
-
}
|
|
20994
|
-
}
|
|
20995
|
-
function deriveLzReceiveTypesAccountsPDA(program, oappId) {
|
|
20996
|
-
if (oappId != void 0) {
|
|
20997
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
|
|
20998
|
-
}
|
|
20999
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8")], program);
|
|
21000
|
-
}
|
|
21001
|
-
function deriveLzComposeTypesAccountsPDA(program, oappId) {
|
|
21002
|
-
if (oappId != void 0) {
|
|
21003
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
|
|
21004
|
-
}
|
|
21005
|
-
return web314.PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8")], program);
|
|
21006
|
-
}
|
|
21007
|
-
var BaseOApp = class {
|
|
21008
|
-
constructor(program) {
|
|
21009
|
-
this.program = program;
|
|
21010
|
-
this.oappBaseDeriver = new OAppBasePDADeriver(program);
|
|
21011
|
-
}
|
|
21012
|
-
async queryIDPDAInfo(connection, commitmentOrConfig) {
|
|
21013
|
-
return this.queryPDAInfo(connection, this.idPDA()[0], commitmentOrConfig);
|
|
21014
|
-
}
|
|
21015
|
-
async queryPDAInfo(connection, pda, commitmentOrConfig) {
|
|
21016
|
-
return connection.getAccountInfo(pda, commitmentOrConfig);
|
|
21017
|
-
}
|
|
21018
|
-
idPDA() {
|
|
21019
|
-
return oappIDPDA(this.program);
|
|
21020
|
-
}
|
|
21021
|
-
async getRemote(connection, dstEid, commitmentOrConfig) {
|
|
21022
|
-
const [remotePDA] = this.oappBaseDeriver.remote(dstEid);
|
|
21023
|
-
const info = await this.queryPDAInfo(connection, remotePDA, commitmentOrConfig);
|
|
21024
|
-
if (info) {
|
|
21025
|
-
const result = AddressType.read(info.data, 8);
|
|
21026
|
-
return Uint8Array.from(result);
|
|
21027
|
-
}
|
|
21028
|
-
return null;
|
|
17947
|
+
return null;
|
|
21029
17948
|
}
|
|
21030
17949
|
};
|
|
21031
17950
|
var idlTypes = [
|
|
@@ -21079,16 +17998,16 @@ var blocked_messagelib_exports = {};
|
|
|
21079
17998
|
__export(blocked_messagelib_exports, {
|
|
21080
17999
|
PROGRAM_ADDRESS: () => PROGRAM_ADDRESS7,
|
|
21081
18000
|
PROGRAM_ID: () => PROGRAM_ID7,
|
|
21082
|
-
createVersionInstruction: () =>
|
|
21083
|
-
createVersionInstructionAccounts: () =>
|
|
21084
|
-
versionInstructionDiscriminator: () =>
|
|
21085
|
-
versionStruct: () =>
|
|
18001
|
+
createVersionInstruction: () => createVersionInstruction3,
|
|
18002
|
+
createVersionInstructionAccounts: () => createVersionInstructionAccounts3,
|
|
18003
|
+
versionInstructionDiscriminator: () => versionInstructionDiscriminator3,
|
|
18004
|
+
versionStruct: () => versionStruct3
|
|
21086
18005
|
});
|
|
21087
|
-
var
|
|
18006
|
+
var versionStruct3 = new beet159__namespace.BeetArgsStruct(
|
|
21088
18007
|
[["instructionDiscriminator", beet159__namespace.uniformFixedSizeArray(beet159__namespace.u8, 8)]],
|
|
21089
18008
|
"VersionInstructionArgs"
|
|
21090
18009
|
);
|
|
21091
|
-
var
|
|
18010
|
+
var versionInstructionDiscriminator3 = [
|
|
21092
18011
|
118,
|
|
21093
18012
|
65,
|
|
21094
18013
|
195,
|
|
@@ -21098,9 +18017,9 @@ var versionInstructionDiscriminator4 = [
|
|
|
21098
18017
|
252,
|
|
21099
18018
|
192
|
|
21100
18019
|
];
|
|
21101
|
-
function
|
|
21102
|
-
const [data] =
|
|
21103
|
-
instructionDiscriminator:
|
|
18020
|
+
function createVersionInstruction3(programId) {
|
|
18021
|
+
const [data] = versionStruct3.serialize({
|
|
18022
|
+
instructionDiscriminator: versionInstructionDiscriminator3
|
|
21104
18023
|
});
|
|
21105
18024
|
const keys = [];
|
|
21106
18025
|
const ix = new web314__namespace.TransactionInstruction({
|
|
@@ -21110,7 +18029,7 @@ function createVersionInstruction4(programId) {
|
|
|
21110
18029
|
});
|
|
21111
18030
|
return ix;
|
|
21112
18031
|
}
|
|
21113
|
-
function
|
|
18032
|
+
function createVersionInstructionAccounts3(programId) {
|
|
21114
18033
|
const keys = [];
|
|
21115
18034
|
return keys;
|
|
21116
18035
|
}
|
|
@@ -21138,7 +18057,7 @@ var SendHelper = class {
|
|
|
21138
18057
|
}
|
|
21139
18058
|
return keys.map((key) => this.accounts.get(key.toBase58()));
|
|
21140
18059
|
}
|
|
21141
|
-
async getQuoteAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig) {
|
|
18060
|
+
async getQuoteAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig = "confirmed") {
|
|
21142
18061
|
const [sendLibConfig] = this.endpoint.deriver.sendLibraryConfig(sender, dstEid);
|
|
21143
18062
|
const [defaultSendLibConfig] = this.endpoint.deriver.defaultSendLibraryConfig(dstEid);
|
|
21144
18063
|
const [simpleMsgLib] = this.simpleMsgLib.deriver.messageLib();
|
|
@@ -21157,7 +18076,7 @@ var SendHelper = class {
|
|
|
21157
18076
|
[sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
|
|
21158
18077
|
commitmentOrConfig
|
|
21159
18078
|
);
|
|
21160
|
-
|
|
18079
|
+
invariant4__default.default(defaultSendLibConfigBuf && sendLibConfigBuf, "endpoint send library not initialized");
|
|
21161
18080
|
const [sendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(sendLibConfigBuf, 0);
|
|
21162
18081
|
const [defaultSendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(
|
|
21163
18082
|
defaultSendLibConfigBuf,
|
|
@@ -21204,7 +18123,7 @@ var SendHelper = class {
|
|
|
21204
18123
|
* @param commitmentOrConfig
|
|
21205
18124
|
* 1 or 3(1+2) RPC calls
|
|
21206
18125
|
* */
|
|
21207
|
-
async getSendAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig) {
|
|
18126
|
+
async getSendAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig = "confirmed") {
|
|
21208
18127
|
const [sendLibConfig] = this.endpoint.deriver.sendLibraryConfig(sender, dstEid);
|
|
21209
18128
|
const [defaultSendLibConfig] = this.endpoint.deriver.defaultSendLibraryConfig(dstEid);
|
|
21210
18129
|
const [simpleMsgLib] = this.simpleMsgLib.deriver.messageLib();
|
|
@@ -21223,7 +18142,7 @@ var SendHelper = class {
|
|
|
21223
18142
|
[sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
|
|
21224
18143
|
commitmentOrConfig
|
|
21225
18144
|
);
|
|
21226
|
-
|
|
18145
|
+
invariant4__default.default(defaultSendLibConfigBuf && sendLibConfigBuf, "endpoint send library not initialized");
|
|
21227
18146
|
const [sendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(sendLibConfigBuf, 0);
|
|
21228
18147
|
const [defaultSendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(
|
|
21229
18148
|
defaultSendLibConfigBuf,
|
|
@@ -21339,7 +18258,7 @@ var SendHelper = class {
|
|
|
21339
18258
|
}
|
|
21340
18259
|
// 2 RPC calls
|
|
21341
18260
|
async getUlnAccounts(connection, payer, ulnInfo, ulnDefaultSendConfigInfo, ulnSendConfigInfo, quoteOrSend, commitment) {
|
|
21342
|
-
|
|
18261
|
+
invariant4__default.default(ulnInfo.accountInfo && ulnDefaultSendConfigInfo.accountInfo, "uln send library not initialized");
|
|
21343
18262
|
const [ulnState] = uln_exports.accounts.UlnSettings.fromAccountInfo(ulnInfo.accountInfo, 0);
|
|
21344
18263
|
const [defaultSendConfigState] = uln_exports.accounts.SendConfig.fromAccountInfo(
|
|
21345
18264
|
ulnDefaultSendConfigInfo.accountInfo,
|
|
@@ -21369,7 +18288,7 @@ var SendHelper = class {
|
|
|
21369
18288
|
[executor.executor, ...dvnsKey],
|
|
21370
18289
|
commitment
|
|
21371
18290
|
);
|
|
21372
|
-
|
|
18291
|
+
invariant4__default.default(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
|
|
21373
18292
|
let executorAccounts, dvnAccounts;
|
|
21374
18293
|
{
|
|
21375
18294
|
const executor2 = {
|
|
@@ -21377,7 +18296,7 @@ var SendHelper = class {
|
|
|
21377
18296
|
owner: executorBuf.owner
|
|
21378
18297
|
};
|
|
21379
18298
|
const dvns = dvnBuf.map((dvn, i) => {
|
|
21380
|
-
|
|
18299
|
+
invariant4__default.default(dvn, `dvn:${dvnsKey[i].toBase58()} not initialized`);
|
|
21381
18300
|
return {
|
|
21382
18301
|
config: accounts_exports3.DvnConfig.fromAccountInfo(dvn)[0],
|
|
21383
18302
|
owner: dvn.owner
|
|
@@ -21389,7 +18308,7 @@ var SendHelper = class {
|
|
|
21389
18308
|
});
|
|
21390
18309
|
const priceFeedInfos = await this.getMultipleAccountsInfo(connection, priceFeeds, commitment);
|
|
21391
18310
|
priceFeedInfos.forEach((info, i) => {
|
|
21392
|
-
|
|
18311
|
+
invariant4__default.default(info, `priceFeed:${priceFeeds[i].toBase58()} not initialized`);
|
|
21393
18312
|
});
|
|
21394
18313
|
executorAccounts = new Executor(executor2.owner).getQuoteIXAccountMetaForCPI(
|
|
21395
18314
|
executor2.config.priceFeed,
|
|
@@ -22989,11 +19908,11 @@ var types = [
|
|
|
22989
19908
|
var IdlTypes = {
|
|
22990
19909
|
endpoint: types
|
|
22991
19910
|
};
|
|
22992
|
-
var SetConfigType2 = /* @__PURE__ */ ((
|
|
22993
|
-
|
|
22994
|
-
|
|
22995
|
-
|
|
22996
|
-
return
|
|
19911
|
+
var SetConfigType2 = /* @__PURE__ */ ((SetConfigType3) => {
|
|
19912
|
+
SetConfigType3[SetConfigType3["EXECUTOR"] = 1] = "EXECUTOR";
|
|
19913
|
+
SetConfigType3[SetConfigType3["SEND_ULN"] = 2] = "SEND_ULN";
|
|
19914
|
+
SetConfigType3[SetConfigType3["RECEIVE_ULN"] = 3] = "RECEIVE_ULN";
|
|
19915
|
+
return SetConfigType3;
|
|
22997
19916
|
})(SetConfigType2 || {});
|
|
22998
19917
|
|
|
22999
19918
|
exports.AddressType = AddressType;
|
|
@@ -23032,11 +19951,7 @@ exports.MessageType = MessageType;
|
|
|
23032
19951
|
exports.NONCE_SEED = NONCE_SEED;
|
|
23033
19952
|
exports.OAPP_SEED = OAPP_SEED;
|
|
23034
19953
|
exports.OAppBasePDADeriver = OAppBasePDADeriver;
|
|
23035
|
-
exports.OFT_SEED = OFT_SEED;
|
|
23036
19954
|
exports.OPTIONS_SEED = OPTIONS_SEED;
|
|
23037
|
-
exports.OftPDADeriver = OftPDADeriver;
|
|
23038
|
-
exports.OftProgram = oft_exports;
|
|
23039
|
-
exports.OftTools = oft_tools_exports;
|
|
23040
19955
|
exports.PAYLOAD_HASH_SEED = PAYLOAD_HASH_SEED;
|
|
23041
19956
|
exports.PEER_SEED = PEER_SEED;
|
|
23042
19957
|
exports.PENDING_NONCE_SEED = PENDING_NONCE_SEED;
|