@layerzerolabs/lz-solana-sdk-v2 3.0.105 → 3.0.106

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/umi.mjs CHANGED
@@ -9,7 +9,7 @@ import { keccak_256, sha2_256 } from '@layerzerolabs/lz-foundation';
9
9
  import { arrayify } from '@layerzerolabs/lz-utilities';
10
10
  import { addressToBytes32, PacketV1Codec } from '@layerzerolabs/lz-v2-utilities';
11
11
  import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
12
- import invariant3 from 'tiny-invariant';
12
+ import invariant2 from 'tiny-invariant';
13
13
  import { fetchAllAddressLookupTable } from '@metaplex-foundation/mpl-toolbox';
14
14
  import { Environment } from '@layerzerolabs/lz-definitions';
15
15
 
@@ -416,17 +416,17 @@ function deserializeComposeMessageState(rawAccount) {
416
416
  getComposeMessageStateAccountDataSerializer()
417
417
  );
418
418
  }
419
- async function fetchComposeMessageState(context, publicKey16, options) {
419
+ async function fetchComposeMessageState(context, publicKey15, options) {
420
420
  const maybeAccount = await context.rpc.getAccount(
421
- publicKey(publicKey16, false),
421
+ publicKey(publicKey15, false),
422
422
  options
423
423
  );
424
424
  assertAccountExists(maybeAccount, "ComposeMessageState");
425
425
  return deserializeComposeMessageState(maybeAccount);
426
426
  }
427
- async function safeFetchComposeMessageState(context, publicKey16, options) {
427
+ async function safeFetchComposeMessageState(context, publicKey15, options) {
428
428
  const maybeAccount = await context.rpc.getAccount(
429
- publicKey(publicKey16, false),
429
+ publicKey(publicKey15, false),
430
430
  options
431
431
  );
432
432
  return maybeAccount.exists ? deserializeComposeMessageState(maybeAccount) : null;
@@ -493,17 +493,17 @@ function deserializeEndpointSettings(rawAccount) {
493
493
  getEndpointSettingsAccountDataSerializer()
494
494
  );
495
495
  }
496
- async function fetchEndpointSettings(context, publicKey16, options) {
496
+ async function fetchEndpointSettings(context, publicKey15, options) {
497
497
  const maybeAccount = await context.rpc.getAccount(
498
- publicKey(publicKey16, false),
498
+ publicKey(publicKey15, false),
499
499
  options
500
500
  );
501
501
  assertAccountExists(maybeAccount, "EndpointSettings");
502
502
  return deserializeEndpointSettings(maybeAccount);
503
503
  }
504
- async function safeFetchEndpointSettings(context, publicKey16, options) {
504
+ async function safeFetchEndpointSettings(context, publicKey15, options) {
505
505
  const maybeAccount = await context.rpc.getAccount(
506
- publicKey(publicKey16, false),
506
+ publicKey(publicKey15, false),
507
507
  options
508
508
  );
509
509
  return maybeAccount.exists ? deserializeEndpointSettings(maybeAccount) : null;
@@ -619,17 +619,17 @@ function deserializeMessageLibInfo(rawAccount) {
619
619
  getMessageLibInfoAccountDataSerializer()
620
620
  );
621
621
  }
622
- async function fetchMessageLibInfo(context, publicKey16, options) {
622
+ async function fetchMessageLibInfo(context, publicKey15, options) {
623
623
  const maybeAccount = await context.rpc.getAccount(
624
- publicKey(publicKey16, false),
624
+ publicKey(publicKey15, false),
625
625
  options
626
626
  );
627
627
  assertAccountExists(maybeAccount, "MessageLibInfo");
628
628
  return deserializeMessageLibInfo(maybeAccount);
629
629
  }
630
- async function safeFetchMessageLibInfo(context, publicKey16, options) {
630
+ async function safeFetchMessageLibInfo(context, publicKey15, options) {
631
631
  const maybeAccount = await context.rpc.getAccount(
632
- publicKey(publicKey16, false),
632
+ publicKey(publicKey15, false),
633
633
  options
634
634
  );
635
635
  return maybeAccount.exists ? deserializeMessageLibInfo(maybeAccount) : null;
@@ -693,17 +693,17 @@ function getNonceAccountDataSerializer() {
693
693
  function deserializeNonce(rawAccount) {
694
694
  return deserializeAccount(rawAccount, getNonceAccountDataSerializer());
695
695
  }
696
- async function fetchNonce(context, publicKey16, options) {
696
+ async function fetchNonce(context, publicKey15, options) {
697
697
  const maybeAccount = await context.rpc.getAccount(
698
- publicKey(publicKey16, false),
698
+ publicKey(publicKey15, false),
699
699
  options
700
700
  );
701
701
  assertAccountExists(maybeAccount, "Nonce");
702
702
  return deserializeNonce(maybeAccount);
703
703
  }
704
- async function safeFetchNonce(context, publicKey16, options) {
704
+ async function safeFetchNonce(context, publicKey15, options) {
705
705
  const maybeAccount = await context.rpc.getAccount(
706
- publicKey(publicKey16, false),
706
+ publicKey(publicKey15, false),
707
707
  options
708
708
  );
709
709
  return maybeAccount.exists ? deserializeNonce(maybeAccount) : null;
@@ -762,17 +762,17 @@ function getOAppRegistryAccountDataSerializer() {
762
762
  function deserializeOAppRegistry(rawAccount) {
763
763
  return deserializeAccount(rawAccount, getOAppRegistryAccountDataSerializer());
764
764
  }
765
- async function fetchOAppRegistry(context, publicKey16, options) {
765
+ async function fetchOAppRegistry(context, publicKey15, options) {
766
766
  const maybeAccount = await context.rpc.getAccount(
767
- publicKey(publicKey16, false),
767
+ publicKey(publicKey15, false),
768
768
  options
769
769
  );
770
770
  assertAccountExists(maybeAccount, "OAppRegistry");
771
771
  return deserializeOAppRegistry(maybeAccount);
772
772
  }
773
- async function safeFetchOAppRegistry(context, publicKey16, options) {
773
+ async function safeFetchOAppRegistry(context, publicKey15, options) {
774
774
  const maybeAccount = await context.rpc.getAccount(
775
- publicKey(publicKey16, false),
775
+ publicKey(publicKey15, false),
776
776
  options
777
777
  );
778
778
  return maybeAccount.exists ? deserializeOAppRegistry(maybeAccount) : null;
@@ -832,17 +832,17 @@ function getPayloadHashAccountDataSerializer() {
832
832
  function deserializePayloadHash(rawAccount) {
833
833
  return deserializeAccount(rawAccount, getPayloadHashAccountDataSerializer());
834
834
  }
835
- async function fetchPayloadHash(context, publicKey16, options) {
835
+ async function fetchPayloadHash(context, publicKey15, options) {
836
836
  const maybeAccount = await context.rpc.getAccount(
837
- publicKey(publicKey16, false),
837
+ publicKey(publicKey15, false),
838
838
  options
839
839
  );
840
840
  assertAccountExists(maybeAccount, "PayloadHash");
841
841
  return deserializePayloadHash(maybeAccount);
842
842
  }
843
- async function safeFetchPayloadHash(context, publicKey16, options) {
843
+ async function safeFetchPayloadHash(context, publicKey15, options) {
844
844
  const maybeAccount = await context.rpc.getAccount(
845
- publicKey(publicKey16, false),
845
+ publicKey(publicKey15, false),
846
846
  options
847
847
  );
848
848
  return maybeAccount.exists ? deserializePayloadHash(maybeAccount) : null;
@@ -903,17 +903,17 @@ function deserializePendingInboundNonce(rawAccount) {
903
903
  getPendingInboundNonceAccountDataSerializer()
904
904
  );
905
905
  }
906
- async function fetchPendingInboundNonce(context, publicKey16, options) {
906
+ async function fetchPendingInboundNonce(context, publicKey15, options) {
907
907
  const maybeAccount = await context.rpc.getAccount(
908
- publicKey(publicKey16, false),
908
+ publicKey(publicKey15, false),
909
909
  options
910
910
  );
911
911
  assertAccountExists(maybeAccount, "PendingInboundNonce");
912
912
  return deserializePendingInboundNonce(maybeAccount);
913
913
  }
914
- async function safeFetchPendingInboundNonce(context, publicKey16, options) {
914
+ async function safeFetchPendingInboundNonce(context, publicKey15, options) {
915
915
  const maybeAccount = await context.rpc.getAccount(
916
- publicKey(publicKey16, false),
916
+ publicKey(publicKey15, false),
917
917
  options
918
918
  );
919
919
  return maybeAccount.exists ? deserializePendingInboundNonce(maybeAccount) : null;
@@ -976,17 +976,17 @@ function deserializeReceiveLibraryConfig(rawAccount) {
976
976
  getReceiveLibraryConfigAccountDataSerializer()
977
977
  );
978
978
  }
979
- async function fetchReceiveLibraryConfig(context, publicKey16, options) {
979
+ async function fetchReceiveLibraryConfig(context, publicKey15, options) {
980
980
  const maybeAccount = await context.rpc.getAccount(
981
- publicKey(publicKey16, false),
981
+ publicKey(publicKey15, false),
982
982
  options
983
983
  );
984
984
  assertAccountExists(maybeAccount, "ReceiveLibraryConfig");
985
985
  return deserializeReceiveLibraryConfig(maybeAccount);
986
986
  }
987
- async function safeFetchReceiveLibraryConfig(context, publicKey16, options) {
987
+ async function safeFetchReceiveLibraryConfig(context, publicKey15, options) {
988
988
  const maybeAccount = await context.rpc.getAccount(
989
- publicKey(publicKey16, false),
989
+ publicKey(publicKey15, false),
990
990
  options
991
991
  );
992
992
  return maybeAccount.exists ? deserializeReceiveLibraryConfig(maybeAccount) : null;
@@ -1049,17 +1049,17 @@ function deserializeSendLibraryConfig(rawAccount) {
1049
1049
  getSendLibraryConfigAccountDataSerializer()
1050
1050
  );
1051
1051
  }
1052
- async function fetchSendLibraryConfig(context, publicKey16, options) {
1052
+ async function fetchSendLibraryConfig(context, publicKey15, options) {
1053
1053
  const maybeAccount = await context.rpc.getAccount(
1054
- publicKey(publicKey16, false),
1054
+ publicKey(publicKey15, false),
1055
1055
  options
1056
1056
  );
1057
1057
  assertAccountExists(maybeAccount, "SendLibraryConfig");
1058
1058
  return deserializeSendLibraryConfig(maybeAccount);
1059
1059
  }
1060
- async function safeFetchSendLibraryConfig(context, publicKey16, options) {
1060
+ async function safeFetchSendLibraryConfig(context, publicKey15, options) {
1061
1061
  const maybeAccount = await context.rpc.getAccount(
1062
- publicKey(publicKey16, false),
1062
+ publicKey(publicKey15, false),
1063
1063
  options
1064
1064
  );
1065
1065
  return maybeAccount.exists ? deserializeSendLibraryConfig(maybeAccount) : null;
@@ -3996,17 +3996,17 @@ function getMessageLibAccountDataSerializer() {
3996
3996
  function deserializeMessageLib(rawAccount) {
3997
3997
  return deserializeAccount(rawAccount, getMessageLibAccountDataSerializer());
3998
3998
  }
3999
- async function fetchMessageLib(context, publicKey16, options) {
3999
+ async function fetchMessageLib(context, publicKey15, options) {
4000
4000
  const maybeAccount = await context.rpc.getAccount(
4001
- publicKey(publicKey16, false),
4001
+ publicKey(publicKey15, false),
4002
4002
  options
4003
4003
  );
4004
4004
  assertAccountExists(maybeAccount, "MessageLib");
4005
4005
  return deserializeMessageLib(maybeAccount);
4006
4006
  }
4007
- async function safeFetchMessageLib(context, publicKey16, options) {
4007
+ async function safeFetchMessageLib(context, publicKey15, options) {
4008
4008
  const maybeAccount = await context.rpc.getAccount(
4009
- publicKey(publicKey16, false),
4009
+ publicKey(publicKey15, false),
4010
4010
  options
4011
4011
  );
4012
4012
  return maybeAccount.exists ? deserializeMessageLib(maybeAccount) : null;
@@ -4073,17 +4073,17 @@ function deserializeReceiveConfigStore(rawAccount) {
4073
4073
  getReceiveConfigStoreAccountDataSerializer()
4074
4074
  );
4075
4075
  }
4076
- async function fetchReceiveConfigStore(context, publicKey16, options) {
4076
+ async function fetchReceiveConfigStore(context, publicKey15, options) {
4077
4077
  const maybeAccount = await context.rpc.getAccount(
4078
- publicKey(publicKey16, false),
4078
+ publicKey(publicKey15, false),
4079
4079
  options
4080
4080
  );
4081
4081
  assertAccountExists(maybeAccount, "ReceiveConfigStore");
4082
4082
  return deserializeReceiveConfigStore(maybeAccount);
4083
4083
  }
4084
- async function safeFetchReceiveConfigStore(context, publicKey16, options) {
4084
+ async function safeFetchReceiveConfigStore(context, publicKey15, options) {
4085
4085
  const maybeAccount = await context.rpc.getAccount(
4086
- publicKey(publicKey16, false),
4086
+ publicKey(publicKey15, false),
4087
4087
  options
4088
4088
  );
4089
4089
  return maybeAccount.exists ? deserializeReceiveConfigStore(maybeAccount) : null;
@@ -4145,17 +4145,17 @@ function deserializeSendConfigStore(rawAccount) {
4145
4145
  getSendConfigStoreAccountDataSerializer()
4146
4146
  );
4147
4147
  }
4148
- async function fetchSendConfigStore(context, publicKey16, options) {
4148
+ async function fetchSendConfigStore(context, publicKey15, options) {
4149
4149
  const maybeAccount = await context.rpc.getAccount(
4150
- publicKey(publicKey16, false),
4150
+ publicKey(publicKey15, false),
4151
4151
  options
4152
4152
  );
4153
4153
  assertAccountExists(maybeAccount, "SendConfigStore");
4154
4154
  return deserializeSendConfigStore(maybeAccount);
4155
4155
  }
4156
- async function safeFetchSendConfigStore(context, publicKey16, options) {
4156
+ async function safeFetchSendConfigStore(context, publicKey15, options) {
4157
4157
  const maybeAccount = await context.rpc.getAccount(
4158
- publicKey(publicKey16, false),
4158
+ publicKey(publicKey15, false),
4159
4159
  options
4160
4160
  );
4161
4161
  return maybeAccount.exists ? deserializeSendConfigStore(maybeAccount) : null;
@@ -6973,17 +6973,17 @@ function getDvnConfigAccountDataSerializer() {
6973
6973
  function deserializeDvnConfig(rawAccount) {
6974
6974
  return deserializeAccount(rawAccount, getDvnConfigAccountDataSerializer());
6975
6975
  }
6976
- async function fetchDvnConfig(context, publicKey16, options) {
6976
+ async function fetchDvnConfig(context, publicKey15, options) {
6977
6977
  const maybeAccount = await context.rpc.getAccount(
6978
- publicKey(publicKey16, false),
6978
+ publicKey(publicKey15, false),
6979
6979
  options
6980
6980
  );
6981
6981
  assertAccountExists(maybeAccount, "DvnConfig");
6982
6982
  return deserializeDvnConfig(maybeAccount);
6983
6983
  }
6984
- async function safeFetchDvnConfig(context, publicKey16, options) {
6984
+ async function safeFetchDvnConfig(context, publicKey15, options) {
6985
6985
  const maybeAccount = await context.rpc.getAccount(
6986
- publicKey(publicKey16, false),
6986
+ publicKey(publicKey15, false),
6987
6987
  options
6988
6988
  );
6989
6989
  return maybeAccount.exists ? deserializeDvnConfig(maybeAccount) : null;
@@ -7046,17 +7046,17 @@ function getExecuteHashAccountDataSerializer() {
7046
7046
  function deserializeExecuteHash(rawAccount) {
7047
7047
  return deserializeAccount(rawAccount, getExecuteHashAccountDataSerializer());
7048
7048
  }
7049
- async function fetchExecuteHash(context, publicKey16, options) {
7049
+ async function fetchExecuteHash(context, publicKey15, options) {
7050
7050
  const maybeAccount = await context.rpc.getAccount(
7051
- publicKey(publicKey16, false),
7051
+ publicKey(publicKey15, false),
7052
7052
  options
7053
7053
  );
7054
7054
  assertAccountExists(maybeAccount, "ExecuteHash");
7055
7055
  return deserializeExecuteHash(maybeAccount);
7056
7056
  }
7057
- async function safeFetchExecuteHash(context, publicKey16, options) {
7057
+ async function safeFetchExecuteHash(context, publicKey15, options) {
7058
7058
  const maybeAccount = await context.rpc.getAccount(
7059
- publicKey(publicKey16, false),
7059
+ publicKey(publicKey15, false),
7060
7060
  options
7061
7061
  );
7062
7062
  return maybeAccount.exists ? deserializeExecuteHash(maybeAccount) : null;
@@ -7117,17 +7117,17 @@ function deserializeReceiveConfig(rawAccount) {
7117
7117
  getReceiveConfigAccountDataSerializer()
7118
7118
  );
7119
7119
  }
7120
- async function fetchReceiveConfig(context, publicKey16, options) {
7120
+ async function fetchReceiveConfig(context, publicKey15, options) {
7121
7121
  const maybeAccount = await context.rpc.getAccount(
7122
- publicKey(publicKey16, false),
7122
+ publicKey(publicKey15, false),
7123
7123
  options
7124
7124
  );
7125
7125
  assertAccountExists(maybeAccount, "ReceiveConfig");
7126
7126
  return deserializeReceiveConfig(maybeAccount);
7127
7127
  }
7128
- async function safeFetchReceiveConfig(context, publicKey16, options) {
7128
+ async function safeFetchReceiveConfig(context, publicKey15, options) {
7129
7129
  const maybeAccount = await context.rpc.getAccount(
7130
- publicKey(publicKey16, false),
7130
+ publicKey(publicKey15, false),
7131
7131
  options
7132
7132
  );
7133
7133
  return maybeAccount.exists ? deserializeReceiveConfig(maybeAccount) : null;
@@ -8420,17 +8420,17 @@ function deserializeExecutionContextV1(rawAccount) {
8420
8420
  getExecutionContextV1AccountDataSerializer()
8421
8421
  );
8422
8422
  }
8423
- async function fetchExecutionContextV1(context, publicKey16, options) {
8423
+ async function fetchExecutionContextV1(context, publicKey15, options) {
8424
8424
  const maybeAccount = await context.rpc.getAccount(
8425
- publicKey(publicKey16, false),
8425
+ publicKey(publicKey15, false),
8426
8426
  options
8427
8427
  );
8428
8428
  assertAccountExists(maybeAccount, "ExecutionContextV1");
8429
8429
  return deserializeExecutionContextV1(maybeAccount);
8430
8430
  }
8431
- async function safeFetchExecutionContextV1(context, publicKey16, options) {
8431
+ async function safeFetchExecutionContextV1(context, publicKey15, options) {
8432
8432
  const maybeAccount = await context.rpc.getAccount(
8433
- publicKey(publicKey16, false),
8433
+ publicKey(publicKey15, false),
8434
8434
  options
8435
8435
  );
8436
8436
  return maybeAccount.exists ? deserializeExecutionContextV1(maybeAccount) : null;
@@ -8672,17 +8672,17 @@ function deserializeExecutorConfig(rawAccount) {
8672
8672
  getExecutorConfigAccountDataSerializer()
8673
8673
  );
8674
8674
  }
8675
- async function fetchExecutorConfig(context, publicKey16, options) {
8675
+ async function fetchExecutorConfig(context, publicKey15, options) {
8676
8676
  const maybeAccount = await context.rpc.getAccount(
8677
- publicKey(publicKey16, false),
8677
+ publicKey(publicKey15, false),
8678
8678
  options
8679
8679
  );
8680
8680
  assertAccountExists(maybeAccount, "ExecutorConfig");
8681
8681
  return deserializeExecutorConfig(maybeAccount);
8682
8682
  }
8683
- async function safeFetchExecutorConfig(context, publicKey16, options) {
8683
+ async function safeFetchExecutorConfig(context, publicKey15, options) {
8684
8684
  const maybeAccount = await context.rpc.getAccount(
8685
- publicKey(publicKey16, false),
8685
+ publicKey(publicKey15, false),
8686
8686
  options
8687
8687
  );
8688
8688
  return maybeAccount.exists ? deserializeExecutorConfig(maybeAccount) : null;
@@ -8750,17 +8750,17 @@ function getNonceAccountDataSerializer2() {
8750
8750
  function deserializeNonce2(rawAccount) {
8751
8751
  return deserializeAccount(rawAccount, getNonceAccountDataSerializer2());
8752
8752
  }
8753
- async function fetchNonce2(context, publicKey16, options) {
8753
+ async function fetchNonce2(context, publicKey15, options) {
8754
8754
  const maybeAccount = await context.rpc.getAccount(
8755
- publicKey(publicKey16, false),
8755
+ publicKey(publicKey15, false),
8756
8756
  options
8757
8757
  );
8758
8758
  assertAccountExists(maybeAccount, "Nonce");
8759
8759
  return deserializeNonce2(maybeAccount);
8760
8760
  }
8761
- async function safeFetchNonce2(context, publicKey16, options) {
8761
+ async function safeFetchNonce2(context, publicKey15, options) {
8762
8762
  const maybeAccount = await context.rpc.getAccount(
8763
- publicKey(publicKey16, false),
8763
+ publicKey(publicKey15, false),
8764
8764
  options
8765
8765
  );
8766
8766
  return maybeAccount.exists ? deserializeNonce2(maybeAccount) : null;
@@ -9796,6 +9796,11 @@ function getLzReceiveTypesV2AccountsSerializer() {
9796
9796
  description: "LzReceiveTypesV2Result"
9797
9797
  });
9798
9798
  }
9799
+ function getLzComposeTypesV2AccountsSerializer() {
9800
+ return struct([["accounts", array(publicKey$1())]], {
9801
+ description: "LzComposeTypesV2Accounts"
9802
+ });
9803
+ }
9799
9804
  function getAccountMetaRefSerializer() {
9800
9805
  return struct(
9801
9806
  [
@@ -9805,7 +9810,7 @@ function getAccountMetaRefSerializer() {
9805
9810
  { description: "AccountMetaRef" }
9806
9811
  );
9807
9812
  }
9808
- function getInstructionSerializer() {
9813
+ function getInstructionForLzReceiveSerializer() {
9809
9814
  return dataEnum(
9810
9815
  [
9811
9816
  [
@@ -9826,16 +9831,47 @@ function getInstructionSerializer() {
9826
9831
  { description: "Instruction" }
9827
9832
  );
9828
9833
  }
9834
+ function getInstructionForLzComposeSerializer() {
9835
+ return dataEnum(
9836
+ [
9837
+ [
9838
+ "LzCompose",
9839
+ struct([
9840
+ ["accounts", array(getAccountMetaRefSerializer())]
9841
+ ])
9842
+ ],
9843
+ [
9844
+ "Standard",
9845
+ struct([
9846
+ ["programId", publicKey$1()],
9847
+ ["accounts", array(getAccountMetaRefSerializer())],
9848
+ ["data", bytes({ size: u32() })]
9849
+ ])
9850
+ ]
9851
+ ],
9852
+ { description: "Instruction" }
9853
+ );
9854
+ }
9829
9855
  function getLzReceiveTypesV2ResultSerializer() {
9830
9856
  return struct(
9831
9857
  [
9832
9858
  ["contextVersion", u8()],
9833
9859
  ["alts", array(publicKey$1())],
9834
- ["instructions", array(getInstructionSerializer())]
9860
+ ["instructions", array(getInstructionForLzReceiveSerializer())]
9835
9861
  ],
9836
9862
  { description: "LzReceiveTypesV2Result" }
9837
9863
  );
9838
9864
  }
9865
+ function getLzComposeTypesV2ResultSerializer() {
9866
+ return struct(
9867
+ [
9868
+ ["contextVersion", u8()],
9869
+ ["alts", array(publicKey$1())],
9870
+ ["instructions", array(getInstructionForLzComposeSerializer())]
9871
+ ],
9872
+ { description: "LzComposeTypesV2Result" }
9873
+ );
9874
+ }
9839
9875
  function addressLocator(kind, data) {
9840
9876
  return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...data ?? {} };
9841
9877
  }
@@ -10360,7 +10396,206 @@ function toWeb3Connection(rpc) {
10360
10396
  }
10361
10397
  }
10362
10398
 
10363
- // src/receive-types-v1.ts
10399
+ // src/compose-types-v1.ts
10400
+ async function getLzComposeAccountsFromTypesV1(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
10401
+ const oappPDA = new OmniAppPDA(composerProgram);
10402
+ const [lzComposeTypesAccountsPDA] = oappPDA.lzComposeTypesAccounts(to);
10403
+ const info = await rpc.getAccount(lzComposeTypesAccountsPDA, { commitment });
10404
+ const accounts = [];
10405
+ if (info.exists) {
10406
+ const buffer = Buffer.from(info.data);
10407
+ const len = buffer.length - 8;
10408
+ if (len % 32 !== 0) {
10409
+ throw new Error(
10410
+ `Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
10411
+ );
10412
+ }
10413
+ for (let i = 8; i < len; i += 32) {
10414
+ const [address] = publicKey$1().deserialize(buffer, i);
10415
+ accounts.push({
10416
+ pubkey: address,
10417
+ isSigner: false,
10418
+ isWritable: false
10419
+ });
10420
+ }
10421
+ }
10422
+ const data = getLzComposeParamsSerializer2().serialize(params);
10423
+ const lzComposeTypesIx = {
10424
+ programId: composerProgram,
10425
+ keys: accounts,
10426
+ data: Buffer.concat([instructionDiscriminator("lz_compose_types"), data])
10427
+ };
10428
+ const keys = await simulateWeb3JsTransaction(
10429
+ rpc.getEndpoint(),
10430
+ [toWeb3JsInstruction(lzComposeTypesIx)],
10431
+ toWeb3JsPublicKey(composerProgram),
10432
+ toWeb3JsPublicKey(payer),
10433
+ array(getLzReceiveAccountSerializer()),
10434
+ commitment
10435
+ );
10436
+ return updateAccountFromSimulatedResp(keys, payer);
10437
+ }
10438
+ function updateAccountFromSimulatedResp(accounts, payer) {
10439
+ return accounts.map((r) => {
10440
+ if (r.pubkey == defaultPublicKey() && r.isSigner) {
10441
+ if (!payer) throw new Error("payer is required");
10442
+ return {
10443
+ pubkey: payer,
10444
+ isSigner: true,
10445
+ isWritable: r.isWritable
10446
+ };
10447
+ } else {
10448
+ return {
10449
+ pubkey: r.pubkey,
10450
+ isSigner: r.isSigner,
10451
+ isWritable: r.isWritable
10452
+ };
10453
+ }
10454
+ });
10455
+ }
10456
+ async function buildLzComposeExecutionPlan(rpc, executorProgram, payer, to, composerProgram, params, composeTypesAccounts, commitment = "confirmed") {
10457
+ composeTypesAccounts = composeTypesAccounts ?? await getLzComposeTypesInfo(rpc, payer, to, composerProgram, params, commitment);
10458
+ const data = getLzComposeParamsSerializer2().serialize(params);
10459
+ const lzComposeTypesIx = {
10460
+ programId: composerProgram,
10461
+ keys: composeTypesAccounts.accounts.map((pubkey) => {
10462
+ return {
10463
+ pubkey,
10464
+ isSigner: false,
10465
+ isWritable: false
10466
+ };
10467
+ }),
10468
+ data: Buffer.concat([instructionDiscriminator("lz_compose_types_v2"), data])
10469
+ };
10470
+ const resp = await simulateWeb3JsTransaction(
10471
+ rpc.getEndpoint(),
10472
+ [toWeb3JsInstruction(lzComposeTypesIx)],
10473
+ toWeb3JsPublicKey(composerProgram),
10474
+ toWeb3JsPublicKey(payer),
10475
+ getLzComposeTypesV2ResultSerializer(),
10476
+ commitment
10477
+ );
10478
+ const tables = await fetchAllAddressLookupTable({ rpc }, resp.alts);
10479
+ const signers = {};
10480
+ const lzComposeDiscriminator = instructionDiscriminator("lz_compose").toString("hex");
10481
+ const instructionTracker = {};
10482
+ for (const ix of resp.instructions) {
10483
+ let programId = composerProgram;
10484
+ let instructionType = "lz_compose";
10485
+ if (ix.__kind === "Standard") {
10486
+ const { programId: stdProgramId, data: data2 } = ix;
10487
+ programId = stdProgramId;
10488
+ const discriminator = Buffer.from(data2.slice(0, 8)).toString("hex");
10489
+ instructionType = discriminator === lzComposeDiscriminator ? "lz_compose" : discriminator;
10490
+ }
10491
+ const key = `${programId}-${instructionType}`;
10492
+ if (instructionTracker[key]) {
10493
+ throw new Error(`Duplicate instruction found: ${instructionType} for program ${programId}`);
10494
+ }
10495
+ instructionTracker[key] = true;
10496
+ }
10497
+ const { contextVersion } = resp;
10498
+ const instructions = resp.instructions.map((ix) => {
10499
+ if (ix.__kind === "LzCompose") {
10500
+ return {
10501
+ programId: composerProgram,
10502
+ keys: ix.accounts.map(
10503
+ (account) => accountMetaRefToAccountMeta(
10504
+ { eddsa: EDDSA },
10505
+ executorProgram,
10506
+ tables,
10507
+ signers,
10508
+ account,
10509
+ payer,
10510
+ contextVersion
10511
+ )
10512
+ ),
10513
+ data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
10514
+ };
10515
+ } else {
10516
+ return {
10517
+ programId: ix.programId,
10518
+ keys: ix.accounts.map(
10519
+ (account) => accountMetaRefToAccountMeta(
10520
+ { eddsa: EDDSA },
10521
+ executorProgram,
10522
+ tables,
10523
+ signers,
10524
+ account,
10525
+ payer,
10526
+ contextVersion
10527
+ )
10528
+ ),
10529
+ data: ix.data
10530
+ };
10531
+ }
10532
+ });
10533
+ return {
10534
+ contextVersion,
10535
+ signers: Object.values(signers).filter((signer) => signer !== void 0),
10536
+ instructions,
10537
+ addressLookupTables: tables
10538
+ };
10539
+ }
10540
+ async function getLzComposeTypesInfo(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
10541
+ const oappPDA = new OmniAppPDA(composerProgram);
10542
+ const [lzComposeTypesAccountsPDA] = oappPDA.lzComposeTypesAccounts(to);
10543
+ const lzComposeTypesIx = {
10544
+ programId: composerProgram,
10545
+ keys: [
10546
+ {
10547
+ pubkey: to,
10548
+ isSigner: false,
10549
+ isWritable: false
10550
+ },
10551
+ {
10552
+ pubkey: lzComposeTypesAccountsPDA,
10553
+ isSigner: false,
10554
+ isWritable: false
10555
+ }
10556
+ ],
10557
+ data: Buffer.concat([instructionDiscriminator("lz_compose_types_info")])
10558
+ };
10559
+ const resp = await simulateWeb3JsTransaction(
10560
+ rpc.getEndpoint(),
10561
+ [toWeb3JsInstruction(lzComposeTypesIx)],
10562
+ toWeb3JsPublicKey(composerProgram),
10563
+ toWeb3JsPublicKey(payer),
10564
+ bytes(),
10565
+ commitment
10566
+ );
10567
+ const version4 = resp.at(0);
10568
+ if (version4 !== 2) {
10569
+ throw new Error(`Invalid version ${version4}. Expected version 2.`);
10570
+ }
10571
+ return getLzComposeTypesV2AccountsSerializer().deserialize(resp, 1)[0];
10572
+ }
10573
+ function accountMetaRefToAccountMeta(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
10574
+ const { isWritable, pubkey: locator } = accountMetaRef;
10575
+ const pubkey = addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion);
10576
+ return { pubkey, isSigner: locator.__kind === "Signer" || locator.__kind === "Payer", isWritable };
10577
+ }
10578
+ function addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion) {
10579
+ if (locator.__kind === "Payer") {
10580
+ return payer;
10581
+ } else if (locator.__kind === "Signer") {
10582
+ const index = locator.fields[0];
10583
+ let signer = signers[index];
10584
+ if (signer === void 0) {
10585
+ signer = generateSigner(umi);
10586
+ signers[index] = signer;
10587
+ }
10588
+ return signer.publicKey;
10589
+ } else if (locator.__kind === "Address") {
10590
+ return locator.fields[0];
10591
+ } else if (locator.__kind === "Context") {
10592
+ const pda = new ExecutorPDA(executorProgram);
10593
+ return pda.context(payer, contextVersion)[0];
10594
+ } else {
10595
+ const table = tables[locator.fields[0]];
10596
+ return table.addresses[locator.fields[1]];
10597
+ }
10598
+ }
10364
10599
  async function getLzReceiveAccountsFromTypesV1(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
10365
10600
  const oappPDA = new OmniAppPDA(receiverProgram);
10366
10601
  const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
@@ -10397,9 +10632,9 @@ async function getLzReceiveAccountsFromTypesV1(rpc, payer, receiver, receiverPro
10397
10632
  array(getLzReceiveAccountSerializer()),
10398
10633
  commitment
10399
10634
  );
10400
- return updateAccountFromSimulatedResp(keys, payer);
10635
+ return updateAccountFromSimulatedResp2(keys, payer);
10401
10636
  }
10402
- function updateAccountFromSimulatedResp(accounts, payer) {
10637
+ function updateAccountFromSimulatedResp2(accounts, payer) {
10403
10638
  return accounts.map((r) => {
10404
10639
  if (r.pubkey == defaultPublicKey() && r.isSigner) {
10405
10640
  if (!payer) throw new Error("payer is required");
@@ -10464,7 +10699,7 @@ async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver
10464
10699
  return {
10465
10700
  programId: receiverProgram,
10466
10701
  keys: ix.accounts.map(
10467
- (account) => accountMetaRefToAccountMeta(
10702
+ (account) => accountMetaRefToAccountMeta2(
10468
10703
  { eddsa: EDDSA },
10469
10704
  executorProgram,
10470
10705
  tables,
@@ -10480,7 +10715,7 @@ async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver
10480
10715
  return {
10481
10716
  programId: ix.programId,
10482
10717
  keys: ix.accounts.map(
10483
- (account) => accountMetaRefToAccountMeta(
10718
+ (account) => accountMetaRefToAccountMeta2(
10484
10719
  { eddsa: EDDSA },
10485
10720
  executorProgram,
10486
10721
  tables,
@@ -10497,7 +10732,8 @@ async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver
10497
10732
  return {
10498
10733
  contextVersion,
10499
10734
  signers: Object.values(signers).filter((signer) => signer !== void 0),
10500
- instructions
10735
+ instructions,
10736
+ addressLookupTables: tables
10501
10737
  };
10502
10738
  }
10503
10739
  async function getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
@@ -10533,12 +10769,12 @@ async function getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, para
10533
10769
  }
10534
10770
  return getLzReceiveTypesV2AccountsSerializer().deserialize(resp, 1)[0];
10535
10771
  }
10536
- function accountMetaRefToAccountMeta(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
10772
+ function accountMetaRefToAccountMeta2(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
10537
10773
  const { isWritable, pubkey: locator } = accountMetaRef;
10538
- const pubkey = addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion);
10774
+ const pubkey = addressLocatorToPublicKey2(umi, executorProgram, tables, signers, locator, payer, contextVersion);
10539
10775
  return { pubkey, isSigner: locator.__kind === "Signer" || locator.__kind === "Payer", isWritable };
10540
10776
  }
10541
- function addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion) {
10777
+ function addressLocatorToPublicKey2(umi, executorProgram, tables, signers, locator, payer, contextVersion) {
10542
10778
  if (locator.__kind === "Payer") {
10543
10779
  return payer;
10544
10780
  } else if (locator.__kind === "Signer") {
@@ -10576,7 +10812,7 @@ async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0,
10576
10812
  };
10577
10813
  const receiverPubkey = publicKey(receiverBytes);
10578
10814
  const receiverInfo = await rpc.getAccount(receiverPubkey, { commitment });
10579
- invariant3(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
10815
+ invariant2(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
10580
10816
  const receiverProgram = publicKey(receiverInfo.owner);
10581
10817
  let version4 = 1;
10582
10818
  let receiveTypesAccounts;
@@ -10624,7 +10860,7 @@ async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0,
10624
10860
  };
10625
10861
  }
10626
10862
  }
10627
- async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]), commitment = "confirmed") {
10863
+ async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]), executorProgram = EXECUTOR_PROGRAM_ID, commitment = "confirmed") {
10628
10864
  const { to, from, guid, index, message } = event;
10629
10865
  const params = {
10630
10866
  from,
@@ -10638,73 +10874,38 @@ async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]),
10638
10874
  if (!accountInfo.exists) {
10639
10875
  throw new Error(`Account not found: ${to}`);
10640
10876
  }
10641
- const programId = accountInfo.owner;
10642
- const accounts = await getLzComposeAccountMeta(rpc, payer, to, programId, params, commitment);
10643
- const data = getLzComposeParamsSerializer2().serialize(params);
10644
- return {
10645
- programId,
10646
- keys: accounts,
10647
- data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
10648
- };
10649
- }
10650
- async function getLzComposeAccountMeta(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
10651
- const lzComposeTypesAccounts = await (async () => {
10652
- const oappPDA = new OmniAppPDA(composerProgram);
10653
- const [lzComposeTypesAccountsPDA] = oappPDA.lzComposeTypesAccounts(to);
10654
- const info = await rpc.getAccount(lzComposeTypesAccountsPDA, { commitment });
10655
- const accounts = [];
10656
- if (info.exists) {
10657
- const buffer = Buffer.from(info.data);
10658
- const len = buffer.length - 8;
10659
- if (len % 32 !== 0) {
10660
- throw new Error(
10661
- `Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
10662
- );
10663
- }
10664
- for (let i = 8; i < len; i += 32) {
10665
- const [address] = publicKey$1().deserialize(buffer, i);
10666
- accounts.push({
10667
- pubkey: address,
10668
- isSigner: false,
10669
- isWritable: false
10670
- });
10671
- }
10672
- }
10673
- return accounts;
10674
- })();
10675
- const data = getLzComposeParamsSerializer2().serialize(params);
10676
- const lzComposeTypesIx = {
10677
- programId: composerProgram,
10678
- keys: lzComposeTypesAccounts,
10679
- data: Buffer.concat([instructionDiscriminator("lz_compose_types"), data])
10680
- };
10681
- const keys = await simulateWeb3JsTransaction(
10682
- rpc.getEndpoint(),
10683
- [toWeb3JsInstruction(lzComposeTypesIx)],
10684
- toWeb3JsPublicKey(composerProgram),
10685
- toWeb3JsPublicKey(payer),
10686
- array(getLzReceiveAccountSerializer()),
10687
- "confirmed"
10688
- );
10689
- return updateAccountFromSimulatedResp2(keys, payer);
10690
- }
10691
- function updateAccountFromSimulatedResp2(accounts, payer) {
10692
- return accounts.map((r) => {
10693
- if (r.pubkey == defaultPublicKey() && r.isSigner) {
10694
- if (!payer) throw new Error("payer is required");
10695
- return {
10696
- pubkey: payer,
10697
- isSigner: true,
10698
- isWritable: r.isWritable
10699
- };
10700
- } else {
10701
- return {
10702
- pubkey: r.pubkey,
10703
- isSigner: r.isSigner,
10704
- isWritable: r.isWritable
10705
- };
10706
- }
10707
- });
10877
+ const composerProgram = accountInfo.owner;
10878
+ let version4 = 1;
10879
+ let composeTypesAccounts;
10880
+ try {
10881
+ composeTypesAccounts = await getLzComposeTypesInfo(rpc, payer, to, composerProgram, params, commitment);
10882
+ version4 = 2;
10883
+ } catch (e) {
10884
+ version4 = 1;
10885
+ }
10886
+ if (version4 === 2) {
10887
+ return buildLzComposeExecutionPlan(
10888
+ rpc,
10889
+ executorProgram,
10890
+ payer,
10891
+ to,
10892
+ composerProgram,
10893
+ params,
10894
+ composeTypesAccounts,
10895
+ commitment
10896
+ );
10897
+ } else {
10898
+ const accounts = await getLzComposeAccountsFromTypesV1(rpc, payer, to, composerProgram, params, commitment);
10899
+ const data = getLzComposeParamsSerializer2().serialize(params);
10900
+ return {
10901
+ instruction: {
10902
+ programId: composerProgram,
10903
+ keys: accounts,
10904
+ data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
10905
+ },
10906
+ contextVersion: 1
10907
+ };
10908
+ }
10708
10909
  }
10709
10910
 
10710
10911
  // src/executor.ts
@@ -10954,68 +11155,34 @@ var Executor = class {
10954
11155
  const { contextVersion } = lzReceiveResult;
10955
11156
  const instructions = [this.preExecute(executor, contextVersion, value).instruction];
10956
11157
  const signers = [];
11158
+ const addressLookupTables = [];
10957
11159
  if ("instruction" in lzReceiveResult) {
10958
11160
  instructions.push(lzReceiveResult.instruction);
10959
11161
  } else {
10960
11162
  instructions.push(...lzReceiveResult.instructions);
10961
11163
  signers.push(...lzReceiveResult.signers);
11164
+ addressLookupTables.push(...lzReceiveResult.addressLookupTables);
10962
11165
  }
10963
11166
  instructions.push(this.postExecute(executor, contextVersion).instruction);
10964
- return { signers, instructions };
11167
+ return { signers, instructions, addressLookupTables };
10965
11168
  }
10966
11169
  async compose(rpc, executor, param, commitment = "confirmed") {
10967
- const { event, extraData, value = 0n, computeUnits = 4e5, endpointProgram = ENDPOINT_PROGRAM_ID } = param;
10968
- const endpointEventDeriver = new EventPDA(endpointProgram);
10969
- const executorEventDeriver = new EventPDA(this.programId);
10970
- const { to, from, guid, index, message } = event;
10971
- const receiverInfo = await rpc.getAccount(to, { commitment });
10972
- invariant3(receiverInfo.exists, `Receiver account not found: ${to}`);
10973
- const receiverProgram = publicKey(receiverInfo.owner);
10974
- const accounts = await getLzComposeAccountMeta(
10975
- rpc,
10976
- executor.publicKey,
10977
- to,
10978
- receiverProgram,
10979
- {
10980
- from,
10981
- to,
10982
- guid,
10983
- index,
10984
- message,
10985
- extraData
10986
- },
10987
- commitment
10988
- );
10989
- const txBuilder = compose(
10990
- { programs: this.programRepo },
10991
- {
10992
- executor,
10993
- config: this.pda.config(),
10994
- endpointProgram,
10995
- endpointEventAuthority: endpointEventDeriver.eventAuthority()[0],
10996
- program: this.programId,
10997
- eventAuthority: executorEventDeriver.eventAuthority()[0],
10998
- // param
10999
- lzCompose: {
11000
- to,
11001
- from,
11002
- guid,
11003
- index,
11004
- message,
11005
- extraData
11006
- },
11007
- computeUnits,
11008
- value
11009
- }
11010
- );
11011
- return txBuilder.addRemainingAccounts([
11012
- {
11013
- pubkey: receiverProgram,
11014
- isWritable: false,
11015
- isSigner: false
11016
- },
11017
- ...accounts
11018
- ]).items[0];
11170
+ const { event, extraData, value = 0n } = param;
11171
+ const payer = executor.publicKey;
11172
+ const lzComposeResult = await lzCompose(rpc, payer, event, extraData, this.programId, commitment);
11173
+ const { contextVersion } = lzComposeResult;
11174
+ const instructions = [this.preExecute(executor, contextVersion, value).instruction];
11175
+ const signers = [];
11176
+ const addressLookupTables = [];
11177
+ if ("instruction" in lzComposeResult) {
11178
+ instructions.push(lzComposeResult.instruction);
11179
+ } else {
11180
+ instructions.push(...lzComposeResult.instructions);
11181
+ signers.push(...lzComposeResult.signers);
11182
+ addressLookupTables.push(...lzComposeResult.addressLookupTables);
11183
+ }
11184
+ instructions.push(this.postExecute(executor, contextVersion).instruction);
11185
+ return { signers, instructions, addressLookupTables };
11019
11186
  }
11020
11187
  preExecute(executor, version4, feeLimit) {
11021
11188
  const context = this.pda.context(executor.publicKey, version4);
@@ -11084,17 +11251,17 @@ function deserializeConfirmations(rawAccount) {
11084
11251
  getConfirmationsAccountDataSerializer()
11085
11252
  );
11086
11253
  }
11087
- async function fetchConfirmations(context, publicKey16, options) {
11254
+ async function fetchConfirmations(context, publicKey15, options) {
11088
11255
  const maybeAccount = await context.rpc.getAccount(
11089
- publicKey(publicKey16, false),
11256
+ publicKey(publicKey15, false),
11090
11257
  options
11091
11258
  );
11092
11259
  assertAccountExists(maybeAccount, "Confirmations");
11093
11260
  return deserializeConfirmations(maybeAccount);
11094
11261
  }
11095
- async function safeFetchConfirmations(context, publicKey16, options) {
11262
+ async function safeFetchConfirmations(context, publicKey15, options) {
11096
11263
  const maybeAccount = await context.rpc.getAccount(
11097
- publicKey(publicKey16, false),
11264
+ publicKey(publicKey15, false),
11098
11265
  options
11099
11266
  );
11100
11267
  return maybeAccount.exists ? deserializeConfirmations(maybeAccount) : null;
@@ -11156,17 +11323,17 @@ function deserializeReceiveConfig2(rawAccount) {
11156
11323
  getReceiveConfigAccountDataSerializer2()
11157
11324
  );
11158
11325
  }
11159
- async function fetchReceiveConfig2(context, publicKey16, options) {
11326
+ async function fetchReceiveConfig2(context, publicKey15, options) {
11160
11327
  const maybeAccount = await context.rpc.getAccount(
11161
- publicKey(publicKey16, false),
11328
+ publicKey(publicKey15, false),
11162
11329
  options
11163
11330
  );
11164
11331
  assertAccountExists(maybeAccount, "ReceiveConfig");
11165
11332
  return deserializeReceiveConfig2(maybeAccount);
11166
11333
  }
11167
- async function safeFetchReceiveConfig2(context, publicKey16, options) {
11334
+ async function safeFetchReceiveConfig2(context, publicKey15, options) {
11168
11335
  const maybeAccount = await context.rpc.getAccount(
11169
- publicKey(publicKey16, false),
11336
+ publicKey(publicKey15, false),
11170
11337
  options
11171
11338
  );
11172
11339
  return maybeAccount.exists ? deserializeReceiveConfig2(maybeAccount) : null;
@@ -11226,17 +11393,17 @@ function getSendConfigAccountDataSerializer() {
11226
11393
  function deserializeSendConfig(rawAccount) {
11227
11394
  return deserializeAccount(rawAccount, getSendConfigAccountDataSerializer());
11228
11395
  }
11229
- async function fetchSendConfig(context, publicKey16, options) {
11396
+ async function fetchSendConfig(context, publicKey15, options) {
11230
11397
  const maybeAccount = await context.rpc.getAccount(
11231
- publicKey(publicKey16, false),
11398
+ publicKey(publicKey15, false),
11232
11399
  options
11233
11400
  );
11234
11401
  assertAccountExists(maybeAccount, "SendConfig");
11235
11402
  return deserializeSendConfig(maybeAccount);
11236
11403
  }
11237
- async function safeFetchSendConfig(context, publicKey16, options) {
11404
+ async function safeFetchSendConfig(context, publicKey15, options) {
11238
11405
  const maybeAccount = await context.rpc.getAccount(
11239
- publicKey(publicKey16, false),
11406
+ publicKey(publicKey15, false),
11240
11407
  options
11241
11408
  );
11242
11409
  return maybeAccount.exists ? deserializeSendConfig(maybeAccount) : null;
@@ -11296,17 +11463,17 @@ function getUlnSettingsAccountDataSerializer() {
11296
11463
  function deserializeUlnSettings(rawAccount) {
11297
11464
  return deserializeAccount(rawAccount, getUlnSettingsAccountDataSerializer());
11298
11465
  }
11299
- async function fetchUlnSettings(context, publicKey16, options) {
11466
+ async function fetchUlnSettings(context, publicKey15, options) {
11300
11467
  const maybeAccount = await context.rpc.getAccount(
11301
- publicKey(publicKey16, false),
11468
+ publicKey(publicKey15, false),
11302
11469
  options
11303
11470
  );
11304
11471
  assertAccountExists(maybeAccount, "UlnSettings");
11305
11472
  return deserializeUlnSettings(maybeAccount);
11306
11473
  }
11307
- async function safeFetchUlnSettings(context, publicKey16, options) {
11474
+ async function safeFetchUlnSettings(context, publicKey15, options) {
11308
11475
  const maybeAccount = await context.rpc.getAccount(
11309
- publicKey(publicKey16, false),
11476
+ publicKey(publicKey15, false),
11310
11477
  options
11311
11478
  );
11312
11479
  return maybeAccount.exists ? deserializeUlnSettings(maybeAccount) : null;
@@ -12943,9 +13110,9 @@ var Uln = class {
12943
13110
  }
12944
13111
  ).items[0];
12945
13112
  } else {
12946
- invariant3(isSome(sendUlnConfig), "sendUlnConfig is required");
12947
- invariant3(isSome(receiveUlnConfig), "receiveUlnConfig is required");
12948
- invariant3(isSome(executorConfig), "executorConfig is required");
13113
+ invariant2(isSome(sendUlnConfig), "sendUlnConfig is required");
13114
+ invariant2(isSome(receiveUlnConfig), "receiveUlnConfig is required");
13115
+ invariant2(isSome(executorConfig), "executorConfig is required");
12949
13116
  return initDefaultConfig2(
12950
13117
  { programs: this.programRepo },
12951
13118
  {
@@ -13099,9 +13266,9 @@ var Uln = class {
13099
13266
  const { payer, tokenMint, tokenSource } = accounts;
13100
13267
  const { sender, dstEid } = path;
13101
13268
  const ulnState = await this.getSetting(rpc, commitment);
13102
- invariant3(ulnState !== null, "ULN not initialized");
13103
- invariant3(isSome(ulnState.treasury), "treasury not set");
13104
- invariant3(isSome(ulnState.treasury.value.lzToken), "lzToken treasury not set");
13269
+ invariant2(ulnState !== null, "ULN not initialized");
13270
+ invariant2(isSome(ulnState.treasury), "treasury not set");
13271
+ invariant2(isSome(ulnState.treasury.value.lzToken), "lzToken treasury not set");
13105
13272
  const lzTokenTreasury = ulnState.treasury.value.lzToken.value.receiver;
13106
13273
  let txBuilder = sendWithLzToken2(
13107
13274
  { payer: createNoopSigner(payer), programs: this.programRepo },
@@ -13169,7 +13336,7 @@ var Uln = class {
13169
13336
  });
13170
13337
  const priceFeedInfos = await rpc.getAccounts(priceFeeds, { commitment });
13171
13338
  const priceFeedDict = priceFeedInfos.reduce((acc, info, i) => {
13172
- invariant3(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
13339
+ invariant2(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
13173
13340
  acc.set(priceFeeds[i], info.owner);
13174
13341
  return acc;
13175
13342
  }, /* @__PURE__ */ new Map());
@@ -13205,7 +13372,7 @@ var Uln = class {
13205
13372
  const [defaultSendConfigBuf, sendConfigBuf] = await rpc.getAccounts([defaultSendConfig, sendConfig], {
13206
13373
  commitment
13207
13374
  });
13208
- invariant3(defaultSendConfigBuf.exists, "defaultSendConfig not initialized");
13375
+ invariant2(defaultSendConfigBuf.exists, "defaultSendConfig not initialized");
13209
13376
  const defaultSendConfigState = deserializeSendConfig(defaultSendConfigBuf);
13210
13377
  let {
13211
13378
  executor,
@@ -13229,14 +13396,14 @@ var Uln = class {
13229
13396
  const [executorBuf, ...dvnBuf] = await rpc.getAccounts([executor.executor, ...dvns], {
13230
13397
  commitment
13231
13398
  });
13232
- invariant3(executorBuf.exists, `executor:${executor.executor} not initialized`);
13399
+ invariant2(executorBuf.exists, `executor:${executor.executor} not initialized`);
13233
13400
  return {
13234
13401
  executor: {
13235
13402
  config: accounts_exports4.deserializeExecutorConfig(executorBuf),
13236
13403
  owner: executorBuf.owner
13237
13404
  },
13238
13405
  dvns: dvnBuf.map((dvn, i) => {
13239
- invariant3(dvn.exists, `dvn:${dvns[i]} not initialized`);
13406
+ invariant2(dvn.exists, `dvn:${dvns[i]} not initialized`);
13240
13407
  return {
13241
13408
  config: accounts_exports3.deserializeDvnConfig(dvn),
13242
13409
  owner: dvn.owner
@@ -13716,17 +13883,17 @@ function getPriceFeedAccountDataSerializer() {
13716
13883
  function deserializePriceFeed(rawAccount) {
13717
13884
  return deserializeAccount(rawAccount, getPriceFeedAccountDataSerializer());
13718
13885
  }
13719
- async function fetchPriceFeed(context, publicKey16, options) {
13886
+ async function fetchPriceFeed(context, publicKey15, options) {
13720
13887
  const maybeAccount = await context.rpc.getAccount(
13721
- publicKey(publicKey16, false),
13888
+ publicKey(publicKey15, false),
13722
13889
  options
13723
13890
  );
13724
13891
  assertAccountExists(maybeAccount, "PriceFeed");
13725
13892
  return deserializePriceFeed(maybeAccount);
13726
13893
  }
13727
- async function safeFetchPriceFeed(context, publicKey16, options) {
13894
+ async function safeFetchPriceFeed(context, publicKey15, options) {
13728
13895
  const maybeAccount = await context.rpc.getAccount(
13729
- publicKey(publicKey16, false),
13896
+ publicKey(publicKey15, false),
13730
13897
  options
13731
13898
  );
13732
13899
  return maybeAccount.exists ? deserializePriceFeed(maybeAccount) : null;
@@ -14634,7 +14801,7 @@ var SendHelper = class {
14634
14801
  [sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
14635
14802
  commitment
14636
14803
  );
14637
- invariant3(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14804
+ invariant2(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14638
14805
  const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
14639
14806
  const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
14640
14807
  const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
@@ -14700,7 +14867,7 @@ var SendHelper = class {
14700
14867
  [sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
14701
14868
  commitment
14702
14869
  );
14703
- invariant3(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14870
+ invariant2(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14704
14871
  const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
14705
14872
  const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
14706
14873
  const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
@@ -14883,7 +15050,7 @@ var SendHelper = class {
14883
15050
  * @returns {Promise<AccountMeta[]>} A promise that resolves to an array of account metadata.
14884
15051
  */
14885
15052
  async getUlnAccounts(rpc, payer, ulnInfo, ulnDefaultSendConfigInfo, ulnSendConfigInfo, quoteOrSend, commitment = "confirmed") {
14886
- invariant3(
15053
+ invariant2(
14887
15054
  ulnInfo.accountInfo.exists && ulnDefaultSendConfigInfo.accountInfo.exists,
14888
15055
  "uln send library not initialized"
14889
15056
  );
@@ -14913,7 +15080,7 @@ var SendHelper = class {
14913
15080
  [executor.executor, ...dvnsKey],
14914
15081
  commitment
14915
15082
  );
14916
- invariant3(executorBuf.exists, `executor:${executor.executor} not initialized`);
15083
+ invariant2(executorBuf.exists, `executor:${executor.executor} not initialized`);
14917
15084
  let executorAccounts, dvnAccounts;
14918
15085
  {
14919
15086
  const executor2 = {
@@ -14921,7 +15088,7 @@ var SendHelper = class {
14921
15088
  owner: executorBuf.owner
14922
15089
  };
14923
15090
  const dvns = dvnBuf.map((dvn, i) => {
14924
- invariant3(dvn.exists, `dvn:${dvnsKey[i]} not initialized`);
15091
+ invariant2(dvn.exists, `dvn:${dvnsKey[i]} not initialized`);
14925
15092
  return {
14926
15093
  config: accounts_exports3.deserializeDvnConfig(dvn),
14927
15094
  owner: dvn.owner
@@ -14933,10 +15100,10 @@ var SendHelper = class {
14933
15100
  });
14934
15101
  const priceFeedInfos = await this.getMultipleAccountsInfo(rpc, priceFeeds, commitment);
14935
15102
  priceFeedInfos.forEach((info, i) => {
14936
- invariant3(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
15103
+ invariant2(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
14937
15104
  });
14938
15105
  const executorPriceFeed = await this.getMultipleAccountsInfo(rpc, [executor2.config.priceFeed], commitment);
14939
- invariant3(executorPriceFeed[0].exists, `executor priceFeed:${executor2.config.priceFeed} not initialized`);
15106
+ invariant2(executorPriceFeed[0].exists, `executor priceFeed:${executor2.config.priceFeed} not initialized`);
14940
15107
  executorAccounts = new Executor(executor2.owner).getQuoteIXAccountMetaForCPI(
14941
15108
  executor2.config.priceFeed,
14942
15109
  executorPriceFeed[0].owner,
@@ -14945,7 +15112,7 @@ var SendHelper = class {
14945
15112
  dvnAccounts = (await Promise.all(
14946
15113
  dvns.map(async (p, i) => {
14947
15114
  const dvnPriceFeed = await this.getMultipleAccountsInfo(rpc, [p.config.priceFeed], commitment);
14948
- invariant3(dvnPriceFeed[0].exists, `dvn priceFeed:${p.config.priceFeed} not initialized`);
15115
+ invariant2(dvnPriceFeed[0].exists, `dvn priceFeed:${p.config.priceFeed} not initialized`);
14949
15116
  return new DVN(p.owner).getQuoteIXAccountMetaForCPI(
14950
15117
  p.config.priceFeed,
14951
15118
  dvnPriceFeed[0].owner,
@@ -15028,6 +15195,6 @@ var SetConfigType2 = /* @__PURE__ */ ((SetConfigType3) => {
15028
15195
  return SetConfigType3;
15029
15196
  })(SetConfigType2 || {});
15030
15197
 
15031
- export { blocked_messagelib_exports as BlockedMessageLibProgram, dvn_exports2 as DVNProgram, DvnPDA, dvn_exports as DvnProgram, EDDSA, ENFORCED_OPTIONS_SEED, EndpointPDA, endpoint_exports as EndpointProgram, EventPDA, ExecutorOptionType, ExecutorPDA, executor_exports as ExecutorProgram, FAUCET_URL, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDA, MessageType, OmniAppPDA, PEER_SEED, PriceFeedPDA, pricefeed_exports as PriceFeedProgram, SendHelper, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, UlnPDA, uln_exports as UlnProgram, addressLocator, buildLzReceiveExecutionPlan, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractPacketSentEventByTxHash, extractReceivedPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getAccountMetaRefSerializer, getAddressLocatorSerializer, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getInstructionSerializer, getLzComposeAccountMeta, getLzComposeParamsSerializer2 as getLzComposeParamsSerializer, getLzReceiveAccountSerializer, getLzReceiveAccountsFromTypesV1, getLzReceiveParamsSerializer, getLzReceiveTypesInfo, getLzReceiveTypesV2AccountsSerializer, getLzReceiveTypesV2ResultSerializer, getNextNonceInstructionDataSerializer, getPricefeedProgramId, getProgramKeypair, getSimpleMessageLibProgramId, getULNProgramId, idlTypes, instructionDiscriminator, isAccountInitialized, isAddressLocator, lzCompose, lzReceive, messageLibs, nextNonce, simulateWeb3JsTransaction, toWeb3Connection, txWithAddressLookupTable, txWithNonce };
15198
+ export { blocked_messagelib_exports as BlockedMessageLibProgram, dvn_exports2 as DVNProgram, DvnPDA, dvn_exports as DvnProgram, EDDSA, ENFORCED_OPTIONS_SEED, EndpointPDA, endpoint_exports as EndpointProgram, EventPDA, ExecutorOptionType, ExecutorPDA, executor_exports as ExecutorProgram, FAUCET_URL, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDA, MessageType, OmniAppPDA, PEER_SEED, PriceFeedPDA, pricefeed_exports as PriceFeedProgram, SendHelper, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, UlnPDA, uln_exports as UlnProgram, addressLocator, buildLzComposeExecutionPlan, buildLzReceiveExecutionPlan, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractPacketSentEventByTxHash, extractReceivedPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getAccountMetaRefSerializer, getAddressLocatorSerializer, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getInstructionForLzComposeSerializer, getInstructionForLzReceiveSerializer, getLzComposeAccountsFromTypesV1, getLzComposeParamsSerializer2 as getLzComposeParamsSerializer, getLzComposeTypesInfo, getLzComposeTypesV2AccountsSerializer, getLzComposeTypesV2ResultSerializer, getLzReceiveAccountSerializer, getLzReceiveAccountsFromTypesV1, getLzReceiveParamsSerializer, getLzReceiveTypesInfo, getLzReceiveTypesV2AccountsSerializer, getLzReceiveTypesV2ResultSerializer, getNextNonceInstructionDataSerializer, getPricefeedProgramId, getProgramKeypair, getSimpleMessageLibProgramId, getULNProgramId, idlTypes, instructionDiscriminator, isAccountInitialized, isAddressLocator, lzCompose, lzReceive, messageLibs, nextNonce, simulateWeb3JsTransaction, toWeb3Connection, txWithAddressLookupTable, txWithNonce };
15032
15199
  //# sourceMappingURL=umi.mjs.map
15033
15200
  //# sourceMappingURL=umi.mjs.map