@layerzerolabs/lz-solana-sdk-v2 3.0.103 → 3.0.105-mpt.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +0 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +0 -15
- package/dist/index.d.ts +0 -15
- package/dist/index.mjs +0 -73
- package/dist/index.mjs.map +1 -1
- package/dist/umi.cjs +703 -291
- package/dist/umi.cjs.map +1 -1
- package/dist/umi.d.mts +234 -102
- package/dist/umi.d.ts +234 -102
- package/dist/umi.mjs +695 -292
- package/dist/umi.mjs.map +1 -1
- package/package.json +10 -9
- package/src/executor.ts +35 -59
- package/src/generated/kinobi/executor/accounts/executionContextV1.ts +173 -0
- package/src/generated/kinobi/executor/accounts/index.ts +1 -0
- package/src/generated/kinobi/executor/errors/executor.ts +32 -0
- package/src/generated/kinobi/executor/instructions/index.ts +2 -1
- package/src/generated/kinobi/executor/instructions/postExecute.ts +141 -0
- package/src/generated/kinobi/executor/instructions/preExecute.ts +164 -0
- package/src/generated/kinobi/executor/types/index.ts +0 -1
- package/src/index.ts +2 -0
- package/src/pda.ts +10 -1
- package/src/receive-types-v1.ts +85 -0
- package/src/receive-types-v2.ts +217 -0
- package/src/receive.ts +66 -111
- package/src/solita/executor.ts +1 -88
- package/src/types.ts +140 -0
- package/src/generated/kinobi/executor/instructions/execute.ts +0 -159
- package/src/generated/kinobi/executor/types/lzReceiveParams.ts +0 -50
package/dist/umi.cjs
CHANGED
|
@@ -11,6 +11,7 @@ var lzUtilities = require('@layerzerolabs/lz-utilities');
|
|
|
11
11
|
var lzV2Utilities = require('@layerzerolabs/lz-v2-utilities');
|
|
12
12
|
var splToken = require('@solana/spl-token');
|
|
13
13
|
var invariant3 = require('tiny-invariant');
|
|
14
|
+
var mplToolbox = require('@metaplex-foundation/mpl-toolbox');
|
|
14
15
|
var lzDefinitions = require('@layerzerolabs/lz-definitions');
|
|
15
16
|
|
|
16
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -308,8 +309,16 @@ var _ExecutorPDA = class _ExecutorPDA {
|
|
|
308
309
|
config() {
|
|
309
310
|
return EDDSA.findPda(this.program, [Buffer.from(_ExecutorPDA.EXECUTOR_CONFIG_SEED, "utf8")]);
|
|
310
311
|
}
|
|
312
|
+
context(executor, version4) {
|
|
313
|
+
return EDDSA.findPda(this.program, [
|
|
314
|
+
Buffer.from(_ExecutorPDA.EXECUTION_CONTEXT_SEED, "utf8"),
|
|
315
|
+
umi.publicKeyBytes(executor),
|
|
316
|
+
serializers.u8().serialize(version4)
|
|
317
|
+
]);
|
|
318
|
+
}
|
|
311
319
|
};
|
|
312
320
|
_ExecutorPDA.EXECUTOR_CONFIG_SEED = "ExecutorConfig";
|
|
321
|
+
_ExecutorPDA.EXECUTION_CONTEXT_SEED = "ExecutionContext";
|
|
313
322
|
var ExecutorPDA = _ExecutorPDA;
|
|
314
323
|
var _PriceFeedPDA = class _PriceFeedPDA {
|
|
315
324
|
constructor(program) {
|
|
@@ -431,17 +440,17 @@ function deserializeComposeMessageState(rawAccount) {
|
|
|
431
440
|
getComposeMessageStateAccountDataSerializer()
|
|
432
441
|
);
|
|
433
442
|
}
|
|
434
|
-
async function fetchComposeMessageState(context,
|
|
443
|
+
async function fetchComposeMessageState(context, publicKey16, options) {
|
|
435
444
|
const maybeAccount = await context.rpc.getAccount(
|
|
436
|
-
umi.publicKey(
|
|
445
|
+
umi.publicKey(publicKey16, false),
|
|
437
446
|
options
|
|
438
447
|
);
|
|
439
448
|
umi.assertAccountExists(maybeAccount, "ComposeMessageState");
|
|
440
449
|
return deserializeComposeMessageState(maybeAccount);
|
|
441
450
|
}
|
|
442
|
-
async function safeFetchComposeMessageState(context,
|
|
451
|
+
async function safeFetchComposeMessageState(context, publicKey16, options) {
|
|
443
452
|
const maybeAccount = await context.rpc.getAccount(
|
|
444
|
-
umi.publicKey(
|
|
453
|
+
umi.publicKey(publicKey16, false),
|
|
445
454
|
options
|
|
446
455
|
);
|
|
447
456
|
return maybeAccount.exists ? deserializeComposeMessageState(maybeAccount) : null;
|
|
@@ -508,17 +517,17 @@ function deserializeEndpointSettings(rawAccount) {
|
|
|
508
517
|
getEndpointSettingsAccountDataSerializer()
|
|
509
518
|
);
|
|
510
519
|
}
|
|
511
|
-
async function fetchEndpointSettings(context,
|
|
520
|
+
async function fetchEndpointSettings(context, publicKey16, options) {
|
|
512
521
|
const maybeAccount = await context.rpc.getAccount(
|
|
513
|
-
umi.publicKey(
|
|
522
|
+
umi.publicKey(publicKey16, false),
|
|
514
523
|
options
|
|
515
524
|
);
|
|
516
525
|
umi.assertAccountExists(maybeAccount, "EndpointSettings");
|
|
517
526
|
return deserializeEndpointSettings(maybeAccount);
|
|
518
527
|
}
|
|
519
|
-
async function safeFetchEndpointSettings(context,
|
|
528
|
+
async function safeFetchEndpointSettings(context, publicKey16, options) {
|
|
520
529
|
const maybeAccount = await context.rpc.getAccount(
|
|
521
|
-
umi.publicKey(
|
|
530
|
+
umi.publicKey(publicKey16, false),
|
|
522
531
|
options
|
|
523
532
|
);
|
|
524
533
|
return maybeAccount.exists ? deserializeEndpointSettings(maybeAccount) : null;
|
|
@@ -634,17 +643,17 @@ function deserializeMessageLibInfo(rawAccount) {
|
|
|
634
643
|
getMessageLibInfoAccountDataSerializer()
|
|
635
644
|
);
|
|
636
645
|
}
|
|
637
|
-
async function fetchMessageLibInfo(context,
|
|
646
|
+
async function fetchMessageLibInfo(context, publicKey16, options) {
|
|
638
647
|
const maybeAccount = await context.rpc.getAccount(
|
|
639
|
-
umi.publicKey(
|
|
648
|
+
umi.publicKey(publicKey16, false),
|
|
640
649
|
options
|
|
641
650
|
);
|
|
642
651
|
umi.assertAccountExists(maybeAccount, "MessageLibInfo");
|
|
643
652
|
return deserializeMessageLibInfo(maybeAccount);
|
|
644
653
|
}
|
|
645
|
-
async function safeFetchMessageLibInfo(context,
|
|
654
|
+
async function safeFetchMessageLibInfo(context, publicKey16, options) {
|
|
646
655
|
const maybeAccount = await context.rpc.getAccount(
|
|
647
|
-
umi.publicKey(
|
|
656
|
+
umi.publicKey(publicKey16, false),
|
|
648
657
|
options
|
|
649
658
|
);
|
|
650
659
|
return maybeAccount.exists ? deserializeMessageLibInfo(maybeAccount) : null;
|
|
@@ -708,17 +717,17 @@ function getNonceAccountDataSerializer() {
|
|
|
708
717
|
function deserializeNonce(rawAccount) {
|
|
709
718
|
return umi.deserializeAccount(rawAccount, getNonceAccountDataSerializer());
|
|
710
719
|
}
|
|
711
|
-
async function fetchNonce(context,
|
|
720
|
+
async function fetchNonce(context, publicKey16, options) {
|
|
712
721
|
const maybeAccount = await context.rpc.getAccount(
|
|
713
|
-
umi.publicKey(
|
|
722
|
+
umi.publicKey(publicKey16, false),
|
|
714
723
|
options
|
|
715
724
|
);
|
|
716
725
|
umi.assertAccountExists(maybeAccount, "Nonce");
|
|
717
726
|
return deserializeNonce(maybeAccount);
|
|
718
727
|
}
|
|
719
|
-
async function safeFetchNonce(context,
|
|
728
|
+
async function safeFetchNonce(context, publicKey16, options) {
|
|
720
729
|
const maybeAccount = await context.rpc.getAccount(
|
|
721
|
-
umi.publicKey(
|
|
730
|
+
umi.publicKey(publicKey16, false),
|
|
722
731
|
options
|
|
723
732
|
);
|
|
724
733
|
return maybeAccount.exists ? deserializeNonce(maybeAccount) : null;
|
|
@@ -777,17 +786,17 @@ function getOAppRegistryAccountDataSerializer() {
|
|
|
777
786
|
function deserializeOAppRegistry(rawAccount) {
|
|
778
787
|
return umi.deserializeAccount(rawAccount, getOAppRegistryAccountDataSerializer());
|
|
779
788
|
}
|
|
780
|
-
async function fetchOAppRegistry(context,
|
|
789
|
+
async function fetchOAppRegistry(context, publicKey16, options) {
|
|
781
790
|
const maybeAccount = await context.rpc.getAccount(
|
|
782
|
-
umi.publicKey(
|
|
791
|
+
umi.publicKey(publicKey16, false),
|
|
783
792
|
options
|
|
784
793
|
);
|
|
785
794
|
umi.assertAccountExists(maybeAccount, "OAppRegistry");
|
|
786
795
|
return deserializeOAppRegistry(maybeAccount);
|
|
787
796
|
}
|
|
788
|
-
async function safeFetchOAppRegistry(context,
|
|
797
|
+
async function safeFetchOAppRegistry(context, publicKey16, options) {
|
|
789
798
|
const maybeAccount = await context.rpc.getAccount(
|
|
790
|
-
umi.publicKey(
|
|
799
|
+
umi.publicKey(publicKey16, false),
|
|
791
800
|
options
|
|
792
801
|
);
|
|
793
802
|
return maybeAccount.exists ? deserializeOAppRegistry(maybeAccount) : null;
|
|
@@ -847,17 +856,17 @@ function getPayloadHashAccountDataSerializer() {
|
|
|
847
856
|
function deserializePayloadHash(rawAccount) {
|
|
848
857
|
return umi.deserializeAccount(rawAccount, getPayloadHashAccountDataSerializer());
|
|
849
858
|
}
|
|
850
|
-
async function fetchPayloadHash(context,
|
|
859
|
+
async function fetchPayloadHash(context, publicKey16, options) {
|
|
851
860
|
const maybeAccount = await context.rpc.getAccount(
|
|
852
|
-
umi.publicKey(
|
|
861
|
+
umi.publicKey(publicKey16, false),
|
|
853
862
|
options
|
|
854
863
|
);
|
|
855
864
|
umi.assertAccountExists(maybeAccount, "PayloadHash");
|
|
856
865
|
return deserializePayloadHash(maybeAccount);
|
|
857
866
|
}
|
|
858
|
-
async function safeFetchPayloadHash(context,
|
|
867
|
+
async function safeFetchPayloadHash(context, publicKey16, options) {
|
|
859
868
|
const maybeAccount = await context.rpc.getAccount(
|
|
860
|
-
umi.publicKey(
|
|
869
|
+
umi.publicKey(publicKey16, false),
|
|
861
870
|
options
|
|
862
871
|
);
|
|
863
872
|
return maybeAccount.exists ? deserializePayloadHash(maybeAccount) : null;
|
|
@@ -918,17 +927,17 @@ function deserializePendingInboundNonce(rawAccount) {
|
|
|
918
927
|
getPendingInboundNonceAccountDataSerializer()
|
|
919
928
|
);
|
|
920
929
|
}
|
|
921
|
-
async function fetchPendingInboundNonce(context,
|
|
930
|
+
async function fetchPendingInboundNonce(context, publicKey16, options) {
|
|
922
931
|
const maybeAccount = await context.rpc.getAccount(
|
|
923
|
-
umi.publicKey(
|
|
932
|
+
umi.publicKey(publicKey16, false),
|
|
924
933
|
options
|
|
925
934
|
);
|
|
926
935
|
umi.assertAccountExists(maybeAccount, "PendingInboundNonce");
|
|
927
936
|
return deserializePendingInboundNonce(maybeAccount);
|
|
928
937
|
}
|
|
929
|
-
async function safeFetchPendingInboundNonce(context,
|
|
938
|
+
async function safeFetchPendingInboundNonce(context, publicKey16, options) {
|
|
930
939
|
const maybeAccount = await context.rpc.getAccount(
|
|
931
|
-
umi.publicKey(
|
|
940
|
+
umi.publicKey(publicKey16, false),
|
|
932
941
|
options
|
|
933
942
|
);
|
|
934
943
|
return maybeAccount.exists ? deserializePendingInboundNonce(maybeAccount) : null;
|
|
@@ -991,17 +1000,17 @@ function deserializeReceiveLibraryConfig(rawAccount) {
|
|
|
991
1000
|
getReceiveLibraryConfigAccountDataSerializer()
|
|
992
1001
|
);
|
|
993
1002
|
}
|
|
994
|
-
async function fetchReceiveLibraryConfig(context,
|
|
1003
|
+
async function fetchReceiveLibraryConfig(context, publicKey16, options) {
|
|
995
1004
|
const maybeAccount = await context.rpc.getAccount(
|
|
996
|
-
umi.publicKey(
|
|
1005
|
+
umi.publicKey(publicKey16, false),
|
|
997
1006
|
options
|
|
998
1007
|
);
|
|
999
1008
|
umi.assertAccountExists(maybeAccount, "ReceiveLibraryConfig");
|
|
1000
1009
|
return deserializeReceiveLibraryConfig(maybeAccount);
|
|
1001
1010
|
}
|
|
1002
|
-
async function safeFetchReceiveLibraryConfig(context,
|
|
1011
|
+
async function safeFetchReceiveLibraryConfig(context, publicKey16, options) {
|
|
1003
1012
|
const maybeAccount = await context.rpc.getAccount(
|
|
1004
|
-
umi.publicKey(
|
|
1013
|
+
umi.publicKey(publicKey16, false),
|
|
1005
1014
|
options
|
|
1006
1015
|
);
|
|
1007
1016
|
return maybeAccount.exists ? deserializeReceiveLibraryConfig(maybeAccount) : null;
|
|
@@ -1064,17 +1073,17 @@ function deserializeSendLibraryConfig(rawAccount) {
|
|
|
1064
1073
|
getSendLibraryConfigAccountDataSerializer()
|
|
1065
1074
|
);
|
|
1066
1075
|
}
|
|
1067
|
-
async function fetchSendLibraryConfig(context,
|
|
1076
|
+
async function fetchSendLibraryConfig(context, publicKey16, options) {
|
|
1068
1077
|
const maybeAccount = await context.rpc.getAccount(
|
|
1069
|
-
umi.publicKey(
|
|
1078
|
+
umi.publicKey(publicKey16, false),
|
|
1070
1079
|
options
|
|
1071
1080
|
);
|
|
1072
1081
|
umi.assertAccountExists(maybeAccount, "SendLibraryConfig");
|
|
1073
1082
|
return deserializeSendLibraryConfig(maybeAccount);
|
|
1074
1083
|
}
|
|
1075
|
-
async function safeFetchSendLibraryConfig(context,
|
|
1084
|
+
async function safeFetchSendLibraryConfig(context, publicKey16, options) {
|
|
1076
1085
|
const maybeAccount = await context.rpc.getAccount(
|
|
1077
|
-
umi.publicKey(
|
|
1086
|
+
umi.publicKey(publicKey16, false),
|
|
1078
1087
|
options
|
|
1079
1088
|
);
|
|
1080
1089
|
return maybeAccount.exists ? deserializeSendLibraryConfig(maybeAccount) : null;
|
|
@@ -4011,17 +4020,17 @@ function getMessageLibAccountDataSerializer() {
|
|
|
4011
4020
|
function deserializeMessageLib(rawAccount) {
|
|
4012
4021
|
return umi.deserializeAccount(rawAccount, getMessageLibAccountDataSerializer());
|
|
4013
4022
|
}
|
|
4014
|
-
async function fetchMessageLib(context,
|
|
4023
|
+
async function fetchMessageLib(context, publicKey16, options) {
|
|
4015
4024
|
const maybeAccount = await context.rpc.getAccount(
|
|
4016
|
-
umi.publicKey(
|
|
4025
|
+
umi.publicKey(publicKey16, false),
|
|
4017
4026
|
options
|
|
4018
4027
|
);
|
|
4019
4028
|
umi.assertAccountExists(maybeAccount, "MessageLib");
|
|
4020
4029
|
return deserializeMessageLib(maybeAccount);
|
|
4021
4030
|
}
|
|
4022
|
-
async function safeFetchMessageLib(context,
|
|
4031
|
+
async function safeFetchMessageLib(context, publicKey16, options) {
|
|
4023
4032
|
const maybeAccount = await context.rpc.getAccount(
|
|
4024
|
-
umi.publicKey(
|
|
4033
|
+
umi.publicKey(publicKey16, false),
|
|
4025
4034
|
options
|
|
4026
4035
|
);
|
|
4027
4036
|
return maybeAccount.exists ? deserializeMessageLib(maybeAccount) : null;
|
|
@@ -4088,17 +4097,17 @@ function deserializeReceiveConfigStore(rawAccount) {
|
|
|
4088
4097
|
getReceiveConfigStoreAccountDataSerializer()
|
|
4089
4098
|
);
|
|
4090
4099
|
}
|
|
4091
|
-
async function fetchReceiveConfigStore(context,
|
|
4100
|
+
async function fetchReceiveConfigStore(context, publicKey16, options) {
|
|
4092
4101
|
const maybeAccount = await context.rpc.getAccount(
|
|
4093
|
-
umi.publicKey(
|
|
4102
|
+
umi.publicKey(publicKey16, false),
|
|
4094
4103
|
options
|
|
4095
4104
|
);
|
|
4096
4105
|
umi.assertAccountExists(maybeAccount, "ReceiveConfigStore");
|
|
4097
4106
|
return deserializeReceiveConfigStore(maybeAccount);
|
|
4098
4107
|
}
|
|
4099
|
-
async function safeFetchReceiveConfigStore(context,
|
|
4108
|
+
async function safeFetchReceiveConfigStore(context, publicKey16, options) {
|
|
4100
4109
|
const maybeAccount = await context.rpc.getAccount(
|
|
4101
|
-
umi.publicKey(
|
|
4110
|
+
umi.publicKey(publicKey16, false),
|
|
4102
4111
|
options
|
|
4103
4112
|
);
|
|
4104
4113
|
return maybeAccount.exists ? deserializeReceiveConfigStore(maybeAccount) : null;
|
|
@@ -4160,17 +4169,17 @@ function deserializeSendConfigStore(rawAccount) {
|
|
|
4160
4169
|
getSendConfigStoreAccountDataSerializer()
|
|
4161
4170
|
);
|
|
4162
4171
|
}
|
|
4163
|
-
async function fetchSendConfigStore(context,
|
|
4172
|
+
async function fetchSendConfigStore(context, publicKey16, options) {
|
|
4164
4173
|
const maybeAccount = await context.rpc.getAccount(
|
|
4165
|
-
umi.publicKey(
|
|
4174
|
+
umi.publicKey(publicKey16, false),
|
|
4166
4175
|
options
|
|
4167
4176
|
);
|
|
4168
4177
|
umi.assertAccountExists(maybeAccount, "SendConfigStore");
|
|
4169
4178
|
return deserializeSendConfigStore(maybeAccount);
|
|
4170
4179
|
}
|
|
4171
|
-
async function safeFetchSendConfigStore(context,
|
|
4180
|
+
async function safeFetchSendConfigStore(context, publicKey16, options) {
|
|
4172
4181
|
const maybeAccount = await context.rpc.getAccount(
|
|
4173
|
-
umi.publicKey(
|
|
4182
|
+
umi.publicKey(publicKey16, false),
|
|
4174
4183
|
options
|
|
4175
4184
|
);
|
|
4176
4185
|
return maybeAccount.exists ? deserializeSendConfigStore(maybeAccount) : null;
|
|
@@ -6988,17 +6997,17 @@ function getDvnConfigAccountDataSerializer() {
|
|
|
6988
6997
|
function deserializeDvnConfig(rawAccount) {
|
|
6989
6998
|
return umi.deserializeAccount(rawAccount, getDvnConfigAccountDataSerializer());
|
|
6990
6999
|
}
|
|
6991
|
-
async function fetchDvnConfig(context,
|
|
7000
|
+
async function fetchDvnConfig(context, publicKey16, options) {
|
|
6992
7001
|
const maybeAccount = await context.rpc.getAccount(
|
|
6993
|
-
umi.publicKey(
|
|
7002
|
+
umi.publicKey(publicKey16, false),
|
|
6994
7003
|
options
|
|
6995
7004
|
);
|
|
6996
7005
|
umi.assertAccountExists(maybeAccount, "DvnConfig");
|
|
6997
7006
|
return deserializeDvnConfig(maybeAccount);
|
|
6998
7007
|
}
|
|
6999
|
-
async function safeFetchDvnConfig(context,
|
|
7008
|
+
async function safeFetchDvnConfig(context, publicKey16, options) {
|
|
7000
7009
|
const maybeAccount = await context.rpc.getAccount(
|
|
7001
|
-
umi.publicKey(
|
|
7010
|
+
umi.publicKey(publicKey16, false),
|
|
7002
7011
|
options
|
|
7003
7012
|
);
|
|
7004
7013
|
return maybeAccount.exists ? deserializeDvnConfig(maybeAccount) : null;
|
|
@@ -7061,17 +7070,17 @@ function getExecuteHashAccountDataSerializer() {
|
|
|
7061
7070
|
function deserializeExecuteHash(rawAccount) {
|
|
7062
7071
|
return umi.deserializeAccount(rawAccount, getExecuteHashAccountDataSerializer());
|
|
7063
7072
|
}
|
|
7064
|
-
async function fetchExecuteHash(context,
|
|
7073
|
+
async function fetchExecuteHash(context, publicKey16, options) {
|
|
7065
7074
|
const maybeAccount = await context.rpc.getAccount(
|
|
7066
|
-
umi.publicKey(
|
|
7075
|
+
umi.publicKey(publicKey16, false),
|
|
7067
7076
|
options
|
|
7068
7077
|
);
|
|
7069
7078
|
umi.assertAccountExists(maybeAccount, "ExecuteHash");
|
|
7070
7079
|
return deserializeExecuteHash(maybeAccount);
|
|
7071
7080
|
}
|
|
7072
|
-
async function safeFetchExecuteHash(context,
|
|
7081
|
+
async function safeFetchExecuteHash(context, publicKey16, options) {
|
|
7073
7082
|
const maybeAccount = await context.rpc.getAccount(
|
|
7074
|
-
umi.publicKey(
|
|
7083
|
+
umi.publicKey(publicKey16, false),
|
|
7075
7084
|
options
|
|
7076
7085
|
);
|
|
7077
7086
|
return maybeAccount.exists ? deserializeExecuteHash(maybeAccount) : null;
|
|
@@ -7132,17 +7141,17 @@ function deserializeReceiveConfig(rawAccount) {
|
|
|
7132
7141
|
getReceiveConfigAccountDataSerializer()
|
|
7133
7142
|
);
|
|
7134
7143
|
}
|
|
7135
|
-
async function fetchReceiveConfig(context,
|
|
7144
|
+
async function fetchReceiveConfig(context, publicKey16, options) {
|
|
7136
7145
|
const maybeAccount = await context.rpc.getAccount(
|
|
7137
|
-
umi.publicKey(
|
|
7146
|
+
umi.publicKey(publicKey16, false),
|
|
7138
7147
|
options
|
|
7139
7148
|
);
|
|
7140
7149
|
umi.assertAccountExists(maybeAccount, "ReceiveConfig");
|
|
7141
7150
|
return deserializeReceiveConfig(maybeAccount);
|
|
7142
7151
|
}
|
|
7143
|
-
async function safeFetchReceiveConfig(context,
|
|
7152
|
+
async function safeFetchReceiveConfig(context, publicKey16, options) {
|
|
7144
7153
|
const maybeAccount = await context.rpc.getAccount(
|
|
7145
|
-
umi.publicKey(
|
|
7154
|
+
umi.publicKey(publicKey16, false),
|
|
7146
7155
|
options
|
|
7147
7156
|
);
|
|
7148
7157
|
return maybeAccount.exists ? deserializeReceiveConfig(maybeAccount) : null;
|
|
@@ -8389,22 +8398,105 @@ __export(executor_exports, {
|
|
|
8389
8398
|
// src/generated/kinobi/executor/accounts/index.ts
|
|
8390
8399
|
var accounts_exports4 = {};
|
|
8391
8400
|
__export(accounts_exports4, {
|
|
8401
|
+
deserializeExecutionContextV1: () => deserializeExecutionContextV1,
|
|
8392
8402
|
deserializeExecutorConfig: () => deserializeExecutorConfig,
|
|
8393
8403
|
deserializeNonce: () => deserializeNonce2,
|
|
8404
|
+
fetchAllExecutionContextV1: () => fetchAllExecutionContextV1,
|
|
8394
8405
|
fetchAllExecutorConfig: () => fetchAllExecutorConfig,
|
|
8395
8406
|
fetchAllNonce: () => fetchAllNonce2,
|
|
8407
|
+
fetchExecutionContextV1: () => fetchExecutionContextV1,
|
|
8396
8408
|
fetchExecutorConfig: () => fetchExecutorConfig,
|
|
8397
8409
|
fetchNonce: () => fetchNonce2,
|
|
8410
|
+
getExecutionContextV1AccountDataSerializer: () => getExecutionContextV1AccountDataSerializer,
|
|
8411
|
+
getExecutionContextV1GpaBuilder: () => getExecutionContextV1GpaBuilder,
|
|
8412
|
+
getExecutionContextV1Size: () => getExecutionContextV1Size,
|
|
8398
8413
|
getExecutorConfigAccountDataSerializer: () => getExecutorConfigAccountDataSerializer,
|
|
8399
8414
|
getExecutorConfigGpaBuilder: () => getExecutorConfigGpaBuilder,
|
|
8400
8415
|
getNonceAccountDataSerializer: () => getNonceAccountDataSerializer2,
|
|
8401
8416
|
getNonceGpaBuilder: () => getNonceGpaBuilder2,
|
|
8402
8417
|
getNonceSize: () => getNonceSize2,
|
|
8418
|
+
safeFetchAllExecutionContextV1: () => safeFetchAllExecutionContextV1,
|
|
8403
8419
|
safeFetchAllExecutorConfig: () => safeFetchAllExecutorConfig,
|
|
8404
8420
|
safeFetchAllNonce: () => safeFetchAllNonce2,
|
|
8421
|
+
safeFetchExecutionContextV1: () => safeFetchExecutionContextV1,
|
|
8405
8422
|
safeFetchExecutorConfig: () => safeFetchExecutorConfig,
|
|
8406
8423
|
safeFetchNonce: () => safeFetchNonce2
|
|
8407
8424
|
});
|
|
8425
|
+
function getExecutionContextV1AccountDataSerializer() {
|
|
8426
|
+
return serializers.mapSerializer(
|
|
8427
|
+
serializers.struct(
|
|
8428
|
+
[
|
|
8429
|
+
["discriminator", serializers.bytes({ size: 8 })],
|
|
8430
|
+
["initialPayerBalance", serializers.u64()],
|
|
8431
|
+
["feeLimit", serializers.u64()]
|
|
8432
|
+
],
|
|
8433
|
+
{ description: "ExecutionContextV1AccountData" }
|
|
8434
|
+
),
|
|
8435
|
+
(value) => ({
|
|
8436
|
+
...value,
|
|
8437
|
+
discriminator: new Uint8Array([132, 92, 176, 59, 141, 186, 141, 137])
|
|
8438
|
+
})
|
|
8439
|
+
);
|
|
8440
|
+
}
|
|
8441
|
+
function deserializeExecutionContextV1(rawAccount) {
|
|
8442
|
+
return umi.deserializeAccount(
|
|
8443
|
+
rawAccount,
|
|
8444
|
+
getExecutionContextV1AccountDataSerializer()
|
|
8445
|
+
);
|
|
8446
|
+
}
|
|
8447
|
+
async function fetchExecutionContextV1(context, publicKey16, options) {
|
|
8448
|
+
const maybeAccount = await context.rpc.getAccount(
|
|
8449
|
+
umi.publicKey(publicKey16, false),
|
|
8450
|
+
options
|
|
8451
|
+
);
|
|
8452
|
+
umi.assertAccountExists(maybeAccount, "ExecutionContextV1");
|
|
8453
|
+
return deserializeExecutionContextV1(maybeAccount);
|
|
8454
|
+
}
|
|
8455
|
+
async function safeFetchExecutionContextV1(context, publicKey16, options) {
|
|
8456
|
+
const maybeAccount = await context.rpc.getAccount(
|
|
8457
|
+
umi.publicKey(publicKey16, false),
|
|
8458
|
+
options
|
|
8459
|
+
);
|
|
8460
|
+
return maybeAccount.exists ? deserializeExecutionContextV1(maybeAccount) : null;
|
|
8461
|
+
}
|
|
8462
|
+
async function fetchAllExecutionContextV1(context, publicKeys, options) {
|
|
8463
|
+
const maybeAccounts = await context.rpc.getAccounts(
|
|
8464
|
+
publicKeys.map((key) => umi.publicKey(key, false)),
|
|
8465
|
+
options
|
|
8466
|
+
);
|
|
8467
|
+
return maybeAccounts.map((maybeAccount) => {
|
|
8468
|
+
umi.assertAccountExists(maybeAccount, "ExecutionContextV1");
|
|
8469
|
+
return deserializeExecutionContextV1(maybeAccount);
|
|
8470
|
+
});
|
|
8471
|
+
}
|
|
8472
|
+
async function safeFetchAllExecutionContextV1(context, publicKeys, options) {
|
|
8473
|
+
const maybeAccounts = await context.rpc.getAccounts(
|
|
8474
|
+
publicKeys.map((key) => umi.publicKey(key, false)),
|
|
8475
|
+
options
|
|
8476
|
+
);
|
|
8477
|
+
return maybeAccounts.filter((maybeAccount) => maybeAccount.exists).map(
|
|
8478
|
+
(maybeAccount) => deserializeExecutionContextV1(maybeAccount)
|
|
8479
|
+
);
|
|
8480
|
+
}
|
|
8481
|
+
function getExecutionContextV1GpaBuilder(context) {
|
|
8482
|
+
const programId = context.programs.getPublicKey(
|
|
8483
|
+
"executor",
|
|
8484
|
+
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
8485
|
+
);
|
|
8486
|
+
return umi.gpaBuilder(context, programId).registerFields({
|
|
8487
|
+
discriminator: [0, serializers.bytes({ size: 8 })],
|
|
8488
|
+
initialPayerBalance: [8, serializers.u64()],
|
|
8489
|
+
feeLimit: [16, serializers.u64()]
|
|
8490
|
+
}).deserializeUsing(
|
|
8491
|
+
(account) => deserializeExecutionContextV1(account)
|
|
8492
|
+
).whereField(
|
|
8493
|
+
"discriminator",
|
|
8494
|
+
new Uint8Array([132, 92, 176, 59, 141, 186, 141, 137])
|
|
8495
|
+
);
|
|
8496
|
+
}
|
|
8497
|
+
function getExecutionContextV1Size() {
|
|
8498
|
+
return 24;
|
|
8499
|
+
}
|
|
8408
8500
|
|
|
8409
8501
|
// src/generated/kinobi/executor/types/index.ts
|
|
8410
8502
|
var types_exports4 = {};
|
|
@@ -8417,7 +8509,6 @@ __export(types_exports4, {
|
|
|
8417
8509
|
getExecutionStateSerializer: () => getExecutionStateSerializer,
|
|
8418
8510
|
getLzComposeParamsSerializer: () => getLzComposeParamsSerializer,
|
|
8419
8511
|
getLzOptionSerializer: () => getLzOptionSerializer2,
|
|
8420
|
-
getLzReceiveParamsSerializer: () => getLzReceiveParamsSerializer,
|
|
8421
8512
|
getNativeDropRequestSerializer: () => getNativeDropRequestSerializer,
|
|
8422
8513
|
getOwnerSetConfigParamsSerializer: () => getOwnerSetConfigParamsSerializer,
|
|
8423
8514
|
isAdminSetConfigParams: () => isAdminSetConfigParams,
|
|
@@ -8509,19 +8600,6 @@ function getLzOptionSerializer2() {
|
|
|
8509
8600
|
{ description: "LzOption" }
|
|
8510
8601
|
);
|
|
8511
8602
|
}
|
|
8512
|
-
function getLzReceiveParamsSerializer() {
|
|
8513
|
-
return serializers.struct(
|
|
8514
|
-
[
|
|
8515
|
-
["srcEid", serializers.u32()],
|
|
8516
|
-
["sender", serializers.bytes({ size: 32 })],
|
|
8517
|
-
["nonce", serializers.u64()],
|
|
8518
|
-
["guid", serializers.bytes({ size: 32 })],
|
|
8519
|
-
["message", serializers.bytes({ size: serializers.u32() })],
|
|
8520
|
-
["extraData", serializers.bytes({ size: serializers.u32() })]
|
|
8521
|
-
],
|
|
8522
|
-
{ description: "LzReceiveParams" }
|
|
8523
|
-
);
|
|
8524
|
-
}
|
|
8525
8603
|
function getNativeDropRequestSerializer() {
|
|
8526
8604
|
return serializers.struct(
|
|
8527
8605
|
[
|
|
@@ -8618,17 +8696,17 @@ function deserializeExecutorConfig(rawAccount) {
|
|
|
8618
8696
|
getExecutorConfigAccountDataSerializer()
|
|
8619
8697
|
);
|
|
8620
8698
|
}
|
|
8621
|
-
async function fetchExecutorConfig(context,
|
|
8699
|
+
async function fetchExecutorConfig(context, publicKey16, options) {
|
|
8622
8700
|
const maybeAccount = await context.rpc.getAccount(
|
|
8623
|
-
umi.publicKey(
|
|
8701
|
+
umi.publicKey(publicKey16, false),
|
|
8624
8702
|
options
|
|
8625
8703
|
);
|
|
8626
8704
|
umi.assertAccountExists(maybeAccount, "ExecutorConfig");
|
|
8627
8705
|
return deserializeExecutorConfig(maybeAccount);
|
|
8628
8706
|
}
|
|
8629
|
-
async function safeFetchExecutorConfig(context,
|
|
8707
|
+
async function safeFetchExecutorConfig(context, publicKey16, options) {
|
|
8630
8708
|
const maybeAccount = await context.rpc.getAccount(
|
|
8631
|
-
umi.publicKey(
|
|
8709
|
+
umi.publicKey(publicKey16, false),
|
|
8632
8710
|
options
|
|
8633
8711
|
);
|
|
8634
8712
|
return maybeAccount.exists ? deserializeExecutorConfig(maybeAccount) : null;
|
|
@@ -8696,17 +8774,17 @@ function getNonceAccountDataSerializer2() {
|
|
|
8696
8774
|
function deserializeNonce2(rawAccount) {
|
|
8697
8775
|
return umi.deserializeAccount(rawAccount, getNonceAccountDataSerializer2());
|
|
8698
8776
|
}
|
|
8699
|
-
async function fetchNonce2(context,
|
|
8777
|
+
async function fetchNonce2(context, publicKey16, options) {
|
|
8700
8778
|
const maybeAccount = await context.rpc.getAccount(
|
|
8701
|
-
umi.publicKey(
|
|
8779
|
+
umi.publicKey(publicKey16, false),
|
|
8702
8780
|
options
|
|
8703
8781
|
);
|
|
8704
8782
|
umi.assertAccountExists(maybeAccount, "Nonce");
|
|
8705
8783
|
return deserializeNonce2(maybeAccount);
|
|
8706
8784
|
}
|
|
8707
|
-
async function safeFetchNonce2(context,
|
|
8785
|
+
async function safeFetchNonce2(context, publicKey16, options) {
|
|
8708
8786
|
const maybeAccount = await context.rpc.getAccount(
|
|
8709
|
-
umi.publicKey(
|
|
8787
|
+
umi.publicKey(publicKey16, false),
|
|
8710
8788
|
options
|
|
8711
8789
|
);
|
|
8712
8790
|
return maybeAccount.exists ? deserializeNonce2(maybeAccount) : null;
|
|
@@ -8750,9 +8828,11 @@ function getNonceSize2() {
|
|
|
8750
8828
|
// src/generated/kinobi/executor/errors/index.ts
|
|
8751
8829
|
var errors_exports4 = {};
|
|
8752
8830
|
__export(errors_exports4, {
|
|
8831
|
+
ContextAccountAlreadyInitializedError: () => ContextAccountAlreadyInitializedError,
|
|
8753
8832
|
EidNotSupportedError: () => EidNotSupportedError2,
|
|
8754
8833
|
ExecutorIsAdminError: () => ExecutorIsAdminError,
|
|
8755
8834
|
InsufficientBalanceError: () => InsufficientBalanceError,
|
|
8835
|
+
InvalidInstructionSequenceError: () => InvalidInstructionSequenceError,
|
|
8756
8836
|
InvalidNativeDropReceiverError: () => InvalidNativeDropReceiverError,
|
|
8757
8837
|
InvalidNativeDropRequestsLengthError: () => InvalidNativeDropRequestsLengthError,
|
|
8758
8838
|
InvalidOwnerError: () => InvalidOwnerError,
|
|
@@ -8956,6 +9036,32 @@ var InvalidOwnerError = class extends umi.ProgramError {
|
|
|
8956
9036
|
};
|
|
8957
9037
|
codeToErrorMap4.set(6017, InvalidOwnerError);
|
|
8958
9038
|
nameToErrorMap4.set("InvalidOwner", InvalidOwnerError);
|
|
9039
|
+
var InvalidInstructionSequenceError = class extends umi.ProgramError {
|
|
9040
|
+
// 6018
|
|
9041
|
+
constructor(program, cause) {
|
|
9042
|
+
super("", program, cause);
|
|
9043
|
+
this.name = "InvalidInstructionSequence";
|
|
9044
|
+
this.code = 6018;
|
|
9045
|
+
}
|
|
9046
|
+
};
|
|
9047
|
+
codeToErrorMap4.set(6018, InvalidInstructionSequenceError);
|
|
9048
|
+
nameToErrorMap4.set(
|
|
9049
|
+
"InvalidInstructionSequence",
|
|
9050
|
+
InvalidInstructionSequenceError
|
|
9051
|
+
);
|
|
9052
|
+
var ContextAccountAlreadyInitializedError = class extends umi.ProgramError {
|
|
9053
|
+
// 6019
|
|
9054
|
+
constructor(program, cause) {
|
|
9055
|
+
super("", program, cause);
|
|
9056
|
+
this.name = "ContextAccountAlreadyInitialized";
|
|
9057
|
+
this.code = 6019;
|
|
9058
|
+
}
|
|
9059
|
+
};
|
|
9060
|
+
codeToErrorMap4.set(6019, ContextAccountAlreadyInitializedError);
|
|
9061
|
+
nameToErrorMap4.set(
|
|
9062
|
+
"ContextAccountAlreadyInitialized",
|
|
9063
|
+
ContextAccountAlreadyInitializedError
|
|
9064
|
+
);
|
|
8959
9065
|
function getExecutorErrorFromCode(code, program, cause) {
|
|
8960
9066
|
const constructor = codeToErrorMap4.get(code);
|
|
8961
9067
|
return constructor ? new constructor(program, cause) : null;
|
|
@@ -8991,20 +9097,22 @@ __export(instructions_exports4, {
|
|
|
8991
9097
|
adminSetConfig: () => adminSetConfig,
|
|
8992
9098
|
compose: () => compose,
|
|
8993
9099
|
executable: () => executable,
|
|
8994
|
-
execute: () => execute,
|
|
8995
9100
|
extendExecutorConfig: () => extendExecutorConfig,
|
|
8996
9101
|
getAdminSetConfigInstructionDataSerializer: () => getAdminSetConfigInstructionDataSerializer,
|
|
8997
9102
|
getComposeInstructionDataSerializer: () => getComposeInstructionDataSerializer,
|
|
8998
9103
|
getExecutableInstructionDataSerializer: () => getExecutableInstructionDataSerializer,
|
|
8999
|
-
getExecuteInstructionDataSerializer: () => getExecuteInstructionDataSerializer,
|
|
9000
9104
|
getExtendExecutorConfigInstructionDataSerializer: () => getExtendExecutorConfigInstructionDataSerializer,
|
|
9001
9105
|
getInitExecutorInstructionDataSerializer: () => getInitExecutorInstructionDataSerializer,
|
|
9002
9106
|
getNativeDropInstructionDataSerializer: () => getNativeDropInstructionDataSerializer,
|
|
9003
9107
|
getOwnerSetConfigInstructionDataSerializer: () => getOwnerSetConfigInstructionDataSerializer,
|
|
9108
|
+
getPostExecuteInstructionDataSerializer: () => getPostExecuteInstructionDataSerializer,
|
|
9109
|
+
getPreExecuteInstructionDataSerializer: () => getPreExecuteInstructionDataSerializer,
|
|
9004
9110
|
getQuoteExecutorInstructionDataSerializer: () => getQuoteExecutorInstructionDataSerializer,
|
|
9005
9111
|
initExecutor: () => initExecutor,
|
|
9006
9112
|
nativeDrop: () => nativeDrop,
|
|
9007
9113
|
ownerSetConfig: () => ownerSetConfig,
|
|
9114
|
+
postExecute: () => postExecute,
|
|
9115
|
+
preExecute: () => preExecute,
|
|
9008
9116
|
quoteExecutor: () => quoteExecutor
|
|
9009
9117
|
});
|
|
9010
9118
|
function getAccountMetasAndSigners4(accounts, optionalAccountStrategy, programId) {
|
|
@@ -9200,78 +9308,6 @@ function executable(context, accounts, args) {
|
|
|
9200
9308
|
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9201
9309
|
]);
|
|
9202
9310
|
}
|
|
9203
|
-
function getExecuteInstructionDataSerializer() {
|
|
9204
|
-
return serializers.mapSerializer(
|
|
9205
|
-
serializers.struct(
|
|
9206
|
-
[
|
|
9207
|
-
["discriminator", serializers.bytes({ size: 8 })],
|
|
9208
|
-
["receiver", serializers.publicKey()],
|
|
9209
|
-
["lzReceive", getLzReceiveParamsSerializer()],
|
|
9210
|
-
["value", serializers.u64()],
|
|
9211
|
-
["computeUnits", serializers.u64()]
|
|
9212
|
-
],
|
|
9213
|
-
{ description: "ExecuteInstructionData" }
|
|
9214
|
-
),
|
|
9215
|
-
(value) => ({
|
|
9216
|
-
...value,
|
|
9217
|
-
discriminator: new Uint8Array([130, 221, 242, 154, 13, 193, 189, 29])
|
|
9218
|
-
})
|
|
9219
|
-
);
|
|
9220
|
-
}
|
|
9221
|
-
function execute(context, input) {
|
|
9222
|
-
const programId = context.programs.getPublicKey(
|
|
9223
|
-
"executor",
|
|
9224
|
-
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
9225
|
-
);
|
|
9226
|
-
const resolvedAccounts = {
|
|
9227
|
-
executor: {
|
|
9228
|
-
index: 0,
|
|
9229
|
-
isWritable: true,
|
|
9230
|
-
value: input.executor ?? null
|
|
9231
|
-
},
|
|
9232
|
-
config: {
|
|
9233
|
-
index: 1,
|
|
9234
|
-
isWritable: false,
|
|
9235
|
-
value: input.config ?? null
|
|
9236
|
-
},
|
|
9237
|
-
endpointProgram: {
|
|
9238
|
-
index: 2,
|
|
9239
|
-
isWritable: false,
|
|
9240
|
-
value: input.endpointProgram ?? null
|
|
9241
|
-
},
|
|
9242
|
-
endpointEventAuthority: {
|
|
9243
|
-
index: 3,
|
|
9244
|
-
isWritable: false,
|
|
9245
|
-
value: input.endpointEventAuthority ?? null
|
|
9246
|
-
},
|
|
9247
|
-
eventAuthority: {
|
|
9248
|
-
index: 4,
|
|
9249
|
-
isWritable: false,
|
|
9250
|
-
value: input.eventAuthority ?? null
|
|
9251
|
-
},
|
|
9252
|
-
program: {
|
|
9253
|
-
index: 5,
|
|
9254
|
-
isWritable: false,
|
|
9255
|
-
value: input.program ?? null
|
|
9256
|
-
}
|
|
9257
|
-
};
|
|
9258
|
-
const resolvedArgs = { ...input };
|
|
9259
|
-
const orderedAccounts = Object.values(
|
|
9260
|
-
resolvedAccounts
|
|
9261
|
-
).sort((a, b) => a.index - b.index);
|
|
9262
|
-
const [keys, signers] = getAccountMetasAndSigners4(
|
|
9263
|
-
orderedAccounts,
|
|
9264
|
-
"programId",
|
|
9265
|
-
programId
|
|
9266
|
-
);
|
|
9267
|
-
const data = getExecuteInstructionDataSerializer().serialize(
|
|
9268
|
-
resolvedArgs
|
|
9269
|
-
);
|
|
9270
|
-
const bytesCreatedOnChain = 0;
|
|
9271
|
-
return umi.transactionBuilder([
|
|
9272
|
-
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9273
|
-
]);
|
|
9274
|
-
}
|
|
9275
9311
|
function getExtendExecutorConfigInstructionDataSerializer() {
|
|
9276
9312
|
return serializers.mapSerializer(
|
|
9277
9313
|
serializers.struct(
|
|
@@ -9520,6 +9556,137 @@ function ownerSetConfig(context, input) {
|
|
|
9520
9556
|
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9521
9557
|
]);
|
|
9522
9558
|
}
|
|
9559
|
+
function getPostExecuteInstructionDataSerializer() {
|
|
9560
|
+
return serializers.mapSerializer(
|
|
9561
|
+
serializers.struct(
|
|
9562
|
+
[
|
|
9563
|
+
["discriminator", serializers.bytes({ size: 8 })],
|
|
9564
|
+
["contextVersion", serializers.u8()]
|
|
9565
|
+
],
|
|
9566
|
+
{ description: "PostExecuteInstructionData" }
|
|
9567
|
+
),
|
|
9568
|
+
(value) => ({
|
|
9569
|
+
...value,
|
|
9570
|
+
discriminator: new Uint8Array([74, 168, 167, 167, 76, 220, 95, 56])
|
|
9571
|
+
})
|
|
9572
|
+
);
|
|
9573
|
+
}
|
|
9574
|
+
function postExecute(context, input) {
|
|
9575
|
+
const programId = context.programs.getPublicKey(
|
|
9576
|
+
"executor",
|
|
9577
|
+
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
9578
|
+
);
|
|
9579
|
+
const resolvedAccounts = {
|
|
9580
|
+
executor: {
|
|
9581
|
+
index: 0,
|
|
9582
|
+
isWritable: false,
|
|
9583
|
+
value: input.executor ?? null
|
|
9584
|
+
},
|
|
9585
|
+
context: {
|
|
9586
|
+
index: 1,
|
|
9587
|
+
isWritable: true,
|
|
9588
|
+
value: input.context ?? null
|
|
9589
|
+
},
|
|
9590
|
+
instructionSysvar: {
|
|
9591
|
+
index: 2,
|
|
9592
|
+
isWritable: false,
|
|
9593
|
+
value: input.instructionSysvar ?? null
|
|
9594
|
+
}
|
|
9595
|
+
};
|
|
9596
|
+
const resolvedArgs = { ...input };
|
|
9597
|
+
if (!resolvedAccounts.instructionSysvar.value) {
|
|
9598
|
+
resolvedAccounts.instructionSysvar.value = umi.publicKey(
|
|
9599
|
+
"Sysvar1nstructions1111111111111111111111111"
|
|
9600
|
+
);
|
|
9601
|
+
}
|
|
9602
|
+
const orderedAccounts = Object.values(
|
|
9603
|
+
resolvedAccounts
|
|
9604
|
+
).sort((a, b) => a.index - b.index);
|
|
9605
|
+
const [keys, signers] = getAccountMetasAndSigners4(
|
|
9606
|
+
orderedAccounts,
|
|
9607
|
+
"programId",
|
|
9608
|
+
programId
|
|
9609
|
+
);
|
|
9610
|
+
const data = getPostExecuteInstructionDataSerializer().serialize(
|
|
9611
|
+
resolvedArgs
|
|
9612
|
+
);
|
|
9613
|
+
const bytesCreatedOnChain = 0;
|
|
9614
|
+
return umi.transactionBuilder([
|
|
9615
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9616
|
+
]);
|
|
9617
|
+
}
|
|
9618
|
+
function getPreExecuteInstructionDataSerializer() {
|
|
9619
|
+
return serializers.mapSerializer(
|
|
9620
|
+
serializers.struct(
|
|
9621
|
+
[
|
|
9622
|
+
["discriminator", serializers.bytes({ size: 8 })],
|
|
9623
|
+
["contextVersion", serializers.u8()],
|
|
9624
|
+
["feeLimit", serializers.u64()]
|
|
9625
|
+
],
|
|
9626
|
+
{ description: "PreExecuteInstructionData" }
|
|
9627
|
+
),
|
|
9628
|
+
(value) => ({
|
|
9629
|
+
...value,
|
|
9630
|
+
discriminator: new Uint8Array([207, 125, 18, 148, 72, 192, 198, 83])
|
|
9631
|
+
})
|
|
9632
|
+
);
|
|
9633
|
+
}
|
|
9634
|
+
function preExecute(context, input) {
|
|
9635
|
+
const programId = context.programs.getPublicKey(
|
|
9636
|
+
"executor",
|
|
9637
|
+
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
9638
|
+
);
|
|
9639
|
+
const resolvedAccounts = {
|
|
9640
|
+
executor: {
|
|
9641
|
+
index: 0,
|
|
9642
|
+
isWritable: true,
|
|
9643
|
+
value: input.executor ?? null
|
|
9644
|
+
},
|
|
9645
|
+
context: {
|
|
9646
|
+
index: 1,
|
|
9647
|
+
isWritable: true,
|
|
9648
|
+
value: input.context ?? null
|
|
9649
|
+
},
|
|
9650
|
+
systemProgram: {
|
|
9651
|
+
index: 2,
|
|
9652
|
+
isWritable: false,
|
|
9653
|
+
value: input.systemProgram ?? null
|
|
9654
|
+
},
|
|
9655
|
+
instructionSysvar: {
|
|
9656
|
+
index: 3,
|
|
9657
|
+
isWritable: false,
|
|
9658
|
+
value: input.instructionSysvar ?? null
|
|
9659
|
+
}
|
|
9660
|
+
};
|
|
9661
|
+
const resolvedArgs = { ...input };
|
|
9662
|
+
if (!resolvedAccounts.systemProgram.value) {
|
|
9663
|
+
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
|
|
9664
|
+
"splSystem",
|
|
9665
|
+
"11111111111111111111111111111111"
|
|
9666
|
+
);
|
|
9667
|
+
resolvedAccounts.systemProgram.isWritable = false;
|
|
9668
|
+
}
|
|
9669
|
+
if (!resolvedAccounts.instructionSysvar.value) {
|
|
9670
|
+
resolvedAccounts.instructionSysvar.value = umi.publicKey(
|
|
9671
|
+
"Sysvar1nstructions1111111111111111111111111"
|
|
9672
|
+
);
|
|
9673
|
+
}
|
|
9674
|
+
const orderedAccounts = Object.values(
|
|
9675
|
+
resolvedAccounts
|
|
9676
|
+
).sort((a, b) => a.index - b.index);
|
|
9677
|
+
const [keys, signers] = getAccountMetasAndSigners4(
|
|
9678
|
+
orderedAccounts,
|
|
9679
|
+
"programId",
|
|
9680
|
+
programId
|
|
9681
|
+
);
|
|
9682
|
+
const data = getPreExecuteInstructionDataSerializer().serialize(
|
|
9683
|
+
resolvedArgs
|
|
9684
|
+
);
|
|
9685
|
+
const bytesCreatedOnChain = 0;
|
|
9686
|
+
return umi.transactionBuilder([
|
|
9687
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9688
|
+
]);
|
|
9689
|
+
}
|
|
9523
9690
|
function getQuoteExecutorInstructionDataSerializer() {
|
|
9524
9691
|
return serializers.mapSerializer(
|
|
9525
9692
|
serializers.struct(
|
|
@@ -9585,9 +9752,10 @@ var MSG_TYPE_OFFSET = 0;
|
|
|
9585
9752
|
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
9586
9753
|
MessageType2[MessageType2["VANILLA"] = 1] = "VANILLA";
|
|
9587
9754
|
MessageType2[MessageType2["COMPOSED_TYPE"] = 2] = "COMPOSED_TYPE";
|
|
9755
|
+
MessageType2[MessageType2["ABA"] = 3] = "ABA";
|
|
9588
9756
|
return MessageType2;
|
|
9589
9757
|
})(MessageType || {});
|
|
9590
|
-
function
|
|
9758
|
+
function getLzReceiveParamsSerializer() {
|
|
9591
9759
|
return serializers.struct(
|
|
9592
9760
|
[
|
|
9593
9761
|
["srcEid", serializers.u32()],
|
|
@@ -9632,6 +9800,72 @@ var ExecutorOptionType = /* @__PURE__ */ ((ExecutorOptionType2) => {
|
|
|
9632
9800
|
return ExecutorOptionType2;
|
|
9633
9801
|
})(ExecutorOptionType || {});
|
|
9634
9802
|
var MaxExecutorOptionTypeLength = 10;
|
|
9803
|
+
function getAddressLocatorSerializer() {
|
|
9804
|
+
return serializers.dataEnum(
|
|
9805
|
+
[
|
|
9806
|
+
[
|
|
9807
|
+
"Address",
|
|
9808
|
+
serializers.struct([["fields", serializers.tuple([serializers.publicKey()])]])
|
|
9809
|
+
],
|
|
9810
|
+
["AltIndex", serializers.struct([["fields", serializers.tuple([serializers.u8(), serializers.u8()])]])],
|
|
9811
|
+
["Payer", serializers.unit()],
|
|
9812
|
+
["Signer", serializers.struct([["fields", serializers.tuple([serializers.u8()])]])],
|
|
9813
|
+
["Context", serializers.unit()]
|
|
9814
|
+
],
|
|
9815
|
+
{ description: "AddressLocator" }
|
|
9816
|
+
);
|
|
9817
|
+
}
|
|
9818
|
+
function getLzReceiveTypesV2AccountsSerializer() {
|
|
9819
|
+
return serializers.struct([["accounts", serializers.array(serializers.publicKey())]], {
|
|
9820
|
+
description: "LzReceiveTypesV2Result"
|
|
9821
|
+
});
|
|
9822
|
+
}
|
|
9823
|
+
function getAccountMetaRefSerializer() {
|
|
9824
|
+
return serializers.struct(
|
|
9825
|
+
[
|
|
9826
|
+
["pubkey", getAddressLocatorSerializer()],
|
|
9827
|
+
["isWritable", serializers.bool()]
|
|
9828
|
+
],
|
|
9829
|
+
{ description: "AccountMetaRef" }
|
|
9830
|
+
);
|
|
9831
|
+
}
|
|
9832
|
+
function getInstructionSerializer() {
|
|
9833
|
+
return serializers.dataEnum(
|
|
9834
|
+
[
|
|
9835
|
+
[
|
|
9836
|
+
"LzReceive",
|
|
9837
|
+
serializers.struct([
|
|
9838
|
+
["accounts", serializers.array(getAccountMetaRefSerializer())]
|
|
9839
|
+
])
|
|
9840
|
+
],
|
|
9841
|
+
[
|
|
9842
|
+
"Standard",
|
|
9843
|
+
serializers.struct([
|
|
9844
|
+
["programId", serializers.publicKey()],
|
|
9845
|
+
["accounts", serializers.array(getAccountMetaRefSerializer())],
|
|
9846
|
+
["data", serializers.bytes({ size: serializers.u32() })]
|
|
9847
|
+
])
|
|
9848
|
+
]
|
|
9849
|
+
],
|
|
9850
|
+
{ description: "Instruction" }
|
|
9851
|
+
);
|
|
9852
|
+
}
|
|
9853
|
+
function getLzReceiveTypesV2ResultSerializer() {
|
|
9854
|
+
return serializers.struct(
|
|
9855
|
+
[
|
|
9856
|
+
["contextVersion", serializers.u8()],
|
|
9857
|
+
["alts", serializers.array(serializers.publicKey())],
|
|
9858
|
+
["instructions", serializers.array(getInstructionSerializer())]
|
|
9859
|
+
],
|
|
9860
|
+
{ description: "LzReceiveTypesV2Result" }
|
|
9861
|
+
);
|
|
9862
|
+
}
|
|
9863
|
+
function addressLocator(kind, data) {
|
|
9864
|
+
return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...data ?? {} };
|
|
9865
|
+
}
|
|
9866
|
+
function isAddressLocator(kind, value) {
|
|
9867
|
+
return value.__kind === kind;
|
|
9868
|
+
}
|
|
9635
9869
|
|
|
9636
9870
|
// src/generated/kinobi/uln/events/index.ts
|
|
9637
9871
|
var events_exports4 = {};
|
|
@@ -10150,29 +10384,269 @@ function toWeb3Connection(rpc) {
|
|
|
10150
10384
|
}
|
|
10151
10385
|
}
|
|
10152
10386
|
|
|
10387
|
+
// src/receive-types-v1.ts
|
|
10388
|
+
async function getLzReceiveAccountsFromTypesV1(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
|
|
10389
|
+
const oappPDA = new OmniAppPDA(receiverProgram);
|
|
10390
|
+
const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
|
|
10391
|
+
const info = await rpc.getAccount(lzReceiveTypesAccountsPDA, { commitment });
|
|
10392
|
+
const accounts = [];
|
|
10393
|
+
if (info.exists) {
|
|
10394
|
+
const buffer = Buffer.from(info.data);
|
|
10395
|
+
const len = buffer.length - 8;
|
|
10396
|
+
if (len % 32 !== 0) {
|
|
10397
|
+
throw new Error(
|
|
10398
|
+
`Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
|
|
10399
|
+
);
|
|
10400
|
+
}
|
|
10401
|
+
for (let i = 8; i < len; i += 32) {
|
|
10402
|
+
const [address] = serializers.publicKey().deserialize(buffer, i);
|
|
10403
|
+
accounts.push({
|
|
10404
|
+
pubkey: address,
|
|
10405
|
+
isSigner: false,
|
|
10406
|
+
isWritable: false
|
|
10407
|
+
});
|
|
10408
|
+
}
|
|
10409
|
+
}
|
|
10410
|
+
const data = getLzReceiveParamsSerializer().serialize(params);
|
|
10411
|
+
const lzReceiveTypesIx = {
|
|
10412
|
+
programId: receiverProgram,
|
|
10413
|
+
keys: accounts,
|
|
10414
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive_types"), data])
|
|
10415
|
+
};
|
|
10416
|
+
const keys = await simulateWeb3JsTransaction(
|
|
10417
|
+
rpc.getEndpoint(),
|
|
10418
|
+
[umiWeb3jsAdapters.toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10419
|
+
umiWeb3jsAdapters.toWeb3JsPublicKey(receiverProgram),
|
|
10420
|
+
umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
|
|
10421
|
+
serializers.array(getLzReceiveAccountSerializer()),
|
|
10422
|
+
commitment
|
|
10423
|
+
);
|
|
10424
|
+
return updateAccountFromSimulatedResp(keys, payer);
|
|
10425
|
+
}
|
|
10426
|
+
function updateAccountFromSimulatedResp(accounts, payer) {
|
|
10427
|
+
return accounts.map((r) => {
|
|
10428
|
+
if (r.pubkey == umi.defaultPublicKey() && r.isSigner) {
|
|
10429
|
+
if (!payer) throw new Error("payer is required");
|
|
10430
|
+
return {
|
|
10431
|
+
pubkey: payer,
|
|
10432
|
+
isSigner: true,
|
|
10433
|
+
isWritable: r.isWritable
|
|
10434
|
+
};
|
|
10435
|
+
} else {
|
|
10436
|
+
return {
|
|
10437
|
+
pubkey: r.pubkey,
|
|
10438
|
+
isSigner: r.isSigner,
|
|
10439
|
+
isWritable: r.isWritable
|
|
10440
|
+
};
|
|
10441
|
+
}
|
|
10442
|
+
});
|
|
10443
|
+
}
|
|
10444
|
+
async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver, receiverProgram, params, receiveTypesAccounts, commitment = "confirmed") {
|
|
10445
|
+
receiveTypesAccounts = receiveTypesAccounts ?? await getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, params, commitment);
|
|
10446
|
+
const data = getLzReceiveParamsSerializer().serialize(params);
|
|
10447
|
+
const lzReceiveTypesIx = {
|
|
10448
|
+
programId: receiverProgram,
|
|
10449
|
+
keys: receiveTypesAccounts.accounts.map((pubkey) => {
|
|
10450
|
+
return {
|
|
10451
|
+
pubkey,
|
|
10452
|
+
isSigner: false,
|
|
10453
|
+
isWritable: false
|
|
10454
|
+
};
|
|
10455
|
+
}),
|
|
10456
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive_types_v2"), data])
|
|
10457
|
+
};
|
|
10458
|
+
const resp = await simulateWeb3JsTransaction(
|
|
10459
|
+
rpc.getEndpoint(),
|
|
10460
|
+
[umiWeb3jsAdapters.toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10461
|
+
umiWeb3jsAdapters.toWeb3JsPublicKey(receiverProgram),
|
|
10462
|
+
umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
|
|
10463
|
+
getLzReceiveTypesV2ResultSerializer(),
|
|
10464
|
+
commitment
|
|
10465
|
+
);
|
|
10466
|
+
const tables = await mplToolbox.fetchAllAddressLookupTable({ rpc }, resp.alts);
|
|
10467
|
+
const signers = {};
|
|
10468
|
+
const lzReceiveDiscriminator = instructionDiscriminator("lz_receive").toString("hex");
|
|
10469
|
+
const instructionTracker = {};
|
|
10470
|
+
for (const ix of resp.instructions) {
|
|
10471
|
+
let programId = receiverProgram;
|
|
10472
|
+
let instructionType = "lz_receive";
|
|
10473
|
+
if (ix.__kind === "Standard") {
|
|
10474
|
+
const { programId: stdProgramId, data: data2 } = ix;
|
|
10475
|
+
programId = stdProgramId;
|
|
10476
|
+
const discriminator = Buffer.from(data2.slice(0, 8)).toString("hex");
|
|
10477
|
+
instructionType = discriminator === lzReceiveDiscriminator ? "lz_receive" : discriminator;
|
|
10478
|
+
}
|
|
10479
|
+
const key = `${programId}-${instructionType}`;
|
|
10480
|
+
if (instructionTracker[key]) {
|
|
10481
|
+
throw new Error(`Duplicate instruction found: ${instructionType} for program ${programId}`);
|
|
10482
|
+
}
|
|
10483
|
+
instructionTracker[key] = true;
|
|
10484
|
+
}
|
|
10485
|
+
const { contextVersion } = resp;
|
|
10486
|
+
const instructions = resp.instructions.map((ix) => {
|
|
10487
|
+
if (ix.__kind === "LzReceive") {
|
|
10488
|
+
return {
|
|
10489
|
+
programId: receiverProgram,
|
|
10490
|
+
keys: ix.accounts.map(
|
|
10491
|
+
(account) => accountMetaRefToAccountMeta(
|
|
10492
|
+
{ eddsa: EDDSA },
|
|
10493
|
+
executorProgram,
|
|
10494
|
+
tables,
|
|
10495
|
+
signers,
|
|
10496
|
+
account,
|
|
10497
|
+
payer,
|
|
10498
|
+
contextVersion
|
|
10499
|
+
)
|
|
10500
|
+
),
|
|
10501
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive"), data])
|
|
10502
|
+
};
|
|
10503
|
+
} else {
|
|
10504
|
+
return {
|
|
10505
|
+
programId: ix.programId,
|
|
10506
|
+
keys: ix.accounts.map(
|
|
10507
|
+
(account) => accountMetaRefToAccountMeta(
|
|
10508
|
+
{ eddsa: EDDSA },
|
|
10509
|
+
executorProgram,
|
|
10510
|
+
tables,
|
|
10511
|
+
signers,
|
|
10512
|
+
account,
|
|
10513
|
+
payer,
|
|
10514
|
+
contextVersion
|
|
10515
|
+
)
|
|
10516
|
+
),
|
|
10517
|
+
data: ix.data
|
|
10518
|
+
};
|
|
10519
|
+
}
|
|
10520
|
+
});
|
|
10521
|
+
return {
|
|
10522
|
+
contextVersion,
|
|
10523
|
+
signers: Object.values(signers).filter((signer) => signer !== void 0),
|
|
10524
|
+
instructions
|
|
10525
|
+
};
|
|
10526
|
+
}
|
|
10527
|
+
async function getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
|
|
10528
|
+
const oappPDA = new OmniAppPDA(receiverProgram);
|
|
10529
|
+
const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
|
|
10530
|
+
const lzReceiveTypesIx = {
|
|
10531
|
+
programId: receiverProgram,
|
|
10532
|
+
keys: [
|
|
10533
|
+
{
|
|
10534
|
+
pubkey: receiver,
|
|
10535
|
+
isSigner: false,
|
|
10536
|
+
isWritable: false
|
|
10537
|
+
},
|
|
10538
|
+
{
|
|
10539
|
+
pubkey: lzReceiveTypesAccountsPDA,
|
|
10540
|
+
isSigner: false,
|
|
10541
|
+
isWritable: false
|
|
10542
|
+
}
|
|
10543
|
+
],
|
|
10544
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive_types_info")])
|
|
10545
|
+
};
|
|
10546
|
+
const resp = await simulateWeb3JsTransaction(
|
|
10547
|
+
rpc.getEndpoint(),
|
|
10548
|
+
[umiWeb3jsAdapters.toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10549
|
+
umiWeb3jsAdapters.toWeb3JsPublicKey(receiverProgram),
|
|
10550
|
+
umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
|
|
10551
|
+
serializers.bytes(),
|
|
10552
|
+
commitment
|
|
10553
|
+
);
|
|
10554
|
+
const version4 = resp.at(0);
|
|
10555
|
+
if (version4 !== 2) {
|
|
10556
|
+
throw new Error(`Invalid version ${version4}. Expected version 2.`);
|
|
10557
|
+
}
|
|
10558
|
+
return getLzReceiveTypesV2AccountsSerializer().deserialize(resp, 1)[0];
|
|
10559
|
+
}
|
|
10560
|
+
function accountMetaRefToAccountMeta(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
|
|
10561
|
+
const { isWritable, pubkey: locator } = accountMetaRef;
|
|
10562
|
+
const pubkey = addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion);
|
|
10563
|
+
return { pubkey, isSigner: locator.__kind === "Signer" || locator.__kind === "Payer", isWritable };
|
|
10564
|
+
}
|
|
10565
|
+
function addressLocatorToPublicKey(umi$1, executorProgram, tables, signers, locator, payer, contextVersion) {
|
|
10566
|
+
if (locator.__kind === "Payer") {
|
|
10567
|
+
return payer;
|
|
10568
|
+
} else if (locator.__kind === "Signer") {
|
|
10569
|
+
const index = locator.fields[0];
|
|
10570
|
+
let signer = signers[index];
|
|
10571
|
+
if (signer === void 0) {
|
|
10572
|
+
signer = umi.generateSigner(umi$1);
|
|
10573
|
+
signers[index] = signer;
|
|
10574
|
+
}
|
|
10575
|
+
return signer.publicKey;
|
|
10576
|
+
} else if (locator.__kind === "Address") {
|
|
10577
|
+
return locator.fields[0];
|
|
10578
|
+
} else if (locator.__kind === "Context") {
|
|
10579
|
+
const pda = new ExecutorPDA(executorProgram);
|
|
10580
|
+
return pda.context(payer, contextVersion)[0];
|
|
10581
|
+
} else {
|
|
10582
|
+
const table = tables[locator.fields[0]];
|
|
10583
|
+
return table.addresses[locator.fields[1]];
|
|
10584
|
+
}
|
|
10585
|
+
}
|
|
10586
|
+
|
|
10153
10587
|
// src/receive.ts
|
|
10154
|
-
async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0, 0]), commitment = "confirmed") {
|
|
10155
|
-
const { message: message_, sender, srcEid, guid, receiver: receiver_ } = packet;
|
|
10156
|
-
const
|
|
10588
|
+
async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0, 0]), executorProgram = EXECUTOR_PROGRAM_ID, commitment = "confirmed") {
|
|
10589
|
+
const { message: message_, sender: sender_, srcEid, guid, receiver: receiver_, nonce } = packet;
|
|
10590
|
+
const sender = lzUtilities.arrayify(sender_);
|
|
10591
|
+
const receiverBytes = lzV2Utilities.addressToBytes32(receiver_);
|
|
10157
10592
|
const message = lzUtilities.arrayify(message_);
|
|
10158
10593
|
const params = {
|
|
10159
10594
|
srcEid,
|
|
10160
|
-
sender
|
|
10595
|
+
sender,
|
|
10161
10596
|
guid: lzUtilities.arrayify(guid),
|
|
10162
10597
|
message,
|
|
10163
10598
|
callerParams,
|
|
10164
|
-
nonce: BigInt(
|
|
10599
|
+
nonce: BigInt(nonce)
|
|
10165
10600
|
};
|
|
10166
|
-
const
|
|
10167
|
-
|
|
10601
|
+
const receiverPubkey = umi.publicKey(receiverBytes);
|
|
10602
|
+
const receiverInfo = await rpc.getAccount(receiverPubkey, { commitment });
|
|
10603
|
+
invariant3__default.default(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
|
|
10168
10604
|
const receiverProgram = umi.publicKey(receiverInfo.owner);
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10605
|
+
let version4 = 1;
|
|
10606
|
+
let receiveTypesAccounts;
|
|
10607
|
+
try {
|
|
10608
|
+
receiveTypesAccounts = await getLzReceiveTypesInfo(
|
|
10609
|
+
rpc,
|
|
10610
|
+
payer,
|
|
10611
|
+
receiverPubkey,
|
|
10612
|
+
receiverProgram,
|
|
10613
|
+
params,
|
|
10614
|
+
commitment
|
|
10615
|
+
);
|
|
10616
|
+
version4 = 2;
|
|
10617
|
+
} catch (e) {
|
|
10618
|
+
version4 = 1;
|
|
10619
|
+
}
|
|
10620
|
+
if (version4 === 2) {
|
|
10621
|
+
return buildLzReceiveExecutionPlan(
|
|
10622
|
+
rpc,
|
|
10623
|
+
executorProgram,
|
|
10624
|
+
payer,
|
|
10625
|
+
receiverPubkey,
|
|
10626
|
+
receiverProgram,
|
|
10627
|
+
params,
|
|
10628
|
+
receiveTypesAccounts,
|
|
10629
|
+
commitment
|
|
10630
|
+
);
|
|
10631
|
+
} else {
|
|
10632
|
+
const accounts = await getLzReceiveAccountsFromTypesV1(
|
|
10633
|
+
rpc,
|
|
10634
|
+
payer,
|
|
10635
|
+
receiverPubkey,
|
|
10636
|
+
receiverProgram,
|
|
10637
|
+
params,
|
|
10638
|
+
commitment
|
|
10639
|
+
);
|
|
10640
|
+
const data = getLzReceiveParamsSerializer().serialize(params);
|
|
10641
|
+
return {
|
|
10642
|
+
instruction: {
|
|
10643
|
+
programId: receiverProgram,
|
|
10644
|
+
keys: accounts,
|
|
10645
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive"), data])
|
|
10646
|
+
},
|
|
10647
|
+
contextVersion: 1
|
|
10648
|
+
};
|
|
10649
|
+
}
|
|
10176
10650
|
}
|
|
10177
10651
|
async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]), commitment = "confirmed") {
|
|
10178
10652
|
const { to, from, guid, index, message } = event;
|
|
@@ -10197,47 +10671,6 @@ async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]),
|
|
|
10197
10671
|
data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
|
|
10198
10672
|
};
|
|
10199
10673
|
}
|
|
10200
|
-
async function getLzReceiveAccounts(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
|
|
10201
|
-
const lzReceiveTypesAccounts = await (async () => {
|
|
10202
|
-
const oappPDA = new OmniAppPDA(receiverProgram);
|
|
10203
|
-
const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
|
|
10204
|
-
const info = await rpc.getAccount(lzReceiveTypesAccountsPDA, { commitment });
|
|
10205
|
-
const accounts = [];
|
|
10206
|
-
if (info.exists) {
|
|
10207
|
-
const buffer = Buffer.from(info.data);
|
|
10208
|
-
const len = buffer.length - 8;
|
|
10209
|
-
if (len % 32 !== 0) {
|
|
10210
|
-
throw new Error(
|
|
10211
|
-
`Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
|
|
10212
|
-
);
|
|
10213
|
-
}
|
|
10214
|
-
for (let i = 8; i < len; i += 32) {
|
|
10215
|
-
const [address] = serializers.publicKey().deserialize(buffer, i);
|
|
10216
|
-
accounts.push({
|
|
10217
|
-
pubkey: address,
|
|
10218
|
-
isSigner: false,
|
|
10219
|
-
isWritable: false
|
|
10220
|
-
});
|
|
10221
|
-
}
|
|
10222
|
-
}
|
|
10223
|
-
return accounts;
|
|
10224
|
-
})();
|
|
10225
|
-
const data = getLzReceiveParamsSerializer2().serialize(params);
|
|
10226
|
-
const lzReceiveTypesIx = {
|
|
10227
|
-
programId: receiverProgram,
|
|
10228
|
-
keys: lzReceiveTypesAccounts,
|
|
10229
|
-
data: Buffer.concat([instructionDiscriminator("lz_receive_types"), data])
|
|
10230
|
-
};
|
|
10231
|
-
const keys = await simulateWeb3JsTransaction(
|
|
10232
|
-
rpc.getEndpoint(),
|
|
10233
|
-
[umiWeb3jsAdapters.toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10234
|
-
umiWeb3jsAdapters.toWeb3JsPublicKey(receiverProgram),
|
|
10235
|
-
umiWeb3jsAdapters.toWeb3JsPublicKey(payer),
|
|
10236
|
-
serializers.array(getLzReceiveAccountSerializer()),
|
|
10237
|
-
"confirmed"
|
|
10238
|
-
);
|
|
10239
|
-
return updateAccountFromSimulatedResp(keys, payer);
|
|
10240
|
-
}
|
|
10241
10674
|
async function getLzComposeAccountMeta(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
|
|
10242
10675
|
const lzComposeTypesAccounts = await (async () => {
|
|
10243
10676
|
const oappPDA = new OmniAppPDA(composerProgram);
|
|
@@ -10277,9 +10710,9 @@ async function getLzComposeAccountMeta(rpc, payer, to, composerProgram, params,
|
|
|
10277
10710
|
serializers.array(getLzReceiveAccountSerializer()),
|
|
10278
10711
|
"confirmed"
|
|
10279
10712
|
);
|
|
10280
|
-
return
|
|
10713
|
+
return updateAccountFromSimulatedResp2(keys, payer);
|
|
10281
10714
|
}
|
|
10282
|
-
function
|
|
10715
|
+
function updateAccountFromSimulatedResp2(accounts, payer) {
|
|
10283
10716
|
return accounts.map((r) => {
|
|
10284
10717
|
if (r.pubkey == umi.defaultPublicKey() && r.isSigner) {
|
|
10285
10718
|
if (!payer) throw new Error("payer is required");
|
|
@@ -10539,61 +10972,20 @@ var Executor = class {
|
|
|
10539
10972
|
].concat(ixAccounts);
|
|
10540
10973
|
}
|
|
10541
10974
|
async execute(rpc, executor, param, commitment = "confirmed") {
|
|
10542
|
-
const { packet, extraData, value = 0n
|
|
10543
|
-
const
|
|
10544
|
-
const
|
|
10545
|
-
const {
|
|
10546
|
-
const
|
|
10547
|
-
const
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
{
|
|
10557
|
-
srcEid,
|
|
10558
|
-
sender: lzUtilities.arrayify(sender),
|
|
10559
|
-
guid: lzUtilities.arrayify(guid),
|
|
10560
|
-
message,
|
|
10561
|
-
callerParams: extraData,
|
|
10562
|
-
nonce: BigInt(packet.nonce)
|
|
10563
|
-
},
|
|
10564
|
-
commitment
|
|
10565
|
-
);
|
|
10566
|
-
const txBuilder = execute(
|
|
10567
|
-
{ programs: this.programRepo },
|
|
10568
|
-
{
|
|
10569
|
-
executor,
|
|
10570
|
-
config: this.pda.config(),
|
|
10571
|
-
endpointProgram,
|
|
10572
|
-
endpointEventAuthority: endpointEventPDA.eventAuthority()[0],
|
|
10573
|
-
program: this.programId,
|
|
10574
|
-
eventAuthority: executorEventPDA.eventAuthority()[0],
|
|
10575
|
-
// param
|
|
10576
|
-
receiver,
|
|
10577
|
-
lzReceive: {
|
|
10578
|
-
srcEid,
|
|
10579
|
-
sender: lzUtilities.arrayify(sender),
|
|
10580
|
-
nonce: parseInt(nonce),
|
|
10581
|
-
guid: lzUtilities.arrayify(guid),
|
|
10582
|
-
message,
|
|
10583
|
-
extraData
|
|
10584
|
-
},
|
|
10585
|
-
value,
|
|
10586
|
-
computeUnits
|
|
10587
|
-
}
|
|
10588
|
-
);
|
|
10589
|
-
return txBuilder.addRemainingAccounts([
|
|
10590
|
-
{
|
|
10591
|
-
pubkey: receiverProgram,
|
|
10592
|
-
isWritable: false,
|
|
10593
|
-
isSigner: false
|
|
10594
|
-
},
|
|
10595
|
-
...accounts
|
|
10596
|
-
]).items[0];
|
|
10975
|
+
const { packet, extraData, value = 0n } = param;
|
|
10976
|
+
const payer = executor.publicKey;
|
|
10977
|
+
const lzReceiveResult = await lzReceive(rpc, payer, packet, extraData, this.programId, commitment);
|
|
10978
|
+
const { contextVersion } = lzReceiveResult;
|
|
10979
|
+
const instructions = [this.preExecute(executor, contextVersion, value).instruction];
|
|
10980
|
+
const signers = [];
|
|
10981
|
+
if ("instruction" in lzReceiveResult) {
|
|
10982
|
+
instructions.push(lzReceiveResult.instruction);
|
|
10983
|
+
} else {
|
|
10984
|
+
instructions.push(...lzReceiveResult.instructions);
|
|
10985
|
+
signers.push(...lzReceiveResult.signers);
|
|
10986
|
+
}
|
|
10987
|
+
instructions.push(this.postExecute(executor, contextVersion).instruction);
|
|
10988
|
+
return { signers, instructions };
|
|
10597
10989
|
}
|
|
10598
10990
|
async compose(rpc, executor, param, commitment = "confirmed") {
|
|
10599
10991
|
const { event, extraData, value = 0n, computeUnits = 4e5, endpointProgram = ENDPOINT_PROGRAM_ID } = param;
|
|
@@ -10649,6 +11041,17 @@ var Executor = class {
|
|
|
10649
11041
|
...accounts
|
|
10650
11042
|
]).items[0];
|
|
10651
11043
|
}
|
|
11044
|
+
preExecute(executor, version4, feeLimit) {
|
|
11045
|
+
const context = this.pda.context(executor.publicKey, version4);
|
|
11046
|
+
return preExecute(
|
|
11047
|
+
{ programs: this.programRepo },
|
|
11048
|
+
{ executor, context, feeLimit, contextVersion: version4 }
|
|
11049
|
+
).items[0];
|
|
11050
|
+
}
|
|
11051
|
+
postExecute(executor, version4) {
|
|
11052
|
+
const context = this.pda.context(executor.publicKey, version4);
|
|
11053
|
+
return postExecute({ programs: this.programRepo }, { context, executor, contextVersion: version4 }).items[0];
|
|
11054
|
+
}
|
|
10652
11055
|
};
|
|
10653
11056
|
|
|
10654
11057
|
// src/generated/kinobi/uln/accounts/index.ts
|
|
@@ -10705,17 +11108,17 @@ function deserializeConfirmations(rawAccount) {
|
|
|
10705
11108
|
getConfirmationsAccountDataSerializer()
|
|
10706
11109
|
);
|
|
10707
11110
|
}
|
|
10708
|
-
async function fetchConfirmations(context,
|
|
11111
|
+
async function fetchConfirmations(context, publicKey16, options) {
|
|
10709
11112
|
const maybeAccount = await context.rpc.getAccount(
|
|
10710
|
-
umi.publicKey(
|
|
11113
|
+
umi.publicKey(publicKey16, false),
|
|
10711
11114
|
options
|
|
10712
11115
|
);
|
|
10713
11116
|
umi.assertAccountExists(maybeAccount, "Confirmations");
|
|
10714
11117
|
return deserializeConfirmations(maybeAccount);
|
|
10715
11118
|
}
|
|
10716
|
-
async function safeFetchConfirmations(context,
|
|
11119
|
+
async function safeFetchConfirmations(context, publicKey16, options) {
|
|
10717
11120
|
const maybeAccount = await context.rpc.getAccount(
|
|
10718
|
-
umi.publicKey(
|
|
11121
|
+
umi.publicKey(publicKey16, false),
|
|
10719
11122
|
options
|
|
10720
11123
|
);
|
|
10721
11124
|
return maybeAccount.exists ? deserializeConfirmations(maybeAccount) : null;
|
|
@@ -10777,17 +11180,17 @@ function deserializeReceiveConfig2(rawAccount) {
|
|
|
10777
11180
|
getReceiveConfigAccountDataSerializer2()
|
|
10778
11181
|
);
|
|
10779
11182
|
}
|
|
10780
|
-
async function fetchReceiveConfig2(context,
|
|
11183
|
+
async function fetchReceiveConfig2(context, publicKey16, options) {
|
|
10781
11184
|
const maybeAccount = await context.rpc.getAccount(
|
|
10782
|
-
umi.publicKey(
|
|
11185
|
+
umi.publicKey(publicKey16, false),
|
|
10783
11186
|
options
|
|
10784
11187
|
);
|
|
10785
11188
|
umi.assertAccountExists(maybeAccount, "ReceiveConfig");
|
|
10786
11189
|
return deserializeReceiveConfig2(maybeAccount);
|
|
10787
11190
|
}
|
|
10788
|
-
async function safeFetchReceiveConfig2(context,
|
|
11191
|
+
async function safeFetchReceiveConfig2(context, publicKey16, options) {
|
|
10789
11192
|
const maybeAccount = await context.rpc.getAccount(
|
|
10790
|
-
umi.publicKey(
|
|
11193
|
+
umi.publicKey(publicKey16, false),
|
|
10791
11194
|
options
|
|
10792
11195
|
);
|
|
10793
11196
|
return maybeAccount.exists ? deserializeReceiveConfig2(maybeAccount) : null;
|
|
@@ -10847,17 +11250,17 @@ function getSendConfigAccountDataSerializer() {
|
|
|
10847
11250
|
function deserializeSendConfig(rawAccount) {
|
|
10848
11251
|
return umi.deserializeAccount(rawAccount, getSendConfigAccountDataSerializer());
|
|
10849
11252
|
}
|
|
10850
|
-
async function fetchSendConfig(context,
|
|
11253
|
+
async function fetchSendConfig(context, publicKey16, options) {
|
|
10851
11254
|
const maybeAccount = await context.rpc.getAccount(
|
|
10852
|
-
umi.publicKey(
|
|
11255
|
+
umi.publicKey(publicKey16, false),
|
|
10853
11256
|
options
|
|
10854
11257
|
);
|
|
10855
11258
|
umi.assertAccountExists(maybeAccount, "SendConfig");
|
|
10856
11259
|
return deserializeSendConfig(maybeAccount);
|
|
10857
11260
|
}
|
|
10858
|
-
async function safeFetchSendConfig(context,
|
|
11261
|
+
async function safeFetchSendConfig(context, publicKey16, options) {
|
|
10859
11262
|
const maybeAccount = await context.rpc.getAccount(
|
|
10860
|
-
umi.publicKey(
|
|
11263
|
+
umi.publicKey(publicKey16, false),
|
|
10861
11264
|
options
|
|
10862
11265
|
);
|
|
10863
11266
|
return maybeAccount.exists ? deserializeSendConfig(maybeAccount) : null;
|
|
@@ -10917,17 +11320,17 @@ function getUlnSettingsAccountDataSerializer() {
|
|
|
10917
11320
|
function deserializeUlnSettings(rawAccount) {
|
|
10918
11321
|
return umi.deserializeAccount(rawAccount, getUlnSettingsAccountDataSerializer());
|
|
10919
11322
|
}
|
|
10920
|
-
async function fetchUlnSettings(context,
|
|
11323
|
+
async function fetchUlnSettings(context, publicKey16, options) {
|
|
10921
11324
|
const maybeAccount = await context.rpc.getAccount(
|
|
10922
|
-
umi.publicKey(
|
|
11325
|
+
umi.publicKey(publicKey16, false),
|
|
10923
11326
|
options
|
|
10924
11327
|
);
|
|
10925
11328
|
umi.assertAccountExists(maybeAccount, "UlnSettings");
|
|
10926
11329
|
return deserializeUlnSettings(maybeAccount);
|
|
10927
11330
|
}
|
|
10928
|
-
async function safeFetchUlnSettings(context,
|
|
11331
|
+
async function safeFetchUlnSettings(context, publicKey16, options) {
|
|
10929
11332
|
const maybeAccount = await context.rpc.getAccount(
|
|
10930
|
-
umi.publicKey(
|
|
11333
|
+
umi.publicKey(publicKey16, false),
|
|
10931
11334
|
options
|
|
10932
11335
|
);
|
|
10933
11336
|
return maybeAccount.exists ? deserializeUlnSettings(maybeAccount) : null;
|
|
@@ -13337,17 +13740,17 @@ function getPriceFeedAccountDataSerializer() {
|
|
|
13337
13740
|
function deserializePriceFeed(rawAccount) {
|
|
13338
13741
|
return umi.deserializeAccount(rawAccount, getPriceFeedAccountDataSerializer());
|
|
13339
13742
|
}
|
|
13340
|
-
async function fetchPriceFeed(context,
|
|
13743
|
+
async function fetchPriceFeed(context, publicKey16, options) {
|
|
13341
13744
|
const maybeAccount = await context.rpc.getAccount(
|
|
13342
|
-
umi.publicKey(
|
|
13745
|
+
umi.publicKey(publicKey16, false),
|
|
13343
13746
|
options
|
|
13344
13747
|
);
|
|
13345
13748
|
umi.assertAccountExists(maybeAccount, "PriceFeed");
|
|
13346
13749
|
return deserializePriceFeed(maybeAccount);
|
|
13347
13750
|
}
|
|
13348
|
-
async function safeFetchPriceFeed(context,
|
|
13751
|
+
async function safeFetchPriceFeed(context, publicKey16, options) {
|
|
13349
13752
|
const maybeAccount = await context.rpc.getAccount(
|
|
13350
|
-
umi.publicKey(
|
|
13753
|
+
umi.publicKey(publicKey16, false),
|
|
13351
13754
|
options
|
|
13352
13755
|
);
|
|
13353
13756
|
return maybeAccount.exists ? deserializePriceFeed(maybeAccount) : null;
|
|
@@ -14676,6 +15079,8 @@ exports.SetConfigType = SetConfigType2;
|
|
|
14676
15079
|
exports.SimpleMessageLibProgram = simple_message_lib_exports;
|
|
14677
15080
|
exports.UlnPDA = UlnPDA;
|
|
14678
15081
|
exports.UlnProgram = uln_exports;
|
|
15082
|
+
exports.addressLocator = addressLocator;
|
|
15083
|
+
exports.buildLzReceiveExecutionPlan = buildLzReceiveExecutionPlan;
|
|
14679
15084
|
exports.buildMessageV0 = buildMessageV0;
|
|
14680
15085
|
exports.buildVersionedTransaction = buildVersionedTransaction;
|
|
14681
15086
|
exports.closeLookupTable = closeLookupTable;
|
|
@@ -14689,15 +15094,21 @@ exports.extractReceivedPacketEventByTxHash = extractReceivedPacketEventByTxHash;
|
|
|
14689
15094
|
exports.extractVerifiedPacketEventByTxHash = extractVerifiedPacketEventByTxHash;
|
|
14690
15095
|
exports.extractWorkerFeePaidEventByTxHash = extractWorkerFeePaidEventByTxHash;
|
|
14691
15096
|
exports.generateAddressLookupTable = generateAddressLookupTable;
|
|
15097
|
+
exports.getAccountMetaRefSerializer = getAccountMetaRefSerializer;
|
|
15098
|
+
exports.getAddressLocatorSerializer = getAddressLocatorSerializer;
|
|
14692
15099
|
exports.getBlockedMessageLibProgramId = getBlockedMessageLibProgramId;
|
|
14693
15100
|
exports.getDVNProgramId = getDVNProgramId;
|
|
14694
15101
|
exports.getEndpointProgramId = getEndpointProgramId;
|
|
14695
15102
|
exports.getExecutorProgramId = getExecutorProgramId;
|
|
15103
|
+
exports.getInstructionSerializer = getInstructionSerializer;
|
|
14696
15104
|
exports.getLzComposeAccountMeta = getLzComposeAccountMeta;
|
|
14697
15105
|
exports.getLzComposeParamsSerializer = getLzComposeParamsSerializer2;
|
|
14698
15106
|
exports.getLzReceiveAccountSerializer = getLzReceiveAccountSerializer;
|
|
14699
|
-
exports.
|
|
14700
|
-
exports.getLzReceiveParamsSerializer =
|
|
15107
|
+
exports.getLzReceiveAccountsFromTypesV1 = getLzReceiveAccountsFromTypesV1;
|
|
15108
|
+
exports.getLzReceiveParamsSerializer = getLzReceiveParamsSerializer;
|
|
15109
|
+
exports.getLzReceiveTypesInfo = getLzReceiveTypesInfo;
|
|
15110
|
+
exports.getLzReceiveTypesV2AccountsSerializer = getLzReceiveTypesV2AccountsSerializer;
|
|
15111
|
+
exports.getLzReceiveTypesV2ResultSerializer = getLzReceiveTypesV2ResultSerializer;
|
|
14701
15112
|
exports.getNextNonceInstructionDataSerializer = getNextNonceInstructionDataSerializer;
|
|
14702
15113
|
exports.getPricefeedProgramId = getPricefeedProgramId;
|
|
14703
15114
|
exports.getProgramKeypair = getProgramKeypair;
|
|
@@ -14706,6 +15117,7 @@ exports.getULNProgramId = getULNProgramId;
|
|
|
14706
15117
|
exports.idlTypes = idlTypes;
|
|
14707
15118
|
exports.instructionDiscriminator = instructionDiscriminator;
|
|
14708
15119
|
exports.isAccountInitialized = isAccountInitialized;
|
|
15120
|
+
exports.isAddressLocator = isAddressLocator;
|
|
14709
15121
|
exports.lzCompose = lzCompose;
|
|
14710
15122
|
exports.lzReceive = lzReceive;
|
|
14711
15123
|
exports.messageLibs = messageLibs;
|