@layerzerolabs/lz-solana-sdk-v2 2.3.43 → 2.3.45-oft-rc.0

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/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as web314 from '@solana/web3.js';
2
- import { PublicKey, TransactionInstruction, AddressLookupTableProgram, VersionedTransaction, TransactionMessage, Keypair, NONCE_ACCOUNT_LENGTH, Transaction, SystemProgram, NonceAccount, ComputeBudgetProgram } from '@solana/web3.js';
2
+ import { PublicKey, TransactionInstruction, AddressLookupTableProgram, VersionedTransaction, TransactionMessage, Keypair, NONCE_ACCOUNT_LENGTH, Transaction, SystemProgram, NonceAccount } from '@solana/web3.js';
3
3
  import BN from 'bn.js';
4
- import { arrayify, hexlify, hexZeroPad } from '@ethersproject/bytes';
4
+ import { arrayify, hexZeroPad, hexlify } from '@ethersproject/bytes';
5
5
  import { keccak256 } from '@ethersproject/keccak256';
6
- import invariant5 from 'tiny-invariant';
6
+ import invariant4 from 'tiny-invariant';
7
7
  import { getAddress } from '@ethersproject/address';
8
8
  import base58 from 'bs58';
9
9
  import '@ethersproject/abi';
@@ -13,7 +13,6 @@ import * as beet159 from '@metaplex-foundation/beet';
13
13
  import { uniformFixedSizeArray, u8, FixableBeetArgsStruct, u32, u64, bytes, u16, BeetArgsStruct, bool, array } from '@metaplex-foundation/beet';
14
14
  import * as beetSolana85 from '@metaplex-foundation/beet-solana';
15
15
  import * as splToken from '@solana/spl-token';
16
- import { getMintLen, createInitializeMintInstruction, TOKEN_PROGRAM_ID } from '@solana/spl-token';
17
16
  import { Environment, EndpointId } from '@layerzerolabs/lz-definitions';
18
17
  import crypto from 'crypto';
19
18
  import { sha256 } from '@ethersproject/sha2';
@@ -59,7 +58,6 @@ var DVN_CONFIG_SEED = "DvnConfig";
59
58
  var EVENT_SEED = "__event_authority";
60
59
  var EXECUTOR_CONFIG_SEED = "ExecutorConfig";
61
60
  var PRICE_FEED_SEED = "PriceFeed";
62
- var OFT_SEED = "Oft";
63
61
  var PEER_SEED = "Peer";
64
62
  var MINT_SEED = "Mint";
65
63
  var ENFORCED_OPTIONS_SEED = "EnforcedOptions";
@@ -314,35 +312,6 @@ var PriceFeedPDADeriver = class {
314
312
  return PublicKey.findProgramAddressSync([Buffer.from(PRICE_FEED_SEED, "utf8")], this.program);
315
313
  }
316
314
  };
317
- var OftPDADeriver = class {
318
- constructor(program) {
319
- this.program = program;
320
- }
321
- config() {
322
- return PublicKey.findProgramAddressSync([Buffer.from("OftConfig", "utf8")], this.program);
323
- }
324
- enforcedOptions(oftConfig, eid) {
325
- return PublicKey.findProgramAddressSync(
326
- [Buffer.from(ENFORCED_OPTIONS_SEED, "utf8"), oftConfig.toBytes(), new BN(eid).toArrayLike(Buffer, "be", 4)],
327
- this.program
328
- );
329
- }
330
- peer(oftConfig, eid) {
331
- return PublicKey.findProgramAddressSync(
332
- [Buffer.from(PEER_SEED, "utf8"), oftConfig.toBytes(), new BN(eid).toArrayLike(Buffer, "be", 4)],
333
- this.program
334
- );
335
- }
336
- oftConfig(mintOrEscrow) {
337
- return PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED, "utf8"), mintOrEscrow.toBuffer()], this.program);
338
- }
339
- lzReceiveTypesAccounts(oftConfig) {
340
- return PublicKey.findProgramAddressSync(
341
- [Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
342
- this.program
343
- );
344
- }
345
- };
346
315
 
347
316
  // src/endpoint.ts
348
317
  var endpoint_exports = {};
@@ -489,23 +458,6 @@ var PacketV1Codec = class _PacketV1Codec {
489
458
  };
490
459
  }
491
460
  };
492
- var PacketSerializer = class {
493
- static serialize(packet) {
494
- return PacketV1Codec.encode(packet);
495
- }
496
- static serializeBytes(packet) {
497
- return PacketV1Codec.encodeBytes(packet);
498
- }
499
- static deserialize(bytesLike) {
500
- let codec;
501
- if (bytesLike instanceof Uint8Array) {
502
- codec = PacketV1Codec.fromBytes(bytesLike);
503
- } else {
504
- codec = PacketV1Codec.from(bytesLike);
505
- }
506
- return codec.toPacket();
507
- }
508
- };
509
461
 
510
462
  // src/generated/endpoint/accounts/index.ts
511
463
  var accounts_exports = {};
@@ -5893,13 +5845,8 @@ var Endpoint = class {
5893
5845
  /**
5894
5846
  * init endpoint settings, including eid, admin, it also registers the blocked message lib
5895
5847
  */
5896
- async initEndpoint(connection, endpointId, payer, admin, commitmentOrConfig) {
5848
+ initEndpoint(endpointId, payer, admin) {
5897
5849
  const [settingPDA] = this.deriver.setting();
5898
- const initialized = await isAccountInitialized(connection, settingPDA, commitmentOrConfig);
5899
- if (initialized) {
5900
- console.warn("endpoint already initialized");
5901
- return null;
5902
- }
5903
5850
  return createInitEndpointInstruction(
5904
5851
  {
5905
5852
  payer,
@@ -5918,13 +5865,9 @@ var Endpoint = class {
5918
5865
  /***
5919
5866
  * call this function after endpoint initialized. Only admin can call this function.
5920
5867
  */
5921
- async registerLibrary(connection, admin, messageLibProgram, libType = 2 /* SendAndReceive */, commitmentOrConfig) {
5868
+ registerLibrary(admin, messageLibProgram, libType = 2 /* SendAndReceive */) {
5922
5869
  const [msgLibPda] = new MessageLibPDADeriver(messageLibProgram).messageLib();
5923
5870
  const [msgLibInfoPda] = this.deriver.messageLibraryInfo(msgLibPda);
5924
- const info = await connection.getAccountInfo(msgLibInfoPda, commitmentOrConfig);
5925
- if (info) {
5926
- return null;
5927
- }
5928
5871
  const [settingPDA] = this.deriver.setting();
5929
5872
  return createRegisterLibraryInstruction(
5930
5873
  {
@@ -6049,7 +5992,7 @@ var Endpoint = class {
6049
5992
  );
6050
5993
  }
6051
5994
  }
6052
- async initOappConfig(delegate, msgLibSDK, payer, oappID, eid) {
5995
+ initOAppConfig(delegate, msgLibSDK, payer, oappID, eid) {
6053
5996
  const [msgLib] = new MessageLibPDADeriver(msgLibSDK.program).messageLib();
6054
5997
  const [oappRegistry] = this.deriver.oappRegistry(oappID);
6055
5998
  const [msgLibInfo] = this.deriver.messageLibraryInfo(msgLib);
@@ -6060,7 +6003,7 @@ var Endpoint = class {
6060
6003
  messageLib: msgLib,
6061
6004
  messageLibInfo: msgLibInfo,
6062
6005
  messageLibProgram: msgLibSDK.program,
6063
- anchorRemainingAccounts: await msgLibSDK.getInitConfigIXAccountMetaForCPI(payer, oappID, eid)
6006
+ anchorRemainingAccounts: msgLibSDK.getInitConfigIXAccountMetaForCPI(payer, oappID, eid)
6064
6007
  },
6065
6008
  {
6066
6009
  params: {
@@ -6071,15 +6014,7 @@ var Endpoint = class {
6071
6014
  this.program
6072
6015
  );
6073
6016
  }
6074
- async initOAppNonce(connection, delegate, dstEid, oappIDPDA2, remoteOappAddr) {
6075
- const [nonce] = this.deriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
6076
- const info = await connection.getAccountInfo(nonce);
6077
- if (info) {
6078
- return null;
6079
- }
6080
- return this.initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr);
6081
- }
6082
- initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr) {
6017
+ initOAppNonce(delegate, dstEid, oappIDPDA2, remoteOappAddr) {
6083
6018
  const [nonce] = this.deriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
6084
6019
  const [pendingNonce] = this.deriver.pendingNonce(oappIDPDA2, dstEid, remoteOappAddr);
6085
6020
  const [oappRegistry] = this.deriver.oappRegistry(oappIDPDA2);
@@ -6100,15 +6035,7 @@ var Endpoint = class {
6100
6035
  this.program
6101
6036
  );
6102
6037
  }
6103
- async initSendLibrary(connection, delegate, sender, dstEid, commitmentOrConfig) {
6104
- const [sendLibraryConfig] = this.deriver.sendLibraryConfig(sender, dstEid);
6105
- const info = await connection.getAccountInfo(sendLibraryConfig, commitmentOrConfig);
6106
- if (info) {
6107
- return null;
6108
- }
6109
- return this.initSendLibraryWithoutChecks(delegate, sender, dstEid);
6110
- }
6111
- initSendLibraryWithoutChecks(delegate, sender, dstEid) {
6038
+ initSendLibrary(delegate, sender, dstEid) {
6112
6039
  const [oappRegistry] = this.deriver.oappRegistry(sender);
6113
6040
  const [sendLibraryConfig] = this.deriver.sendLibraryConfig(sender, dstEid);
6114
6041
  return createInitSendLibraryInstruction(
@@ -6126,7 +6053,7 @@ var Endpoint = class {
6126
6053
  this.program
6127
6054
  );
6128
6055
  }
6129
- async setSendLibrary(oappAdmin, oappIDPDA2, newSendLibProgram, dstEid) {
6056
+ setSendLibrary(oappAdmin, oappIDPDA2, newSendLibProgram, dstEid) {
6130
6057
  const [newSendLib] = new MessageLibPDADeriver(newSendLibProgram).messageLib();
6131
6058
  const [sendLibraryConfig] = this.deriver.sendLibraryConfig(oappIDPDA2, dstEid);
6132
6059
  const [sendLibraryInfo] = this.deriver.messageLibraryInfo(newSendLib);
@@ -6149,17 +6076,9 @@ var Endpoint = class {
6149
6076
  },
6150
6077
  this.program
6151
6078
  );
6152
- return Promise.resolve(ix);
6153
- }
6154
- async initReceiveLibrary(connection, delegate, receiver, srcEid, commitmentOrConfig) {
6155
- const [receiveLibraryConfig] = this.deriver.receiveLibraryConfig(receiver, srcEid);
6156
- const info = await connection.getAccountInfo(receiveLibraryConfig, commitmentOrConfig);
6157
- if (info) {
6158
- return null;
6159
- }
6160
- return this.initReceiveLibraryWithoutChecks(delegate, receiver, srcEid);
6079
+ return ix;
6161
6080
  }
6162
- initReceiveLibraryWithoutChecks(delegate, receiver, srcEid) {
6081
+ initReceiveLibrary(delegate, receiver, srcEid) {
6163
6082
  const [oappRegistry] = this.deriver.oappRegistry(receiver);
6164
6083
  const [receiveLibraryConfig] = this.deriver.receiveLibraryConfig(receiver, srcEid);
6165
6084
  return createInitReceiveLibraryInstruction(
@@ -6177,7 +6096,7 @@ var Endpoint = class {
6177
6096
  this.program
6178
6097
  );
6179
6098
  }
6180
- async setReceiveLibrary(oappAdmin, oappIDPDA2, newReceiveLibProgram, srcEid, gracePeriod) {
6099
+ setReceiveLibrary(oappAdmin, oappIDPDA2, newReceiveLibProgram, srcEid, gracePeriod) {
6181
6100
  const [newReceiveLib] = new MessageLibPDADeriver(newReceiveLibProgram).messageLib();
6182
6101
  const [receiveLibraryConfig] = this.deriver.receiveLibraryConfig(oappIDPDA2, srcEid);
6183
6102
  const [receiveLibraryInfo] = this.deriver.messageLibraryInfo(newReceiveLib);
@@ -6196,12 +6115,12 @@ var Endpoint = class {
6196
6115
  receiver: oappIDPDA2,
6197
6116
  eid: srcEid,
6198
6117
  newLib: newReceiveLib,
6199
- gracePeriod: gracePeriod ?? 0
6118
+ gracePeriod: gracePeriod === void 0 ? 0 : new BN(gracePeriod.toString())
6200
6119
  }
6201
6120
  },
6202
6121
  this.program
6203
6122
  );
6204
- return Promise.resolve(ix);
6123
+ return ix;
6205
6124
  }
6206
6125
  async setOappConfig(connection, oappDelegate, oappID, msgLibProgram, eid, config, commitment = "confirmed") {
6207
6126
  const [msgLib] = new MessageLibPDADeriver(msgLibProgram).messageLib();
@@ -6723,7 +6642,7 @@ var Endpoint = class {
6723
6642
  * get app configured send library
6724
6643
  * 2 RPC calls
6725
6644
  */
6726
- async getSendLibrary(connection, oappPda, dstEid, commitmentOrConfig) {
6645
+ async getSendLibrary(connection, oappPda, dstEid, commitmentOrConfig = "confirmed") {
6727
6646
  const [sendLibConfig] = this.deriver.sendLibraryConfig(oappPda, dstEid);
6728
6647
  const [defaultSendLibConfig] = this.deriver.defaultSendLibraryConfig(dstEid);
6729
6648
  const [defaultSendLibConfigBuf, sendLibConfigBuf] = await connection.getMultipleAccountsInfo(
@@ -6790,7 +6709,7 @@ var Endpoint = class {
6790
6709
  };
6791
6710
  }
6792
6711
  const messageLibInfo = await connection.getAccountInfo(info.messageLib, commitmentOrConfig);
6793
- invariant5(messageLibInfo, "messageLibInfo should not be null");
6712
+ invariant4(messageLibInfo, "messageLibInfo should not be null");
6794
6713
  const { timeout } = info;
6795
6714
  if (timeout) {
6796
6715
  return {
@@ -8798,12 +8717,8 @@ var SimpleMessageLib = class {
8798
8717
  this.program = program;
8799
8718
  this.deriver = new MessageLibPDADeriver(program);
8800
8719
  }
8801
- async initSimpleMessageLib(connection, endpointProgram, payer, admin, eid, nativeFee, lzTokenFee = 0) {
8720
+ initSimpleMessageLib(endpointProgram, payer, admin, eid, nativeFee, lzTokenFee = 0) {
8802
8721
  const [messageLibPda] = this.deriver.messageLib();
8803
- const info = await connection.getAccountInfo(messageLibPda);
8804
- if (info) {
8805
- return null;
8806
- }
8807
8722
  const [endpointAuth] = new EndpointPDADeriver(endpointProgram).messageLibraryInfo(messageLibPda);
8808
8723
  return createInitMessageLibInstruction(
8809
8724
  {
@@ -8907,7 +8822,7 @@ var SimpleMessageLib = class {
8907
8822
  /***
8908
8823
  * Get the account meta of the send instruction for CPI(Cross-Program Invocation )
8909
8824
  */
8910
- async getInitConfigIXAccountMetaForCPI(payer, oappID, eid) {
8825
+ getInitConfigIXAccountMetaForCPI(payer, oappID, eid) {
8911
8826
  const [sendConfig] = this.deriver.sendConfig(eid, oappID);
8912
8827
  const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
8913
8828
  const [messageLib] = this.deriver.messageLib();
@@ -8927,7 +8842,7 @@ var SimpleMessageLib = class {
8927
8842
  key.isSigner = false;
8928
8843
  }
8929
8844
  });
8930
- return Promise.resolve(keys.slice(1));
8845
+ return keys.slice(1);
8931
8846
  }
8932
8847
  async getSetConfigIXAccountMetaForCPI(endpointProgram, oappID, eid) {
8933
8848
  const [sendConfig] = this.deriver.sendConfig(eid, oappID);
@@ -12777,8 +12692,8 @@ async function extractEventFromTransactionSignature(connection, program, signatu
12777
12692
  }
12778
12693
  const dataBuffer = Buffer.from(decoded.subarray(16, decoded.length));
12779
12694
  if (eventBeet instanceof beet159.FixableBeetArgsStruct) {
12780
- const beet302 = eventBeet.toFixedFromData(dataBuffer, 0);
12781
- events.push(beet302.read(dataBuffer, 0));
12695
+ const beet260 = eventBeet.toFixedFromData(dataBuffer, 0);
12696
+ events.push(beet260.read(dataBuffer, 0));
12782
12697
  } else {
12783
12698
  events.push(eventBeet.read(dataBuffer, 0));
12784
12699
  }
@@ -12924,7 +12839,7 @@ async function simulateTransaction(connection, instructions, programId, payer, c
12924
12839
  }
12925
12840
 
12926
12841
  // src/recevie.ts
12927
- async function lzReceive(connection, payer, packet, callerParams = Uint8Array.from([0, 0]), commitmentOrConfig) {
12842
+ async function lzReceive(connection, payer, packet, callerParams = Uint8Array.from([0, 0]), commitmentOrConfig = "confirmed") {
12928
12843
  const { message: message_, sender, srcEid, guid, receiver: receiver_ } = packet;
12929
12844
  const receiver = new PublicKey(addressToBytes32(receiver_));
12930
12845
  const message = arrayify(message_);
@@ -13348,12 +13263,8 @@ var Executor = class {
13348
13263
  this.deriver = new ExecutorPDADeriver(this.program);
13349
13264
  }
13350
13265
  // owner methods
13351
- async initExecutor(connection, payer, owner, admins, executors, msglibs, priceFeed, commitmentOrConfig) {
13266
+ initExecutor(payer, owner, admins, executors, msglibs, priceFeed) {
13352
13267
  const [configAccount] = this.deriver.config();
13353
- const info = await connection.getAccountInfo(configAccount, commitmentOrConfig);
13354
- if (info) {
13355
- throw new Error("Executor already initialized");
13356
- }
13357
13268
  return createInitExecutorInstruction(
13358
13269
  {
13359
13270
  payer,
@@ -16501,14 +16412,10 @@ var Uln = class {
16501
16412
  const [eventAuthorityPDA] = new EventPDADeriver(program).eventAuthority();
16502
16413
  this.eventAuthorityPDA = eventAuthorityPDA;
16503
16414
  }
16504
- async initUln(connection, payer, admin, endpointProgram, eid, commitmentOrConfig) {
16415
+ initUln(endpointProgram, payer, admin, eid) {
16505
16416
  const [setting] = this.deriver.setting();
16506
16417
  const [msgLib] = this.deriver.messageLib();
16507
16418
  const [endpointAuth] = new EndpointPDADeriver(endpointProgram).messageLibraryInfo(msgLib);
16508
- const info = await connection.getAccountInfo(setting, commitmentOrConfig);
16509
- if (info) {
16510
- throw new Error("uln already initialized");
16511
- }
16512
16419
  return createInitUlnInstruction(
16513
16420
  {
16514
16421
  payer,
@@ -16698,7 +16605,7 @@ var Uln = class {
16698
16605
  });
16699
16606
  const priceFeedInfos = await connection.getMultipleAccountsInfo(priceFeeds, commitment);
16700
16607
  const priceFeedDict = priceFeedInfos.reduce((acc, info, i) => {
16701
- invariant5(info, `priceFeed:${priceFeeds[i].toBase58()} not initialized`);
16608
+ invariant4(info, `priceFeed:${priceFeeds[i].toBase58()} not initialized`);
16702
16609
  acc.set(priceFeeds[i].toBase58(), info.owner);
16703
16610
  return acc;
16704
16611
  }, /* @__PURE__ */ new Map());
@@ -16729,7 +16636,7 @@ var Uln = class {
16729
16636
  [defaultSendConfig, sendConfig],
16730
16637
  commitment
16731
16638
  );
16732
- invariant5(defaultSendConfigBuf, "defaultSendConfig not initialized");
16639
+ invariant4(defaultSendConfigBuf, "defaultSendConfig not initialized");
16733
16640
  const [defaultSendConfigState] = SendConfig.fromAccountInfo(defaultSendConfigBuf);
16734
16641
  let {
16735
16642
  executor,
@@ -16754,14 +16661,14 @@ var Uln = class {
16754
16661
  [executor.executor, ...dvns],
16755
16662
  commitment
16756
16663
  );
16757
- invariant5(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
16664
+ invariant4(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
16758
16665
  return {
16759
16666
  executor: {
16760
16667
  config: accounts_exports4.ExecutorConfig.fromAccountInfo(executorBuf)[0],
16761
16668
  owner: executorBuf.owner
16762
16669
  },
16763
16670
  dvns: dvnBuf.map((dvn, i) => {
16764
- invariant5(dvn, `dvn:${dvns[i].toBase58()} not initialized`);
16671
+ invariant4(dvn, `dvn:${dvns[i].toBase58()} not initialized`);
16765
16672
  return {
16766
16673
  config: accounts_exports3.DvnConfig.fromAccountInfo(dvn)[0],
16767
16674
  owner: dvn.owner
@@ -16925,7 +16832,7 @@ var Uln = class {
16925
16832
  /***
16926
16833
  * Get the account meta of the send instruction for CPI(Cross-Program Invocation )
16927
16834
  */
16928
- async getInitConfigIXAccountMetaForCPI(payer, oappID, eid) {
16835
+ getInitConfigIXAccountMetaForCPI(payer, oappID, eid) {
16929
16836
  const [sendConfig] = this.deriver.sendConfig(eid, oappID);
16930
16837
  const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
16931
16838
  const [setting] = this.deriver.setting();
@@ -16945,7 +16852,7 @@ var Uln = class {
16945
16852
  key.isSigner = false;
16946
16853
  }
16947
16854
  });
16948
- return Promise.resolve(accounts.slice(1));
16855
+ return accounts.slice(1);
16949
16856
  }
16950
16857
  static constructSetConfigData(configType, configData) {
16951
16858
  switch (configType) {
@@ -17031,7 +16938,7 @@ var Uln = class {
17031
16938
  return null;
17032
16939
  }
17033
16940
  }
17034
- async getFinalReceiveConfigState(connection, receiver, eid, commitmentOrConfig) {
16941
+ async getFinalReceiveConfigState(connection, receiver, eid, commitmentOrConfig = "confirmed") {
17035
16942
  const NIL_CONFIRMATIONS = "18446744073709551615";
17036
16943
  const NIL_DVN_COUNT = "255";
17037
16944
  const rtn_config = {
@@ -17965,3039 +17872,50 @@ var PriceFeed2 = class {
17965
17872
  }
17966
17873
  }
17967
17874
  };
17968
-
17969
- // src/oft-tools.ts
17970
- var oft_tools_exports = {};
17971
- __export(oft_tools_exports, {
17972
- SOLANA_EID: () => SOLANA_EID,
17973
- createInitAdapterOftIx: () => createInitAdapterOftIx,
17974
- createInitConfigIx: () => createInitConfigIx,
17975
- createInitNativeOftIx: () => createInitNativeOftIx,
17976
- createInitNonceIx: () => createInitNonceIx,
17977
- createInitReceiveLibraryIx: () => createInitReceiveLibraryIx,
17978
- createInitSendLibraryIx: () => createInitSendLibraryIx,
17979
- createMintToIx: () => createMintToIx,
17980
- createNonceTx: () => createNonceTx,
17981
- createSetConfigIx: () => createSetConfigIx,
17982
- createSetDelegateIx: () => createSetDelegateIx,
17983
- createSetEnforcedOptionsIx: () => createSetEnforcedOptionsIx,
17984
- createSetMintAuthorityIx: () => createSetMintAuthorityIx,
17985
- createSetPeerIx: () => createSetPeerIx,
17986
- createSetRateLimitIx: () => createSetRateLimitIx,
17987
- createSetReceiveLibraryIx: () => createSetReceiveLibraryIx,
17988
- createSetSendLibraryIx: () => createSetSendLibraryIx,
17989
- createTransferAdminIx: () => createTransferAdminIx,
17990
- getDelegate: () => getDelegate,
17991
- getEndpointConfig: () => getEndpointConfig,
17992
- getEnforcedOptions: () => getEnforcedOptions,
17993
- getPeerAddress: () => getPeerAddress,
17994
- quoteOft: () => quoteOft,
17995
- quoteWithUln: () => quoteWithUln,
17996
- sendWithUln: () => sendWithUln
17997
- });
17998
-
17999
- // src/oft.ts
18000
- var oft_exports = {};
18001
- __export(oft_exports, {
18002
- OFT_DECIMALS: () => OFT_DECIMALS,
18003
- Oft: () => Oft,
18004
- accounts: () => accounts_exports7,
18005
- instructions: () => instructions_exports7,
18006
- types: () => types_exports7
18007
- });
18008
-
18009
- // src/generated/oft/accounts/index.ts
18010
- var accounts_exports7 = {};
18011
- __export(accounts_exports7, {
18012
- EnforcedOptions: () => EnforcedOptions,
18013
- LzReceiveTypesAccounts: () => LzReceiveTypesAccounts,
18014
- OftConfig: () => OftConfig,
18015
- Peer: () => Peer,
18016
- accountProviders: () => accountProviders7,
18017
- enforcedOptionsBeet: () => enforcedOptionsBeet,
18018
- enforcedOptionsDiscriminator: () => enforcedOptionsDiscriminator,
18019
- lzReceiveTypesAccountsBeet: () => lzReceiveTypesAccountsBeet,
18020
- lzReceiveTypesAccountsDiscriminator: () => lzReceiveTypesAccountsDiscriminator,
18021
- oftConfigBeet: () => oftConfigBeet,
18022
- oftConfigDiscriminator: () => oftConfigDiscriminator,
18023
- peerBeet: () => peerBeet,
18024
- peerDiscriminator: () => peerDiscriminator
18025
- });
18026
- var enforcedOptionsDiscriminator = [114, 221, 43, 174, 5, 37, 8, 20];
18027
- var EnforcedOptions = class _EnforcedOptions {
18028
- constructor(send, sendAndCall, bump) {
18029
- this.send = send;
18030
- this.sendAndCall = sendAndCall;
18031
- this.bump = bump;
18032
- }
18033
- /**
18034
- * Creates a {@link EnforcedOptions} instance from the provided args.
18035
- */
18036
- static fromArgs(args) {
18037
- return new _EnforcedOptions(args.send, args.sendAndCall, args.bump);
18038
- }
18039
- /**
18040
- * Deserializes the {@link EnforcedOptions} from the data of the provided {@link web3.AccountInfo}.
18041
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18042
- */
18043
- static fromAccountInfo(accountInfo, offset = 0) {
18044
- return _EnforcedOptions.deserialize(accountInfo.data, offset);
18045
- }
18046
- /**
18047
- * Retrieves the account info from the provided address and deserializes
18048
- * the {@link EnforcedOptions} from its data.
18049
- *
18050
- * @throws Error if no account info is found at the address or if deserialization fails
18051
- */
18052
- static async fromAccountAddress(connection, address, commitmentOrConfig) {
18053
- const accountInfo = await connection.getAccountInfo(
18054
- address,
18055
- commitmentOrConfig
17875
+ function oappIDPDA(program, seed = COUNT_SEED, id) {
17876
+ if (id != void 0) {
17877
+ return PublicKey.findProgramAddressSync(
17878
+ [Buffer.from(seed, "utf8"), new BN(id).toArrayLike(Buffer, "be", 1)],
17879
+ program
18056
17880
  );
18057
- if (accountInfo == null) {
18058
- throw new Error(`Unable to find EnforcedOptions account at ${address}`);
18059
- }
18060
- return _EnforcedOptions.fromAccountInfo(accountInfo, 0)[0];
18061
- }
18062
- /**
18063
- * Provides a {@link web3.Connection.getProgramAccounts} config builder,
18064
- * to fetch accounts matching filters that can be specified via that builder.
18065
- *
18066
- * @param programId - the program that owns the accounts we are filtering
18067
- */
18068
- static gpaBuilder(programId) {
18069
- return beetSolana85.GpaBuilder.fromStruct(programId, enforcedOptionsBeet);
18070
- }
18071
- /**
18072
- * Deserializes the {@link EnforcedOptions} from the provided data Buffer.
18073
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18074
- */
18075
- static deserialize(buf, offset = 0) {
18076
- return enforcedOptionsBeet.deserialize(buf, offset);
18077
- }
18078
- /**
18079
- * Serializes the {@link EnforcedOptions} into a Buffer.
18080
- * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
18081
- */
18082
- serialize() {
18083
- return enforcedOptionsBeet.serialize({
18084
- accountDiscriminator: enforcedOptionsDiscriminator,
18085
- ...this
18086
- });
17881
+ } else {
17882
+ return PublicKey.findProgramAddressSync([Buffer.from(seed, "utf8")], program);
18087
17883
  }
18088
- /**
18089
- * Returns the byteSize of a {@link Buffer} holding the serialized data of
18090
- * {@link EnforcedOptions} for the provided args.
18091
- *
18092
- * @param args need to be provided since the byte size for this account
18093
- * depends on them
18094
- */
18095
- static byteSize(args) {
18096
- const instance = _EnforcedOptions.fromArgs(args);
18097
- return enforcedOptionsBeet.toFixedFromValue({
18098
- accountDiscriminator: enforcedOptionsDiscriminator,
18099
- ...instance
18100
- }).byteSize;
17884
+ }
17885
+ function deriveLzReceiveTypesAccountsPDA(program, oappId) {
17886
+ if (oappId != void 0) {
17887
+ return PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
18101
17888
  }
18102
- /**
18103
- * Fetches the minimum balance needed to exempt an account holding
18104
- * {@link EnforcedOptions} data from rent
18105
- *
18106
- * @param args need to be provided since the byte size for this account
18107
- * depends on them
18108
- * @param connection used to retrieve the rent exemption information
18109
- */
18110
- static async getMinimumBalanceForRentExemption(args, connection, commitment) {
18111
- return connection.getMinimumBalanceForRentExemption(
18112
- _EnforcedOptions.byteSize(args),
18113
- commitment
18114
- );
17889
+ return PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8")], program);
17890
+ }
17891
+ function deriveLzComposeTypesAccountsPDA(program, oappId) {
17892
+ if (oappId != void 0) {
17893
+ return PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
18115
17894
  }
18116
- /**
18117
- * Returns a readable version of {@link EnforcedOptions} properties
18118
- * and can be used to convert to JSON and/or logging
18119
- */
18120
- pretty() {
18121
- return {
18122
- send: this.send,
18123
- sendAndCall: this.sendAndCall,
18124
- bump: this.bump
18125
- };
17895
+ return PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8")], program);
17896
+ }
17897
+ var BaseOApp = class {
17898
+ constructor(program) {
17899
+ this.program = program;
17900
+ this.oappBaseDeriver = new OAppBasePDADeriver(program);
18126
17901
  }
18127
- };
18128
- var enforcedOptionsBeet = new beet159.FixableBeetStruct(
18129
- [
18130
- ["accountDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18131
- ["send", beet159.bytes],
18132
- ["sendAndCall", beet159.bytes],
18133
- ["bump", beet159.u8]
18134
- ],
18135
- EnforcedOptions.fromArgs,
18136
- "EnforcedOptions"
18137
- );
18138
- var lzReceiveTypesAccountsDiscriminator = [
18139
- 248,
18140
- 87,
18141
- 167,
18142
- 117,
18143
- 5,
18144
- 251,
18145
- 21,
18146
- 126
18147
- ];
18148
- var LzReceiveTypesAccounts = class _LzReceiveTypesAccounts {
18149
- constructor(oftConfig, tokenMint) {
18150
- this.oftConfig = oftConfig;
18151
- this.tokenMint = tokenMint;
17902
+ async queryIDPDAInfo(connection, commitmentOrConfig) {
17903
+ return this.queryPDAInfo(connection, this.idPDA()[0], commitmentOrConfig);
18152
17904
  }
18153
- /**
18154
- * Creates a {@link LzReceiveTypesAccounts} instance from the provided args.
18155
- */
18156
- static fromArgs(args) {
18157
- return new _LzReceiveTypesAccounts(args.oftConfig, args.tokenMint);
17905
+ async queryPDAInfo(connection, pda, commitmentOrConfig) {
17906
+ return connection.getAccountInfo(pda, commitmentOrConfig);
18158
17907
  }
18159
- /**
18160
- * Deserializes the {@link LzReceiveTypesAccounts} from the data of the provided {@link web3.AccountInfo}.
18161
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18162
- */
18163
- static fromAccountInfo(accountInfo, offset = 0) {
18164
- return _LzReceiveTypesAccounts.deserialize(accountInfo.data, offset);
17908
+ idPDA() {
17909
+ return oappIDPDA(this.program);
18165
17910
  }
18166
- /**
18167
- * Retrieves the account info from the provided address and deserializes
18168
- * the {@link LzReceiveTypesAccounts} from its data.
18169
- *
18170
- * @throws Error if no account info is found at the address or if deserialization fails
18171
- */
18172
- static async fromAccountAddress(connection, address, commitmentOrConfig) {
18173
- const accountInfo = await connection.getAccountInfo(
18174
- address,
18175
- commitmentOrConfig
18176
- );
18177
- if (accountInfo == null) {
18178
- throw new Error(
18179
- `Unable to find LzReceiveTypesAccounts account at ${address}`
18180
- );
17911
+ async getRemote(connection, dstEid, commitmentOrConfig) {
17912
+ const [remotePDA] = this.oappBaseDeriver.remote(dstEid);
17913
+ const info = await this.queryPDAInfo(connection, remotePDA, commitmentOrConfig);
17914
+ if (info) {
17915
+ const result = AddressType.read(info.data, 8);
17916
+ return Uint8Array.from(result);
18181
17917
  }
18182
- return _LzReceiveTypesAccounts.fromAccountInfo(accountInfo, 0)[0];
18183
- }
18184
- /**
18185
- * Provides a {@link web3.Connection.getProgramAccounts} config builder,
18186
- * to fetch accounts matching filters that can be specified via that builder.
18187
- *
18188
- * @param programId - the program that owns the accounts we are filtering
18189
- */
18190
- static gpaBuilder(programId) {
18191
- return beetSolana85.GpaBuilder.fromStruct(
18192
- programId,
18193
- lzReceiveTypesAccountsBeet
18194
- );
18195
- }
18196
- /**
18197
- * Deserializes the {@link LzReceiveTypesAccounts} from the provided data Buffer.
18198
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18199
- */
18200
- static deserialize(buf, offset = 0) {
18201
- return lzReceiveTypesAccountsBeet.deserialize(buf, offset);
18202
- }
18203
- /**
18204
- * Serializes the {@link LzReceiveTypesAccounts} into a Buffer.
18205
- * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
18206
- */
18207
- serialize() {
18208
- return lzReceiveTypesAccountsBeet.serialize({
18209
- accountDiscriminator: lzReceiveTypesAccountsDiscriminator,
18210
- ...this
18211
- });
18212
- }
18213
- /**
18214
- * Returns the byteSize of a {@link Buffer} holding the serialized data of
18215
- * {@link LzReceiveTypesAccounts}
18216
- */
18217
- static get byteSize() {
18218
- return lzReceiveTypesAccountsBeet.byteSize;
18219
- }
18220
- /**
18221
- * Fetches the minimum balance needed to exempt an account holding
18222
- * {@link LzReceiveTypesAccounts} data from rent
18223
- *
18224
- * @param connection used to retrieve the rent exemption information
18225
- */
18226
- static async getMinimumBalanceForRentExemption(connection, commitment) {
18227
- return connection.getMinimumBalanceForRentExemption(
18228
- _LzReceiveTypesAccounts.byteSize,
18229
- commitment
18230
- );
18231
- }
18232
- /**
18233
- * Determines if the provided {@link Buffer} has the correct byte size to
18234
- * hold {@link LzReceiveTypesAccounts} data.
18235
- */
18236
- static hasCorrectByteSize(buf, offset = 0) {
18237
- return buf.byteLength - offset === _LzReceiveTypesAccounts.byteSize;
18238
- }
18239
- /**
18240
- * Returns a readable version of {@link LzReceiveTypesAccounts} properties
18241
- * and can be used to convert to JSON and/or logging
18242
- */
18243
- pretty() {
18244
- return {
18245
- oftConfig: this.oftConfig.toBase58(),
18246
- tokenMint: this.tokenMint.toBase58()
18247
- };
18248
- }
18249
- };
18250
- var lzReceiveTypesAccountsBeet = new beet159.BeetStruct(
18251
- [
18252
- ["accountDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18253
- ["oftConfig", beetSolana85.publicKey],
18254
- ["tokenMint", beetSolana85.publicKey]
18255
- ],
18256
- LzReceiveTypesAccounts.fromArgs,
18257
- "LzReceiveTypesAccounts"
18258
- );
18259
- var isOftConfigExtNative = (x) => x.__kind === "Native";
18260
- var isOftConfigExtAdapter = (x) => x.__kind === "Adapter";
18261
- var oftConfigExtBeet = beet159.dataEnum([
18262
- [
18263
- "Native",
18264
- new beet159.FixableBeetArgsStruct(
18265
- [["fields", beet159.tuple([beet159.coption(beetSolana85.publicKey)])]],
18266
- 'OftConfigExtRecord["Native"]'
18267
- )
18268
- ],
18269
- [
18270
- "Adapter",
18271
- new beet159.BeetArgsStruct(
18272
- [["fields", beet159.fixedSizeTuple([beetSolana85.publicKey])]],
18273
- 'OftConfigExtRecord["Adapter"]'
18274
- )
18275
- ]
18276
- ]);
18277
-
18278
- // src/generated/oft/accounts/OftConfig.ts
18279
- var oftConfigDiscriminator = [50, 97, 89, 128, 99, 15, 107, 27];
18280
- var OftConfig = class _OftConfig {
18281
- constructor(ld2sdRate, tokenMint, tokenProgram, endpointProgram, bump, admin, ext) {
18282
- this.ld2sdRate = ld2sdRate;
18283
- this.tokenMint = tokenMint;
18284
- this.tokenProgram = tokenProgram;
18285
- this.endpointProgram = endpointProgram;
18286
- this.bump = bump;
18287
- this.admin = admin;
18288
- this.ext = ext;
18289
- }
18290
- /**
18291
- * Creates a {@link OftConfig} instance from the provided args.
18292
- */
18293
- static fromArgs(args) {
18294
- return new _OftConfig(
18295
- args.ld2sdRate,
18296
- args.tokenMint,
18297
- args.tokenProgram,
18298
- args.endpointProgram,
18299
- args.bump,
18300
- args.admin,
18301
- args.ext
18302
- );
18303
- }
18304
- /**
18305
- * Deserializes the {@link OftConfig} from the data of the provided {@link web3.AccountInfo}.
18306
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18307
- */
18308
- static fromAccountInfo(accountInfo, offset = 0) {
18309
- return _OftConfig.deserialize(accountInfo.data, offset);
18310
- }
18311
- /**
18312
- * Retrieves the account info from the provided address and deserializes
18313
- * the {@link OftConfig} from its data.
18314
- *
18315
- * @throws Error if no account info is found at the address or if deserialization fails
18316
- */
18317
- static async fromAccountAddress(connection, address, commitmentOrConfig) {
18318
- const accountInfo = await connection.getAccountInfo(
18319
- address,
18320
- commitmentOrConfig
18321
- );
18322
- if (accountInfo == null) {
18323
- throw new Error(`Unable to find OftConfig account at ${address}`);
18324
- }
18325
- return _OftConfig.fromAccountInfo(accountInfo, 0)[0];
18326
- }
18327
- /**
18328
- * Provides a {@link web3.Connection.getProgramAccounts} config builder,
18329
- * to fetch accounts matching filters that can be specified via that builder.
18330
- *
18331
- * @param programId - the program that owns the accounts we are filtering
18332
- */
18333
- static gpaBuilder(programId) {
18334
- return beetSolana85.GpaBuilder.fromStruct(programId, oftConfigBeet);
18335
- }
18336
- /**
18337
- * Deserializes the {@link OftConfig} from the provided data Buffer.
18338
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18339
- */
18340
- static deserialize(buf, offset = 0) {
18341
- return oftConfigBeet.deserialize(buf, offset);
18342
- }
18343
- /**
18344
- * Serializes the {@link OftConfig} into a Buffer.
18345
- * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
18346
- */
18347
- serialize() {
18348
- return oftConfigBeet.serialize({
18349
- accountDiscriminator: oftConfigDiscriminator,
18350
- ...this
18351
- });
18352
- }
18353
- /**
18354
- * Returns the byteSize of a {@link Buffer} holding the serialized data of
18355
- * {@link OftConfig} for the provided args.
18356
- *
18357
- * @param args need to be provided since the byte size for this account
18358
- * depends on them
18359
- */
18360
- static byteSize(args) {
18361
- const instance = _OftConfig.fromArgs(args);
18362
- return oftConfigBeet.toFixedFromValue({
18363
- accountDiscriminator: oftConfigDiscriminator,
18364
- ...instance
18365
- }).byteSize;
18366
- }
18367
- /**
18368
- * Fetches the minimum balance needed to exempt an account holding
18369
- * {@link OftConfig} data from rent
18370
- *
18371
- * @param args need to be provided since the byte size for this account
18372
- * depends on them
18373
- * @param connection used to retrieve the rent exemption information
18374
- */
18375
- static async getMinimumBalanceForRentExemption(args, connection, commitment) {
18376
- return connection.getMinimumBalanceForRentExemption(
18377
- _OftConfig.byteSize(args),
18378
- commitment
18379
- );
18380
- }
18381
- /**
18382
- * Returns a readable version of {@link OftConfig} properties
18383
- * and can be used to convert to JSON and/or logging
18384
- */
18385
- pretty() {
18386
- return {
18387
- ld2sdRate: (() => {
18388
- const x = this.ld2sdRate;
18389
- if (typeof x.toNumber === "function") {
18390
- try {
18391
- return x.toNumber();
18392
- } catch (_) {
18393
- return x;
18394
- }
18395
- }
18396
- return x;
18397
- })(),
18398
- tokenMint: this.tokenMint.toBase58(),
18399
- tokenProgram: this.tokenProgram.toBase58(),
18400
- endpointProgram: this.endpointProgram.toBase58(),
18401
- bump: this.bump,
18402
- admin: this.admin.toBase58(),
18403
- ext: this.ext.__kind
18404
- };
18405
- }
18406
- };
18407
- var oftConfigBeet = new beet159.FixableBeetStruct(
18408
- [
18409
- ["accountDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18410
- ["ld2sdRate", beet159.u64],
18411
- ["tokenMint", beetSolana85.publicKey],
18412
- ["tokenProgram", beetSolana85.publicKey],
18413
- ["endpointProgram", beetSolana85.publicKey],
18414
- ["bump", beet159.u8],
18415
- ["admin", beetSolana85.publicKey],
18416
- ["ext", oftConfigExtBeet]
18417
- ],
18418
- OftConfig.fromArgs,
18419
- "OftConfig"
18420
- );
18421
- var rateLimiterBeet = new beet159.BeetArgsStruct(
18422
- [
18423
- ["capacity", beet159.u64],
18424
- ["tokens", beet159.u64],
18425
- ["refillPerSecond", beet159.u64],
18426
- ["lastRefillTime", beet159.u64]
18427
- ],
18428
- "RateLimiter"
18429
- );
18430
-
18431
- // src/generated/oft/accounts/Peer.ts
18432
- var peerDiscriminator = [50, 8, 19, 55, 40, 253, 37, 58];
18433
- var Peer = class _Peer {
18434
- constructor(address, rateLimiter, bump) {
18435
- this.address = address;
18436
- this.rateLimiter = rateLimiter;
18437
- this.bump = bump;
18438
- }
18439
- /**
18440
- * Creates a {@link Peer} instance from the provided args.
18441
- */
18442
- static fromArgs(args) {
18443
- return new _Peer(args.address, args.rateLimiter, args.bump);
18444
- }
18445
- /**
18446
- * Deserializes the {@link Peer} from the data of the provided {@link web3.AccountInfo}.
18447
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18448
- */
18449
- static fromAccountInfo(accountInfo, offset = 0) {
18450
- return _Peer.deserialize(accountInfo.data, offset);
18451
- }
18452
- /**
18453
- * Retrieves the account info from the provided address and deserializes
18454
- * the {@link Peer} from its data.
18455
- *
18456
- * @throws Error if no account info is found at the address or if deserialization fails
18457
- */
18458
- static async fromAccountAddress(connection, address, commitmentOrConfig) {
18459
- const accountInfo = await connection.getAccountInfo(
18460
- address,
18461
- commitmentOrConfig
18462
- );
18463
- if (accountInfo == null) {
18464
- throw new Error(`Unable to find Peer account at ${address}`);
18465
- }
18466
- return _Peer.fromAccountInfo(accountInfo, 0)[0];
18467
- }
18468
- /**
18469
- * Provides a {@link web3.Connection.getProgramAccounts} config builder,
18470
- * to fetch accounts matching filters that can be specified via that builder.
18471
- *
18472
- * @param programId - the program that owns the accounts we are filtering
18473
- */
18474
- static gpaBuilder(programId) {
18475
- return beetSolana85.GpaBuilder.fromStruct(programId, peerBeet);
18476
- }
18477
- /**
18478
- * Deserializes the {@link Peer} from the provided data Buffer.
18479
- * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
18480
- */
18481
- static deserialize(buf, offset = 0) {
18482
- return peerBeet.deserialize(buf, offset);
18483
- }
18484
- /**
18485
- * Serializes the {@link Peer} into a Buffer.
18486
- * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
18487
- */
18488
- serialize() {
18489
- return peerBeet.serialize({
18490
- accountDiscriminator: peerDiscriminator,
18491
- ...this
18492
- });
18493
- }
18494
- /**
18495
- * Returns the byteSize of a {@link Buffer} holding the serialized data of
18496
- * {@link Peer} for the provided args.
18497
- *
18498
- * @param args need to be provided since the byte size for this account
18499
- * depends on them
18500
- */
18501
- static byteSize(args) {
18502
- const instance = _Peer.fromArgs(args);
18503
- return peerBeet.toFixedFromValue({
18504
- accountDiscriminator: peerDiscriminator,
18505
- ...instance
18506
- }).byteSize;
18507
- }
18508
- /**
18509
- * Fetches the minimum balance needed to exempt an account holding
18510
- * {@link Peer} data from rent
18511
- *
18512
- * @param args need to be provided since the byte size for this account
18513
- * depends on them
18514
- * @param connection used to retrieve the rent exemption information
18515
- */
18516
- static async getMinimumBalanceForRentExemption(args, connection, commitment) {
18517
- return connection.getMinimumBalanceForRentExemption(
18518
- _Peer.byteSize(args),
18519
- commitment
18520
- );
18521
- }
18522
- /**
18523
- * Returns a readable version of {@link Peer} properties
18524
- * and can be used to convert to JSON and/or logging
18525
- */
18526
- pretty() {
18527
- return {
18528
- address: this.address,
18529
- rateLimiter: this.rateLimiter,
18530
- bump: this.bump
18531
- };
18532
- }
18533
- };
18534
- var peerBeet = new beet159.FixableBeetStruct(
18535
- [
18536
- ["accountDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18537
- ["address", beet159.uniformFixedSizeArray(beet159.u8, 32)],
18538
- ["rateLimiter", beet159.coption(rateLimiterBeet)],
18539
- ["bump", beet159.u8]
18540
- ],
18541
- Peer.fromArgs,
18542
- "Peer"
18543
- );
18544
-
18545
- // src/generated/oft/accounts/index.ts
18546
- var accountProviders7 = {
18547
- EnforcedOptions,
18548
- LzReceiveTypesAccounts,
18549
- OftConfig,
18550
- Peer
18551
- };
18552
-
18553
- // src/generated/oft/instructions/index.ts
18554
- var instructions_exports7 = {};
18555
- __export(instructions_exports7, {
18556
- createInitAdapterOftInstruction: () => createInitAdapterOftInstruction,
18557
- createInitAdapterOftInstructionAccounts: () => createInitAdapterOftInstructionAccounts,
18558
- createInitOftInstruction: () => createInitOftInstruction,
18559
- createInitOftInstructionAccounts: () => createInitOftInstructionAccounts,
18560
- createLzReceiveInstruction: () => createLzReceiveInstruction,
18561
- createLzReceiveInstructionAccounts: () => createLzReceiveInstructionAccounts,
18562
- createLzReceiveTypesInstruction: () => createLzReceiveTypesInstruction,
18563
- createLzReceiveTypesInstructionAccounts: () => createLzReceiveTypesInstructionAccounts,
18564
- createMintToInstruction: () => createMintToInstruction,
18565
- createMintToInstructionAccounts: () => createMintToInstructionAccounts,
18566
- createQuoteInstruction: () => createQuoteInstruction4,
18567
- createQuoteInstructionAccounts: () => createQuoteInstructionAccounts4,
18568
- createQuoteOftInstruction: () => createQuoteOftInstruction,
18569
- createQuoteOftInstructionAccounts: () => createQuoteOftInstructionAccounts,
18570
- createSendInstruction: () => createSendInstruction4,
18571
- createSendInstructionAccounts: () => createSendInstructionAccounts4,
18572
- createSetDelegateInstruction: () => createSetDelegateInstruction2,
18573
- createSetDelegateInstructionAccounts: () => createSetDelegateInstructionAccounts2,
18574
- createSetEnforcedOptionsInstruction: () => createSetEnforcedOptionsInstruction,
18575
- createSetEnforcedOptionsInstructionAccounts: () => createSetEnforcedOptionsInstructionAccounts,
18576
- createSetMintAuthorityInstruction: () => createSetMintAuthorityInstruction,
18577
- createSetMintAuthorityInstructionAccounts: () => createSetMintAuthorityInstructionAccounts,
18578
- createSetPeerInstruction: () => createSetPeerInstruction,
18579
- createSetPeerInstructionAccounts: () => createSetPeerInstructionAccounts,
18580
- createSetRateLimitInstruction: () => createSetRateLimitInstruction,
18581
- createSetRateLimitInstructionAccounts: () => createSetRateLimitInstructionAccounts,
18582
- createTransferAdminInstruction: () => createTransferAdminInstruction5,
18583
- createTransferAdminInstructionAccounts: () => createTransferAdminInstructionAccounts5,
18584
- createVersionInstruction: () => createVersionInstruction3,
18585
- createVersionInstructionAccounts: () => createVersionInstructionAccounts3,
18586
- initAdapterOftInstructionDiscriminator: () => initAdapterOftInstructionDiscriminator,
18587
- initAdapterOftStruct: () => initAdapterOftStruct,
18588
- initOftInstructionDiscriminator: () => initOftInstructionDiscriminator,
18589
- initOftStruct: () => initOftStruct,
18590
- lzReceiveInstructionDiscriminator: () => lzReceiveInstructionDiscriminator,
18591
- lzReceiveStruct: () => lzReceiveStruct,
18592
- lzReceiveTypesInstructionDiscriminator: () => lzReceiveTypesInstructionDiscriminator,
18593
- lzReceiveTypesStruct: () => lzReceiveTypesStruct,
18594
- mintToInstructionDiscriminator: () => mintToInstructionDiscriminator,
18595
- mintToStruct: () => mintToStruct,
18596
- quoteInstructionDiscriminator: () => quoteInstructionDiscriminator4,
18597
- quoteOftInstructionDiscriminator: () => quoteOftInstructionDiscriminator,
18598
- quoteOftStruct: () => quoteOftStruct,
18599
- quoteStruct: () => quoteStruct4,
18600
- sendInstructionDiscriminator: () => sendInstructionDiscriminator4,
18601
- sendStruct: () => sendStruct4,
18602
- setDelegateInstructionDiscriminator: () => setDelegateInstructionDiscriminator2,
18603
- setDelegateStruct: () => setDelegateStruct2,
18604
- setEnforcedOptionsInstructionDiscriminator: () => setEnforcedOptionsInstructionDiscriminator,
18605
- setEnforcedOptionsStruct: () => setEnforcedOptionsStruct,
18606
- setMintAuthorityInstructionDiscriminator: () => setMintAuthorityInstructionDiscriminator,
18607
- setMintAuthorityStruct: () => setMintAuthorityStruct,
18608
- setPeerInstructionDiscriminator: () => setPeerInstructionDiscriminator,
18609
- setPeerStruct: () => setPeerStruct,
18610
- setRateLimitInstructionDiscriminator: () => setRateLimitInstructionDiscriminator,
18611
- setRateLimitStruct: () => setRateLimitStruct,
18612
- transferAdminInstructionDiscriminator: () => transferAdminInstructionDiscriminator5,
18613
- transferAdminStruct: () => transferAdminStruct5,
18614
- versionInstructionDiscriminator: () => versionInstructionDiscriminator3,
18615
- versionStruct: () => versionStruct3
18616
- });
18617
- var initAdapterOftParamsBeet = new beet159.FixableBeetArgsStruct(
18618
- [
18619
- ["admin", beetSolana85.publicKey],
18620
- ["sharedDecimals", beet159.u8],
18621
- ["endpointProgram", beet159.coption(beetSolana85.publicKey)]
18622
- ],
18623
- "InitAdapterOftParams"
18624
- );
18625
-
18626
- // src/generated/oft/instructions/initAdapterOft.ts
18627
- var initAdapterOftStruct = new beet159.FixableBeetArgsStruct(
18628
- [
18629
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18630
- ["params", initAdapterOftParamsBeet]
18631
- ],
18632
- "InitAdapterOftInstructionArgs"
18633
- );
18634
- var initAdapterOftInstructionDiscriminator = [
18635
- 92,
18636
- 52,
18637
- 111,
18638
- 30,
18639
- 206,
18640
- 84,
18641
- 108,
18642
- 137
18643
- ];
18644
- function createInitAdapterOftInstruction(accounts, args, programId) {
18645
- const [data] = initAdapterOftStruct.serialize({
18646
- instructionDiscriminator: initAdapterOftInstructionDiscriminator,
18647
- ...args
18648
- });
18649
- const keys = [
18650
- {
18651
- pubkey: accounts.payer,
18652
- isWritable: true,
18653
- isSigner: true
18654
- },
18655
- {
18656
- pubkey: accounts.oftConfig,
18657
- isWritable: true,
18658
- isSigner: false
18659
- },
18660
- {
18661
- pubkey: accounts.lzReceiveTypesAccounts,
18662
- isWritable: true,
18663
- isSigner: false
18664
- },
18665
- {
18666
- pubkey: accounts.tokenMint,
18667
- isWritable: false,
18668
- isSigner: false
18669
- },
18670
- {
18671
- pubkey: accounts.tokenEscrow,
18672
- isWritable: true,
18673
- isSigner: true
18674
- },
18675
- {
18676
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
18677
- isWritable: false,
18678
- isSigner: false
18679
- },
18680
- {
18681
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
18682
- isWritable: false,
18683
- isSigner: false
18684
- }
18685
- ];
18686
- if (accounts.anchorRemainingAccounts != null) {
18687
- for (const acc of accounts.anchorRemainingAccounts) {
18688
- keys.push(acc);
18689
- }
18690
- }
18691
- const ix = new web314.TransactionInstruction({
18692
- programId,
18693
- keys,
18694
- data
18695
- });
18696
- return ix;
18697
- }
18698
- function createInitAdapterOftInstructionAccounts(accounts, programId) {
18699
- const keys = [
18700
- {
18701
- pubkey: accounts.payer,
18702
- isWritable: true,
18703
- isSigner: true
18704
- },
18705
- {
18706
- pubkey: accounts.oftConfig,
18707
- isWritable: true,
18708
- isSigner: false
18709
- },
18710
- {
18711
- pubkey: accounts.lzReceiveTypesAccounts,
18712
- isWritable: true,
18713
- isSigner: false
18714
- },
18715
- {
18716
- pubkey: accounts.tokenMint,
18717
- isWritable: false,
18718
- isSigner: false
18719
- },
18720
- {
18721
- pubkey: accounts.tokenEscrow,
18722
- isWritable: true,
18723
- isSigner: true
18724
- },
18725
- {
18726
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
18727
- isWritable: false,
18728
- isSigner: false
18729
- },
18730
- {
18731
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
18732
- isWritable: false,
18733
- isSigner: false
18734
- }
18735
- ];
18736
- if (accounts.anchorRemainingAccounts != null) {
18737
- for (const acc of accounts.anchorRemainingAccounts) {
18738
- keys.push(acc);
18739
- }
18740
- }
18741
- return keys;
18742
- }
18743
- var initOftParamsBeet = new beet159.FixableBeetArgsStruct(
18744
- [
18745
- ["admin", beetSolana85.publicKey],
18746
- ["sharedDecimals", beet159.u8],
18747
- ["endpointProgram", beet159.coption(beetSolana85.publicKey)],
18748
- ["mintAuthority", beet159.coption(beetSolana85.publicKey)]
18749
- ],
18750
- "InitOftParams"
18751
- );
18752
-
18753
- // src/generated/oft/instructions/initOft.ts
18754
- var initOftStruct = new beet159.FixableBeetArgsStruct(
18755
- [
18756
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18757
- ["params", initOftParamsBeet]
18758
- ],
18759
- "InitOftInstructionArgs"
18760
- );
18761
- var initOftInstructionDiscriminator = [
18762
- 182,
18763
- 169,
18764
- 147,
18765
- 16,
18766
- 201,
18767
- 45,
18768
- 76,
18769
- 23
18770
- ];
18771
- function createInitOftInstruction(accounts, args, programId) {
18772
- const [data] = initOftStruct.serialize({
18773
- instructionDiscriminator: initOftInstructionDiscriminator,
18774
- ...args
18775
- });
18776
- const keys = [
18777
- {
18778
- pubkey: accounts.payer,
18779
- isWritable: true,
18780
- isSigner: true
18781
- },
18782
- {
18783
- pubkey: accounts.oftConfig,
18784
- isWritable: true,
18785
- isSigner: false
18786
- },
18787
- {
18788
- pubkey: accounts.lzReceiveTypesAccounts,
18789
- isWritable: true,
18790
- isSigner: false
18791
- },
18792
- {
18793
- pubkey: accounts.tokenMint,
18794
- isWritable: false,
18795
- isSigner: false
18796
- },
18797
- {
18798
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
18799
- isWritable: false,
18800
- isSigner: false
18801
- },
18802
- {
18803
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
18804
- isWritable: false,
18805
- isSigner: false
18806
- }
18807
- ];
18808
- if (accounts.anchorRemainingAccounts != null) {
18809
- for (const acc of accounts.anchorRemainingAccounts) {
18810
- keys.push(acc);
18811
- }
18812
- }
18813
- const ix = new web314.TransactionInstruction({
18814
- programId,
18815
- keys,
18816
- data
18817
- });
18818
- return ix;
18819
- }
18820
- function createInitOftInstructionAccounts(accounts, programId) {
18821
- const keys = [
18822
- {
18823
- pubkey: accounts.payer,
18824
- isWritable: true,
18825
- isSigner: true
18826
- },
18827
- {
18828
- pubkey: accounts.oftConfig,
18829
- isWritable: true,
18830
- isSigner: false
18831
- },
18832
- {
18833
- pubkey: accounts.lzReceiveTypesAccounts,
18834
- isWritable: true,
18835
- isSigner: false
18836
- },
18837
- {
18838
- pubkey: accounts.tokenMint,
18839
- isWritable: false,
18840
- isSigner: false
18841
- },
18842
- {
18843
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
18844
- isWritable: false,
18845
- isSigner: false
18846
- },
18847
- {
18848
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
18849
- isWritable: false,
18850
- isSigner: false
18851
- }
18852
- ];
18853
- if (accounts.anchorRemainingAccounts != null) {
18854
- for (const acc of accounts.anchorRemainingAccounts) {
18855
- keys.push(acc);
18856
- }
18857
- }
18858
- return keys;
18859
- }
18860
- var lzReceiveParamsBeet2 = new beet159.FixableBeetArgsStruct(
18861
- [
18862
- ["srcEid", beet159.u32],
18863
- ["sender", beet159.uniformFixedSizeArray(beet159.u8, 32)],
18864
- ["nonce", beet159.u64],
18865
- ["guid", beet159.uniformFixedSizeArray(beet159.u8, 32)],
18866
- ["message", beet159.bytes],
18867
- ["extraData", beet159.bytes]
18868
- ],
18869
- "LzReceiveParams"
18870
- );
18871
-
18872
- // src/generated/oft/instructions/lzReceive.ts
18873
- var lzReceiveStruct = new beet159.FixableBeetArgsStruct(
18874
- [
18875
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
18876
- ["params", lzReceiveParamsBeet2]
18877
- ],
18878
- "LzReceiveInstructionArgs"
18879
- );
18880
- var lzReceiveInstructionDiscriminator = [
18881
- 8,
18882
- 179,
18883
- 120,
18884
- 109,
18885
- 33,
18886
- 118,
18887
- 189,
18888
- 80
18889
- ];
18890
- function createLzReceiveInstruction(accounts, args, programId) {
18891
- const [data] = lzReceiveStruct.serialize({
18892
- instructionDiscriminator: lzReceiveInstructionDiscriminator,
18893
- ...args
18894
- });
18895
- const keys = [
18896
- {
18897
- pubkey: accounts.payer,
18898
- isWritable: true,
18899
- isSigner: true
18900
- },
18901
- {
18902
- pubkey: accounts.peer,
18903
- isWritable: true,
18904
- isSigner: false
18905
- },
18906
- {
18907
- pubkey: accounts.oftConfig,
18908
- isWritable: false,
18909
- isSigner: false
18910
- },
18911
- {
18912
- pubkey: accounts.tokenEscrow ?? programId,
18913
- isWritable: accounts.tokenEscrow != null,
18914
- isSigner: false
18915
- },
18916
- {
18917
- pubkey: accounts.toAddress,
18918
- isWritable: false,
18919
- isSigner: false
18920
- },
18921
- {
18922
- pubkey: accounts.tokenDest,
18923
- isWritable: true,
18924
- isSigner: false
18925
- },
18926
- {
18927
- pubkey: accounts.tokenMint,
18928
- isWritable: true,
18929
- isSigner: false
18930
- },
18931
- {
18932
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
18933
- isWritable: false,
18934
- isSigner: false
18935
- },
18936
- {
18937
- pubkey: accounts.associatedTokenProgram,
18938
- isWritable: false,
18939
- isSigner: false
18940
- },
18941
- {
18942
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
18943
- isWritable: false,
18944
- isSigner: false
18945
- },
18946
- {
18947
- pubkey: accounts.eventAuthority,
18948
- isWritable: false,
18949
- isSigner: false
18950
- },
18951
- {
18952
- pubkey: accounts.program,
18953
- isWritable: false,
18954
- isSigner: false
18955
- }
18956
- ];
18957
- if (accounts.anchorRemainingAccounts != null) {
18958
- for (const acc of accounts.anchorRemainingAccounts) {
18959
- keys.push(acc);
18960
- }
18961
- }
18962
- const ix = new web314.TransactionInstruction({
18963
- programId,
18964
- keys,
18965
- data
18966
- });
18967
- return ix;
18968
- }
18969
- function createLzReceiveInstructionAccounts(accounts, programId) {
18970
- const keys = [
18971
- {
18972
- pubkey: accounts.payer,
18973
- isWritable: true,
18974
- isSigner: true
18975
- },
18976
- {
18977
- pubkey: accounts.peer,
18978
- isWritable: true,
18979
- isSigner: false
18980
- },
18981
- {
18982
- pubkey: accounts.oftConfig,
18983
- isWritable: false,
18984
- isSigner: false
18985
- },
18986
- {
18987
- pubkey: accounts.tokenEscrow ?? programId,
18988
- isWritable: accounts.tokenEscrow != null,
18989
- isSigner: false
18990
- },
18991
- {
18992
- pubkey: accounts.toAddress,
18993
- isWritable: false,
18994
- isSigner: false
18995
- },
18996
- {
18997
- pubkey: accounts.tokenDest,
18998
- isWritable: true,
18999
- isSigner: false
19000
- },
19001
- {
19002
- pubkey: accounts.tokenMint,
19003
- isWritable: true,
19004
- isSigner: false
19005
- },
19006
- {
19007
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
19008
- isWritable: false,
19009
- isSigner: false
19010
- },
19011
- {
19012
- pubkey: accounts.associatedTokenProgram,
19013
- isWritable: false,
19014
- isSigner: false
19015
- },
19016
- {
19017
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
19018
- isWritable: false,
19019
- isSigner: false
19020
- },
19021
- {
19022
- pubkey: accounts.eventAuthority,
19023
- isWritable: false,
19024
- isSigner: false
19025
- },
19026
- {
19027
- pubkey: accounts.program,
19028
- isWritable: false,
19029
- isSigner: false
19030
- }
19031
- ];
19032
- if (accounts.anchorRemainingAccounts != null) {
19033
- for (const acc of accounts.anchorRemainingAccounts) {
19034
- keys.push(acc);
19035
- }
19036
- }
19037
- return keys;
19038
- }
19039
- var lzReceiveTypesStruct = new beet159.FixableBeetArgsStruct(
19040
- [
19041
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19042
- ["params", lzReceiveParamsBeet2]
19043
- ],
19044
- "LzReceiveTypesInstructionArgs"
19045
- );
19046
- var lzReceiveTypesInstructionDiscriminator = [
19047
- 221,
19048
- 17,
19049
- 246,
19050
- 159,
19051
- 248,
19052
- 128,
19053
- 31,
19054
- 96
19055
- ];
19056
- function createLzReceiveTypesInstruction(accounts, args, programId) {
19057
- const [data] = lzReceiveTypesStruct.serialize({
19058
- instructionDiscriminator: lzReceiveTypesInstructionDiscriminator,
19059
- ...args
19060
- });
19061
- const keys = [
19062
- {
19063
- pubkey: accounts.oftConfig,
19064
- isWritable: false,
19065
- isSigner: false
19066
- },
19067
- {
19068
- pubkey: accounts.tokenMint,
19069
- isWritable: false,
19070
- isSigner: false
19071
- }
19072
- ];
19073
- if (accounts.anchorRemainingAccounts != null) {
19074
- for (const acc of accounts.anchorRemainingAccounts) {
19075
- keys.push(acc);
19076
- }
19077
- }
19078
- const ix = new web314.TransactionInstruction({
19079
- programId,
19080
- keys,
19081
- data
19082
- });
19083
- return ix;
19084
- }
19085
- function createLzReceiveTypesInstructionAccounts(accounts, programId) {
19086
- const keys = [
19087
- {
19088
- pubkey: accounts.oftConfig,
19089
- isWritable: false,
19090
- isSigner: false
19091
- },
19092
- {
19093
- pubkey: accounts.tokenMint,
19094
- isWritable: false,
19095
- isSigner: false
19096
- }
19097
- ];
19098
- if (accounts.anchorRemainingAccounts != null) {
19099
- for (const acc of accounts.anchorRemainingAccounts) {
19100
- keys.push(acc);
19101
- }
19102
- }
19103
- return keys;
19104
- }
19105
- var mintToParamsBeet = new beet159.BeetArgsStruct(
19106
- [["amount", beet159.u64]],
19107
- "MintToParams"
19108
- );
19109
-
19110
- // src/generated/oft/instructions/mintTo.ts
19111
- var mintToStruct = new beet159.BeetArgsStruct(
19112
- [
19113
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19114
- ["params", mintToParamsBeet]
19115
- ],
19116
- "MintToInstructionArgs"
19117
- );
19118
- var mintToInstructionDiscriminator = [
19119
- 241,
19120
- 34,
19121
- 48,
19122
- 186,
19123
- 37,
19124
- 179,
19125
- 123,
19126
- 192
19127
- ];
19128
- function createMintToInstruction(accounts, args, programId) {
19129
- const [data] = mintToStruct.serialize({
19130
- instructionDiscriminator: mintToInstructionDiscriminator,
19131
- ...args
19132
- });
19133
- const keys = [
19134
- {
19135
- pubkey: accounts.minter,
19136
- isWritable: false,
19137
- isSigner: true
19138
- },
19139
- {
19140
- pubkey: accounts.oftConfig,
19141
- isWritable: false,
19142
- isSigner: false
19143
- },
19144
- {
19145
- pubkey: accounts.tokenDest,
19146
- isWritable: true,
19147
- isSigner: false
19148
- },
19149
- {
19150
- pubkey: accounts.tokenMint,
19151
- isWritable: true,
19152
- isSigner: false
19153
- },
19154
- {
19155
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
19156
- isWritable: false,
19157
- isSigner: false
19158
- }
19159
- ];
19160
- if (accounts.anchorRemainingAccounts != null) {
19161
- for (const acc of accounts.anchorRemainingAccounts) {
19162
- keys.push(acc);
19163
- }
19164
- }
19165
- const ix = new web314.TransactionInstruction({
19166
- programId,
19167
- keys,
19168
- data
19169
- });
19170
- return ix;
19171
- }
19172
- function createMintToInstructionAccounts(accounts, programId) {
19173
- const keys = [
19174
- {
19175
- pubkey: accounts.minter,
19176
- isWritable: false,
19177
- isSigner: true
19178
- },
19179
- {
19180
- pubkey: accounts.oftConfig,
19181
- isWritable: false,
19182
- isSigner: false
19183
- },
19184
- {
19185
- pubkey: accounts.tokenDest,
19186
- isWritable: true,
19187
- isSigner: false
19188
- },
19189
- {
19190
- pubkey: accounts.tokenMint,
19191
- isWritable: true,
19192
- isSigner: false
19193
- },
19194
- {
19195
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
19196
- isWritable: false,
19197
- isSigner: false
19198
- }
19199
- ];
19200
- if (accounts.anchorRemainingAccounts != null) {
19201
- for (const acc of accounts.anchorRemainingAccounts) {
19202
- keys.push(acc);
19203
- }
19204
- }
19205
- return keys;
19206
- }
19207
- var quoteParamsBeet4 = new beet159.FixableBeetArgsStruct(
19208
- [
19209
- ["dstEid", beet159.u32],
19210
- ["to", beet159.uniformFixedSizeArray(beet159.u8, 32)],
19211
- ["amountLd", beet159.u64],
19212
- ["minAmountLd", beet159.u64],
19213
- ["options", beet159.bytes],
19214
- ["composeMsg", beet159.coption(beet159.bytes)],
19215
- ["payInLzToken", beet159.bool]
19216
- ],
19217
- "QuoteParams"
19218
- );
19219
-
19220
- // src/generated/oft/instructions/quote.ts
19221
- var quoteStruct4 = new beet159.FixableBeetArgsStruct(
19222
- [
19223
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19224
- ["params", quoteParamsBeet4]
19225
- ],
19226
- "QuoteInstructionArgs"
19227
- );
19228
- var quoteInstructionDiscriminator4 = [
19229
- 149,
19230
- 42,
19231
- 109,
19232
- 247,
19233
- 134,
19234
- 146,
19235
- 213,
19236
- 123
19237
- ];
19238
- function createQuoteInstruction4(accounts, args, programId) {
19239
- const [data] = quoteStruct4.serialize({
19240
- instructionDiscriminator: quoteInstructionDiscriminator4,
19241
- ...args
19242
- });
19243
- const keys = [
19244
- {
19245
- pubkey: accounts.oftConfig,
19246
- isWritable: false,
19247
- isSigner: false
19248
- },
19249
- {
19250
- pubkey: accounts.peer,
19251
- isWritable: false,
19252
- isSigner: false
19253
- },
19254
- {
19255
- pubkey: accounts.enforcedOptions,
19256
- isWritable: false,
19257
- isSigner: false
19258
- },
19259
- {
19260
- pubkey: accounts.tokenMint,
19261
- isWritable: false,
19262
- isSigner: false
19263
- }
19264
- ];
19265
- if (accounts.anchorRemainingAccounts != null) {
19266
- for (const acc of accounts.anchorRemainingAccounts) {
19267
- keys.push(acc);
19268
- }
19269
- }
19270
- const ix = new web314.TransactionInstruction({
19271
- programId,
19272
- keys,
19273
- data
19274
- });
19275
- return ix;
19276
- }
19277
- function createQuoteInstructionAccounts4(accounts, programId) {
19278
- const keys = [
19279
- {
19280
- pubkey: accounts.oftConfig,
19281
- isWritable: false,
19282
- isSigner: false
19283
- },
19284
- {
19285
- pubkey: accounts.peer,
19286
- isWritable: false,
19287
- isSigner: false
19288
- },
19289
- {
19290
- pubkey: accounts.enforcedOptions,
19291
- isWritable: false,
19292
- isSigner: false
19293
- },
19294
- {
19295
- pubkey: accounts.tokenMint,
19296
- isWritable: false,
19297
- isSigner: false
19298
- }
19299
- ];
19300
- if (accounts.anchorRemainingAccounts != null) {
19301
- for (const acc of accounts.anchorRemainingAccounts) {
19302
- keys.push(acc);
19303
- }
19304
- }
19305
- return keys;
19306
- }
19307
- var quoteOftParamsBeet = new beet159.FixableBeetArgsStruct(
19308
- [
19309
- ["dstEid", beet159.u32],
19310
- ["to", beet159.uniformFixedSizeArray(beet159.u8, 32)],
19311
- ["amountLd", beet159.u64],
19312
- ["minAmountLd", beet159.u64],
19313
- ["options", beet159.bytes],
19314
- ["composeMsg", beet159.coption(beet159.bytes)],
19315
- ["payInLzToken", beet159.bool]
19316
- ],
19317
- "QuoteOftParams"
19318
- );
19319
-
19320
- // src/generated/oft/instructions/quoteOft.ts
19321
- var quoteOftStruct = new beet159.FixableBeetArgsStruct(
19322
- [
19323
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19324
- ["params", quoteOftParamsBeet]
19325
- ],
19326
- "QuoteOftInstructionArgs"
19327
- );
19328
- var quoteOftInstructionDiscriminator = [
19329
- 179,
19330
- 255,
19331
- 92,
19332
- 202,
19333
- 251,
19334
- 82,
19335
- 82,
19336
- 118
19337
- ];
19338
- function createQuoteOftInstruction(accounts, args, programId) {
19339
- const [data] = quoteOftStruct.serialize({
19340
- instructionDiscriminator: quoteOftInstructionDiscriminator,
19341
- ...args
19342
- });
19343
- const keys = [
19344
- {
19345
- pubkey: accounts.oftConfig,
19346
- isWritable: false,
19347
- isSigner: false
19348
- },
19349
- {
19350
- pubkey: accounts.peer,
19351
- isWritable: false,
19352
- isSigner: false
19353
- },
19354
- {
19355
- pubkey: accounts.tokenMint,
19356
- isWritable: false,
19357
- isSigner: false
19358
- }
19359
- ];
19360
- if (accounts.anchorRemainingAccounts != null) {
19361
- for (const acc of accounts.anchorRemainingAccounts) {
19362
- keys.push(acc);
19363
- }
19364
- }
19365
- const ix = new web314.TransactionInstruction({
19366
- programId,
19367
- keys,
19368
- data
19369
- });
19370
- return ix;
19371
- }
19372
- function createQuoteOftInstructionAccounts(accounts, programId) {
19373
- const keys = [
19374
- {
19375
- pubkey: accounts.oftConfig,
19376
- isWritable: false,
19377
- isSigner: false
19378
- },
19379
- {
19380
- pubkey: accounts.peer,
19381
- isWritable: false,
19382
- isSigner: false
19383
- },
19384
- {
19385
- pubkey: accounts.tokenMint,
19386
- isWritable: false,
19387
- isSigner: false
19388
- }
19389
- ];
19390
- if (accounts.anchorRemainingAccounts != null) {
19391
- for (const acc of accounts.anchorRemainingAccounts) {
19392
- keys.push(acc);
19393
- }
19394
- }
19395
- return keys;
19396
- }
19397
- var sendParamsBeet4 = new beet159.FixableBeetArgsStruct(
19398
- [
19399
- ["dstEid", beet159.u32],
19400
- ["to", beet159.uniformFixedSizeArray(beet159.u8, 32)],
19401
- ["amountLd", beet159.u64],
19402
- ["minAmountLd", beet159.u64],
19403
- ["options", beet159.bytes],
19404
- ["composeMsg", beet159.coption(beet159.bytes)],
19405
- ["nativeFee", beet159.u64],
19406
- ["lzTokenFee", beet159.u64]
19407
- ],
19408
- "SendParams"
19409
- );
19410
-
19411
- // src/generated/oft/instructions/send.ts
19412
- var sendStruct4 = new beet159.FixableBeetArgsStruct(
19413
- [
19414
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19415
- ["params", sendParamsBeet4]
19416
- ],
19417
- "SendInstructionArgs"
19418
- );
19419
- var sendInstructionDiscriminator4 = [102, 251, 20, 187, 65, 75, 12, 69];
19420
- function createSendInstruction4(accounts, args, programId) {
19421
- const [data] = sendStruct4.serialize({
19422
- instructionDiscriminator: sendInstructionDiscriminator4,
19423
- ...args
19424
- });
19425
- const keys = [
19426
- {
19427
- pubkey: accounts.signer,
19428
- isWritable: false,
19429
- isSigner: true
19430
- },
19431
- {
19432
- pubkey: accounts.peer,
19433
- isWritable: true,
19434
- isSigner: false
19435
- },
19436
- {
19437
- pubkey: accounts.enforcedOptions,
19438
- isWritable: false,
19439
- isSigner: false
19440
- },
19441
- {
19442
- pubkey: accounts.oftConfig,
19443
- isWritable: false,
19444
- isSigner: false
19445
- },
19446
- {
19447
- pubkey: accounts.tokenSource,
19448
- isWritable: true,
19449
- isSigner: false
19450
- },
19451
- {
19452
- pubkey: accounts.tokenEscrow ?? programId,
19453
- isWritable: accounts.tokenEscrow != null,
19454
- isSigner: false
19455
- },
19456
- {
19457
- pubkey: accounts.tokenMint,
19458
- isWritable: true,
19459
- isSigner: false
19460
- },
19461
- {
19462
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
19463
- isWritable: false,
19464
- isSigner: false
19465
- },
19466
- {
19467
- pubkey: accounts.eventAuthority,
19468
- isWritable: false,
19469
- isSigner: false
19470
- },
19471
- {
19472
- pubkey: accounts.program,
19473
- isWritable: false,
19474
- isSigner: false
19475
- }
19476
- ];
19477
- if (accounts.anchorRemainingAccounts != null) {
19478
- for (const acc of accounts.anchorRemainingAccounts) {
19479
- keys.push(acc);
19480
- }
19481
- }
19482
- const ix = new web314.TransactionInstruction({
19483
- programId,
19484
- keys,
19485
- data
19486
- });
19487
- return ix;
19488
- }
19489
- function createSendInstructionAccounts4(accounts, programId) {
19490
- const keys = [
19491
- {
19492
- pubkey: accounts.signer,
19493
- isWritable: false,
19494
- isSigner: true
19495
- },
19496
- {
19497
- pubkey: accounts.peer,
19498
- isWritable: true,
19499
- isSigner: false
19500
- },
19501
- {
19502
- pubkey: accounts.enforcedOptions,
19503
- isWritable: false,
19504
- isSigner: false
19505
- },
19506
- {
19507
- pubkey: accounts.oftConfig,
19508
- isWritable: false,
19509
- isSigner: false
19510
- },
19511
- {
19512
- pubkey: accounts.tokenSource,
19513
- isWritable: true,
19514
- isSigner: false
19515
- },
19516
- {
19517
- pubkey: accounts.tokenEscrow ?? programId,
19518
- isWritable: accounts.tokenEscrow != null,
19519
- isSigner: false
19520
- },
19521
- {
19522
- pubkey: accounts.tokenMint,
19523
- isWritable: true,
19524
- isSigner: false
19525
- },
19526
- {
19527
- pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID,
19528
- isWritable: false,
19529
- isSigner: false
19530
- },
19531
- {
19532
- pubkey: accounts.eventAuthority,
19533
- isWritable: false,
19534
- isSigner: false
19535
- },
19536
- {
19537
- pubkey: accounts.program,
19538
- isWritable: false,
19539
- isSigner: false
19540
- }
19541
- ];
19542
- if (accounts.anchorRemainingAccounts != null) {
19543
- for (const acc of accounts.anchorRemainingAccounts) {
19544
- keys.push(acc);
19545
- }
19546
- }
19547
- return keys;
19548
- }
19549
- var setDelegateParamsBeet2 = new beet159.BeetArgsStruct(
19550
- [["delegate", beetSolana85.publicKey]],
19551
- "SetDelegateParams"
19552
- );
19553
-
19554
- // src/generated/oft/instructions/setDelegate.ts
19555
- var setDelegateStruct2 = new beet159.BeetArgsStruct(
19556
- [
19557
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19558
- ["params", setDelegateParamsBeet2]
19559
- ],
19560
- "SetDelegateInstructionArgs"
19561
- );
19562
- var setDelegateInstructionDiscriminator2 = [
19563
- 242,
19564
- 30,
19565
- 46,
19566
- 76,
19567
- 108,
19568
- 235,
19569
- 128,
19570
- 181
19571
- ];
19572
- function createSetDelegateInstruction2(accounts, args, programId) {
19573
- const [data] = setDelegateStruct2.serialize({
19574
- instructionDiscriminator: setDelegateInstructionDiscriminator2,
19575
- ...args
19576
- });
19577
- const keys = [
19578
- {
19579
- pubkey: accounts.admin,
19580
- isWritable: false,
19581
- isSigner: true
19582
- },
19583
- {
19584
- pubkey: accounts.oftConfig,
19585
- isWritable: false,
19586
- isSigner: false
19587
- }
19588
- ];
19589
- if (accounts.anchorRemainingAccounts != null) {
19590
- for (const acc of accounts.anchorRemainingAccounts) {
19591
- keys.push(acc);
19592
- }
19593
- }
19594
- const ix = new web314.TransactionInstruction({
19595
- programId,
19596
- keys,
19597
- data
19598
- });
19599
- return ix;
19600
- }
19601
- function createSetDelegateInstructionAccounts2(accounts, programId) {
19602
- const keys = [
19603
- {
19604
- pubkey: accounts.admin,
19605
- isWritable: false,
19606
- isSigner: true
19607
- },
19608
- {
19609
- pubkey: accounts.oftConfig,
19610
- isWritable: false,
19611
- isSigner: false
19612
- }
19613
- ];
19614
- if (accounts.anchorRemainingAccounts != null) {
19615
- for (const acc of accounts.anchorRemainingAccounts) {
19616
- keys.push(acc);
19617
- }
19618
- }
19619
- return keys;
19620
- }
19621
- var setEnforcedOptionsParamsBeet = new beet159.FixableBeetArgsStruct(
19622
- [
19623
- ["dstEid", beet159.u32],
19624
- ["send", beet159.bytes],
19625
- ["sendAndCall", beet159.bytes]
19626
- ],
19627
- "SetEnforcedOptionsParams"
19628
- );
19629
-
19630
- // src/generated/oft/instructions/setEnforcedOptions.ts
19631
- var setEnforcedOptionsStruct = new beet159.FixableBeetArgsStruct(
19632
- [
19633
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19634
- ["params", setEnforcedOptionsParamsBeet]
19635
- ],
19636
- "SetEnforcedOptionsInstructionArgs"
19637
- );
19638
- var setEnforcedOptionsInstructionDiscriminator = [
19639
- 232,
19640
- 250,
19641
- 49,
19642
- 125,
19643
- 166,
19644
- 188,
19645
- 118,
19646
- 146
19647
- ];
19648
- function createSetEnforcedOptionsInstruction(accounts, args, programId) {
19649
- const [data] = setEnforcedOptionsStruct.serialize({
19650
- instructionDiscriminator: setEnforcedOptionsInstructionDiscriminator,
19651
- ...args
19652
- });
19653
- const keys = [
19654
- {
19655
- pubkey: accounts.admin,
19656
- isWritable: true,
19657
- isSigner: true
19658
- },
19659
- {
19660
- pubkey: accounts.enforcedOptions,
19661
- isWritable: true,
19662
- isSigner: false
19663
- },
19664
- {
19665
- pubkey: accounts.oftConfig,
19666
- isWritable: false,
19667
- isSigner: false
19668
- },
19669
- {
19670
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
19671
- isWritable: false,
19672
- isSigner: false
19673
- }
19674
- ];
19675
- if (accounts.anchorRemainingAccounts != null) {
19676
- for (const acc of accounts.anchorRemainingAccounts) {
19677
- keys.push(acc);
19678
- }
19679
- }
19680
- const ix = new web314.TransactionInstruction({
19681
- programId,
19682
- keys,
19683
- data
19684
- });
19685
- return ix;
19686
- }
19687
- function createSetEnforcedOptionsInstructionAccounts(accounts, programId) {
19688
- const keys = [
19689
- {
19690
- pubkey: accounts.admin,
19691
- isWritable: true,
19692
- isSigner: true
19693
- },
19694
- {
19695
- pubkey: accounts.enforcedOptions,
19696
- isWritable: true,
19697
- isSigner: false
19698
- },
19699
- {
19700
- pubkey: accounts.oftConfig,
19701
- isWritable: false,
19702
- isSigner: false
19703
- },
19704
- {
19705
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
19706
- isWritable: false,
19707
- isSigner: false
19708
- }
19709
- ];
19710
- if (accounts.anchorRemainingAccounts != null) {
19711
- for (const acc of accounts.anchorRemainingAccounts) {
19712
- keys.push(acc);
19713
- }
19714
- }
19715
- return keys;
19716
- }
19717
- var setMintAuthorityParamsBeet = new beet159.FixableBeetArgsStruct(
19718
- [["mintAuthority", beet159.coption(beetSolana85.publicKey)]],
19719
- "SetMintAuthorityParams"
19720
- );
19721
-
19722
- // src/generated/oft/instructions/setMintAuthority.ts
19723
- var setMintAuthorityStruct = new beet159.FixableBeetArgsStruct(
19724
- [
19725
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19726
- ["params", setMintAuthorityParamsBeet]
19727
- ],
19728
- "SetMintAuthorityInstructionArgs"
19729
- );
19730
- var setMintAuthorityInstructionDiscriminator = [
19731
- 67,
19732
- 127,
19733
- 155,
19734
- 187,
19735
- 100,
19736
- 174,
19737
- 103,
19738
- 121
19739
- ];
19740
- function createSetMintAuthorityInstruction(accounts, args, programId) {
19741
- const [data] = setMintAuthorityStruct.serialize({
19742
- instructionDiscriminator: setMintAuthorityInstructionDiscriminator,
19743
- ...args
19744
- });
19745
- const keys = [
19746
- {
19747
- pubkey: accounts.signer,
19748
- isWritable: false,
19749
- isSigner: true
19750
- },
19751
- {
19752
- pubkey: accounts.oftConfig,
19753
- isWritable: true,
19754
- isSigner: false
19755
- }
19756
- ];
19757
- if (accounts.anchorRemainingAccounts != null) {
19758
- for (const acc of accounts.anchorRemainingAccounts) {
19759
- keys.push(acc);
19760
- }
19761
- }
19762
- const ix = new web314.TransactionInstruction({
19763
- programId,
19764
- keys,
19765
- data
19766
- });
19767
- return ix;
19768
- }
19769
- function createSetMintAuthorityInstructionAccounts(accounts, programId) {
19770
- const keys = [
19771
- {
19772
- pubkey: accounts.signer,
19773
- isWritable: false,
19774
- isSigner: true
19775
- },
19776
- {
19777
- pubkey: accounts.oftConfig,
19778
- isWritable: true,
19779
- isSigner: false
19780
- }
19781
- ];
19782
- if (accounts.anchorRemainingAccounts != null) {
19783
- for (const acc of accounts.anchorRemainingAccounts) {
19784
- keys.push(acc);
19785
- }
19786
- }
19787
- return keys;
19788
- }
19789
- var setPeerParamsBeet = new beet159.BeetArgsStruct(
19790
- [
19791
- ["dstEid", beet159.u32],
19792
- ["peer", beet159.uniformFixedSizeArray(beet159.u8, 32)]
19793
- ],
19794
- "SetPeerParams"
19795
- );
19796
-
19797
- // src/generated/oft/instructions/setPeer.ts
19798
- var setPeerStruct = new beet159.BeetArgsStruct(
19799
- [
19800
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19801
- ["params", setPeerParamsBeet]
19802
- ],
19803
- "SetPeerInstructionArgs"
19804
- );
19805
- var setPeerInstructionDiscriminator = [
19806
- 32,
19807
- 70,
19808
- 184,
19809
- 229,
19810
- 200,
19811
- 115,
19812
- 227,
19813
- 177
19814
- ];
19815
- function createSetPeerInstruction(accounts, args, programId) {
19816
- const [data] = setPeerStruct.serialize({
19817
- instructionDiscriminator: setPeerInstructionDiscriminator,
19818
- ...args
19819
- });
19820
- const keys = [
19821
- {
19822
- pubkey: accounts.admin,
19823
- isWritable: true,
19824
- isSigner: true
19825
- },
19826
- {
19827
- pubkey: accounts.peer,
19828
- isWritable: true,
19829
- isSigner: false
19830
- },
19831
- {
19832
- pubkey: accounts.oftConfig,
19833
- isWritable: false,
19834
- isSigner: false
19835
- },
19836
- {
19837
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
19838
- isWritable: false,
19839
- isSigner: false
19840
- }
19841
- ];
19842
- if (accounts.anchorRemainingAccounts != null) {
19843
- for (const acc of accounts.anchorRemainingAccounts) {
19844
- keys.push(acc);
19845
- }
19846
- }
19847
- const ix = new web314.TransactionInstruction({
19848
- programId,
19849
- keys,
19850
- data
19851
- });
19852
- return ix;
19853
- }
19854
- function createSetPeerInstructionAccounts(accounts, programId) {
19855
- const keys = [
19856
- {
19857
- pubkey: accounts.admin,
19858
- isWritable: true,
19859
- isSigner: true
19860
- },
19861
- {
19862
- pubkey: accounts.peer,
19863
- isWritable: true,
19864
- isSigner: false
19865
- },
19866
- {
19867
- pubkey: accounts.oftConfig,
19868
- isWritable: false,
19869
- isSigner: false
19870
- },
19871
- {
19872
- pubkey: accounts.systemProgram ?? web314.SystemProgram.programId,
19873
- isWritable: false,
19874
- isSigner: false
19875
- }
19876
- ];
19877
- if (accounts.anchorRemainingAccounts != null) {
19878
- for (const acc of accounts.anchorRemainingAccounts) {
19879
- keys.push(acc);
19880
- }
19881
- }
19882
- return keys;
19883
- }
19884
- var setRateLimitParamsBeet = new beet159.FixableBeetArgsStruct(
19885
- [
19886
- ["dstEid", beet159.u32],
19887
- ["refillPerSecond", beet159.coption(beet159.u64)],
19888
- ["capacity", beet159.coption(beet159.u64)],
19889
- ["enabled", beet159.bool]
19890
- ],
19891
- "SetRateLimitParams"
19892
- );
19893
-
19894
- // src/generated/oft/instructions/setRateLimit.ts
19895
- var setRateLimitStruct = new beet159.FixableBeetArgsStruct(
19896
- [
19897
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19898
- ["params", setRateLimitParamsBeet]
19899
- ],
19900
- "SetRateLimitInstructionArgs"
19901
- );
19902
- var setRateLimitInstructionDiscriminator = [
19903
- 42,
19904
- 212,
19905
- 44,
19906
- 91,
19907
- 198,
19908
- 58,
19909
- 60,
19910
- 239
19911
- ];
19912
- function createSetRateLimitInstruction(accounts, args, programId) {
19913
- const [data] = setRateLimitStruct.serialize({
19914
- instructionDiscriminator: setRateLimitInstructionDiscriminator,
19915
- ...args
19916
- });
19917
- const keys = [
19918
- {
19919
- pubkey: accounts.admin,
19920
- isWritable: false,
19921
- isSigner: true
19922
- },
19923
- {
19924
- pubkey: accounts.peer,
19925
- isWritable: true,
19926
- isSigner: false
19927
- },
19928
- {
19929
- pubkey: accounts.oftConfig,
19930
- isWritable: false,
19931
- isSigner: false
19932
- }
19933
- ];
19934
- if (accounts.anchorRemainingAccounts != null) {
19935
- for (const acc of accounts.anchorRemainingAccounts) {
19936
- keys.push(acc);
19937
- }
19938
- }
19939
- const ix = new web314.TransactionInstruction({
19940
- programId,
19941
- keys,
19942
- data
19943
- });
19944
- return ix;
19945
- }
19946
- function createSetRateLimitInstructionAccounts(accounts, programId) {
19947
- const keys = [
19948
- {
19949
- pubkey: accounts.admin,
19950
- isWritable: false,
19951
- isSigner: true
19952
- },
19953
- {
19954
- pubkey: accounts.peer,
19955
- isWritable: true,
19956
- isSigner: false
19957
- },
19958
- {
19959
- pubkey: accounts.oftConfig,
19960
- isWritable: false,
19961
- isSigner: false
19962
- }
19963
- ];
19964
- if (accounts.anchorRemainingAccounts != null) {
19965
- for (const acc of accounts.anchorRemainingAccounts) {
19966
- keys.push(acc);
19967
- }
19968
- }
19969
- return keys;
19970
- }
19971
- var transferAdminParamsBeet5 = new beet159.BeetArgsStruct(
19972
- [["admin", beetSolana85.publicKey]],
19973
- "TransferAdminParams"
19974
- );
19975
-
19976
- // src/generated/oft/instructions/transferAdmin.ts
19977
- var transferAdminStruct5 = new beet159.BeetArgsStruct(
19978
- [
19979
- ["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)],
19980
- ["params", transferAdminParamsBeet5]
19981
- ],
19982
- "TransferAdminInstructionArgs"
19983
- );
19984
- var transferAdminInstructionDiscriminator5 = [
19985
- 42,
19986
- 242,
19987
- 66,
19988
- 106,
19989
- 228,
19990
- 10,
19991
- 111,
19992
- 156
19993
- ];
19994
- function createTransferAdminInstruction5(accounts, args, programId) {
19995
- const [data] = transferAdminStruct5.serialize({
19996
- instructionDiscriminator: transferAdminInstructionDiscriminator5,
19997
- ...args
19998
- });
19999
- const keys = [
20000
- {
20001
- pubkey: accounts.admin,
20002
- isWritable: false,
20003
- isSigner: true
20004
- },
20005
- {
20006
- pubkey: accounts.oftConfig,
20007
- isWritable: true,
20008
- isSigner: false
20009
- }
20010
- ];
20011
- if (accounts.anchorRemainingAccounts != null) {
20012
- for (const acc of accounts.anchorRemainingAccounts) {
20013
- keys.push(acc);
20014
- }
20015
- }
20016
- const ix = new web314.TransactionInstruction({
20017
- programId,
20018
- keys,
20019
- data
20020
- });
20021
- return ix;
20022
- }
20023
- function createTransferAdminInstructionAccounts5(accounts, programId) {
20024
- const keys = [
20025
- {
20026
- pubkey: accounts.admin,
20027
- isWritable: false,
20028
- isSigner: true
20029
- },
20030
- {
20031
- pubkey: accounts.oftConfig,
20032
- isWritable: true,
20033
- isSigner: false
20034
- }
20035
- ];
20036
- if (accounts.anchorRemainingAccounts != null) {
20037
- for (const acc of accounts.anchorRemainingAccounts) {
20038
- keys.push(acc);
20039
- }
20040
- }
20041
- return keys;
20042
- }
20043
- var versionStruct3 = new beet159.BeetArgsStruct(
20044
- [["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)]],
20045
- "VersionInstructionArgs"
20046
- );
20047
- var versionInstructionDiscriminator3 = [
20048
- 118,
20049
- 65,
20050
- 195,
20051
- 198,
20052
- 129,
20053
- 216,
20054
- 252,
20055
- 192
20056
- ];
20057
- function createVersionInstruction3(programId) {
20058
- const [data] = versionStruct3.serialize({
20059
- instructionDiscriminator: versionInstructionDiscriminator3
20060
- });
20061
- const keys = [];
20062
- const ix = new web314.TransactionInstruction({
20063
- programId,
20064
- keys,
20065
- data
20066
- });
20067
- return ix;
20068
- }
20069
- function createVersionInstructionAccounts3(programId) {
20070
- const keys = [];
20071
- return keys;
20072
- }
20073
-
20074
- // src/generated/oft/types/index.ts
20075
- var types_exports7 = {};
20076
- __export(types_exports7, {
20077
- initAdapterOftParamsBeet: () => initAdapterOftParamsBeet,
20078
- initOftParamsBeet: () => initOftParamsBeet,
20079
- isOftConfigExtAdapter: () => isOftConfigExtAdapter,
20080
- isOftConfigExtNative: () => isOftConfigExtNative,
20081
- lzAccountBeet: () => lzAccountBeet,
20082
- lzReceiveParamsBeet: () => lzReceiveParamsBeet2,
20083
- messagingFeeBeet: () => messagingFeeBeet4,
20084
- messagingReceiptBeet: () => messagingReceiptBeet2,
20085
- mintToParamsBeet: () => mintToParamsBeet,
20086
- oFTFeeDetailBeet: () => oFTFeeDetailBeet,
20087
- oFTLimitsBeet: () => oFTLimitsBeet,
20088
- oFTReceiptBeet: () => oFTReceiptBeet,
20089
- oftConfigExtBeet: () => oftConfigExtBeet,
20090
- quoteOftParamsBeet: () => quoteOftParamsBeet,
20091
- quoteOftResultBeet: () => quoteOftResultBeet,
20092
- quoteParamsBeet: () => quoteParamsBeet4,
20093
- rateLimiterBeet: () => rateLimiterBeet,
20094
- sendParamsBeet: () => sendParamsBeet4,
20095
- setDelegateParamsBeet: () => setDelegateParamsBeet2,
20096
- setEnforcedOptionsParamsBeet: () => setEnforcedOptionsParamsBeet,
20097
- setMintAuthorityParamsBeet: () => setMintAuthorityParamsBeet,
20098
- setPeerParamsBeet: () => setPeerParamsBeet,
20099
- setRateLimitParamsBeet: () => setRateLimitParamsBeet,
20100
- transferAdminParamsBeet: () => transferAdminParamsBeet5,
20101
- versionBeet: () => versionBeet3
20102
- });
20103
- var lzAccountBeet = new beet159.BeetArgsStruct(
20104
- [
20105
- ["pubkey", beetSolana85.publicKey],
20106
- ["isSigner", beet159.bool],
20107
- ["isWritable", beet159.bool]
20108
- ],
20109
- "LzAccount"
20110
- );
20111
- var messagingFeeBeet4 = new beet159.BeetArgsStruct(
20112
- [
20113
- ["nativeFee", beet159.u64],
20114
- ["lzTokenFee", beet159.u64]
20115
- ],
20116
- "MessagingFee"
20117
- );
20118
- var messagingReceiptBeet2 = new beet159.BeetArgsStruct(
20119
- [
20120
- ["guid", beet159.uniformFixedSizeArray(beet159.u8, 32)],
20121
- ["nonce", beet159.u64],
20122
- ["fee", messagingFeeBeet4]
20123
- ],
20124
- "MessagingReceipt"
20125
- );
20126
- var oFTFeeDetailBeet = new beet159.FixableBeetArgsStruct(
20127
- [
20128
- ["feeAmountLd", beet159.u64],
20129
- ["description", beet159.utf8String]
20130
- ],
20131
- "OFTFeeDetail"
20132
- );
20133
- var oFTLimitsBeet = new beet159.BeetArgsStruct(
20134
- [
20135
- ["minAmountLd", beet159.u64],
20136
- ["maxAmountLd", beet159.u64]
20137
- ],
20138
- "OFTLimits"
20139
- );
20140
- var oFTReceiptBeet = new beet159.BeetArgsStruct(
20141
- [
20142
- ["amountSentLd", beet159.u64],
20143
- ["amountReceivedLd", beet159.u64]
20144
- ],
20145
- "OFTReceipt"
20146
- );
20147
- var quoteOftResultBeet = new beet159.FixableBeetArgsStruct(
20148
- [
20149
- ["oftLimits", oFTLimitsBeet],
20150
- ["oftFeeDetails", beet159.array(oFTFeeDetailBeet)],
20151
- ["oftReceipt", oFTReceiptBeet]
20152
- ],
20153
- "QuoteOftResult"
20154
- );
20155
- var versionBeet3 = new beet159.BeetArgsStruct(
20156
- [
20157
- ["sdkVersion", beet159.u64],
20158
- ["oftVersion", beet159.u64]
20159
- ],
20160
- "Version"
20161
- );
20162
-
20163
- // src/oft.ts
20164
- var OFT_DECIMALS = 6;
20165
- var Oft = class {
20166
- constructor(program, endpointProgram, _tokenProgram, mintKp, escrowKp) {
20167
- this.program = program;
20168
- this.endpointProgram = endpointProgram;
20169
- this.deriver = new OftPDADeriver(this.program);
20170
- this.endpoint = new endpoint_exports.Endpoint(endpointProgram);
20171
- const [eventAuthorityPDA] = new EventPDADeriver(this.program).eventAuthority();
20172
- this.eventAuthorityPDA = eventAuthorityPDA;
20173
- this.mintKp = mintKp;
20174
- this.escrowKp = escrowKp;
20175
- this.isAdapter = escrowKp !== void 0;
20176
- this.tokenProgram = _tokenProgram;
20177
- }
20178
- getOftConfig() {
20179
- if (this.isAdapter) {
20180
- return this.deriver.oftConfig(this.escrowKp)[0];
20181
- }
20182
- return this.deriver.oftConfig(this.mintKp)[0];
20183
- }
20184
- async getVersion() {
20185
- return Promise.resolve([createVersionInstruction3(this.program)]);
20186
- }
20187
- async setDelegate(admin, delegate) {
20188
- const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
20189
- const oftConfig = this.getOftConfig();
20190
- const [oAppRegistry] = this.endpoint.deriver.oappRegistry(oftConfig);
20191
- const endpointSetDelegateKeys = endpoint_exports.instructions.createSetDelegateInstructionAccounts(
20192
- {
20193
- oapp: oftConfig,
20194
- oappRegistry: oAppRegistry,
20195
- eventAuthority: endpointEventAuthority,
20196
- program: this.endpointProgram
20197
- },
20198
- this.endpointProgram
20199
- );
20200
- for (const acc of endpointSetDelegateKeys) {
20201
- acc.isSigner = false;
20202
- }
20203
- const ix = createSetDelegateInstruction2(
20204
- {
20205
- admin,
20206
- oftConfig: this.getOftConfig(),
20207
- anchorRemainingAccounts: [
20208
- {
20209
- pubkey: this.endpointProgram,
20210
- isSigner: false,
20211
- isWritable: false
20212
- },
20213
- ...endpointSetDelegateKeys
20214
- ]
20215
- },
20216
- {
20217
- params: {
20218
- delegate
20219
- }
20220
- },
20221
- this.program
20222
- );
20223
- return Promise.resolve(ix);
20224
- }
20225
- async initOft(connection, payer, admin) {
20226
- const oftConfig = this.getOftConfig();
20227
- const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
20228
- const [oAppRegistry] = this.endpoint.deriver.oappRegistry(oftConfig);
20229
- const [lzReceiveTypes] = PublicKey.findProgramAddressSync(
20230
- [Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
20231
- this.program
20232
- );
20233
- const registerOappIxKeys = endpoint_exports.instructions.createRegisterOappInstructionAccounts(
20234
- {
20235
- payer: admin,
20236
- oapp: oftConfig,
20237
- oappRegistry: oAppRegistry,
20238
- eventAuthority: endpointEventAuthority,
20239
- program: this.endpointProgram
20240
- },
20241
- this.endpointProgram
20242
- );
20243
- for (const acc of registerOappIxKeys) {
20244
- acc.isSigner = false;
20245
- }
20246
- const ret = [
20247
- SystemProgram.createAccount({
20248
- fromPubkey: admin,
20249
- newAccountPubkey: this.mintKp,
20250
- space: getMintLen([]),
20251
- lamports: await connection.getMinimumBalanceForRentExemption(getMintLen([])),
20252
- programId: this.tokenProgram
20253
- }),
20254
- createInitializeMintInstruction(
20255
- this.mintKp,
20256
- OFT_DECIMALS,
20257
- this.isAdapter ? admin : oftConfig,
20258
- null,
20259
- this.tokenProgram
20260
- )
20261
- ];
20262
- if (this.isAdapter) {
20263
- return ret.concat(
20264
- createInitAdapterOftInstruction(
20265
- {
20266
- payer,
20267
- oftConfig,
20268
- tokenMint: this.mintKp,
20269
- tokenEscrow: this.escrowKp,
20270
- lzReceiveTypesAccounts: lzReceiveTypes,
20271
- tokenProgram: this.tokenProgram,
20272
- anchorRemainingAccounts: [
20273
- {
20274
- pubkey: this.endpointProgram,
20275
- isSigner: false,
20276
- isWritable: false
20277
- },
20278
- ...registerOappIxKeys
20279
- ]
20280
- },
20281
- {
20282
- params: {
20283
- admin,
20284
- sharedDecimals: OFT_DECIMALS,
20285
- endpointProgram: this.endpointProgram
20286
- }
20287
- },
20288
- this.program
20289
- )
20290
- );
20291
- } else {
20292
- return ret.concat(
20293
- createInitOftInstruction(
20294
- {
20295
- payer,
20296
- oftConfig,
20297
- tokenMint: this.mintKp,
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
- mintAuthority: admin
20315
- }
20316
- },
20317
- this.program
20318
- )
20319
- );
20320
- }
20321
- }
20322
- getAddressB32() {
20323
- const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
20324
- const ret = new Uint8Array(32);
20325
- ret.fill(0).set(oftConfig.toBytes());
20326
- return ret;
20327
- }
20328
- async mint_to(signer, to, amount) {
20329
- const ix = createMintToInstruction(
20330
- {
20331
- minter: signer,
20332
- oftConfig: this.getOftConfig(),
20333
- tokenDest: to,
20334
- tokenMint: this.mintKp,
20335
- tokenProgram: this.tokenProgram
20336
- },
20337
- {
20338
- params: {
20339
- amount: new BN(amount.toString())
20340
- }
20341
- },
20342
- this.program
20343
- );
20344
- return Promise.resolve(ix);
20345
- }
20346
- async setPeer(_peer, admin, dstEid) {
20347
- const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
20348
- const [peer] = this.deriver.peer(oftConfig, dstEid);
20349
- const ix = createSetPeerInstruction(
20350
- {
20351
- admin,
20352
- peer,
20353
- oftConfig
20354
- },
20355
- {
20356
- params: {
20357
- dstEid,
20358
- peer: new Array(32 - _peer.length).fill(0).concat(_peer)
20359
- }
20360
- },
20361
- this.program
20362
- );
20363
- return Promise.resolve(ix);
20364
- }
20365
- async setEnforcedOptions(admin, send, sendAndCall, dstEid) {
20366
- const oftConfig = this.getOftConfig();
20367
- const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
20368
- const ix = createSetEnforcedOptionsInstruction(
20369
- {
20370
- admin,
20371
- enforcedOptions,
20372
- oftConfig
20373
- },
20374
- {
20375
- params: {
20376
- dstEid,
20377
- send,
20378
- sendAndCall
20379
- }
20380
- },
20381
- this.program
20382
- );
20383
- return Promise.resolve(ix);
20384
- }
20385
- async send(connection, payer, tokenSource, to, dstEid, amountLd, minAmountLd, fee, options = new Uint8Array(), composeMsg, peerAddr, remainingAccounts, commitmentOrConfig = "confirmed") {
20386
- const oftConfig = this.getOftConfig();
20387
- const [peer] = this.deriver.peer(oftConfig, dstEid);
20388
- const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
20389
- if (peerAddr == null) {
20390
- const peerInfo = await Peer.fromAccountAddress(connection, peer);
20391
- peerAddr = peerInfo.address;
20392
- }
20393
- if (remainingAccounts === void 0 || remainingAccounts.length === 0) {
20394
- const msgLibProgram = await this.getSendLibraryProgram(connection, payer, dstEid);
20395
- const [endpointSettings] = this.endpoint.deriver.setting();
20396
- const packetPath = {
20397
- srcEid: 0,
20398
- dstEid,
20399
- sender: hexlify(oftConfig.toBytes()),
20400
- receiver: hexlify(peerAddr)
20401
- };
20402
- invariant5(
20403
- await isAccountInitialized(connection, endpointSettings),
20404
- "endpointSettings account not initialized"
20405
- );
20406
- invariant5(await isAccountInitialized(connection, peer), "peer account not initialized");
20407
- invariant5(
20408
- await isAccountInitialized(connection, enforcedOptions),
20409
- "enforcedOptions account not initialized"
20410
- );
20411
- invariant5(await isAccountInitialized(connection, payer), "payer account not initialized");
20412
- invariant5(
20413
- await isAccountInitialized(
20414
- connection,
20415
- this.endpoint.deriver.nonce(oftConfig, dstEid, Uint8Array.from(peerAddr))[0]
20416
- ),
20417
- "nonce account not initialized"
20418
- );
20419
- remainingAccounts = await this.endpoint.getSendIXAccountMetaForCPI(
20420
- connection,
20421
- payer,
20422
- packetPath,
20423
- msgLibProgram,
20424
- commitmentOrConfig
20425
- );
20426
- }
20427
- return createSendInstruction4(
20428
- {
20429
- signer: payer,
20430
- peer,
20431
- enforcedOptions,
20432
- oftConfig,
20433
- tokenSource,
20434
- tokenEscrow: this.escrowKp,
20435
- tokenMint: this.mintKp,
20436
- tokenProgram: this.tokenProgram,
20437
- eventAuthority: this.eventAuthorityPDA,
20438
- program: this.program,
20439
- // Get remaining accounts from msgLib(simple_msgLib or uln)
20440
- anchorRemainingAccounts: remainingAccounts
20441
- },
20442
- {
20443
- params: {
20444
- dstEid,
20445
- to,
20446
- amountLd: new BN(amountLd.toString()),
20447
- minAmountLd: new BN(minAmountLd.toString()),
20448
- options,
20449
- composeMsg: composeMsg ?? null,
20450
- nativeFee: fee.nativeFee,
20451
- lzTokenFee: fee.lzTokenFee
20452
- }
20453
- },
20454
- this.program
20455
- );
20456
- }
20457
- async setRateLimit(signer, dstEid, capacity, refillPerSecond, enabled) {
20458
- const [peerPda] = this.deriver.peer(this.getOftConfig(), dstEid);
20459
- const ix = createSetRateLimitInstruction(
20460
- {
20461
- admin: signer,
20462
- peer: peerPda,
20463
- oftConfig: this.getOftConfig()
20464
- },
20465
- {
20466
- params: {
20467
- dstEid,
20468
- capacity: new BN(capacity.toString()),
20469
- refillPerSecond: new BN(refillPerSecond.toString()),
20470
- enabled
20471
- }
20472
- },
20473
- this.program
20474
- );
20475
- return Promise.resolve(ix);
20476
- }
20477
- async lzReceive(connection, payer, packet) {
20478
- const deserializedPacket = PacketSerializer.deserialize(packet);
20479
- return lzReceive(connection, payer, deserializedPacket);
20480
- }
20481
- async getSendLibraryProgram(connection, payer, dstEid) {
20482
- const oftConfig = this.getOftConfig();
20483
- const sendLibInfo = await this.endpoint.getSendLibrary(connection, oftConfig, dstEid);
20484
- if (!sendLibInfo?.programId) {
20485
- throw new Error("Send library not initialized or blocked message library");
20486
- }
20487
- const { programId: msgLibProgram } = sendLibInfo;
20488
- const msgLibVersion = await this.endpoint.getMessageLibVersion(connection, payer, msgLibProgram);
20489
- if (msgLibVersion?.major.toString() === "0" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
20490
- return new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
20491
- } else if (msgLibVersion?.major.toString() === "3" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
20492
- return new uln_exports.Uln(msgLibProgram);
20493
- }
20494
- throw new Error(`Unsupported message library version: ${JSON.stringify(msgLibVersion, null, 2)}`);
20495
- }
20496
- };
20497
-
20498
- // src/oft-tools.ts
20499
- var SOLANA_EID = 1;
20500
- async function createInitAdapterOftIx(oftProgramId, payer, admin, mint, escrow, sharedDecimals = OFT_DECIMALS, endpointProgram = PROGRAM_ID, tokenProgram = TOKEN_PROGRAM_ID) {
20501
- const deriver = new OftPDADeriver(oftProgramId);
20502
- const endpoint = new Endpoint(endpointProgram);
20503
- const [oftConfig] = deriver.oftConfig(escrow);
20504
- const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
20505
- return instructions_exports7.createInitAdapterOftInstruction(
20506
- {
20507
- payer,
20508
- oftConfig,
20509
- tokenMint: mint,
20510
- tokenEscrow: escrow,
20511
- lzReceiveTypesAccounts: lzReceiveTypes,
20512
- tokenProgram,
20513
- anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
20514
- },
20515
- {
20516
- params: {
20517
- admin,
20518
- sharedDecimals,
20519
- endpointProgram
20520
- }
20521
- },
20522
- oftProgramId
20523
- );
20524
- }
20525
- async function createNonceTx(connection, nonceAccount, nonceAuthority, instructions, commitmentOrConfig = "confirmed") {
20526
- const nonceAccountInfo = await connection.getNonce(nonceAccount, commitmentOrConfig);
20527
- if (nonceAccountInfo === null) {
20528
- throw new Error("Invalid nonce account");
20529
- }
20530
- const { nonce } = nonceAccountInfo;
20531
- const nonceAdvanceIx = SystemProgram.nonceAdvance({
20532
- noncePubkey: nonceAccount,
20533
- authorizedPubkey: nonceAuthority
20534
- });
20535
- return new Transaction({
20536
- recentBlockhash: nonce,
20537
- nonceInfo: {
20538
- nonce,
20539
- nonceInstruction: nonceAdvanceIx
20540
- }
20541
- }).add(...instructions);
20542
- }
20543
- async function createInitNativeOftIx(oftProgramId, payer, admin, mint, oftMintAuthority, sharedDecimals = OFT_DECIMALS, endpointProgram = PROGRAM_ID, tokenProgram = TOKEN_PROGRAM_ID) {
20544
- const deriver = new OftPDADeriver(oftProgramId);
20545
- const endpoint = new Endpoint(endpointProgram);
20546
- const [oftConfig] = deriver.oftConfig(mint);
20547
- const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
20548
- return instructions_exports7.createInitOftInstruction(
20549
- {
20550
- payer,
20551
- oftConfig,
20552
- tokenMint: mint,
20553
- lzReceiveTypesAccounts: lzReceiveTypes,
20554
- tokenProgram,
20555
- anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
20556
- },
20557
- {
20558
- params: {
20559
- admin,
20560
- sharedDecimals,
20561
- mintAuthority: oftMintAuthority,
20562
- endpointProgram
20563
- }
20564
- },
20565
- oftProgramId
20566
- );
20567
- }
20568
- async function createSetPeerIx(oftProgramId, admin, oftConfig, dstEid, peer) {
20569
- if (peer.length !== 32) {
20570
- throw new Error("Peer must be 32 bytes (left-padded with zeroes)");
20571
- }
20572
- if (dstEid % 3e4 == 0) {
20573
- throw new Error("Invalid dstEid");
20574
- }
20575
- const [peerPda] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
20576
- return instructions_exports7.createSetPeerInstruction(
20577
- {
20578
- admin,
20579
- peer: peerPda,
20580
- oftConfig
20581
- },
20582
- {
20583
- params: {
20584
- dstEid,
20585
- peer: Array.from(peer)
20586
- }
20587
- },
20588
- oftProgramId
20589
- );
20590
- }
20591
- async function createSetDelegateIx(oftProgramId, admin, oftConfig, delegate, endpointProgram = PROGRAM_ID) {
20592
- const endpoint = new Endpoint(endpointProgram);
20593
- const [oAppRegistry] = endpoint.deriver.oappRegistry(oftConfig);
20594
- const endpointEventAuthority = endpoint.eventAuthorityPDA;
20595
- const keys = instructions_exports.createSetDelegateInstructionAccounts(
20596
- {
20597
- oapp: oftConfig,
20598
- oappRegistry: oAppRegistry,
20599
- eventAuthority: endpointEventAuthority,
20600
- program: endpointProgram
20601
- },
20602
- endpointProgram
20603
- );
20604
- for (const acc of keys) {
20605
- acc.isSigner = false;
20606
- }
20607
- return instructions_exports7.createSetDelegateInstruction(
20608
- {
20609
- admin,
20610
- oftConfig,
20611
- anchorRemainingAccounts: [
20612
- {
20613
- pubkey: endpointProgram,
20614
- isSigner: false,
20615
- isWritable: false
20616
- },
20617
- ...keys
20618
- ]
20619
- },
20620
- {
20621
- params: {
20622
- delegate
20623
- }
20624
- },
20625
- oftProgramId
20626
- );
20627
- }
20628
- async function createInitSendLibraryIx(signer, oftConfig, dstEid, endpointProgram = PROGRAM_ID) {
20629
- const endpoint = new Endpoint(endpointProgram);
20630
- return endpoint.initSendLibraryWithoutChecks(signer, oftConfig, dstEid);
20631
- }
20632
- async function createInitReceiveLibraryIx(signer, oftConfig, remoteEid, endpointProgram = PROGRAM_ID) {
20633
- const endpoint = new Endpoint(endpointProgram);
20634
- return endpoint.initReceiveLibraryWithoutChecks(signer, oftConfig, remoteEid);
20635
- }
20636
- async function createSetSendLibraryIx(signer, oftConfig, sendLibraryProgram, dstEid, endpointProgram = PROGRAM_ID) {
20637
- const endpoint = new Endpoint(endpointProgram);
20638
- return endpoint.setSendLibrary(signer, oftConfig, sendLibraryProgram, dstEid);
20639
- }
20640
- async function createSetReceiveLibraryIx(signer, oftConfig, receiveLibraryProgram, dstEid, gracePeriod, endpointProgram = PROGRAM_ID) {
20641
- const endpoint = new Endpoint(endpointProgram);
20642
- return endpoint.setReceiveLibrary(
20643
- signer,
20644
- oftConfig,
20645
- receiveLibraryProgram,
20646
- dstEid,
20647
- parseInt(gracePeriod.toString())
20648
- );
20649
- }
20650
- async function createMintToIx(oftProgramId, signer, tokenMint, tokenDest, amount, tokenProgram = TOKEN_PROGRAM_ID) {
20651
- const [oftConfig] = new OftPDADeriver(oftProgramId).oftConfig(tokenMint);
20652
- return instructions_exports7.createMintToInstruction(
20653
- {
20654
- minter: signer,
20655
- oftConfig,
20656
- tokenDest,
20657
- tokenMint,
20658
- tokenProgram
20659
- },
20660
- {
20661
- params: {
20662
- amount: new BN(amount.toString())
20663
- }
20664
- },
20665
- oftProgramId
20666
- );
20667
- }
20668
- async function createSetRateLimitIx(oftProgramId, signer, oftConfig, dstEid, capacity, refillPerSecond, enabled) {
20669
- const [peer] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
20670
- return instructions_exports7.createSetRateLimitInstruction(
20671
- {
20672
- admin: signer,
20673
- peer,
20674
- oftConfig
20675
- },
20676
- {
20677
- params: {
20678
- dstEid,
20679
- capacity: new BN(capacity.toString()),
20680
- refillPerSecond: new BN(refillPerSecond.toString()),
20681
- enabled
20682
- }
20683
- },
20684
- oftProgramId
20685
- );
20686
- }
20687
- async function createInitConfigIx(signer, oftConfig, dstEid, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID) {
20688
- const endpoint = new Endpoint(endpointProgram);
20689
- let msgLib;
20690
- if (msgLibProgram.toBase58() === simple_message_lib_exports.PROGRAM_ID.toBase58()) {
20691
- msgLib = new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
20692
- } else {
20693
- msgLib = new Uln(msgLibProgram);
20694
- }
20695
- return endpoint.initOappConfig(signer, msgLib, signer, oftConfig, dstEid);
20696
- }
20697
- async function createSetConfigIx(connection, signer, oftConfig, dstEid, configType, config, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID) {
20698
- const endpoint = new Endpoint(endpointProgram);
20699
- return endpoint.setOappConfig(connection, signer, oftConfig, msgLibProgram, dstEid, { configType, value: config });
20700
- }
20701
- async function createSetEnforcedOptionsIx(oftProgramId, admin, oftConfig, dstEid, sendOptions, sendAndCallOptions) {
20702
- const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftConfig, dstEid);
20703
- return instructions_exports7.createSetEnforcedOptionsInstruction(
20704
- {
20705
- admin,
20706
- enforcedOptions,
20707
- oftConfig
20708
- },
20709
- {
20710
- params: {
20711
- dstEid,
20712
- send: sendOptions,
20713
- sendAndCall: sendAndCallOptions
20714
- }
20715
- },
20716
- oftProgramId
20717
- );
20718
- }
20719
- async function createTransferAdminIx(oftProgramId, signer, oftConfig, newAdmin) {
20720
- return instructions_exports7.createTransferAdminInstruction(
20721
- {
20722
- admin: signer,
20723
- oftConfig
20724
- },
20725
- {
20726
- params: {
20727
- admin: newAdmin
20728
- }
20729
- },
20730
- oftProgramId
20731
- );
20732
- }
20733
- async function sendWithUln(connection, oftProgramId, payer, tokenMint, tokenSource, dstEid, amountLd, minAmountLd, options, to, nativeFee, lzTokenFee, tokenEscrow, composeMsg, peerAddr, remainingAccounts, endpointProgram = PROGRAM_ID, tokenProgram = TOKEN_PROGRAM_ID) {
20734
- const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
20735
- return oft.send(
20736
- connection,
20737
- payer,
20738
- tokenSource,
20739
- to,
20740
- dstEid,
20741
- amountLd,
20742
- minAmountLd,
20743
- {
20744
- nativeFee: new BN(nativeFee.toString()),
20745
- lzTokenFee: new BN(lzTokenFee !== void 0 ? lzTokenFee.toString() : 0)
20746
- },
20747
- options,
20748
- composeMsg,
20749
- peerAddr,
20750
- remainingAccounts
20751
- );
20752
- }
20753
- async function createInitNonceIx(delegate, dstEid, oftInstance, remoteOappAddr, endpointProgram = PROGRAM_ID) {
20754
- const endpoint = new Endpoint(endpointProgram);
20755
- return endpoint.initOAppNonceWithoutChecks(delegate, dstEid, oftInstance, remoteOappAddr);
20756
- }
20757
- async function quoteOft(connection, oftProgramId, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, payInLzToken = false, tokenEscrow, composeMsg, tokenProgram = TOKEN_PROGRAM_ID, endpointProgram = PROGRAM_ID) {
20758
- const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
20759
- const oftInstance = oft.getOftConfig();
20760
- const [peer] = oft.deriver.peer(oftInstance, dstEid);
20761
- const ix = instructions_exports7.createQuoteOftInstruction(
20762
- {
20763
- oftConfig: oftInstance,
20764
- peer,
20765
- tokenMint
20766
- },
20767
- {
20768
- params: {
20769
- dstEid,
20770
- to,
20771
- amountLd: new BN(amountLd.toString()),
20772
- minAmountLd: new BN(minAmountLd.toString()),
20773
- options,
20774
- payInLzToken,
20775
- composeMsg: composeMsg ?? null
20776
- }
20777
- },
20778
- oftProgramId
20779
- );
20780
- const returnedValues = await simulateTransaction(connection, [ix], ix.programId, payer, "confirmed");
20781
- const [resultInBeet] = types_exports7.quoteOftResultBeet.deserialize(returnedValues, 0);
20782
- return {
20783
- oftLimits: {
20784
- minAmountLd: BigInt(resultInBeet.oftLimits.minAmountLd.toString()),
20785
- maxAmountLd: BigInt(resultInBeet.oftLimits.maxAmountLd.toString())
20786
- },
20787
- oftFeeDetails: resultInBeet.oftFeeDetails.map((fee) => ({
20788
- feeAmountLd: BigInt(fee.feeAmountLd.toString()),
20789
- description: fee.description
20790
- })),
20791
- oftReceipt: {
20792
- amountSentLd: BigInt(resultInBeet.oftReceipt.amountSentLd.toString()),
20793
- amountReceivedLd: BigInt(resultInBeet.oftReceipt.amountReceivedLd.toString())
20794
- }
20795
- };
20796
- }
20797
- 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 = TOKEN_PROGRAM_ID) {
20798
- const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
20799
- const oftInstance = oft.getOftConfig();
20800
- const [enforcedOptions] = oft.deriver.enforcedOptions(oftInstance, dstEid);
20801
- const [peer] = oft.deriver.peer(oftInstance, dstEid);
20802
- if (peerAddr === void 0) {
20803
- const peerInfo = await accounts_exports7.Peer.fromAccountAddress(connection, peer);
20804
- peerAddr = peerInfo.address;
20805
- }
20806
- const messageLib = new Uln(msgLibProgram);
20807
- const endpoint = new Endpoint(endpointProgram);
20808
- const ix = instructions_exports7.createQuoteInstruction(
20809
- {
20810
- oftConfig: oftInstance,
20811
- peer,
20812
- enforcedOptions,
20813
- tokenMint,
20814
- anchorRemainingAccounts: remainingAccounts ?? await endpoint.getQuoteIXAccountMetaForCPI(
20815
- connection,
20816
- payer,
20817
- {
20818
- srcEid: SOLANA_EID,
20819
- sender: hexlify(oftInstance.toBytes()),
20820
- dstEid,
20821
- receiver: hexlify(peerAddr)
20822
- },
20823
- messageLib
20824
- )
20825
- },
20826
- {
20827
- params: {
20828
- dstEid,
20829
- to,
20830
- amountLd: new BN(amountLd.toString()),
20831
- minAmountLd: new BN(minAmountLd.toString()),
20832
- options,
20833
- payInLzToken,
20834
- composeMsg: composeMsg ?? null
20835
- }
20836
- },
20837
- oftProgramId
20838
- );
20839
- const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
20840
- units: 1e6
20841
- });
20842
- const buffer = await simulateTransaction(connection, [modifyComputeUnits, ix], ix.programId, payer, "confirmed");
20843
- const fee = types_exports.messagingFeeBeet.read(buffer, 0);
20844
- return { nativeFee: BigInt(fee.nativeFee.toString()), lzTokenFee: BigInt(fee.lzTokenFee.toString()) };
20845
- }
20846
- async function createSetMintAuthorityIx(oftProgramId, signer, oftInstance, newAuthority) {
20847
- return instructions_exports7.createSetMintAuthorityInstruction(
20848
- {
20849
- signer,
20850
- oftConfig: oftInstance
20851
- },
20852
- {
20853
- params: {
20854
- mintAuthority: newAuthority
20855
- }
20856
- },
20857
- oftProgramId
20858
- );
20859
- }
20860
- async function getEndpointConfig(connection, oftInstance, dstEid, msgLibProgram = PROGRAM_ID5, endpointProgram = PROGRAM_ID) {
20861
- const endpointDeriver = new EndpointPDADeriver(endpointProgram);
20862
- const ulnDeriver = new UlnPDADeriver(msgLibProgram);
20863
- const [sendLib] = endpointDeriver.sendLibraryConfig(oftInstance, dstEid);
20864
- const [defaultSendLib] = endpointDeriver.defaultSendLibraryConfig(dstEid);
20865
- const [receiveLib] = endpointDeriver.receiveLibraryConfig(oftInstance, dstEid);
20866
- const [defaultReceiveLib] = endpointDeriver.defaultReceiveLibraryConfig(dstEid);
20867
- const [msgLib] = ulnDeriver.messageLib();
20868
- let sendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, sendLib);
20869
- let receiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, receiveLib);
20870
- const defaultSendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, defaultSendLib);
20871
- const defaultReceiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, defaultReceiveLib);
20872
- const nil64 = new BN("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "hex");
20873
- const nil8 = 255;
20874
- if (sendLibraryConfig.messageLib.equals(PublicKey.default)) {
20875
- sendLibraryConfig = defaultSendLibraryConfig;
20876
- }
20877
- if (receiveLibraryConfig.messageLib.equals(PublicKey.default)) {
20878
- receiveLibraryConfig = defaultReceiveLibraryConfig;
20879
- }
20880
- if (sendLibraryConfig.messageLib.equals(msgLib)) {
20881
- const [ulnDefaultSendConfigPDA] = ulnDeriver.defaultSendConfig(dstEid);
20882
- const [ulnSendConfigPDA] = ulnDeriver.sendConfig(dstEid, oftInstance);
20883
- const ulnSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(connection, ulnSendConfigPDA);
20884
- const ulnDefaultSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(
20885
- connection,
20886
- ulnDefaultSendConfigPDA
20887
- );
20888
- if (nil64.eq(new BN(ulnSendConfig.uln.confirmations.toString()))) {
20889
- ulnSendConfig.uln.confirmations = 0;
20890
- } else if (ulnSendConfig.uln.confirmations == 0) {
20891
- ulnSendConfig.uln.confirmations = ulnDefaultSendConfig.uln.confirmations;
20892
- }
20893
- if (ulnSendConfig.uln.requiredDvnCount == nil8) {
20894
- ulnSendConfig.uln.requiredDvnCount = 0;
20895
- } else if (ulnSendConfig.uln.requiredDvnCount == 0) {
20896
- ulnSendConfig.uln.requiredDvnCount = ulnDefaultSendConfig.uln.requiredDvnCount;
20897
- ulnSendConfig.uln.requiredDvns = ulnDefaultSendConfig.uln.requiredDvns;
20898
- }
20899
- if (ulnSendConfig.uln.optionalDvnCount == nil8) {
20900
- ulnSendConfig.uln.optionalDvnCount = 0;
20901
- ulnSendConfig.uln.optionalDvnThreshold = 0;
20902
- } else if (ulnSendConfig.uln.optionalDvnCount == 0) {
20903
- ulnSendConfig.uln.optionalDvnCount = ulnDefaultSendConfig.uln.optionalDvnCount;
20904
- ulnSendConfig.uln.optionalDvnThreshold = ulnDefaultSendConfig.uln.optionalDvnThreshold;
20905
- ulnSendConfig.uln.optionalDvns = ulnDefaultSendConfig.uln.optionalDvns;
20906
- }
20907
- sendLibraryConfig.ulnSendConfig = ulnSendConfig;
20908
- }
20909
- if (receiveLibraryConfig.messageLib.equals(msgLib)) {
20910
- const [ulnDefaultReceiveConfigPDA] = ulnDeriver.defaultReceiveConfig(dstEid);
20911
- const [ulnReceiveConfigPDA] = ulnDeriver.receiveConfig(dstEid, oftInstance);
20912
- const ulnReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(connection, ulnReceiveConfigPDA);
20913
- const ulnDefaultReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(
20914
- connection,
20915
- ulnDefaultReceiveConfigPDA
20916
- );
20917
- if (nil64.eq(new BN(ulnReceiveConfig.uln.confirmations.toString()))) {
20918
- ulnReceiveConfig.uln.confirmations = 0;
20919
- } else if (ulnReceiveConfig.uln.confirmations == 0) {
20920
- ulnReceiveConfig.uln.confirmations = ulnDefaultReceiveConfig.uln.confirmations;
20921
- }
20922
- if (ulnReceiveConfig.uln.requiredDvnCount == nil8) {
20923
- ulnReceiveConfig.uln.requiredDvnCount = 0;
20924
- } else if (ulnReceiveConfig.uln.requiredDvnCount == 0) {
20925
- ulnReceiveConfig.uln.requiredDvnCount = ulnDefaultReceiveConfig.uln.requiredDvnCount;
20926
- ulnReceiveConfig.uln.requiredDvns = ulnDefaultReceiveConfig.uln.requiredDvns;
20927
- }
20928
- if (ulnReceiveConfig.uln.optionalDvnCount == nil8) {
20929
- ulnReceiveConfig.uln.optionalDvnCount = 0;
20930
- ulnReceiveConfig.uln.optionalDvnThreshold = 0;
20931
- } else if (ulnReceiveConfig.uln.optionalDvnCount == 0) {
20932
- ulnReceiveConfig.uln.optionalDvnCount = ulnDefaultReceiveConfig.uln.optionalDvnCount;
20933
- ulnReceiveConfig.uln.optionalDvnThreshold = ulnDefaultReceiveConfig.uln.optionalDvnThreshold;
20934
- ulnReceiveConfig.uln.optionalDvns = ulnDefaultReceiveConfig.uln.optionalDvns;
20935
- }
20936
- receiveLibraryConfig.ulnReceiveConfig = ulnReceiveConfig;
20937
- }
20938
- return {
20939
- sendLibraryConfig,
20940
- receiveLibraryConfig
20941
- };
20942
- }
20943
- async function getPeerAddress(connection, oftProgramId, oftInstance, dstEid) {
20944
- const [peer] = new OftPDADeriver(oftProgramId).peer(oftInstance, dstEid);
20945
- const peerInfo = await accounts_exports7.Peer.fromAccountAddress(connection, peer);
20946
- return hexlify(peerInfo.address);
20947
- }
20948
- async function getDelegate(connection, oftInstance, endpointProgram = PROGRAM_ID) {
20949
- const [oAppRegistry] = new EndpointPDADeriver(endpointProgram).oappRegistry(oftInstance);
20950
- const oAppRegistryInfo = await accounts_exports.OAppRegistry.fromAccountAddress(connection, oAppRegistry);
20951
- return oAppRegistryInfo.delegate;
20952
- }
20953
- async function getEnforcedOptions(connection, oftProgramId, oftInstance, dstEid) {
20954
- const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftInstance, dstEid);
20955
- return accounts_exports7.EnforcedOptions.fromAccountAddress(connection, enforcedOptions);
20956
- }
20957
- function oappIDPDA(program, seed = COUNT_SEED, id) {
20958
- if (id != void 0) {
20959
- return PublicKey.findProgramAddressSync(
20960
- [Buffer.from(seed, "utf8"), new BN(id).toArrayLike(Buffer, "be", 1)],
20961
- program
20962
- );
20963
- } else {
20964
- return PublicKey.findProgramAddressSync([Buffer.from(seed, "utf8")], program);
20965
- }
20966
- }
20967
- function deriveLzReceiveTypesAccountsPDA(program, oappId) {
20968
- if (oappId != void 0) {
20969
- return PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
20970
- }
20971
- return PublicKey.findProgramAddressSync([Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf8")], program);
20972
- }
20973
- function deriveLzComposeTypesAccountsPDA(program, oappId) {
20974
- if (oappId != void 0) {
20975
- return PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8"), oappId.toBytes()], program);
20976
- }
20977
- return PublicKey.findProgramAddressSync([Buffer.from(LZ_COMPOSE_TYPES_SEED, "utf8")], program);
20978
- }
20979
- var BaseOApp = class {
20980
- constructor(program) {
20981
- this.program = program;
20982
- this.oappBaseDeriver = new OAppBasePDADeriver(program);
20983
- }
20984
- async queryIDPDAInfo(connection, commitmentOrConfig) {
20985
- return this.queryPDAInfo(connection, this.idPDA()[0], commitmentOrConfig);
20986
- }
20987
- async queryPDAInfo(connection, pda, commitmentOrConfig) {
20988
- return connection.getAccountInfo(pda, commitmentOrConfig);
20989
- }
20990
- idPDA() {
20991
- return oappIDPDA(this.program);
20992
- }
20993
- async getRemote(connection, dstEid, commitmentOrConfig) {
20994
- const [remotePDA] = this.oappBaseDeriver.remote(dstEid);
20995
- const info = await this.queryPDAInfo(connection, remotePDA, commitmentOrConfig);
20996
- if (info) {
20997
- const result = AddressType.read(info.data, 8);
20998
- return Uint8Array.from(result);
20999
- }
21000
- return null;
17918
+ return null;
21001
17919
  }
21002
17920
  };
21003
17921
  var idlTypes = [
@@ -21051,16 +17969,16 @@ var blocked_messagelib_exports = {};
21051
17969
  __export(blocked_messagelib_exports, {
21052
17970
  PROGRAM_ADDRESS: () => PROGRAM_ADDRESS7,
21053
17971
  PROGRAM_ID: () => PROGRAM_ID7,
21054
- createVersionInstruction: () => createVersionInstruction4,
21055
- createVersionInstructionAccounts: () => createVersionInstructionAccounts4,
21056
- versionInstructionDiscriminator: () => versionInstructionDiscriminator4,
21057
- versionStruct: () => versionStruct4
17972
+ createVersionInstruction: () => createVersionInstruction3,
17973
+ createVersionInstructionAccounts: () => createVersionInstructionAccounts3,
17974
+ versionInstructionDiscriminator: () => versionInstructionDiscriminator3,
17975
+ versionStruct: () => versionStruct3
21058
17976
  });
21059
- var versionStruct4 = new beet159.BeetArgsStruct(
17977
+ var versionStruct3 = new beet159.BeetArgsStruct(
21060
17978
  [["instructionDiscriminator", beet159.uniformFixedSizeArray(beet159.u8, 8)]],
21061
17979
  "VersionInstructionArgs"
21062
17980
  );
21063
- var versionInstructionDiscriminator4 = [
17981
+ var versionInstructionDiscriminator3 = [
21064
17982
  118,
21065
17983
  65,
21066
17984
  195,
@@ -21070,9 +17988,9 @@ var versionInstructionDiscriminator4 = [
21070
17988
  252,
21071
17989
  192
21072
17990
  ];
21073
- function createVersionInstruction4(programId) {
21074
- const [data] = versionStruct4.serialize({
21075
- instructionDiscriminator: versionInstructionDiscriminator4
17991
+ function createVersionInstruction3(programId) {
17992
+ const [data] = versionStruct3.serialize({
17993
+ instructionDiscriminator: versionInstructionDiscriminator3
21076
17994
  });
21077
17995
  const keys = [];
21078
17996
  const ix = new web314.TransactionInstruction({
@@ -21082,7 +18000,7 @@ function createVersionInstruction4(programId) {
21082
18000
  });
21083
18001
  return ix;
21084
18002
  }
21085
- function createVersionInstructionAccounts4(programId) {
18003
+ function createVersionInstructionAccounts3(programId) {
21086
18004
  const keys = [];
21087
18005
  return keys;
21088
18006
  }
@@ -21110,7 +18028,7 @@ var SendHelper = class {
21110
18028
  }
21111
18029
  return keys.map((key) => this.accounts.get(key.toBase58()));
21112
18030
  }
21113
- async getQuoteAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig) {
18031
+ async getQuoteAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig = "confirmed") {
21114
18032
  const [sendLibConfig] = this.endpoint.deriver.sendLibraryConfig(sender, dstEid);
21115
18033
  const [defaultSendLibConfig] = this.endpoint.deriver.defaultSendLibraryConfig(dstEid);
21116
18034
  const [simpleMsgLib] = this.simpleMsgLib.deriver.messageLib();
@@ -21129,7 +18047,7 @@ var SendHelper = class {
21129
18047
  [sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
21130
18048
  commitmentOrConfig
21131
18049
  );
21132
- invariant5(defaultSendLibConfigBuf && sendLibConfigBuf, "endpoint send library not initialized");
18050
+ invariant4(defaultSendLibConfigBuf && sendLibConfigBuf, "endpoint send library not initialized");
21133
18051
  const [sendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(sendLibConfigBuf, 0);
21134
18052
  const [defaultSendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(
21135
18053
  defaultSendLibConfigBuf,
@@ -21176,7 +18094,7 @@ var SendHelper = class {
21176
18094
  * @param commitmentOrConfig
21177
18095
  * 1 or 3(1+2) RPC calls
21178
18096
  * */
21179
- async getSendAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig) {
18097
+ async getSendAccounts(connection, payer, sender, dstEid, receiver, commitmentOrConfig = "confirmed") {
21180
18098
  const [sendLibConfig] = this.endpoint.deriver.sendLibraryConfig(sender, dstEid);
21181
18099
  const [defaultSendLibConfig] = this.endpoint.deriver.defaultSendLibraryConfig(dstEid);
21182
18100
  const [simpleMsgLib] = this.simpleMsgLib.deriver.messageLib();
@@ -21195,7 +18113,7 @@ var SendHelper = class {
21195
18113
  [sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
21196
18114
  commitmentOrConfig
21197
18115
  );
21198
- invariant5(defaultSendLibConfigBuf && sendLibConfigBuf, "endpoint send library not initialized");
18116
+ invariant4(defaultSendLibConfigBuf && sendLibConfigBuf, "endpoint send library not initialized");
21199
18117
  const [sendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(sendLibConfigBuf, 0);
21200
18118
  const [defaultSendLibConfigInfo] = endpoint_exports.accounts.SendLibraryConfig.fromAccountInfo(
21201
18119
  defaultSendLibConfigBuf,
@@ -21311,7 +18229,7 @@ var SendHelper = class {
21311
18229
  }
21312
18230
  // 2 RPC calls
21313
18231
  async getUlnAccounts(connection, payer, ulnInfo, ulnDefaultSendConfigInfo, ulnSendConfigInfo, quoteOrSend, commitment) {
21314
- invariant5(ulnInfo.accountInfo && ulnDefaultSendConfigInfo.accountInfo, "uln send library not initialized");
18232
+ invariant4(ulnInfo.accountInfo && ulnDefaultSendConfigInfo.accountInfo, "uln send library not initialized");
21315
18233
  const [ulnState] = uln_exports.accounts.UlnSettings.fromAccountInfo(ulnInfo.accountInfo, 0);
21316
18234
  const [defaultSendConfigState] = uln_exports.accounts.SendConfig.fromAccountInfo(
21317
18235
  ulnDefaultSendConfigInfo.accountInfo,
@@ -21341,7 +18259,7 @@ var SendHelper = class {
21341
18259
  [executor.executor, ...dvnsKey],
21342
18260
  commitment
21343
18261
  );
21344
- invariant5(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
18262
+ invariant4(executorBuf, `executor:${executor.executor.toBase58()} not initialized`);
21345
18263
  let executorAccounts, dvnAccounts;
21346
18264
  {
21347
18265
  const executor2 = {
@@ -21349,7 +18267,7 @@ var SendHelper = class {
21349
18267
  owner: executorBuf.owner
21350
18268
  };
21351
18269
  const dvns = dvnBuf.map((dvn, i) => {
21352
- invariant5(dvn, `dvn:${dvnsKey[i].toBase58()} not initialized`);
18270
+ invariant4(dvn, `dvn:${dvnsKey[i].toBase58()} not initialized`);
21353
18271
  return {
21354
18272
  config: accounts_exports3.DvnConfig.fromAccountInfo(dvn)[0],
21355
18273
  owner: dvn.owner
@@ -21361,7 +18279,7 @@ var SendHelper = class {
21361
18279
  });
21362
18280
  const priceFeedInfos = await this.getMultipleAccountsInfo(connection, priceFeeds, commitment);
21363
18281
  priceFeedInfos.forEach((info, i) => {
21364
- invariant5(info, `priceFeed:${priceFeeds[i].toBase58()} not initialized`);
18282
+ invariant4(info, `priceFeed:${priceFeeds[i].toBase58()} not initialized`);
21365
18283
  });
21366
18284
  executorAccounts = new Executor(executor2.owner).getQuoteIXAccountMetaForCPI(
21367
18285
  executor2.config.priceFeed,
@@ -22961,13 +19879,13 @@ var types = [
22961
19879
  var IdlTypes = {
22962
19880
  endpoint: types
22963
19881
  };
22964
- var SetConfigType2 = /* @__PURE__ */ ((SetConfigType4) => {
22965
- SetConfigType4[SetConfigType4["EXECUTOR"] = 1] = "EXECUTOR";
22966
- SetConfigType4[SetConfigType4["SEND_ULN"] = 2] = "SEND_ULN";
22967
- SetConfigType4[SetConfigType4["RECEIVE_ULN"] = 3] = "RECEIVE_ULN";
22968
- return SetConfigType4;
19882
+ var SetConfigType2 = /* @__PURE__ */ ((SetConfigType3) => {
19883
+ SetConfigType3[SetConfigType3["EXECUTOR"] = 1] = "EXECUTOR";
19884
+ SetConfigType3[SetConfigType3["SEND_ULN"] = 2] = "SEND_ULN";
19885
+ SetConfigType3[SetConfigType3["RECEIVE_ULN"] = 3] = "RECEIVE_ULN";
19886
+ return SetConfigType3;
22969
19887
  })(SetConfigType2 || {});
22970
19888
 
22971
- export { AddressType, BaseOApp, blocked_messagelib_exports as BlockedMessageLibProgram, COMPOSED_MESSAGE_HASH_SEED, CONFIRMATIONS_SEED, COUNT_SEED, DVNDeriver, dvn_exports2 as DVNProgram, DVN_CONFIG_SEED, dvn_exports as DvnProgram, ENDPOINT_SEED, ENFORCED_OPTIONS_SEED, EVENT_SEED, EXECUTOR_CONFIG_SEED, EndpointPDADeriver, endpoint_exports as EndpointProgram, EventPDADeriver, ExecutorOptionType, ExecutorPDADeriver, executor_exports as ExecutorProgram, FAUCET_URL, IdlTypes, LZ_COMPOSE_TYPES_SEED, LZ_RECEIVE_TYPES_SEED, LzComposeParamsBeet, LzReceiveAccountBeet, LzReceiveParamsBeet, MESSAGE_LIB_SEED, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDADeriver, MessageType, NONCE_SEED, OAPP_SEED, OAppBasePDADeriver, OFT_SEED, OPTIONS_SEED, OftPDADeriver, oft_exports as OftProgram, oft_tools_exports as OftTools, PAYLOAD_HASH_SEED, PEER_SEED, PENDING_NONCE_SEED, PRICE_FEED_SEED, PriceFeedPDADeriver, pricefeed_exports as PriceFeedProgram, RECEIVE_CONFIG_SEED, RECEIVE_LIBRARY_CONFIG_SEED, REMOTE_SEED, SEND_CONFIG_SEED, SEND_LIBRARY_CONFIG_SEED, SendHelper, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, ULN_CONFIG_SEED, ULN_SEED, UlnPDADeriver, uln_exports as UlnProgram, WORKER_SEED, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, deriveLzComposeTypesAccountsPDA, deriveLzReceiveTypesAccountsPDA, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractReceivedPacketEventByTxHash, extractSentPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getLzComposeAccountMeta, getLzReceiveAccounts, getPricefeedProgramId, getProgramKeypair, getSimpleMessageLibProgramId, getULNProgramId, idlTypes, instructionDiscriminator, isAccountInitialized, lzCompose, lzReceive, messageLibs, oappIDPDA, simulateTransaction, txWithAddressLookupTable, txWithNonce };
19889
+ export { AddressType, BaseOApp, blocked_messagelib_exports as BlockedMessageLibProgram, COMPOSED_MESSAGE_HASH_SEED, CONFIRMATIONS_SEED, COUNT_SEED, DVNDeriver, dvn_exports2 as DVNProgram, DVN_CONFIG_SEED, dvn_exports as DvnProgram, ENDPOINT_SEED, ENFORCED_OPTIONS_SEED, EVENT_SEED, EXECUTOR_CONFIG_SEED, EndpointPDADeriver, endpoint_exports as EndpointProgram, EventPDADeriver, ExecutorOptionType, ExecutorPDADeriver, executor_exports as ExecutorProgram, FAUCET_URL, IdlTypes, LZ_COMPOSE_TYPES_SEED, LZ_RECEIVE_TYPES_SEED, LzComposeParamsBeet, LzReceiveAccountBeet, LzReceiveParamsBeet, MESSAGE_LIB_SEED, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDADeriver, MessageType, NONCE_SEED, OAPP_SEED, OAppBasePDADeriver, OPTIONS_SEED, PAYLOAD_HASH_SEED, PEER_SEED, PENDING_NONCE_SEED, PRICE_FEED_SEED, PriceFeedPDADeriver, pricefeed_exports as PriceFeedProgram, RECEIVE_CONFIG_SEED, RECEIVE_LIBRARY_CONFIG_SEED, REMOTE_SEED, SEND_CONFIG_SEED, SEND_LIBRARY_CONFIG_SEED, SendHelper, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, ULN_CONFIG_SEED, ULN_SEED, UlnPDADeriver, uln_exports as UlnProgram, WORKER_SEED, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, deriveLzComposeTypesAccountsPDA, deriveLzReceiveTypesAccountsPDA, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractReceivedPacketEventByTxHash, extractSentPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getLzComposeAccountMeta, getLzReceiveAccounts, getPricefeedProgramId, getProgramKeypair, getSimpleMessageLibProgramId, getULNProgramId, idlTypes, instructionDiscriminator, isAccountInitialized, lzCompose, lzReceive, messageLibs, oappIDPDA, simulateTransaction, txWithAddressLookupTable, txWithNonce };
22972
19890
  //# sourceMappingURL=out.js.map
22973
19891
  //# sourceMappingURL=index.mjs.map