@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.cjs CHANGED
@@ -10,7 +10,7 @@ var lzFoundation = require('@layerzerolabs/lz-foundation');
10
10
  var lzUtilities = require('@layerzerolabs/lz-utilities');
11
11
  var lzV2Utilities = require('@layerzerolabs/lz-v2-utilities');
12
12
  var splToken = require('@solana/spl-token');
13
- var invariant3 = require('tiny-invariant');
13
+ var invariant2 = require('tiny-invariant');
14
14
  var mplToolbox = require('@metaplex-foundation/mpl-toolbox');
15
15
  var lzDefinitions = require('@layerzerolabs/lz-definitions');
16
16
 
@@ -35,7 +35,7 @@ function _interopNamespace(e) {
35
35
  }
36
36
 
37
37
  var web3__namespace = /*#__PURE__*/_interopNamespace(web3);
38
- var invariant3__default = /*#__PURE__*/_interopDefault(invariant3);
38
+ var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
39
39
 
40
40
  var __defProp = Object.defineProperty;
41
41
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -440,17 +440,17 @@ function deserializeComposeMessageState(rawAccount) {
440
440
  getComposeMessageStateAccountDataSerializer()
441
441
  );
442
442
  }
443
- async function fetchComposeMessageState(context, publicKey16, options) {
443
+ async function fetchComposeMessageState(context, publicKey15, options) {
444
444
  const maybeAccount = await context.rpc.getAccount(
445
- umi.publicKey(publicKey16, false),
445
+ umi.publicKey(publicKey15, false),
446
446
  options
447
447
  );
448
448
  umi.assertAccountExists(maybeAccount, "ComposeMessageState");
449
449
  return deserializeComposeMessageState(maybeAccount);
450
450
  }
451
- async function safeFetchComposeMessageState(context, publicKey16, options) {
451
+ async function safeFetchComposeMessageState(context, publicKey15, options) {
452
452
  const maybeAccount = await context.rpc.getAccount(
453
- umi.publicKey(publicKey16, false),
453
+ umi.publicKey(publicKey15, false),
454
454
  options
455
455
  );
456
456
  return maybeAccount.exists ? deserializeComposeMessageState(maybeAccount) : null;
@@ -517,17 +517,17 @@ function deserializeEndpointSettings(rawAccount) {
517
517
  getEndpointSettingsAccountDataSerializer()
518
518
  );
519
519
  }
520
- async function fetchEndpointSettings(context, publicKey16, options) {
520
+ async function fetchEndpointSettings(context, publicKey15, options) {
521
521
  const maybeAccount = await context.rpc.getAccount(
522
- umi.publicKey(publicKey16, false),
522
+ umi.publicKey(publicKey15, false),
523
523
  options
524
524
  );
525
525
  umi.assertAccountExists(maybeAccount, "EndpointSettings");
526
526
  return deserializeEndpointSettings(maybeAccount);
527
527
  }
528
- async function safeFetchEndpointSettings(context, publicKey16, options) {
528
+ async function safeFetchEndpointSettings(context, publicKey15, options) {
529
529
  const maybeAccount = await context.rpc.getAccount(
530
- umi.publicKey(publicKey16, false),
530
+ umi.publicKey(publicKey15, false),
531
531
  options
532
532
  );
533
533
  return maybeAccount.exists ? deserializeEndpointSettings(maybeAccount) : null;
@@ -643,17 +643,17 @@ function deserializeMessageLibInfo(rawAccount) {
643
643
  getMessageLibInfoAccountDataSerializer()
644
644
  );
645
645
  }
646
- async function fetchMessageLibInfo(context, publicKey16, options) {
646
+ async function fetchMessageLibInfo(context, publicKey15, options) {
647
647
  const maybeAccount = await context.rpc.getAccount(
648
- umi.publicKey(publicKey16, false),
648
+ umi.publicKey(publicKey15, false),
649
649
  options
650
650
  );
651
651
  umi.assertAccountExists(maybeAccount, "MessageLibInfo");
652
652
  return deserializeMessageLibInfo(maybeAccount);
653
653
  }
654
- async function safeFetchMessageLibInfo(context, publicKey16, options) {
654
+ async function safeFetchMessageLibInfo(context, publicKey15, options) {
655
655
  const maybeAccount = await context.rpc.getAccount(
656
- umi.publicKey(publicKey16, false),
656
+ umi.publicKey(publicKey15, false),
657
657
  options
658
658
  );
659
659
  return maybeAccount.exists ? deserializeMessageLibInfo(maybeAccount) : null;
@@ -717,17 +717,17 @@ function getNonceAccountDataSerializer() {
717
717
  function deserializeNonce(rawAccount) {
718
718
  return umi.deserializeAccount(rawAccount, getNonceAccountDataSerializer());
719
719
  }
720
- async function fetchNonce(context, publicKey16, options) {
720
+ async function fetchNonce(context, publicKey15, options) {
721
721
  const maybeAccount = await context.rpc.getAccount(
722
- umi.publicKey(publicKey16, false),
722
+ umi.publicKey(publicKey15, false),
723
723
  options
724
724
  );
725
725
  umi.assertAccountExists(maybeAccount, "Nonce");
726
726
  return deserializeNonce(maybeAccount);
727
727
  }
728
- async function safeFetchNonce(context, publicKey16, options) {
728
+ async function safeFetchNonce(context, publicKey15, options) {
729
729
  const maybeAccount = await context.rpc.getAccount(
730
- umi.publicKey(publicKey16, false),
730
+ umi.publicKey(publicKey15, false),
731
731
  options
732
732
  );
733
733
  return maybeAccount.exists ? deserializeNonce(maybeAccount) : null;
@@ -786,17 +786,17 @@ function getOAppRegistryAccountDataSerializer() {
786
786
  function deserializeOAppRegistry(rawAccount) {
787
787
  return umi.deserializeAccount(rawAccount, getOAppRegistryAccountDataSerializer());
788
788
  }
789
- async function fetchOAppRegistry(context, publicKey16, options) {
789
+ async function fetchOAppRegistry(context, publicKey15, options) {
790
790
  const maybeAccount = await context.rpc.getAccount(
791
- umi.publicKey(publicKey16, false),
791
+ umi.publicKey(publicKey15, false),
792
792
  options
793
793
  );
794
794
  umi.assertAccountExists(maybeAccount, "OAppRegistry");
795
795
  return deserializeOAppRegistry(maybeAccount);
796
796
  }
797
- async function safeFetchOAppRegistry(context, publicKey16, options) {
797
+ async function safeFetchOAppRegistry(context, publicKey15, options) {
798
798
  const maybeAccount = await context.rpc.getAccount(
799
- umi.publicKey(publicKey16, false),
799
+ umi.publicKey(publicKey15, false),
800
800
  options
801
801
  );
802
802
  return maybeAccount.exists ? deserializeOAppRegistry(maybeAccount) : null;
@@ -856,17 +856,17 @@ function getPayloadHashAccountDataSerializer() {
856
856
  function deserializePayloadHash(rawAccount) {
857
857
  return umi.deserializeAccount(rawAccount, getPayloadHashAccountDataSerializer());
858
858
  }
859
- async function fetchPayloadHash(context, publicKey16, options) {
859
+ async function fetchPayloadHash(context, publicKey15, options) {
860
860
  const maybeAccount = await context.rpc.getAccount(
861
- umi.publicKey(publicKey16, false),
861
+ umi.publicKey(publicKey15, false),
862
862
  options
863
863
  );
864
864
  umi.assertAccountExists(maybeAccount, "PayloadHash");
865
865
  return deserializePayloadHash(maybeAccount);
866
866
  }
867
- async function safeFetchPayloadHash(context, publicKey16, options) {
867
+ async function safeFetchPayloadHash(context, publicKey15, options) {
868
868
  const maybeAccount = await context.rpc.getAccount(
869
- umi.publicKey(publicKey16, false),
869
+ umi.publicKey(publicKey15, false),
870
870
  options
871
871
  );
872
872
  return maybeAccount.exists ? deserializePayloadHash(maybeAccount) : null;
@@ -927,17 +927,17 @@ function deserializePendingInboundNonce(rawAccount) {
927
927
  getPendingInboundNonceAccountDataSerializer()
928
928
  );
929
929
  }
930
- async function fetchPendingInboundNonce(context, publicKey16, options) {
930
+ async function fetchPendingInboundNonce(context, publicKey15, options) {
931
931
  const maybeAccount = await context.rpc.getAccount(
932
- umi.publicKey(publicKey16, false),
932
+ umi.publicKey(publicKey15, false),
933
933
  options
934
934
  );
935
935
  umi.assertAccountExists(maybeAccount, "PendingInboundNonce");
936
936
  return deserializePendingInboundNonce(maybeAccount);
937
937
  }
938
- async function safeFetchPendingInboundNonce(context, publicKey16, options) {
938
+ async function safeFetchPendingInboundNonce(context, publicKey15, options) {
939
939
  const maybeAccount = await context.rpc.getAccount(
940
- umi.publicKey(publicKey16, false),
940
+ umi.publicKey(publicKey15, false),
941
941
  options
942
942
  );
943
943
  return maybeAccount.exists ? deserializePendingInboundNonce(maybeAccount) : null;
@@ -1000,17 +1000,17 @@ function deserializeReceiveLibraryConfig(rawAccount) {
1000
1000
  getReceiveLibraryConfigAccountDataSerializer()
1001
1001
  );
1002
1002
  }
1003
- async function fetchReceiveLibraryConfig(context, publicKey16, options) {
1003
+ async function fetchReceiveLibraryConfig(context, publicKey15, options) {
1004
1004
  const maybeAccount = await context.rpc.getAccount(
1005
- umi.publicKey(publicKey16, false),
1005
+ umi.publicKey(publicKey15, false),
1006
1006
  options
1007
1007
  );
1008
1008
  umi.assertAccountExists(maybeAccount, "ReceiveLibraryConfig");
1009
1009
  return deserializeReceiveLibraryConfig(maybeAccount);
1010
1010
  }
1011
- async function safeFetchReceiveLibraryConfig(context, publicKey16, options) {
1011
+ async function safeFetchReceiveLibraryConfig(context, publicKey15, options) {
1012
1012
  const maybeAccount = await context.rpc.getAccount(
1013
- umi.publicKey(publicKey16, false),
1013
+ umi.publicKey(publicKey15, false),
1014
1014
  options
1015
1015
  );
1016
1016
  return maybeAccount.exists ? deserializeReceiveLibraryConfig(maybeAccount) : null;
@@ -1073,17 +1073,17 @@ function deserializeSendLibraryConfig(rawAccount) {
1073
1073
  getSendLibraryConfigAccountDataSerializer()
1074
1074
  );
1075
1075
  }
1076
- async function fetchSendLibraryConfig(context, publicKey16, options) {
1076
+ async function fetchSendLibraryConfig(context, publicKey15, options) {
1077
1077
  const maybeAccount = await context.rpc.getAccount(
1078
- umi.publicKey(publicKey16, false),
1078
+ umi.publicKey(publicKey15, false),
1079
1079
  options
1080
1080
  );
1081
1081
  umi.assertAccountExists(maybeAccount, "SendLibraryConfig");
1082
1082
  return deserializeSendLibraryConfig(maybeAccount);
1083
1083
  }
1084
- async function safeFetchSendLibraryConfig(context, publicKey16, options) {
1084
+ async function safeFetchSendLibraryConfig(context, publicKey15, options) {
1085
1085
  const maybeAccount = await context.rpc.getAccount(
1086
- umi.publicKey(publicKey16, false),
1086
+ umi.publicKey(publicKey15, false),
1087
1087
  options
1088
1088
  );
1089
1089
  return maybeAccount.exists ? deserializeSendLibraryConfig(maybeAccount) : null;
@@ -4020,17 +4020,17 @@ function getMessageLibAccountDataSerializer() {
4020
4020
  function deserializeMessageLib(rawAccount) {
4021
4021
  return umi.deserializeAccount(rawAccount, getMessageLibAccountDataSerializer());
4022
4022
  }
4023
- async function fetchMessageLib(context, publicKey16, options) {
4023
+ async function fetchMessageLib(context, publicKey15, options) {
4024
4024
  const maybeAccount = await context.rpc.getAccount(
4025
- umi.publicKey(publicKey16, false),
4025
+ umi.publicKey(publicKey15, false),
4026
4026
  options
4027
4027
  );
4028
4028
  umi.assertAccountExists(maybeAccount, "MessageLib");
4029
4029
  return deserializeMessageLib(maybeAccount);
4030
4030
  }
4031
- async function safeFetchMessageLib(context, publicKey16, options) {
4031
+ async function safeFetchMessageLib(context, publicKey15, options) {
4032
4032
  const maybeAccount = await context.rpc.getAccount(
4033
- umi.publicKey(publicKey16, false),
4033
+ umi.publicKey(publicKey15, false),
4034
4034
  options
4035
4035
  );
4036
4036
  return maybeAccount.exists ? deserializeMessageLib(maybeAccount) : null;
@@ -4097,17 +4097,17 @@ function deserializeReceiveConfigStore(rawAccount) {
4097
4097
  getReceiveConfigStoreAccountDataSerializer()
4098
4098
  );
4099
4099
  }
4100
- async function fetchReceiveConfigStore(context, publicKey16, options) {
4100
+ async function fetchReceiveConfigStore(context, publicKey15, options) {
4101
4101
  const maybeAccount = await context.rpc.getAccount(
4102
- umi.publicKey(publicKey16, false),
4102
+ umi.publicKey(publicKey15, false),
4103
4103
  options
4104
4104
  );
4105
4105
  umi.assertAccountExists(maybeAccount, "ReceiveConfigStore");
4106
4106
  return deserializeReceiveConfigStore(maybeAccount);
4107
4107
  }
4108
- async function safeFetchReceiveConfigStore(context, publicKey16, options) {
4108
+ async function safeFetchReceiveConfigStore(context, publicKey15, options) {
4109
4109
  const maybeAccount = await context.rpc.getAccount(
4110
- umi.publicKey(publicKey16, false),
4110
+ umi.publicKey(publicKey15, false),
4111
4111
  options
4112
4112
  );
4113
4113
  return maybeAccount.exists ? deserializeReceiveConfigStore(maybeAccount) : null;
@@ -4169,17 +4169,17 @@ function deserializeSendConfigStore(rawAccount) {
4169
4169
  getSendConfigStoreAccountDataSerializer()
4170
4170
  );
4171
4171
  }
4172
- async function fetchSendConfigStore(context, publicKey16, options) {
4172
+ async function fetchSendConfigStore(context, publicKey15, options) {
4173
4173
  const maybeAccount = await context.rpc.getAccount(
4174
- umi.publicKey(publicKey16, false),
4174
+ umi.publicKey(publicKey15, false),
4175
4175
  options
4176
4176
  );
4177
4177
  umi.assertAccountExists(maybeAccount, "SendConfigStore");
4178
4178
  return deserializeSendConfigStore(maybeAccount);
4179
4179
  }
4180
- async function safeFetchSendConfigStore(context, publicKey16, options) {
4180
+ async function safeFetchSendConfigStore(context, publicKey15, options) {
4181
4181
  const maybeAccount = await context.rpc.getAccount(
4182
- umi.publicKey(publicKey16, false),
4182
+ umi.publicKey(publicKey15, false),
4183
4183
  options
4184
4184
  );
4185
4185
  return maybeAccount.exists ? deserializeSendConfigStore(maybeAccount) : null;
@@ -6997,17 +6997,17 @@ function getDvnConfigAccountDataSerializer() {
6997
6997
  function deserializeDvnConfig(rawAccount) {
6998
6998
  return umi.deserializeAccount(rawAccount, getDvnConfigAccountDataSerializer());
6999
6999
  }
7000
- async function fetchDvnConfig(context, publicKey16, options) {
7000
+ async function fetchDvnConfig(context, publicKey15, options) {
7001
7001
  const maybeAccount = await context.rpc.getAccount(
7002
- umi.publicKey(publicKey16, false),
7002
+ umi.publicKey(publicKey15, false),
7003
7003
  options
7004
7004
  );
7005
7005
  umi.assertAccountExists(maybeAccount, "DvnConfig");
7006
7006
  return deserializeDvnConfig(maybeAccount);
7007
7007
  }
7008
- async function safeFetchDvnConfig(context, publicKey16, options) {
7008
+ async function safeFetchDvnConfig(context, publicKey15, options) {
7009
7009
  const maybeAccount = await context.rpc.getAccount(
7010
- umi.publicKey(publicKey16, false),
7010
+ umi.publicKey(publicKey15, false),
7011
7011
  options
7012
7012
  );
7013
7013
  return maybeAccount.exists ? deserializeDvnConfig(maybeAccount) : null;
@@ -7070,17 +7070,17 @@ function getExecuteHashAccountDataSerializer() {
7070
7070
  function deserializeExecuteHash(rawAccount) {
7071
7071
  return umi.deserializeAccount(rawAccount, getExecuteHashAccountDataSerializer());
7072
7072
  }
7073
- async function fetchExecuteHash(context, publicKey16, options) {
7073
+ async function fetchExecuteHash(context, publicKey15, options) {
7074
7074
  const maybeAccount = await context.rpc.getAccount(
7075
- umi.publicKey(publicKey16, false),
7075
+ umi.publicKey(publicKey15, false),
7076
7076
  options
7077
7077
  );
7078
7078
  umi.assertAccountExists(maybeAccount, "ExecuteHash");
7079
7079
  return deserializeExecuteHash(maybeAccount);
7080
7080
  }
7081
- async function safeFetchExecuteHash(context, publicKey16, options) {
7081
+ async function safeFetchExecuteHash(context, publicKey15, options) {
7082
7082
  const maybeAccount = await context.rpc.getAccount(
7083
- umi.publicKey(publicKey16, false),
7083
+ umi.publicKey(publicKey15, false),
7084
7084
  options
7085
7085
  );
7086
7086
  return maybeAccount.exists ? deserializeExecuteHash(maybeAccount) : null;
@@ -7141,17 +7141,17 @@ function deserializeReceiveConfig(rawAccount) {
7141
7141
  getReceiveConfigAccountDataSerializer()
7142
7142
  );
7143
7143
  }
7144
- async function fetchReceiveConfig(context, publicKey16, options) {
7144
+ async function fetchReceiveConfig(context, publicKey15, options) {
7145
7145
  const maybeAccount = await context.rpc.getAccount(
7146
- umi.publicKey(publicKey16, false),
7146
+ umi.publicKey(publicKey15, false),
7147
7147
  options
7148
7148
  );
7149
7149
  umi.assertAccountExists(maybeAccount, "ReceiveConfig");
7150
7150
  return deserializeReceiveConfig(maybeAccount);
7151
7151
  }
7152
- async function safeFetchReceiveConfig(context, publicKey16, options) {
7152
+ async function safeFetchReceiveConfig(context, publicKey15, options) {
7153
7153
  const maybeAccount = await context.rpc.getAccount(
7154
- umi.publicKey(publicKey16, false),
7154
+ umi.publicKey(publicKey15, false),
7155
7155
  options
7156
7156
  );
7157
7157
  return maybeAccount.exists ? deserializeReceiveConfig(maybeAccount) : null;
@@ -8444,17 +8444,17 @@ function deserializeExecutionContextV1(rawAccount) {
8444
8444
  getExecutionContextV1AccountDataSerializer()
8445
8445
  );
8446
8446
  }
8447
- async function fetchExecutionContextV1(context, publicKey16, options) {
8447
+ async function fetchExecutionContextV1(context, publicKey15, options) {
8448
8448
  const maybeAccount = await context.rpc.getAccount(
8449
- umi.publicKey(publicKey16, false),
8449
+ umi.publicKey(publicKey15, false),
8450
8450
  options
8451
8451
  );
8452
8452
  umi.assertAccountExists(maybeAccount, "ExecutionContextV1");
8453
8453
  return deserializeExecutionContextV1(maybeAccount);
8454
8454
  }
8455
- async function safeFetchExecutionContextV1(context, publicKey16, options) {
8455
+ async function safeFetchExecutionContextV1(context, publicKey15, options) {
8456
8456
  const maybeAccount = await context.rpc.getAccount(
8457
- umi.publicKey(publicKey16, false),
8457
+ umi.publicKey(publicKey15, false),
8458
8458
  options
8459
8459
  );
8460
8460
  return maybeAccount.exists ? deserializeExecutionContextV1(maybeAccount) : null;
@@ -8696,17 +8696,17 @@ function deserializeExecutorConfig(rawAccount) {
8696
8696
  getExecutorConfigAccountDataSerializer()
8697
8697
  );
8698
8698
  }
8699
- async function fetchExecutorConfig(context, publicKey16, options) {
8699
+ async function fetchExecutorConfig(context, publicKey15, options) {
8700
8700
  const maybeAccount = await context.rpc.getAccount(
8701
- umi.publicKey(publicKey16, false),
8701
+ umi.publicKey(publicKey15, false),
8702
8702
  options
8703
8703
  );
8704
8704
  umi.assertAccountExists(maybeAccount, "ExecutorConfig");
8705
8705
  return deserializeExecutorConfig(maybeAccount);
8706
8706
  }
8707
- async function safeFetchExecutorConfig(context, publicKey16, options) {
8707
+ async function safeFetchExecutorConfig(context, publicKey15, options) {
8708
8708
  const maybeAccount = await context.rpc.getAccount(
8709
- umi.publicKey(publicKey16, false),
8709
+ umi.publicKey(publicKey15, false),
8710
8710
  options
8711
8711
  );
8712
8712
  return maybeAccount.exists ? deserializeExecutorConfig(maybeAccount) : null;
@@ -8774,17 +8774,17 @@ function getNonceAccountDataSerializer2() {
8774
8774
  function deserializeNonce2(rawAccount) {
8775
8775
  return umi.deserializeAccount(rawAccount, getNonceAccountDataSerializer2());
8776
8776
  }
8777
- async function fetchNonce2(context, publicKey16, options) {
8777
+ async function fetchNonce2(context, publicKey15, options) {
8778
8778
  const maybeAccount = await context.rpc.getAccount(
8779
- umi.publicKey(publicKey16, false),
8779
+ umi.publicKey(publicKey15, false),
8780
8780
  options
8781
8781
  );
8782
8782
  umi.assertAccountExists(maybeAccount, "Nonce");
8783
8783
  return deserializeNonce2(maybeAccount);
8784
8784
  }
8785
- async function safeFetchNonce2(context, publicKey16, options) {
8785
+ async function safeFetchNonce2(context, publicKey15, options) {
8786
8786
  const maybeAccount = await context.rpc.getAccount(
8787
- umi.publicKey(publicKey16, false),
8787
+ umi.publicKey(publicKey15, false),
8788
8788
  options
8789
8789
  );
8790
8790
  return maybeAccount.exists ? deserializeNonce2(maybeAccount) : null;
@@ -9820,6 +9820,11 @@ function getLzReceiveTypesV2AccountsSerializer() {
9820
9820
  description: "LzReceiveTypesV2Result"
9821
9821
  });
9822
9822
  }
9823
+ function getLzComposeTypesV2AccountsSerializer() {
9824
+ return serializers.struct([["accounts", serializers.array(serializers.publicKey())]], {
9825
+ description: "LzComposeTypesV2Accounts"
9826
+ });
9827
+ }
9823
9828
  function getAccountMetaRefSerializer() {
9824
9829
  return serializers.struct(
9825
9830
  [
@@ -9829,7 +9834,7 @@ function getAccountMetaRefSerializer() {
9829
9834
  { description: "AccountMetaRef" }
9830
9835
  );
9831
9836
  }
9832
- function getInstructionSerializer() {
9837
+ function getInstructionForLzReceiveSerializer() {
9833
9838
  return serializers.dataEnum(
9834
9839
  [
9835
9840
  [
@@ -9850,16 +9855,47 @@ function getInstructionSerializer() {
9850
9855
  { description: "Instruction" }
9851
9856
  );
9852
9857
  }
9858
+ function getInstructionForLzComposeSerializer() {
9859
+ return serializers.dataEnum(
9860
+ [
9861
+ [
9862
+ "LzCompose",
9863
+ serializers.struct([
9864
+ ["accounts", serializers.array(getAccountMetaRefSerializer())]
9865
+ ])
9866
+ ],
9867
+ [
9868
+ "Standard",
9869
+ serializers.struct([
9870
+ ["programId", serializers.publicKey()],
9871
+ ["accounts", serializers.array(getAccountMetaRefSerializer())],
9872
+ ["data", serializers.bytes({ size: serializers.u32() })]
9873
+ ])
9874
+ ]
9875
+ ],
9876
+ { description: "Instruction" }
9877
+ );
9878
+ }
9853
9879
  function getLzReceiveTypesV2ResultSerializer() {
9854
9880
  return serializers.struct(
9855
9881
  [
9856
9882
  ["contextVersion", serializers.u8()],
9857
9883
  ["alts", serializers.array(serializers.publicKey())],
9858
- ["instructions", serializers.array(getInstructionSerializer())]
9884
+ ["instructions", serializers.array(getInstructionForLzReceiveSerializer())]
9859
9885
  ],
9860
9886
  { description: "LzReceiveTypesV2Result" }
9861
9887
  );
9862
9888
  }
9889
+ function getLzComposeTypesV2ResultSerializer() {
9890
+ return serializers.struct(
9891
+ [
9892
+ ["contextVersion", serializers.u8()],
9893
+ ["alts", serializers.array(serializers.publicKey())],
9894
+ ["instructions", serializers.array(getInstructionForLzComposeSerializer())]
9895
+ ],
9896
+ { description: "LzComposeTypesV2Result" }
9897
+ );
9898
+ }
9863
9899
  function addressLocator(kind, data) {
9864
9900
  return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...data ?? {} };
9865
9901
  }
@@ -10384,7 +10420,206 @@ function toWeb3Connection(rpc) {
10384
10420
  }
10385
10421
  }
10386
10422
 
10387
- // src/receive-types-v1.ts
10423
+ // src/compose-types-v1.ts
10424
+ async function getLzComposeAccountsFromTypesV1(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
10425
+ const oappPDA = new OmniAppPDA(composerProgram);
10426
+ const [lzComposeTypesAccountsPDA] = oappPDA.lzComposeTypesAccounts(to);
10427
+ const info = await rpc.getAccount(lzComposeTypesAccountsPDA, { commitment });
10428
+ const accounts = [];
10429
+ if (info.exists) {
10430
+ const buffer = Buffer.from(info.data);
10431
+ const len = buffer.length - 8;
10432
+ if (len % 32 !== 0) {
10433
+ throw new Error(
10434
+ `Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
10435
+ );
10436
+ }
10437
+ for (let i = 8; i < len; i += 32) {
10438
+ const [address] = serializers.publicKey().deserialize(buffer, i);
10439
+ accounts.push({
10440
+ pubkey: address,
10441
+ isSigner: false,
10442
+ isWritable: false
10443
+ });
10444
+ }
10445
+ }
10446
+ const data = getLzComposeParamsSerializer2().serialize(params);
10447
+ const lzComposeTypesIx = {
10448
+ programId: composerProgram,
10449
+ keys: accounts,
10450
+ data: Buffer.concat([instructionDiscriminator("lz_compose_types"), data])
10451
+ };
10452
+ const keys = await simulateWeb3JsTransaction(
10453
+ rpc.getEndpoint(),
10454
+ [umiWeb3jsAdapters.toWeb3JsInstruction(lzComposeTypesIx)],
10455
+ umiWeb3jsAdapters.toWeb3JsPublicKey(composerProgram),
10456
+ umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
10457
+ serializers.array(getLzReceiveAccountSerializer()),
10458
+ commitment
10459
+ );
10460
+ return updateAccountFromSimulatedResp(keys, payer);
10461
+ }
10462
+ function updateAccountFromSimulatedResp(accounts, payer) {
10463
+ return accounts.map((r) => {
10464
+ if (r.pubkey == umi.defaultPublicKey() && r.isSigner) {
10465
+ if (!payer) throw new Error("payer is required");
10466
+ return {
10467
+ pubkey: payer,
10468
+ isSigner: true,
10469
+ isWritable: r.isWritable
10470
+ };
10471
+ } else {
10472
+ return {
10473
+ pubkey: r.pubkey,
10474
+ isSigner: r.isSigner,
10475
+ isWritable: r.isWritable
10476
+ };
10477
+ }
10478
+ });
10479
+ }
10480
+ async function buildLzComposeExecutionPlan(rpc, executorProgram, payer, to, composerProgram, params, composeTypesAccounts, commitment = "confirmed") {
10481
+ composeTypesAccounts = composeTypesAccounts ?? await getLzComposeTypesInfo(rpc, payer, to, composerProgram, params, commitment);
10482
+ const data = getLzComposeParamsSerializer2().serialize(params);
10483
+ const lzComposeTypesIx = {
10484
+ programId: composerProgram,
10485
+ keys: composeTypesAccounts.accounts.map((pubkey) => {
10486
+ return {
10487
+ pubkey,
10488
+ isSigner: false,
10489
+ isWritable: false
10490
+ };
10491
+ }),
10492
+ data: Buffer.concat([instructionDiscriminator("lz_compose_types_v2"), data])
10493
+ };
10494
+ const resp = await simulateWeb3JsTransaction(
10495
+ rpc.getEndpoint(),
10496
+ [umiWeb3jsAdapters.toWeb3JsInstruction(lzComposeTypesIx)],
10497
+ umiWeb3jsAdapters.toWeb3JsPublicKey(composerProgram),
10498
+ umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
10499
+ getLzComposeTypesV2ResultSerializer(),
10500
+ commitment
10501
+ );
10502
+ const tables = await mplToolbox.fetchAllAddressLookupTable({ rpc }, resp.alts);
10503
+ const signers = {};
10504
+ const lzComposeDiscriminator = instructionDiscriminator("lz_compose").toString("hex");
10505
+ const instructionTracker = {};
10506
+ for (const ix of resp.instructions) {
10507
+ let programId = composerProgram;
10508
+ let instructionType = "lz_compose";
10509
+ if (ix.__kind === "Standard") {
10510
+ const { programId: stdProgramId, data: data2 } = ix;
10511
+ programId = stdProgramId;
10512
+ const discriminator = Buffer.from(data2.slice(0, 8)).toString("hex");
10513
+ instructionType = discriminator === lzComposeDiscriminator ? "lz_compose" : discriminator;
10514
+ }
10515
+ const key = `${programId}-${instructionType}`;
10516
+ if (instructionTracker[key]) {
10517
+ throw new Error(`Duplicate instruction found: ${instructionType} for program ${programId}`);
10518
+ }
10519
+ instructionTracker[key] = true;
10520
+ }
10521
+ const { contextVersion } = resp;
10522
+ const instructions = resp.instructions.map((ix) => {
10523
+ if (ix.__kind === "LzCompose") {
10524
+ return {
10525
+ programId: composerProgram,
10526
+ keys: ix.accounts.map(
10527
+ (account) => accountMetaRefToAccountMeta(
10528
+ { eddsa: EDDSA },
10529
+ executorProgram,
10530
+ tables,
10531
+ signers,
10532
+ account,
10533
+ payer,
10534
+ contextVersion
10535
+ )
10536
+ ),
10537
+ data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
10538
+ };
10539
+ } else {
10540
+ return {
10541
+ programId: ix.programId,
10542
+ keys: ix.accounts.map(
10543
+ (account) => accountMetaRefToAccountMeta(
10544
+ { eddsa: EDDSA },
10545
+ executorProgram,
10546
+ tables,
10547
+ signers,
10548
+ account,
10549
+ payer,
10550
+ contextVersion
10551
+ )
10552
+ ),
10553
+ data: ix.data
10554
+ };
10555
+ }
10556
+ });
10557
+ return {
10558
+ contextVersion,
10559
+ signers: Object.values(signers).filter((signer) => signer !== void 0),
10560
+ instructions,
10561
+ addressLookupTables: tables
10562
+ };
10563
+ }
10564
+ async function getLzComposeTypesInfo(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
10565
+ const oappPDA = new OmniAppPDA(composerProgram);
10566
+ const [lzComposeTypesAccountsPDA] = oappPDA.lzComposeTypesAccounts(to);
10567
+ const lzComposeTypesIx = {
10568
+ programId: composerProgram,
10569
+ keys: [
10570
+ {
10571
+ pubkey: to,
10572
+ isSigner: false,
10573
+ isWritable: false
10574
+ },
10575
+ {
10576
+ pubkey: lzComposeTypesAccountsPDA,
10577
+ isSigner: false,
10578
+ isWritable: false
10579
+ }
10580
+ ],
10581
+ data: Buffer.concat([instructionDiscriminator("lz_compose_types_info")])
10582
+ };
10583
+ const resp = await simulateWeb3JsTransaction(
10584
+ rpc.getEndpoint(),
10585
+ [umiWeb3jsAdapters.toWeb3JsInstruction(lzComposeTypesIx)],
10586
+ umiWeb3jsAdapters.toWeb3JsPublicKey(composerProgram),
10587
+ umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
10588
+ serializers.bytes(),
10589
+ commitment
10590
+ );
10591
+ const version4 = resp.at(0);
10592
+ if (version4 !== 2) {
10593
+ throw new Error(`Invalid version ${version4}. Expected version 2.`);
10594
+ }
10595
+ return getLzComposeTypesV2AccountsSerializer().deserialize(resp, 1)[0];
10596
+ }
10597
+ function accountMetaRefToAccountMeta(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
10598
+ const { isWritable, pubkey: locator } = accountMetaRef;
10599
+ const pubkey = addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion);
10600
+ return { pubkey, isSigner: locator.__kind === "Signer" || locator.__kind === "Payer", isWritable };
10601
+ }
10602
+ function addressLocatorToPublicKey(umi$1, executorProgram, tables, signers, locator, payer, contextVersion) {
10603
+ if (locator.__kind === "Payer") {
10604
+ return payer;
10605
+ } else if (locator.__kind === "Signer") {
10606
+ const index = locator.fields[0];
10607
+ let signer = signers[index];
10608
+ if (signer === void 0) {
10609
+ signer = umi.generateSigner(umi$1);
10610
+ signers[index] = signer;
10611
+ }
10612
+ return signer.publicKey;
10613
+ } else if (locator.__kind === "Address") {
10614
+ return locator.fields[0];
10615
+ } else if (locator.__kind === "Context") {
10616
+ const pda = new ExecutorPDA(executorProgram);
10617
+ return pda.context(payer, contextVersion)[0];
10618
+ } else {
10619
+ const table = tables[locator.fields[0]];
10620
+ return table.addresses[locator.fields[1]];
10621
+ }
10622
+ }
10388
10623
  async function getLzReceiveAccountsFromTypesV1(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
10389
10624
  const oappPDA = new OmniAppPDA(receiverProgram);
10390
10625
  const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
@@ -10421,9 +10656,9 @@ async function getLzReceiveAccountsFromTypesV1(rpc, payer, receiver, receiverPro
10421
10656
  serializers.array(getLzReceiveAccountSerializer()),
10422
10657
  commitment
10423
10658
  );
10424
- return updateAccountFromSimulatedResp(keys, payer);
10659
+ return updateAccountFromSimulatedResp2(keys, payer);
10425
10660
  }
10426
- function updateAccountFromSimulatedResp(accounts, payer) {
10661
+ function updateAccountFromSimulatedResp2(accounts, payer) {
10427
10662
  return accounts.map((r) => {
10428
10663
  if (r.pubkey == umi.defaultPublicKey() && r.isSigner) {
10429
10664
  if (!payer) throw new Error("payer is required");
@@ -10488,7 +10723,7 @@ async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver
10488
10723
  return {
10489
10724
  programId: receiverProgram,
10490
10725
  keys: ix.accounts.map(
10491
- (account) => accountMetaRefToAccountMeta(
10726
+ (account) => accountMetaRefToAccountMeta2(
10492
10727
  { eddsa: EDDSA },
10493
10728
  executorProgram,
10494
10729
  tables,
@@ -10504,7 +10739,7 @@ async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver
10504
10739
  return {
10505
10740
  programId: ix.programId,
10506
10741
  keys: ix.accounts.map(
10507
- (account) => accountMetaRefToAccountMeta(
10742
+ (account) => accountMetaRefToAccountMeta2(
10508
10743
  { eddsa: EDDSA },
10509
10744
  executorProgram,
10510
10745
  tables,
@@ -10521,7 +10756,8 @@ async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver
10521
10756
  return {
10522
10757
  contextVersion,
10523
10758
  signers: Object.values(signers).filter((signer) => signer !== void 0),
10524
- instructions
10759
+ instructions,
10760
+ addressLookupTables: tables
10525
10761
  };
10526
10762
  }
10527
10763
  async function getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
@@ -10557,12 +10793,12 @@ async function getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, para
10557
10793
  }
10558
10794
  return getLzReceiveTypesV2AccountsSerializer().deserialize(resp, 1)[0];
10559
10795
  }
10560
- function accountMetaRefToAccountMeta(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
10796
+ function accountMetaRefToAccountMeta2(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
10561
10797
  const { isWritable, pubkey: locator } = accountMetaRef;
10562
- const pubkey = addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion);
10798
+ const pubkey = addressLocatorToPublicKey2(umi, executorProgram, tables, signers, locator, payer, contextVersion);
10563
10799
  return { pubkey, isSigner: locator.__kind === "Signer" || locator.__kind === "Payer", isWritable };
10564
10800
  }
10565
- function addressLocatorToPublicKey(umi$1, executorProgram, tables, signers, locator, payer, contextVersion) {
10801
+ function addressLocatorToPublicKey2(umi$1, executorProgram, tables, signers, locator, payer, contextVersion) {
10566
10802
  if (locator.__kind === "Payer") {
10567
10803
  return payer;
10568
10804
  } else if (locator.__kind === "Signer") {
@@ -10600,7 +10836,7 @@ async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0,
10600
10836
  };
10601
10837
  const receiverPubkey = umi.publicKey(receiverBytes);
10602
10838
  const receiverInfo = await rpc.getAccount(receiverPubkey, { commitment });
10603
- invariant3__default.default(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
10839
+ invariant2__default.default(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
10604
10840
  const receiverProgram = umi.publicKey(receiverInfo.owner);
10605
10841
  let version4 = 1;
10606
10842
  let receiveTypesAccounts;
@@ -10648,7 +10884,7 @@ async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0,
10648
10884
  };
10649
10885
  }
10650
10886
  }
10651
- async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]), commitment = "confirmed") {
10887
+ async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]), executorProgram = EXECUTOR_PROGRAM_ID, commitment = "confirmed") {
10652
10888
  const { to, from, guid, index, message } = event;
10653
10889
  const params = {
10654
10890
  from,
@@ -10662,73 +10898,38 @@ async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]),
10662
10898
  if (!accountInfo.exists) {
10663
10899
  throw new Error(`Account not found: ${to}`);
10664
10900
  }
10665
- const programId = accountInfo.owner;
10666
- const accounts = await getLzComposeAccountMeta(rpc, payer, to, programId, params, commitment);
10667
- const data = getLzComposeParamsSerializer2().serialize(params);
10668
- return {
10669
- programId,
10670
- keys: accounts,
10671
- data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
10672
- };
10673
- }
10674
- async function getLzComposeAccountMeta(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
10675
- const lzComposeTypesAccounts = await (async () => {
10676
- const oappPDA = new OmniAppPDA(composerProgram);
10677
- const [lzComposeTypesAccountsPDA] = oappPDA.lzComposeTypesAccounts(to);
10678
- const info = await rpc.getAccount(lzComposeTypesAccountsPDA, { commitment });
10679
- const accounts = [];
10680
- if (info.exists) {
10681
- const buffer = Buffer.from(info.data);
10682
- const len = buffer.length - 8;
10683
- if (len % 32 !== 0) {
10684
- throw new Error(
10685
- `Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
10686
- );
10687
- }
10688
- for (let i = 8; i < len; i += 32) {
10689
- const [address] = serializers.publicKey().deserialize(buffer, i);
10690
- accounts.push({
10691
- pubkey: address,
10692
- isSigner: false,
10693
- isWritable: false
10694
- });
10695
- }
10696
- }
10697
- return accounts;
10698
- })();
10699
- const data = getLzComposeParamsSerializer2().serialize(params);
10700
- const lzComposeTypesIx = {
10701
- programId: composerProgram,
10702
- keys: lzComposeTypesAccounts,
10703
- data: Buffer.concat([instructionDiscriminator("lz_compose_types"), data])
10704
- };
10705
- const keys = await simulateWeb3JsTransaction(
10706
- rpc.getEndpoint(),
10707
- [umiWeb3jsAdapters.toWeb3JsInstruction(lzComposeTypesIx)],
10708
- umiWeb3jsAdapters.toWeb3JsPublicKey(composerProgram),
10709
- umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
10710
- serializers.array(getLzReceiveAccountSerializer()),
10711
- "confirmed"
10712
- );
10713
- return updateAccountFromSimulatedResp2(keys, payer);
10714
- }
10715
- function updateAccountFromSimulatedResp2(accounts, payer) {
10716
- return accounts.map((r) => {
10717
- if (r.pubkey == umi.defaultPublicKey() && r.isSigner) {
10718
- if (!payer) throw new Error("payer is required");
10719
- return {
10720
- pubkey: payer,
10721
- isSigner: true,
10722
- isWritable: r.isWritable
10723
- };
10724
- } else {
10725
- return {
10726
- pubkey: r.pubkey,
10727
- isSigner: r.isSigner,
10728
- isWritable: r.isWritable
10729
- };
10730
- }
10731
- });
10901
+ const composerProgram = accountInfo.owner;
10902
+ let version4 = 1;
10903
+ let composeTypesAccounts;
10904
+ try {
10905
+ composeTypesAccounts = await getLzComposeTypesInfo(rpc, payer, to, composerProgram, params, commitment);
10906
+ version4 = 2;
10907
+ } catch (e) {
10908
+ version4 = 1;
10909
+ }
10910
+ if (version4 === 2) {
10911
+ return buildLzComposeExecutionPlan(
10912
+ rpc,
10913
+ executorProgram,
10914
+ payer,
10915
+ to,
10916
+ composerProgram,
10917
+ params,
10918
+ composeTypesAccounts,
10919
+ commitment
10920
+ );
10921
+ } else {
10922
+ const accounts = await getLzComposeAccountsFromTypesV1(rpc, payer, to, composerProgram, params, commitment);
10923
+ const data = getLzComposeParamsSerializer2().serialize(params);
10924
+ return {
10925
+ instruction: {
10926
+ programId: composerProgram,
10927
+ keys: accounts,
10928
+ data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
10929
+ },
10930
+ contextVersion: 1
10931
+ };
10932
+ }
10732
10933
  }
10733
10934
 
10734
10935
  // src/executor.ts
@@ -10978,68 +11179,34 @@ var Executor = class {
10978
11179
  const { contextVersion } = lzReceiveResult;
10979
11180
  const instructions = [this.preExecute(executor, contextVersion, value).instruction];
10980
11181
  const signers = [];
11182
+ const addressLookupTables = [];
10981
11183
  if ("instruction" in lzReceiveResult) {
10982
11184
  instructions.push(lzReceiveResult.instruction);
10983
11185
  } else {
10984
11186
  instructions.push(...lzReceiveResult.instructions);
10985
11187
  signers.push(...lzReceiveResult.signers);
11188
+ addressLookupTables.push(...lzReceiveResult.addressLookupTables);
10986
11189
  }
10987
11190
  instructions.push(this.postExecute(executor, contextVersion).instruction);
10988
- return { signers, instructions };
11191
+ return { signers, instructions, addressLookupTables };
10989
11192
  }
10990
11193
  async compose(rpc, executor, param, commitment = "confirmed") {
10991
- const { event, extraData, value = 0n, computeUnits = 4e5, endpointProgram = ENDPOINT_PROGRAM_ID } = param;
10992
- const endpointEventDeriver = new EventPDA(endpointProgram);
10993
- const executorEventDeriver = new EventPDA(this.programId);
10994
- const { to, from, guid, index, message } = event;
10995
- const receiverInfo = await rpc.getAccount(to, { commitment });
10996
- invariant3__default.default(receiverInfo.exists, `Receiver account not found: ${to}`);
10997
- const receiverProgram = umi.publicKey(receiverInfo.owner);
10998
- const accounts = await getLzComposeAccountMeta(
10999
- rpc,
11000
- executor.publicKey,
11001
- to,
11002
- receiverProgram,
11003
- {
11004
- from,
11005
- to,
11006
- guid,
11007
- index,
11008
- message,
11009
- extraData
11010
- },
11011
- commitment
11012
- );
11013
- const txBuilder = compose(
11014
- { programs: this.programRepo },
11015
- {
11016
- executor,
11017
- config: this.pda.config(),
11018
- endpointProgram,
11019
- endpointEventAuthority: endpointEventDeriver.eventAuthority()[0],
11020
- program: this.programId,
11021
- eventAuthority: executorEventDeriver.eventAuthority()[0],
11022
- // param
11023
- lzCompose: {
11024
- to,
11025
- from,
11026
- guid,
11027
- index,
11028
- message,
11029
- extraData
11030
- },
11031
- computeUnits,
11032
- value
11033
- }
11034
- );
11035
- return txBuilder.addRemainingAccounts([
11036
- {
11037
- pubkey: receiverProgram,
11038
- isWritable: false,
11039
- isSigner: false
11040
- },
11041
- ...accounts
11042
- ]).items[0];
11194
+ const { event, extraData, value = 0n } = param;
11195
+ const payer = executor.publicKey;
11196
+ const lzComposeResult = await lzCompose(rpc, payer, event, extraData, this.programId, commitment);
11197
+ const { contextVersion } = lzComposeResult;
11198
+ const instructions = [this.preExecute(executor, contextVersion, value).instruction];
11199
+ const signers = [];
11200
+ const addressLookupTables = [];
11201
+ if ("instruction" in lzComposeResult) {
11202
+ instructions.push(lzComposeResult.instruction);
11203
+ } else {
11204
+ instructions.push(...lzComposeResult.instructions);
11205
+ signers.push(...lzComposeResult.signers);
11206
+ addressLookupTables.push(...lzComposeResult.addressLookupTables);
11207
+ }
11208
+ instructions.push(this.postExecute(executor, contextVersion).instruction);
11209
+ return { signers, instructions, addressLookupTables };
11043
11210
  }
11044
11211
  preExecute(executor, version4, feeLimit) {
11045
11212
  const context = this.pda.context(executor.publicKey, version4);
@@ -11108,17 +11275,17 @@ function deserializeConfirmations(rawAccount) {
11108
11275
  getConfirmationsAccountDataSerializer()
11109
11276
  );
11110
11277
  }
11111
- async function fetchConfirmations(context, publicKey16, options) {
11278
+ async function fetchConfirmations(context, publicKey15, options) {
11112
11279
  const maybeAccount = await context.rpc.getAccount(
11113
- umi.publicKey(publicKey16, false),
11280
+ umi.publicKey(publicKey15, false),
11114
11281
  options
11115
11282
  );
11116
11283
  umi.assertAccountExists(maybeAccount, "Confirmations");
11117
11284
  return deserializeConfirmations(maybeAccount);
11118
11285
  }
11119
- async function safeFetchConfirmations(context, publicKey16, options) {
11286
+ async function safeFetchConfirmations(context, publicKey15, options) {
11120
11287
  const maybeAccount = await context.rpc.getAccount(
11121
- umi.publicKey(publicKey16, false),
11288
+ umi.publicKey(publicKey15, false),
11122
11289
  options
11123
11290
  );
11124
11291
  return maybeAccount.exists ? deserializeConfirmations(maybeAccount) : null;
@@ -11180,17 +11347,17 @@ function deserializeReceiveConfig2(rawAccount) {
11180
11347
  getReceiveConfigAccountDataSerializer2()
11181
11348
  );
11182
11349
  }
11183
- async function fetchReceiveConfig2(context, publicKey16, options) {
11350
+ async function fetchReceiveConfig2(context, publicKey15, options) {
11184
11351
  const maybeAccount = await context.rpc.getAccount(
11185
- umi.publicKey(publicKey16, false),
11352
+ umi.publicKey(publicKey15, false),
11186
11353
  options
11187
11354
  );
11188
11355
  umi.assertAccountExists(maybeAccount, "ReceiveConfig");
11189
11356
  return deserializeReceiveConfig2(maybeAccount);
11190
11357
  }
11191
- async function safeFetchReceiveConfig2(context, publicKey16, options) {
11358
+ async function safeFetchReceiveConfig2(context, publicKey15, options) {
11192
11359
  const maybeAccount = await context.rpc.getAccount(
11193
- umi.publicKey(publicKey16, false),
11360
+ umi.publicKey(publicKey15, false),
11194
11361
  options
11195
11362
  );
11196
11363
  return maybeAccount.exists ? deserializeReceiveConfig2(maybeAccount) : null;
@@ -11250,17 +11417,17 @@ function getSendConfigAccountDataSerializer() {
11250
11417
  function deserializeSendConfig(rawAccount) {
11251
11418
  return umi.deserializeAccount(rawAccount, getSendConfigAccountDataSerializer());
11252
11419
  }
11253
- async function fetchSendConfig(context, publicKey16, options) {
11420
+ async function fetchSendConfig(context, publicKey15, options) {
11254
11421
  const maybeAccount = await context.rpc.getAccount(
11255
- umi.publicKey(publicKey16, false),
11422
+ umi.publicKey(publicKey15, false),
11256
11423
  options
11257
11424
  );
11258
11425
  umi.assertAccountExists(maybeAccount, "SendConfig");
11259
11426
  return deserializeSendConfig(maybeAccount);
11260
11427
  }
11261
- async function safeFetchSendConfig(context, publicKey16, options) {
11428
+ async function safeFetchSendConfig(context, publicKey15, options) {
11262
11429
  const maybeAccount = await context.rpc.getAccount(
11263
- umi.publicKey(publicKey16, false),
11430
+ umi.publicKey(publicKey15, false),
11264
11431
  options
11265
11432
  );
11266
11433
  return maybeAccount.exists ? deserializeSendConfig(maybeAccount) : null;
@@ -11320,17 +11487,17 @@ function getUlnSettingsAccountDataSerializer() {
11320
11487
  function deserializeUlnSettings(rawAccount) {
11321
11488
  return umi.deserializeAccount(rawAccount, getUlnSettingsAccountDataSerializer());
11322
11489
  }
11323
- async function fetchUlnSettings(context, publicKey16, options) {
11490
+ async function fetchUlnSettings(context, publicKey15, options) {
11324
11491
  const maybeAccount = await context.rpc.getAccount(
11325
- umi.publicKey(publicKey16, false),
11492
+ umi.publicKey(publicKey15, false),
11326
11493
  options
11327
11494
  );
11328
11495
  umi.assertAccountExists(maybeAccount, "UlnSettings");
11329
11496
  return deserializeUlnSettings(maybeAccount);
11330
11497
  }
11331
- async function safeFetchUlnSettings(context, publicKey16, options) {
11498
+ async function safeFetchUlnSettings(context, publicKey15, options) {
11332
11499
  const maybeAccount = await context.rpc.getAccount(
11333
- umi.publicKey(publicKey16, false),
11500
+ umi.publicKey(publicKey15, false),
11334
11501
  options
11335
11502
  );
11336
11503
  return maybeAccount.exists ? deserializeUlnSettings(maybeAccount) : null;
@@ -12967,9 +13134,9 @@ var Uln = class {
12967
13134
  }
12968
13135
  ).items[0];
12969
13136
  } else {
12970
- invariant3__default.default(umi.isSome(sendUlnConfig), "sendUlnConfig is required");
12971
- invariant3__default.default(umi.isSome(receiveUlnConfig), "receiveUlnConfig is required");
12972
- invariant3__default.default(umi.isSome(executorConfig), "executorConfig is required");
13137
+ invariant2__default.default(umi.isSome(sendUlnConfig), "sendUlnConfig is required");
13138
+ invariant2__default.default(umi.isSome(receiveUlnConfig), "receiveUlnConfig is required");
13139
+ invariant2__default.default(umi.isSome(executorConfig), "executorConfig is required");
12973
13140
  return initDefaultConfig2(
12974
13141
  { programs: this.programRepo },
12975
13142
  {
@@ -13123,9 +13290,9 @@ var Uln = class {
13123
13290
  const { payer, tokenMint, tokenSource } = accounts;
13124
13291
  const { sender, dstEid } = path;
13125
13292
  const ulnState = await this.getSetting(rpc, commitment);
13126
- invariant3__default.default(ulnState !== null, "ULN not initialized");
13127
- invariant3__default.default(umi.isSome(ulnState.treasury), "treasury not set");
13128
- invariant3__default.default(umi.isSome(ulnState.treasury.value.lzToken), "lzToken treasury not set");
13293
+ invariant2__default.default(ulnState !== null, "ULN not initialized");
13294
+ invariant2__default.default(umi.isSome(ulnState.treasury), "treasury not set");
13295
+ invariant2__default.default(umi.isSome(ulnState.treasury.value.lzToken), "lzToken treasury not set");
13129
13296
  const lzTokenTreasury = ulnState.treasury.value.lzToken.value.receiver;
13130
13297
  let txBuilder = sendWithLzToken2(
13131
13298
  { payer: umi.createNoopSigner(payer), programs: this.programRepo },
@@ -13193,7 +13360,7 @@ var Uln = class {
13193
13360
  });
13194
13361
  const priceFeedInfos = await rpc.getAccounts(priceFeeds, { commitment });
13195
13362
  const priceFeedDict = priceFeedInfos.reduce((acc, info, i) => {
13196
- invariant3__default.default(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
13363
+ invariant2__default.default(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
13197
13364
  acc.set(priceFeeds[i], info.owner);
13198
13365
  return acc;
13199
13366
  }, /* @__PURE__ */ new Map());
@@ -13229,7 +13396,7 @@ var Uln = class {
13229
13396
  const [defaultSendConfigBuf, sendConfigBuf] = await rpc.getAccounts([defaultSendConfig, sendConfig], {
13230
13397
  commitment
13231
13398
  });
13232
- invariant3__default.default(defaultSendConfigBuf.exists, "defaultSendConfig not initialized");
13399
+ invariant2__default.default(defaultSendConfigBuf.exists, "defaultSendConfig not initialized");
13233
13400
  const defaultSendConfigState = deserializeSendConfig(defaultSendConfigBuf);
13234
13401
  let {
13235
13402
  executor,
@@ -13253,14 +13420,14 @@ var Uln = class {
13253
13420
  const [executorBuf, ...dvnBuf] = await rpc.getAccounts([executor.executor, ...dvns], {
13254
13421
  commitment
13255
13422
  });
13256
- invariant3__default.default(executorBuf.exists, `executor:${executor.executor} not initialized`);
13423
+ invariant2__default.default(executorBuf.exists, `executor:${executor.executor} not initialized`);
13257
13424
  return {
13258
13425
  executor: {
13259
13426
  config: accounts_exports4.deserializeExecutorConfig(executorBuf),
13260
13427
  owner: executorBuf.owner
13261
13428
  },
13262
13429
  dvns: dvnBuf.map((dvn, i) => {
13263
- invariant3__default.default(dvn.exists, `dvn:${dvns[i]} not initialized`);
13430
+ invariant2__default.default(dvn.exists, `dvn:${dvns[i]} not initialized`);
13264
13431
  return {
13265
13432
  config: accounts_exports3.deserializeDvnConfig(dvn),
13266
13433
  owner: dvn.owner
@@ -13740,17 +13907,17 @@ function getPriceFeedAccountDataSerializer() {
13740
13907
  function deserializePriceFeed(rawAccount) {
13741
13908
  return umi.deserializeAccount(rawAccount, getPriceFeedAccountDataSerializer());
13742
13909
  }
13743
- async function fetchPriceFeed(context, publicKey16, options) {
13910
+ async function fetchPriceFeed(context, publicKey15, options) {
13744
13911
  const maybeAccount = await context.rpc.getAccount(
13745
- umi.publicKey(publicKey16, false),
13912
+ umi.publicKey(publicKey15, false),
13746
13913
  options
13747
13914
  );
13748
13915
  umi.assertAccountExists(maybeAccount, "PriceFeed");
13749
13916
  return deserializePriceFeed(maybeAccount);
13750
13917
  }
13751
- async function safeFetchPriceFeed(context, publicKey16, options) {
13918
+ async function safeFetchPriceFeed(context, publicKey15, options) {
13752
13919
  const maybeAccount = await context.rpc.getAccount(
13753
- umi.publicKey(publicKey16, false),
13920
+ umi.publicKey(publicKey15, false),
13754
13921
  options
13755
13922
  );
13756
13923
  return maybeAccount.exists ? deserializePriceFeed(maybeAccount) : null;
@@ -14658,7 +14825,7 @@ var SendHelper = class {
14658
14825
  [sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
14659
14826
  commitment
14660
14827
  );
14661
- invariant3__default.default(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14828
+ invariant2__default.default(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14662
14829
  const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
14663
14830
  const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
14664
14831
  const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
@@ -14724,7 +14891,7 @@ var SendHelper = class {
14724
14891
  [sendLibConfig, defaultSendLibConfig, simpleMsgLib, uln, ulnDefaultSendConfig, ulnSendConfig],
14725
14892
  commitment
14726
14893
  );
14727
- invariant3__default.default(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14894
+ invariant2__default.default(defaultSendLibConfigBuf.exists && sendLibConfigBuf.exists, "endpoint send library not initialized");
14728
14895
  const sendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(sendLibConfigBuf);
14729
14896
  const defaultSendLibConfigInfo = endpoint_exports.accounts.deserializeSendLibraryConfig(defaultSendLibConfigBuf);
14730
14897
  const msgLib = sendLibConfigInfo.messageLib.toString() === DefaultMessageLib.toString() ? defaultSendLibConfigInfo.messageLib : sendLibConfigInfo.messageLib;
@@ -14907,7 +15074,7 @@ var SendHelper = class {
14907
15074
  * @returns {Promise<AccountMeta[]>} A promise that resolves to an array of account metadata.
14908
15075
  */
14909
15076
  async getUlnAccounts(rpc, payer, ulnInfo, ulnDefaultSendConfigInfo, ulnSendConfigInfo, quoteOrSend, commitment = "confirmed") {
14910
- invariant3__default.default(
15077
+ invariant2__default.default(
14911
15078
  ulnInfo.accountInfo.exists && ulnDefaultSendConfigInfo.accountInfo.exists,
14912
15079
  "uln send library not initialized"
14913
15080
  );
@@ -14937,7 +15104,7 @@ var SendHelper = class {
14937
15104
  [executor.executor, ...dvnsKey],
14938
15105
  commitment
14939
15106
  );
14940
- invariant3__default.default(executorBuf.exists, `executor:${executor.executor} not initialized`);
15107
+ invariant2__default.default(executorBuf.exists, `executor:${executor.executor} not initialized`);
14941
15108
  let executorAccounts, dvnAccounts;
14942
15109
  {
14943
15110
  const executor2 = {
@@ -14945,7 +15112,7 @@ var SendHelper = class {
14945
15112
  owner: executorBuf.owner
14946
15113
  };
14947
15114
  const dvns = dvnBuf.map((dvn, i) => {
14948
- invariant3__default.default(dvn.exists, `dvn:${dvnsKey[i]} not initialized`);
15115
+ invariant2__default.default(dvn.exists, `dvn:${dvnsKey[i]} not initialized`);
14949
15116
  return {
14950
15117
  config: accounts_exports3.deserializeDvnConfig(dvn),
14951
15118
  owner: dvn.owner
@@ -14957,10 +15124,10 @@ var SendHelper = class {
14957
15124
  });
14958
15125
  const priceFeedInfos = await this.getMultipleAccountsInfo(rpc, priceFeeds, commitment);
14959
15126
  priceFeedInfos.forEach((info, i) => {
14960
- invariant3__default.default(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
15127
+ invariant2__default.default(info.exists, `priceFeed:${priceFeeds[i]} not initialized`);
14961
15128
  });
14962
15129
  const executorPriceFeed = await this.getMultipleAccountsInfo(rpc, [executor2.config.priceFeed], commitment);
14963
- invariant3__default.default(executorPriceFeed[0].exists, `executor priceFeed:${executor2.config.priceFeed} not initialized`);
15130
+ invariant2__default.default(executorPriceFeed[0].exists, `executor priceFeed:${executor2.config.priceFeed} not initialized`);
14964
15131
  executorAccounts = new Executor(executor2.owner).getQuoteIXAccountMetaForCPI(
14965
15132
  executor2.config.priceFeed,
14966
15133
  executorPriceFeed[0].owner,
@@ -14969,7 +15136,7 @@ var SendHelper = class {
14969
15136
  dvnAccounts = (await Promise.all(
14970
15137
  dvns.map(async (p, i) => {
14971
15138
  const dvnPriceFeed = await this.getMultipleAccountsInfo(rpc, [p.config.priceFeed], commitment);
14972
- invariant3__default.default(dvnPriceFeed[0].exists, `dvn priceFeed:${p.config.priceFeed} not initialized`);
15139
+ invariant2__default.default(dvnPriceFeed[0].exists, `dvn priceFeed:${p.config.priceFeed} not initialized`);
14973
15140
  return new DVN(p.owner).getQuoteIXAccountMetaForCPI(
14974
15141
  p.config.priceFeed,
14975
15142
  dvnPriceFeed[0].owner,
@@ -15080,6 +15247,7 @@ exports.SimpleMessageLibProgram = simple_message_lib_exports;
15080
15247
  exports.UlnPDA = UlnPDA;
15081
15248
  exports.UlnProgram = uln_exports;
15082
15249
  exports.addressLocator = addressLocator;
15250
+ exports.buildLzComposeExecutionPlan = buildLzComposeExecutionPlan;
15083
15251
  exports.buildLzReceiveExecutionPlan = buildLzReceiveExecutionPlan;
15084
15252
  exports.buildMessageV0 = buildMessageV0;
15085
15253
  exports.buildVersionedTransaction = buildVersionedTransaction;
@@ -15100,9 +15268,13 @@ exports.getBlockedMessageLibProgramId = getBlockedMessageLibProgramId;
15100
15268
  exports.getDVNProgramId = getDVNProgramId;
15101
15269
  exports.getEndpointProgramId = getEndpointProgramId;
15102
15270
  exports.getExecutorProgramId = getExecutorProgramId;
15103
- exports.getInstructionSerializer = getInstructionSerializer;
15104
- exports.getLzComposeAccountMeta = getLzComposeAccountMeta;
15271
+ exports.getInstructionForLzComposeSerializer = getInstructionForLzComposeSerializer;
15272
+ exports.getInstructionForLzReceiveSerializer = getInstructionForLzReceiveSerializer;
15273
+ exports.getLzComposeAccountsFromTypesV1 = getLzComposeAccountsFromTypesV1;
15105
15274
  exports.getLzComposeParamsSerializer = getLzComposeParamsSerializer2;
15275
+ exports.getLzComposeTypesInfo = getLzComposeTypesInfo;
15276
+ exports.getLzComposeTypesV2AccountsSerializer = getLzComposeTypesV2AccountsSerializer;
15277
+ exports.getLzComposeTypesV2ResultSerializer = getLzComposeTypesV2ResultSerializer;
15106
15278
  exports.getLzReceiveAccountSerializer = getLzReceiveAccountSerializer;
15107
15279
  exports.getLzReceiveAccountsFromTypesV1 = getLzReceiveAccountsFromTypesV1;
15108
15280
  exports.getLzReceiveParamsSerializer = getLzReceiveParamsSerializer;