@layerzerolabs/lz-solana-sdk-v2 3.0.104 → 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/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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultPublicKey, deserializeAccount, publicKey, assertAccountExists, gpaBuilder, ProgramError, transactionBuilder, createNullRpc, some, createNoopSigner, isSome, isPublicKey, publicKeyBytes, isPda, isSigner } from '@metaplex-foundation/umi';
|
|
2
|
-
import { mapSerializer, struct, bytes, bool, u8, u32, publicKey as publicKey$1, option, scalarEnum, u64, array, u16, dataEnum, tuple, u128, i64, base58, Endian } from '@metaplex-foundation/umi/serializers';
|
|
1
|
+
import { defaultPublicKey, deserializeAccount, publicKey, assertAccountExists, gpaBuilder, ProgramError, transactionBuilder, createNullRpc, some, createNoopSigner, isSome, isPublicKey, generateSigner, publicKeyBytes, isPda, isSigner } from '@metaplex-foundation/umi';
|
|
2
|
+
import { mapSerializer, struct, bytes, bool, u8, u32, publicKey as publicKey$1, option, scalarEnum, u64, array, u16, dataEnum, tuple, u128, i64, unit, base58, Endian } from '@metaplex-foundation/umi/serializers';
|
|
3
3
|
import { createWeb3JsEddsa } from '@metaplex-foundation/umi-eddsa-web3js';
|
|
4
4
|
import { createDefaultProgramRepository } from '@metaplex-foundation/umi-program-repository';
|
|
5
5
|
import { toWeb3JsPublicKey, fromWeb3JsPublicKey, toWeb3JsInstruction } from '@metaplex-foundation/umi-web3js-adapters';
|
|
@@ -10,6 +10,7 @@ import { arrayify } from '@layerzerolabs/lz-utilities';
|
|
|
10
10
|
import { addressToBytes32, PacketV1Codec } from '@layerzerolabs/lz-v2-utilities';
|
|
11
11
|
import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
|
|
12
12
|
import invariant3 from 'tiny-invariant';
|
|
13
|
+
import { fetchAllAddressLookupTable } from '@metaplex-foundation/mpl-toolbox';
|
|
13
14
|
import { Environment } from '@layerzerolabs/lz-definitions';
|
|
14
15
|
|
|
15
16
|
var __defProp = Object.defineProperty;
|
|
@@ -284,8 +285,16 @@ var _ExecutorPDA = class _ExecutorPDA {
|
|
|
284
285
|
config() {
|
|
285
286
|
return EDDSA.findPda(this.program, [Buffer.from(_ExecutorPDA.EXECUTOR_CONFIG_SEED, "utf8")]);
|
|
286
287
|
}
|
|
288
|
+
context(executor, version4) {
|
|
289
|
+
return EDDSA.findPda(this.program, [
|
|
290
|
+
Buffer.from(_ExecutorPDA.EXECUTION_CONTEXT_SEED, "utf8"),
|
|
291
|
+
publicKeyBytes(executor),
|
|
292
|
+
u8().serialize(version4)
|
|
293
|
+
]);
|
|
294
|
+
}
|
|
287
295
|
};
|
|
288
296
|
_ExecutorPDA.EXECUTOR_CONFIG_SEED = "ExecutorConfig";
|
|
297
|
+
_ExecutorPDA.EXECUTION_CONTEXT_SEED = "ExecutionContext";
|
|
289
298
|
var ExecutorPDA = _ExecutorPDA;
|
|
290
299
|
var _PriceFeedPDA = class _PriceFeedPDA {
|
|
291
300
|
constructor(program) {
|
|
@@ -407,17 +416,17 @@ function deserializeComposeMessageState(rawAccount) {
|
|
|
407
416
|
getComposeMessageStateAccountDataSerializer()
|
|
408
417
|
);
|
|
409
418
|
}
|
|
410
|
-
async function fetchComposeMessageState(context,
|
|
419
|
+
async function fetchComposeMessageState(context, publicKey16, options) {
|
|
411
420
|
const maybeAccount = await context.rpc.getAccount(
|
|
412
|
-
publicKey(
|
|
421
|
+
publicKey(publicKey16, false),
|
|
413
422
|
options
|
|
414
423
|
);
|
|
415
424
|
assertAccountExists(maybeAccount, "ComposeMessageState");
|
|
416
425
|
return deserializeComposeMessageState(maybeAccount);
|
|
417
426
|
}
|
|
418
|
-
async function safeFetchComposeMessageState(context,
|
|
427
|
+
async function safeFetchComposeMessageState(context, publicKey16, options) {
|
|
419
428
|
const maybeAccount = await context.rpc.getAccount(
|
|
420
|
-
publicKey(
|
|
429
|
+
publicKey(publicKey16, false),
|
|
421
430
|
options
|
|
422
431
|
);
|
|
423
432
|
return maybeAccount.exists ? deserializeComposeMessageState(maybeAccount) : null;
|
|
@@ -484,17 +493,17 @@ function deserializeEndpointSettings(rawAccount) {
|
|
|
484
493
|
getEndpointSettingsAccountDataSerializer()
|
|
485
494
|
);
|
|
486
495
|
}
|
|
487
|
-
async function fetchEndpointSettings(context,
|
|
496
|
+
async function fetchEndpointSettings(context, publicKey16, options) {
|
|
488
497
|
const maybeAccount = await context.rpc.getAccount(
|
|
489
|
-
publicKey(
|
|
498
|
+
publicKey(publicKey16, false),
|
|
490
499
|
options
|
|
491
500
|
);
|
|
492
501
|
assertAccountExists(maybeAccount, "EndpointSettings");
|
|
493
502
|
return deserializeEndpointSettings(maybeAccount);
|
|
494
503
|
}
|
|
495
|
-
async function safeFetchEndpointSettings(context,
|
|
504
|
+
async function safeFetchEndpointSettings(context, publicKey16, options) {
|
|
496
505
|
const maybeAccount = await context.rpc.getAccount(
|
|
497
|
-
publicKey(
|
|
506
|
+
publicKey(publicKey16, false),
|
|
498
507
|
options
|
|
499
508
|
);
|
|
500
509
|
return maybeAccount.exists ? deserializeEndpointSettings(maybeAccount) : null;
|
|
@@ -610,17 +619,17 @@ function deserializeMessageLibInfo(rawAccount) {
|
|
|
610
619
|
getMessageLibInfoAccountDataSerializer()
|
|
611
620
|
);
|
|
612
621
|
}
|
|
613
|
-
async function fetchMessageLibInfo(context,
|
|
622
|
+
async function fetchMessageLibInfo(context, publicKey16, options) {
|
|
614
623
|
const maybeAccount = await context.rpc.getAccount(
|
|
615
|
-
publicKey(
|
|
624
|
+
publicKey(publicKey16, false),
|
|
616
625
|
options
|
|
617
626
|
);
|
|
618
627
|
assertAccountExists(maybeAccount, "MessageLibInfo");
|
|
619
628
|
return deserializeMessageLibInfo(maybeAccount);
|
|
620
629
|
}
|
|
621
|
-
async function safeFetchMessageLibInfo(context,
|
|
630
|
+
async function safeFetchMessageLibInfo(context, publicKey16, options) {
|
|
622
631
|
const maybeAccount = await context.rpc.getAccount(
|
|
623
|
-
publicKey(
|
|
632
|
+
publicKey(publicKey16, false),
|
|
624
633
|
options
|
|
625
634
|
);
|
|
626
635
|
return maybeAccount.exists ? deserializeMessageLibInfo(maybeAccount) : null;
|
|
@@ -684,17 +693,17 @@ function getNonceAccountDataSerializer() {
|
|
|
684
693
|
function deserializeNonce(rawAccount) {
|
|
685
694
|
return deserializeAccount(rawAccount, getNonceAccountDataSerializer());
|
|
686
695
|
}
|
|
687
|
-
async function fetchNonce(context,
|
|
696
|
+
async function fetchNonce(context, publicKey16, options) {
|
|
688
697
|
const maybeAccount = await context.rpc.getAccount(
|
|
689
|
-
publicKey(
|
|
698
|
+
publicKey(publicKey16, false),
|
|
690
699
|
options
|
|
691
700
|
);
|
|
692
701
|
assertAccountExists(maybeAccount, "Nonce");
|
|
693
702
|
return deserializeNonce(maybeAccount);
|
|
694
703
|
}
|
|
695
|
-
async function safeFetchNonce(context,
|
|
704
|
+
async function safeFetchNonce(context, publicKey16, options) {
|
|
696
705
|
const maybeAccount = await context.rpc.getAccount(
|
|
697
|
-
publicKey(
|
|
706
|
+
publicKey(publicKey16, false),
|
|
698
707
|
options
|
|
699
708
|
);
|
|
700
709
|
return maybeAccount.exists ? deserializeNonce(maybeAccount) : null;
|
|
@@ -753,17 +762,17 @@ function getOAppRegistryAccountDataSerializer() {
|
|
|
753
762
|
function deserializeOAppRegistry(rawAccount) {
|
|
754
763
|
return deserializeAccount(rawAccount, getOAppRegistryAccountDataSerializer());
|
|
755
764
|
}
|
|
756
|
-
async function fetchOAppRegistry(context,
|
|
765
|
+
async function fetchOAppRegistry(context, publicKey16, options) {
|
|
757
766
|
const maybeAccount = await context.rpc.getAccount(
|
|
758
|
-
publicKey(
|
|
767
|
+
publicKey(publicKey16, false),
|
|
759
768
|
options
|
|
760
769
|
);
|
|
761
770
|
assertAccountExists(maybeAccount, "OAppRegistry");
|
|
762
771
|
return deserializeOAppRegistry(maybeAccount);
|
|
763
772
|
}
|
|
764
|
-
async function safeFetchOAppRegistry(context,
|
|
773
|
+
async function safeFetchOAppRegistry(context, publicKey16, options) {
|
|
765
774
|
const maybeAccount = await context.rpc.getAccount(
|
|
766
|
-
publicKey(
|
|
775
|
+
publicKey(publicKey16, false),
|
|
767
776
|
options
|
|
768
777
|
);
|
|
769
778
|
return maybeAccount.exists ? deserializeOAppRegistry(maybeAccount) : null;
|
|
@@ -823,17 +832,17 @@ function getPayloadHashAccountDataSerializer() {
|
|
|
823
832
|
function deserializePayloadHash(rawAccount) {
|
|
824
833
|
return deserializeAccount(rawAccount, getPayloadHashAccountDataSerializer());
|
|
825
834
|
}
|
|
826
|
-
async function fetchPayloadHash(context,
|
|
835
|
+
async function fetchPayloadHash(context, publicKey16, options) {
|
|
827
836
|
const maybeAccount = await context.rpc.getAccount(
|
|
828
|
-
publicKey(
|
|
837
|
+
publicKey(publicKey16, false),
|
|
829
838
|
options
|
|
830
839
|
);
|
|
831
840
|
assertAccountExists(maybeAccount, "PayloadHash");
|
|
832
841
|
return deserializePayloadHash(maybeAccount);
|
|
833
842
|
}
|
|
834
|
-
async function safeFetchPayloadHash(context,
|
|
843
|
+
async function safeFetchPayloadHash(context, publicKey16, options) {
|
|
835
844
|
const maybeAccount = await context.rpc.getAccount(
|
|
836
|
-
publicKey(
|
|
845
|
+
publicKey(publicKey16, false),
|
|
837
846
|
options
|
|
838
847
|
);
|
|
839
848
|
return maybeAccount.exists ? deserializePayloadHash(maybeAccount) : null;
|
|
@@ -894,17 +903,17 @@ function deserializePendingInboundNonce(rawAccount) {
|
|
|
894
903
|
getPendingInboundNonceAccountDataSerializer()
|
|
895
904
|
);
|
|
896
905
|
}
|
|
897
|
-
async function fetchPendingInboundNonce(context,
|
|
906
|
+
async function fetchPendingInboundNonce(context, publicKey16, options) {
|
|
898
907
|
const maybeAccount = await context.rpc.getAccount(
|
|
899
|
-
publicKey(
|
|
908
|
+
publicKey(publicKey16, false),
|
|
900
909
|
options
|
|
901
910
|
);
|
|
902
911
|
assertAccountExists(maybeAccount, "PendingInboundNonce");
|
|
903
912
|
return deserializePendingInboundNonce(maybeAccount);
|
|
904
913
|
}
|
|
905
|
-
async function safeFetchPendingInboundNonce(context,
|
|
914
|
+
async function safeFetchPendingInboundNonce(context, publicKey16, options) {
|
|
906
915
|
const maybeAccount = await context.rpc.getAccount(
|
|
907
|
-
publicKey(
|
|
916
|
+
publicKey(publicKey16, false),
|
|
908
917
|
options
|
|
909
918
|
);
|
|
910
919
|
return maybeAccount.exists ? deserializePendingInboundNonce(maybeAccount) : null;
|
|
@@ -967,17 +976,17 @@ function deserializeReceiveLibraryConfig(rawAccount) {
|
|
|
967
976
|
getReceiveLibraryConfigAccountDataSerializer()
|
|
968
977
|
);
|
|
969
978
|
}
|
|
970
|
-
async function fetchReceiveLibraryConfig(context,
|
|
979
|
+
async function fetchReceiveLibraryConfig(context, publicKey16, options) {
|
|
971
980
|
const maybeAccount = await context.rpc.getAccount(
|
|
972
|
-
publicKey(
|
|
981
|
+
publicKey(publicKey16, false),
|
|
973
982
|
options
|
|
974
983
|
);
|
|
975
984
|
assertAccountExists(maybeAccount, "ReceiveLibraryConfig");
|
|
976
985
|
return deserializeReceiveLibraryConfig(maybeAccount);
|
|
977
986
|
}
|
|
978
|
-
async function safeFetchReceiveLibraryConfig(context,
|
|
987
|
+
async function safeFetchReceiveLibraryConfig(context, publicKey16, options) {
|
|
979
988
|
const maybeAccount = await context.rpc.getAccount(
|
|
980
|
-
publicKey(
|
|
989
|
+
publicKey(publicKey16, false),
|
|
981
990
|
options
|
|
982
991
|
);
|
|
983
992
|
return maybeAccount.exists ? deserializeReceiveLibraryConfig(maybeAccount) : null;
|
|
@@ -1040,17 +1049,17 @@ function deserializeSendLibraryConfig(rawAccount) {
|
|
|
1040
1049
|
getSendLibraryConfigAccountDataSerializer()
|
|
1041
1050
|
);
|
|
1042
1051
|
}
|
|
1043
|
-
async function fetchSendLibraryConfig(context,
|
|
1052
|
+
async function fetchSendLibraryConfig(context, publicKey16, options) {
|
|
1044
1053
|
const maybeAccount = await context.rpc.getAccount(
|
|
1045
|
-
publicKey(
|
|
1054
|
+
publicKey(publicKey16, false),
|
|
1046
1055
|
options
|
|
1047
1056
|
);
|
|
1048
1057
|
assertAccountExists(maybeAccount, "SendLibraryConfig");
|
|
1049
1058
|
return deserializeSendLibraryConfig(maybeAccount);
|
|
1050
1059
|
}
|
|
1051
|
-
async function safeFetchSendLibraryConfig(context,
|
|
1060
|
+
async function safeFetchSendLibraryConfig(context, publicKey16, options) {
|
|
1052
1061
|
const maybeAccount = await context.rpc.getAccount(
|
|
1053
|
-
publicKey(
|
|
1062
|
+
publicKey(publicKey16, false),
|
|
1054
1063
|
options
|
|
1055
1064
|
);
|
|
1056
1065
|
return maybeAccount.exists ? deserializeSendLibraryConfig(maybeAccount) : null;
|
|
@@ -3987,17 +3996,17 @@ function getMessageLibAccountDataSerializer() {
|
|
|
3987
3996
|
function deserializeMessageLib(rawAccount) {
|
|
3988
3997
|
return deserializeAccount(rawAccount, getMessageLibAccountDataSerializer());
|
|
3989
3998
|
}
|
|
3990
|
-
async function fetchMessageLib(context,
|
|
3999
|
+
async function fetchMessageLib(context, publicKey16, options) {
|
|
3991
4000
|
const maybeAccount = await context.rpc.getAccount(
|
|
3992
|
-
publicKey(
|
|
4001
|
+
publicKey(publicKey16, false),
|
|
3993
4002
|
options
|
|
3994
4003
|
);
|
|
3995
4004
|
assertAccountExists(maybeAccount, "MessageLib");
|
|
3996
4005
|
return deserializeMessageLib(maybeAccount);
|
|
3997
4006
|
}
|
|
3998
|
-
async function safeFetchMessageLib(context,
|
|
4007
|
+
async function safeFetchMessageLib(context, publicKey16, options) {
|
|
3999
4008
|
const maybeAccount = await context.rpc.getAccount(
|
|
4000
|
-
publicKey(
|
|
4009
|
+
publicKey(publicKey16, false),
|
|
4001
4010
|
options
|
|
4002
4011
|
);
|
|
4003
4012
|
return maybeAccount.exists ? deserializeMessageLib(maybeAccount) : null;
|
|
@@ -4064,17 +4073,17 @@ function deserializeReceiveConfigStore(rawAccount) {
|
|
|
4064
4073
|
getReceiveConfigStoreAccountDataSerializer()
|
|
4065
4074
|
);
|
|
4066
4075
|
}
|
|
4067
|
-
async function fetchReceiveConfigStore(context,
|
|
4076
|
+
async function fetchReceiveConfigStore(context, publicKey16, options) {
|
|
4068
4077
|
const maybeAccount = await context.rpc.getAccount(
|
|
4069
|
-
publicKey(
|
|
4078
|
+
publicKey(publicKey16, false),
|
|
4070
4079
|
options
|
|
4071
4080
|
);
|
|
4072
4081
|
assertAccountExists(maybeAccount, "ReceiveConfigStore");
|
|
4073
4082
|
return deserializeReceiveConfigStore(maybeAccount);
|
|
4074
4083
|
}
|
|
4075
|
-
async function safeFetchReceiveConfigStore(context,
|
|
4084
|
+
async function safeFetchReceiveConfigStore(context, publicKey16, options) {
|
|
4076
4085
|
const maybeAccount = await context.rpc.getAccount(
|
|
4077
|
-
publicKey(
|
|
4086
|
+
publicKey(publicKey16, false),
|
|
4078
4087
|
options
|
|
4079
4088
|
);
|
|
4080
4089
|
return maybeAccount.exists ? deserializeReceiveConfigStore(maybeAccount) : null;
|
|
@@ -4136,17 +4145,17 @@ function deserializeSendConfigStore(rawAccount) {
|
|
|
4136
4145
|
getSendConfigStoreAccountDataSerializer()
|
|
4137
4146
|
);
|
|
4138
4147
|
}
|
|
4139
|
-
async function fetchSendConfigStore(context,
|
|
4148
|
+
async function fetchSendConfigStore(context, publicKey16, options) {
|
|
4140
4149
|
const maybeAccount = await context.rpc.getAccount(
|
|
4141
|
-
publicKey(
|
|
4150
|
+
publicKey(publicKey16, false),
|
|
4142
4151
|
options
|
|
4143
4152
|
);
|
|
4144
4153
|
assertAccountExists(maybeAccount, "SendConfigStore");
|
|
4145
4154
|
return deserializeSendConfigStore(maybeAccount);
|
|
4146
4155
|
}
|
|
4147
|
-
async function safeFetchSendConfigStore(context,
|
|
4156
|
+
async function safeFetchSendConfigStore(context, publicKey16, options) {
|
|
4148
4157
|
const maybeAccount = await context.rpc.getAccount(
|
|
4149
|
-
publicKey(
|
|
4158
|
+
publicKey(publicKey16, false),
|
|
4150
4159
|
options
|
|
4151
4160
|
);
|
|
4152
4161
|
return maybeAccount.exists ? deserializeSendConfigStore(maybeAccount) : null;
|
|
@@ -6964,17 +6973,17 @@ function getDvnConfigAccountDataSerializer() {
|
|
|
6964
6973
|
function deserializeDvnConfig(rawAccount) {
|
|
6965
6974
|
return deserializeAccount(rawAccount, getDvnConfigAccountDataSerializer());
|
|
6966
6975
|
}
|
|
6967
|
-
async function fetchDvnConfig(context,
|
|
6976
|
+
async function fetchDvnConfig(context, publicKey16, options) {
|
|
6968
6977
|
const maybeAccount = await context.rpc.getAccount(
|
|
6969
|
-
publicKey(
|
|
6978
|
+
publicKey(publicKey16, false),
|
|
6970
6979
|
options
|
|
6971
6980
|
);
|
|
6972
6981
|
assertAccountExists(maybeAccount, "DvnConfig");
|
|
6973
6982
|
return deserializeDvnConfig(maybeAccount);
|
|
6974
6983
|
}
|
|
6975
|
-
async function safeFetchDvnConfig(context,
|
|
6984
|
+
async function safeFetchDvnConfig(context, publicKey16, options) {
|
|
6976
6985
|
const maybeAccount = await context.rpc.getAccount(
|
|
6977
|
-
publicKey(
|
|
6986
|
+
publicKey(publicKey16, false),
|
|
6978
6987
|
options
|
|
6979
6988
|
);
|
|
6980
6989
|
return maybeAccount.exists ? deserializeDvnConfig(maybeAccount) : null;
|
|
@@ -7037,17 +7046,17 @@ function getExecuteHashAccountDataSerializer() {
|
|
|
7037
7046
|
function deserializeExecuteHash(rawAccount) {
|
|
7038
7047
|
return deserializeAccount(rawAccount, getExecuteHashAccountDataSerializer());
|
|
7039
7048
|
}
|
|
7040
|
-
async function fetchExecuteHash(context,
|
|
7049
|
+
async function fetchExecuteHash(context, publicKey16, options) {
|
|
7041
7050
|
const maybeAccount = await context.rpc.getAccount(
|
|
7042
|
-
publicKey(
|
|
7051
|
+
publicKey(publicKey16, false),
|
|
7043
7052
|
options
|
|
7044
7053
|
);
|
|
7045
7054
|
assertAccountExists(maybeAccount, "ExecuteHash");
|
|
7046
7055
|
return deserializeExecuteHash(maybeAccount);
|
|
7047
7056
|
}
|
|
7048
|
-
async function safeFetchExecuteHash(context,
|
|
7057
|
+
async function safeFetchExecuteHash(context, publicKey16, options) {
|
|
7049
7058
|
const maybeAccount = await context.rpc.getAccount(
|
|
7050
|
-
publicKey(
|
|
7059
|
+
publicKey(publicKey16, false),
|
|
7051
7060
|
options
|
|
7052
7061
|
);
|
|
7053
7062
|
return maybeAccount.exists ? deserializeExecuteHash(maybeAccount) : null;
|
|
@@ -7108,17 +7117,17 @@ function deserializeReceiveConfig(rawAccount) {
|
|
|
7108
7117
|
getReceiveConfigAccountDataSerializer()
|
|
7109
7118
|
);
|
|
7110
7119
|
}
|
|
7111
|
-
async function fetchReceiveConfig(context,
|
|
7120
|
+
async function fetchReceiveConfig(context, publicKey16, options) {
|
|
7112
7121
|
const maybeAccount = await context.rpc.getAccount(
|
|
7113
|
-
publicKey(
|
|
7122
|
+
publicKey(publicKey16, false),
|
|
7114
7123
|
options
|
|
7115
7124
|
);
|
|
7116
7125
|
assertAccountExists(maybeAccount, "ReceiveConfig");
|
|
7117
7126
|
return deserializeReceiveConfig(maybeAccount);
|
|
7118
7127
|
}
|
|
7119
|
-
async function safeFetchReceiveConfig(context,
|
|
7128
|
+
async function safeFetchReceiveConfig(context, publicKey16, options) {
|
|
7120
7129
|
const maybeAccount = await context.rpc.getAccount(
|
|
7121
|
-
publicKey(
|
|
7130
|
+
publicKey(publicKey16, false),
|
|
7122
7131
|
options
|
|
7123
7132
|
);
|
|
7124
7133
|
return maybeAccount.exists ? deserializeReceiveConfig(maybeAccount) : null;
|
|
@@ -8365,22 +8374,105 @@ __export(executor_exports, {
|
|
|
8365
8374
|
// src/generated/kinobi/executor/accounts/index.ts
|
|
8366
8375
|
var accounts_exports4 = {};
|
|
8367
8376
|
__export(accounts_exports4, {
|
|
8377
|
+
deserializeExecutionContextV1: () => deserializeExecutionContextV1,
|
|
8368
8378
|
deserializeExecutorConfig: () => deserializeExecutorConfig,
|
|
8369
8379
|
deserializeNonce: () => deserializeNonce2,
|
|
8380
|
+
fetchAllExecutionContextV1: () => fetchAllExecutionContextV1,
|
|
8370
8381
|
fetchAllExecutorConfig: () => fetchAllExecutorConfig,
|
|
8371
8382
|
fetchAllNonce: () => fetchAllNonce2,
|
|
8383
|
+
fetchExecutionContextV1: () => fetchExecutionContextV1,
|
|
8372
8384
|
fetchExecutorConfig: () => fetchExecutorConfig,
|
|
8373
8385
|
fetchNonce: () => fetchNonce2,
|
|
8386
|
+
getExecutionContextV1AccountDataSerializer: () => getExecutionContextV1AccountDataSerializer,
|
|
8387
|
+
getExecutionContextV1GpaBuilder: () => getExecutionContextV1GpaBuilder,
|
|
8388
|
+
getExecutionContextV1Size: () => getExecutionContextV1Size,
|
|
8374
8389
|
getExecutorConfigAccountDataSerializer: () => getExecutorConfigAccountDataSerializer,
|
|
8375
8390
|
getExecutorConfigGpaBuilder: () => getExecutorConfigGpaBuilder,
|
|
8376
8391
|
getNonceAccountDataSerializer: () => getNonceAccountDataSerializer2,
|
|
8377
8392
|
getNonceGpaBuilder: () => getNonceGpaBuilder2,
|
|
8378
8393
|
getNonceSize: () => getNonceSize2,
|
|
8394
|
+
safeFetchAllExecutionContextV1: () => safeFetchAllExecutionContextV1,
|
|
8379
8395
|
safeFetchAllExecutorConfig: () => safeFetchAllExecutorConfig,
|
|
8380
8396
|
safeFetchAllNonce: () => safeFetchAllNonce2,
|
|
8397
|
+
safeFetchExecutionContextV1: () => safeFetchExecutionContextV1,
|
|
8381
8398
|
safeFetchExecutorConfig: () => safeFetchExecutorConfig,
|
|
8382
8399
|
safeFetchNonce: () => safeFetchNonce2
|
|
8383
8400
|
});
|
|
8401
|
+
function getExecutionContextV1AccountDataSerializer() {
|
|
8402
|
+
return mapSerializer(
|
|
8403
|
+
struct(
|
|
8404
|
+
[
|
|
8405
|
+
["discriminator", bytes({ size: 8 })],
|
|
8406
|
+
["initialPayerBalance", u64()],
|
|
8407
|
+
["feeLimit", u64()]
|
|
8408
|
+
],
|
|
8409
|
+
{ description: "ExecutionContextV1AccountData" }
|
|
8410
|
+
),
|
|
8411
|
+
(value) => ({
|
|
8412
|
+
...value,
|
|
8413
|
+
discriminator: new Uint8Array([132, 92, 176, 59, 141, 186, 141, 137])
|
|
8414
|
+
})
|
|
8415
|
+
);
|
|
8416
|
+
}
|
|
8417
|
+
function deserializeExecutionContextV1(rawAccount) {
|
|
8418
|
+
return deserializeAccount(
|
|
8419
|
+
rawAccount,
|
|
8420
|
+
getExecutionContextV1AccountDataSerializer()
|
|
8421
|
+
);
|
|
8422
|
+
}
|
|
8423
|
+
async function fetchExecutionContextV1(context, publicKey16, options) {
|
|
8424
|
+
const maybeAccount = await context.rpc.getAccount(
|
|
8425
|
+
publicKey(publicKey16, false),
|
|
8426
|
+
options
|
|
8427
|
+
);
|
|
8428
|
+
assertAccountExists(maybeAccount, "ExecutionContextV1");
|
|
8429
|
+
return deserializeExecutionContextV1(maybeAccount);
|
|
8430
|
+
}
|
|
8431
|
+
async function safeFetchExecutionContextV1(context, publicKey16, options) {
|
|
8432
|
+
const maybeAccount = await context.rpc.getAccount(
|
|
8433
|
+
publicKey(publicKey16, false),
|
|
8434
|
+
options
|
|
8435
|
+
);
|
|
8436
|
+
return maybeAccount.exists ? deserializeExecutionContextV1(maybeAccount) : null;
|
|
8437
|
+
}
|
|
8438
|
+
async function fetchAllExecutionContextV1(context, publicKeys, options) {
|
|
8439
|
+
const maybeAccounts = await context.rpc.getAccounts(
|
|
8440
|
+
publicKeys.map((key) => publicKey(key, false)),
|
|
8441
|
+
options
|
|
8442
|
+
);
|
|
8443
|
+
return maybeAccounts.map((maybeAccount) => {
|
|
8444
|
+
assertAccountExists(maybeAccount, "ExecutionContextV1");
|
|
8445
|
+
return deserializeExecutionContextV1(maybeAccount);
|
|
8446
|
+
});
|
|
8447
|
+
}
|
|
8448
|
+
async function safeFetchAllExecutionContextV1(context, publicKeys, options) {
|
|
8449
|
+
const maybeAccounts = await context.rpc.getAccounts(
|
|
8450
|
+
publicKeys.map((key) => publicKey(key, false)),
|
|
8451
|
+
options
|
|
8452
|
+
);
|
|
8453
|
+
return maybeAccounts.filter((maybeAccount) => maybeAccount.exists).map(
|
|
8454
|
+
(maybeAccount) => deserializeExecutionContextV1(maybeAccount)
|
|
8455
|
+
);
|
|
8456
|
+
}
|
|
8457
|
+
function getExecutionContextV1GpaBuilder(context) {
|
|
8458
|
+
const programId = context.programs.getPublicKey(
|
|
8459
|
+
"executor",
|
|
8460
|
+
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
8461
|
+
);
|
|
8462
|
+
return gpaBuilder(context, programId).registerFields({
|
|
8463
|
+
discriminator: [0, bytes({ size: 8 })],
|
|
8464
|
+
initialPayerBalance: [8, u64()],
|
|
8465
|
+
feeLimit: [16, u64()]
|
|
8466
|
+
}).deserializeUsing(
|
|
8467
|
+
(account) => deserializeExecutionContextV1(account)
|
|
8468
|
+
).whereField(
|
|
8469
|
+
"discriminator",
|
|
8470
|
+
new Uint8Array([132, 92, 176, 59, 141, 186, 141, 137])
|
|
8471
|
+
);
|
|
8472
|
+
}
|
|
8473
|
+
function getExecutionContextV1Size() {
|
|
8474
|
+
return 24;
|
|
8475
|
+
}
|
|
8384
8476
|
|
|
8385
8477
|
// src/generated/kinobi/executor/types/index.ts
|
|
8386
8478
|
var types_exports4 = {};
|
|
@@ -8393,7 +8485,6 @@ __export(types_exports4, {
|
|
|
8393
8485
|
getExecutionStateSerializer: () => getExecutionStateSerializer,
|
|
8394
8486
|
getLzComposeParamsSerializer: () => getLzComposeParamsSerializer,
|
|
8395
8487
|
getLzOptionSerializer: () => getLzOptionSerializer2,
|
|
8396
|
-
getLzReceiveParamsSerializer: () => getLzReceiveParamsSerializer,
|
|
8397
8488
|
getNativeDropRequestSerializer: () => getNativeDropRequestSerializer,
|
|
8398
8489
|
getOwnerSetConfigParamsSerializer: () => getOwnerSetConfigParamsSerializer,
|
|
8399
8490
|
isAdminSetConfigParams: () => isAdminSetConfigParams,
|
|
@@ -8485,19 +8576,6 @@ function getLzOptionSerializer2() {
|
|
|
8485
8576
|
{ description: "LzOption" }
|
|
8486
8577
|
);
|
|
8487
8578
|
}
|
|
8488
|
-
function getLzReceiveParamsSerializer() {
|
|
8489
|
-
return struct(
|
|
8490
|
-
[
|
|
8491
|
-
["srcEid", u32()],
|
|
8492
|
-
["sender", bytes({ size: 32 })],
|
|
8493
|
-
["nonce", u64()],
|
|
8494
|
-
["guid", bytes({ size: 32 })],
|
|
8495
|
-
["message", bytes({ size: u32() })],
|
|
8496
|
-
["extraData", bytes({ size: u32() })]
|
|
8497
|
-
],
|
|
8498
|
-
{ description: "LzReceiveParams" }
|
|
8499
|
-
);
|
|
8500
|
-
}
|
|
8501
8579
|
function getNativeDropRequestSerializer() {
|
|
8502
8580
|
return struct(
|
|
8503
8581
|
[
|
|
@@ -8594,17 +8672,17 @@ function deserializeExecutorConfig(rawAccount) {
|
|
|
8594
8672
|
getExecutorConfigAccountDataSerializer()
|
|
8595
8673
|
);
|
|
8596
8674
|
}
|
|
8597
|
-
async function fetchExecutorConfig(context,
|
|
8675
|
+
async function fetchExecutorConfig(context, publicKey16, options) {
|
|
8598
8676
|
const maybeAccount = await context.rpc.getAccount(
|
|
8599
|
-
publicKey(
|
|
8677
|
+
publicKey(publicKey16, false),
|
|
8600
8678
|
options
|
|
8601
8679
|
);
|
|
8602
8680
|
assertAccountExists(maybeAccount, "ExecutorConfig");
|
|
8603
8681
|
return deserializeExecutorConfig(maybeAccount);
|
|
8604
8682
|
}
|
|
8605
|
-
async function safeFetchExecutorConfig(context,
|
|
8683
|
+
async function safeFetchExecutorConfig(context, publicKey16, options) {
|
|
8606
8684
|
const maybeAccount = await context.rpc.getAccount(
|
|
8607
|
-
publicKey(
|
|
8685
|
+
publicKey(publicKey16, false),
|
|
8608
8686
|
options
|
|
8609
8687
|
);
|
|
8610
8688
|
return maybeAccount.exists ? deserializeExecutorConfig(maybeAccount) : null;
|
|
@@ -8672,17 +8750,17 @@ function getNonceAccountDataSerializer2() {
|
|
|
8672
8750
|
function deserializeNonce2(rawAccount) {
|
|
8673
8751
|
return deserializeAccount(rawAccount, getNonceAccountDataSerializer2());
|
|
8674
8752
|
}
|
|
8675
|
-
async function fetchNonce2(context,
|
|
8753
|
+
async function fetchNonce2(context, publicKey16, options) {
|
|
8676
8754
|
const maybeAccount = await context.rpc.getAccount(
|
|
8677
|
-
publicKey(
|
|
8755
|
+
publicKey(publicKey16, false),
|
|
8678
8756
|
options
|
|
8679
8757
|
);
|
|
8680
8758
|
assertAccountExists(maybeAccount, "Nonce");
|
|
8681
8759
|
return deserializeNonce2(maybeAccount);
|
|
8682
8760
|
}
|
|
8683
|
-
async function safeFetchNonce2(context,
|
|
8761
|
+
async function safeFetchNonce2(context, publicKey16, options) {
|
|
8684
8762
|
const maybeAccount = await context.rpc.getAccount(
|
|
8685
|
-
publicKey(
|
|
8763
|
+
publicKey(publicKey16, false),
|
|
8686
8764
|
options
|
|
8687
8765
|
);
|
|
8688
8766
|
return maybeAccount.exists ? deserializeNonce2(maybeAccount) : null;
|
|
@@ -8726,9 +8804,11 @@ function getNonceSize2() {
|
|
|
8726
8804
|
// src/generated/kinobi/executor/errors/index.ts
|
|
8727
8805
|
var errors_exports4 = {};
|
|
8728
8806
|
__export(errors_exports4, {
|
|
8807
|
+
ContextAccountAlreadyInitializedError: () => ContextAccountAlreadyInitializedError,
|
|
8729
8808
|
EidNotSupportedError: () => EidNotSupportedError2,
|
|
8730
8809
|
ExecutorIsAdminError: () => ExecutorIsAdminError,
|
|
8731
8810
|
InsufficientBalanceError: () => InsufficientBalanceError,
|
|
8811
|
+
InvalidInstructionSequenceError: () => InvalidInstructionSequenceError,
|
|
8732
8812
|
InvalidNativeDropReceiverError: () => InvalidNativeDropReceiverError,
|
|
8733
8813
|
InvalidNativeDropRequestsLengthError: () => InvalidNativeDropRequestsLengthError,
|
|
8734
8814
|
InvalidOwnerError: () => InvalidOwnerError,
|
|
@@ -8932,6 +9012,32 @@ var InvalidOwnerError = class extends ProgramError {
|
|
|
8932
9012
|
};
|
|
8933
9013
|
codeToErrorMap4.set(6017, InvalidOwnerError);
|
|
8934
9014
|
nameToErrorMap4.set("InvalidOwner", InvalidOwnerError);
|
|
9015
|
+
var InvalidInstructionSequenceError = class extends ProgramError {
|
|
9016
|
+
// 6018
|
|
9017
|
+
constructor(program, cause) {
|
|
9018
|
+
super("", program, cause);
|
|
9019
|
+
this.name = "InvalidInstructionSequence";
|
|
9020
|
+
this.code = 6018;
|
|
9021
|
+
}
|
|
9022
|
+
};
|
|
9023
|
+
codeToErrorMap4.set(6018, InvalidInstructionSequenceError);
|
|
9024
|
+
nameToErrorMap4.set(
|
|
9025
|
+
"InvalidInstructionSequence",
|
|
9026
|
+
InvalidInstructionSequenceError
|
|
9027
|
+
);
|
|
9028
|
+
var ContextAccountAlreadyInitializedError = class extends ProgramError {
|
|
9029
|
+
// 6019
|
|
9030
|
+
constructor(program, cause) {
|
|
9031
|
+
super("", program, cause);
|
|
9032
|
+
this.name = "ContextAccountAlreadyInitialized";
|
|
9033
|
+
this.code = 6019;
|
|
9034
|
+
}
|
|
9035
|
+
};
|
|
9036
|
+
codeToErrorMap4.set(6019, ContextAccountAlreadyInitializedError);
|
|
9037
|
+
nameToErrorMap4.set(
|
|
9038
|
+
"ContextAccountAlreadyInitialized",
|
|
9039
|
+
ContextAccountAlreadyInitializedError
|
|
9040
|
+
);
|
|
8935
9041
|
function getExecutorErrorFromCode(code, program, cause) {
|
|
8936
9042
|
const constructor = codeToErrorMap4.get(code);
|
|
8937
9043
|
return constructor ? new constructor(program, cause) : null;
|
|
@@ -8967,20 +9073,22 @@ __export(instructions_exports4, {
|
|
|
8967
9073
|
adminSetConfig: () => adminSetConfig,
|
|
8968
9074
|
compose: () => compose,
|
|
8969
9075
|
executable: () => executable,
|
|
8970
|
-
execute: () => execute,
|
|
8971
9076
|
extendExecutorConfig: () => extendExecutorConfig,
|
|
8972
9077
|
getAdminSetConfigInstructionDataSerializer: () => getAdminSetConfigInstructionDataSerializer,
|
|
8973
9078
|
getComposeInstructionDataSerializer: () => getComposeInstructionDataSerializer,
|
|
8974
9079
|
getExecutableInstructionDataSerializer: () => getExecutableInstructionDataSerializer,
|
|
8975
|
-
getExecuteInstructionDataSerializer: () => getExecuteInstructionDataSerializer,
|
|
8976
9080
|
getExtendExecutorConfigInstructionDataSerializer: () => getExtendExecutorConfigInstructionDataSerializer,
|
|
8977
9081
|
getInitExecutorInstructionDataSerializer: () => getInitExecutorInstructionDataSerializer,
|
|
8978
9082
|
getNativeDropInstructionDataSerializer: () => getNativeDropInstructionDataSerializer,
|
|
8979
9083
|
getOwnerSetConfigInstructionDataSerializer: () => getOwnerSetConfigInstructionDataSerializer,
|
|
9084
|
+
getPostExecuteInstructionDataSerializer: () => getPostExecuteInstructionDataSerializer,
|
|
9085
|
+
getPreExecuteInstructionDataSerializer: () => getPreExecuteInstructionDataSerializer,
|
|
8980
9086
|
getQuoteExecutorInstructionDataSerializer: () => getQuoteExecutorInstructionDataSerializer,
|
|
8981
9087
|
initExecutor: () => initExecutor,
|
|
8982
9088
|
nativeDrop: () => nativeDrop,
|
|
8983
9089
|
ownerSetConfig: () => ownerSetConfig,
|
|
9090
|
+
postExecute: () => postExecute,
|
|
9091
|
+
preExecute: () => preExecute,
|
|
8984
9092
|
quoteExecutor: () => quoteExecutor
|
|
8985
9093
|
});
|
|
8986
9094
|
function getAccountMetasAndSigners4(accounts, optionalAccountStrategy, programId) {
|
|
@@ -9176,78 +9284,6 @@ function executable(context, accounts, args) {
|
|
|
9176
9284
|
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9177
9285
|
]);
|
|
9178
9286
|
}
|
|
9179
|
-
function getExecuteInstructionDataSerializer() {
|
|
9180
|
-
return mapSerializer(
|
|
9181
|
-
struct(
|
|
9182
|
-
[
|
|
9183
|
-
["discriminator", bytes({ size: 8 })],
|
|
9184
|
-
["receiver", publicKey$1()],
|
|
9185
|
-
["lzReceive", getLzReceiveParamsSerializer()],
|
|
9186
|
-
["value", u64()],
|
|
9187
|
-
["computeUnits", u64()]
|
|
9188
|
-
],
|
|
9189
|
-
{ description: "ExecuteInstructionData" }
|
|
9190
|
-
),
|
|
9191
|
-
(value) => ({
|
|
9192
|
-
...value,
|
|
9193
|
-
discriminator: new Uint8Array([130, 221, 242, 154, 13, 193, 189, 29])
|
|
9194
|
-
})
|
|
9195
|
-
);
|
|
9196
|
-
}
|
|
9197
|
-
function execute(context, input) {
|
|
9198
|
-
const programId = context.programs.getPublicKey(
|
|
9199
|
-
"executor",
|
|
9200
|
-
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
9201
|
-
);
|
|
9202
|
-
const resolvedAccounts = {
|
|
9203
|
-
executor: {
|
|
9204
|
-
index: 0,
|
|
9205
|
-
isWritable: true,
|
|
9206
|
-
value: input.executor ?? null
|
|
9207
|
-
},
|
|
9208
|
-
config: {
|
|
9209
|
-
index: 1,
|
|
9210
|
-
isWritable: false,
|
|
9211
|
-
value: input.config ?? null
|
|
9212
|
-
},
|
|
9213
|
-
endpointProgram: {
|
|
9214
|
-
index: 2,
|
|
9215
|
-
isWritable: false,
|
|
9216
|
-
value: input.endpointProgram ?? null
|
|
9217
|
-
},
|
|
9218
|
-
endpointEventAuthority: {
|
|
9219
|
-
index: 3,
|
|
9220
|
-
isWritable: false,
|
|
9221
|
-
value: input.endpointEventAuthority ?? null
|
|
9222
|
-
},
|
|
9223
|
-
eventAuthority: {
|
|
9224
|
-
index: 4,
|
|
9225
|
-
isWritable: false,
|
|
9226
|
-
value: input.eventAuthority ?? null
|
|
9227
|
-
},
|
|
9228
|
-
program: {
|
|
9229
|
-
index: 5,
|
|
9230
|
-
isWritable: false,
|
|
9231
|
-
value: input.program ?? null
|
|
9232
|
-
}
|
|
9233
|
-
};
|
|
9234
|
-
const resolvedArgs = { ...input };
|
|
9235
|
-
const orderedAccounts = Object.values(
|
|
9236
|
-
resolvedAccounts
|
|
9237
|
-
).sort((a, b) => a.index - b.index);
|
|
9238
|
-
const [keys, signers] = getAccountMetasAndSigners4(
|
|
9239
|
-
orderedAccounts,
|
|
9240
|
-
"programId",
|
|
9241
|
-
programId
|
|
9242
|
-
);
|
|
9243
|
-
const data = getExecuteInstructionDataSerializer().serialize(
|
|
9244
|
-
resolvedArgs
|
|
9245
|
-
);
|
|
9246
|
-
const bytesCreatedOnChain = 0;
|
|
9247
|
-
return transactionBuilder([
|
|
9248
|
-
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9249
|
-
]);
|
|
9250
|
-
}
|
|
9251
9287
|
function getExtendExecutorConfigInstructionDataSerializer() {
|
|
9252
9288
|
return mapSerializer(
|
|
9253
9289
|
struct(
|
|
@@ -9496,6 +9532,137 @@ function ownerSetConfig(context, input) {
|
|
|
9496
9532
|
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9497
9533
|
]);
|
|
9498
9534
|
}
|
|
9535
|
+
function getPostExecuteInstructionDataSerializer() {
|
|
9536
|
+
return mapSerializer(
|
|
9537
|
+
struct(
|
|
9538
|
+
[
|
|
9539
|
+
["discriminator", bytes({ size: 8 })],
|
|
9540
|
+
["contextVersion", u8()]
|
|
9541
|
+
],
|
|
9542
|
+
{ description: "PostExecuteInstructionData" }
|
|
9543
|
+
),
|
|
9544
|
+
(value) => ({
|
|
9545
|
+
...value,
|
|
9546
|
+
discriminator: new Uint8Array([74, 168, 167, 167, 76, 220, 95, 56])
|
|
9547
|
+
})
|
|
9548
|
+
);
|
|
9549
|
+
}
|
|
9550
|
+
function postExecute(context, input) {
|
|
9551
|
+
const programId = context.programs.getPublicKey(
|
|
9552
|
+
"executor",
|
|
9553
|
+
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
9554
|
+
);
|
|
9555
|
+
const resolvedAccounts = {
|
|
9556
|
+
executor: {
|
|
9557
|
+
index: 0,
|
|
9558
|
+
isWritable: false,
|
|
9559
|
+
value: input.executor ?? null
|
|
9560
|
+
},
|
|
9561
|
+
context: {
|
|
9562
|
+
index: 1,
|
|
9563
|
+
isWritable: true,
|
|
9564
|
+
value: input.context ?? null
|
|
9565
|
+
},
|
|
9566
|
+
instructionSysvar: {
|
|
9567
|
+
index: 2,
|
|
9568
|
+
isWritable: false,
|
|
9569
|
+
value: input.instructionSysvar ?? null
|
|
9570
|
+
}
|
|
9571
|
+
};
|
|
9572
|
+
const resolvedArgs = { ...input };
|
|
9573
|
+
if (!resolvedAccounts.instructionSysvar.value) {
|
|
9574
|
+
resolvedAccounts.instructionSysvar.value = publicKey(
|
|
9575
|
+
"Sysvar1nstructions1111111111111111111111111"
|
|
9576
|
+
);
|
|
9577
|
+
}
|
|
9578
|
+
const orderedAccounts = Object.values(
|
|
9579
|
+
resolvedAccounts
|
|
9580
|
+
).sort((a, b) => a.index - b.index);
|
|
9581
|
+
const [keys, signers] = getAccountMetasAndSigners4(
|
|
9582
|
+
orderedAccounts,
|
|
9583
|
+
"programId",
|
|
9584
|
+
programId
|
|
9585
|
+
);
|
|
9586
|
+
const data = getPostExecuteInstructionDataSerializer().serialize(
|
|
9587
|
+
resolvedArgs
|
|
9588
|
+
);
|
|
9589
|
+
const bytesCreatedOnChain = 0;
|
|
9590
|
+
return transactionBuilder([
|
|
9591
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9592
|
+
]);
|
|
9593
|
+
}
|
|
9594
|
+
function getPreExecuteInstructionDataSerializer() {
|
|
9595
|
+
return mapSerializer(
|
|
9596
|
+
struct(
|
|
9597
|
+
[
|
|
9598
|
+
["discriminator", bytes({ size: 8 })],
|
|
9599
|
+
["contextVersion", u8()],
|
|
9600
|
+
["feeLimit", u64()]
|
|
9601
|
+
],
|
|
9602
|
+
{ description: "PreExecuteInstructionData" }
|
|
9603
|
+
),
|
|
9604
|
+
(value) => ({
|
|
9605
|
+
...value,
|
|
9606
|
+
discriminator: new Uint8Array([207, 125, 18, 148, 72, 192, 198, 83])
|
|
9607
|
+
})
|
|
9608
|
+
);
|
|
9609
|
+
}
|
|
9610
|
+
function preExecute(context, input) {
|
|
9611
|
+
const programId = context.programs.getPublicKey(
|
|
9612
|
+
"executor",
|
|
9613
|
+
"6doghB248px58JSSwG4qejQ46kFMW4AMj7vzJnWZHNZn"
|
|
9614
|
+
);
|
|
9615
|
+
const resolvedAccounts = {
|
|
9616
|
+
executor: {
|
|
9617
|
+
index: 0,
|
|
9618
|
+
isWritable: true,
|
|
9619
|
+
value: input.executor ?? null
|
|
9620
|
+
},
|
|
9621
|
+
context: {
|
|
9622
|
+
index: 1,
|
|
9623
|
+
isWritable: true,
|
|
9624
|
+
value: input.context ?? null
|
|
9625
|
+
},
|
|
9626
|
+
systemProgram: {
|
|
9627
|
+
index: 2,
|
|
9628
|
+
isWritable: false,
|
|
9629
|
+
value: input.systemProgram ?? null
|
|
9630
|
+
},
|
|
9631
|
+
instructionSysvar: {
|
|
9632
|
+
index: 3,
|
|
9633
|
+
isWritable: false,
|
|
9634
|
+
value: input.instructionSysvar ?? null
|
|
9635
|
+
}
|
|
9636
|
+
};
|
|
9637
|
+
const resolvedArgs = { ...input };
|
|
9638
|
+
if (!resolvedAccounts.systemProgram.value) {
|
|
9639
|
+
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
|
|
9640
|
+
"splSystem",
|
|
9641
|
+
"11111111111111111111111111111111"
|
|
9642
|
+
);
|
|
9643
|
+
resolvedAccounts.systemProgram.isWritable = false;
|
|
9644
|
+
}
|
|
9645
|
+
if (!resolvedAccounts.instructionSysvar.value) {
|
|
9646
|
+
resolvedAccounts.instructionSysvar.value = publicKey(
|
|
9647
|
+
"Sysvar1nstructions1111111111111111111111111"
|
|
9648
|
+
);
|
|
9649
|
+
}
|
|
9650
|
+
const orderedAccounts = Object.values(
|
|
9651
|
+
resolvedAccounts
|
|
9652
|
+
).sort((a, b) => a.index - b.index);
|
|
9653
|
+
const [keys, signers] = getAccountMetasAndSigners4(
|
|
9654
|
+
orderedAccounts,
|
|
9655
|
+
"programId",
|
|
9656
|
+
programId
|
|
9657
|
+
);
|
|
9658
|
+
const data = getPreExecuteInstructionDataSerializer().serialize(
|
|
9659
|
+
resolvedArgs
|
|
9660
|
+
);
|
|
9661
|
+
const bytesCreatedOnChain = 0;
|
|
9662
|
+
return transactionBuilder([
|
|
9663
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }
|
|
9664
|
+
]);
|
|
9665
|
+
}
|
|
9499
9666
|
function getQuoteExecutorInstructionDataSerializer() {
|
|
9500
9667
|
return mapSerializer(
|
|
9501
9668
|
struct(
|
|
@@ -9561,9 +9728,10 @@ var MSG_TYPE_OFFSET = 0;
|
|
|
9561
9728
|
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
9562
9729
|
MessageType2[MessageType2["VANILLA"] = 1] = "VANILLA";
|
|
9563
9730
|
MessageType2[MessageType2["COMPOSED_TYPE"] = 2] = "COMPOSED_TYPE";
|
|
9731
|
+
MessageType2[MessageType2["ABA"] = 3] = "ABA";
|
|
9564
9732
|
return MessageType2;
|
|
9565
9733
|
})(MessageType || {});
|
|
9566
|
-
function
|
|
9734
|
+
function getLzReceiveParamsSerializer() {
|
|
9567
9735
|
return struct(
|
|
9568
9736
|
[
|
|
9569
9737
|
["srcEid", u32()],
|
|
@@ -9608,6 +9776,72 @@ var ExecutorOptionType = /* @__PURE__ */ ((ExecutorOptionType2) => {
|
|
|
9608
9776
|
return ExecutorOptionType2;
|
|
9609
9777
|
})(ExecutorOptionType || {});
|
|
9610
9778
|
var MaxExecutorOptionTypeLength = 10;
|
|
9779
|
+
function getAddressLocatorSerializer() {
|
|
9780
|
+
return dataEnum(
|
|
9781
|
+
[
|
|
9782
|
+
[
|
|
9783
|
+
"Address",
|
|
9784
|
+
struct([["fields", tuple([publicKey$1()])]])
|
|
9785
|
+
],
|
|
9786
|
+
["AltIndex", struct([["fields", tuple([u8(), u8()])]])],
|
|
9787
|
+
["Payer", unit()],
|
|
9788
|
+
["Signer", struct([["fields", tuple([u8()])]])],
|
|
9789
|
+
["Context", unit()]
|
|
9790
|
+
],
|
|
9791
|
+
{ description: "AddressLocator" }
|
|
9792
|
+
);
|
|
9793
|
+
}
|
|
9794
|
+
function getLzReceiveTypesV2AccountsSerializer() {
|
|
9795
|
+
return struct([["accounts", array(publicKey$1())]], {
|
|
9796
|
+
description: "LzReceiveTypesV2Result"
|
|
9797
|
+
});
|
|
9798
|
+
}
|
|
9799
|
+
function getAccountMetaRefSerializer() {
|
|
9800
|
+
return struct(
|
|
9801
|
+
[
|
|
9802
|
+
["pubkey", getAddressLocatorSerializer()],
|
|
9803
|
+
["isWritable", bool()]
|
|
9804
|
+
],
|
|
9805
|
+
{ description: "AccountMetaRef" }
|
|
9806
|
+
);
|
|
9807
|
+
}
|
|
9808
|
+
function getInstructionSerializer() {
|
|
9809
|
+
return dataEnum(
|
|
9810
|
+
[
|
|
9811
|
+
[
|
|
9812
|
+
"LzReceive",
|
|
9813
|
+
struct([
|
|
9814
|
+
["accounts", array(getAccountMetaRefSerializer())]
|
|
9815
|
+
])
|
|
9816
|
+
],
|
|
9817
|
+
[
|
|
9818
|
+
"Standard",
|
|
9819
|
+
struct([
|
|
9820
|
+
["programId", publicKey$1()],
|
|
9821
|
+
["accounts", array(getAccountMetaRefSerializer())],
|
|
9822
|
+
["data", bytes({ size: u32() })]
|
|
9823
|
+
])
|
|
9824
|
+
]
|
|
9825
|
+
],
|
|
9826
|
+
{ description: "Instruction" }
|
|
9827
|
+
);
|
|
9828
|
+
}
|
|
9829
|
+
function getLzReceiveTypesV2ResultSerializer() {
|
|
9830
|
+
return struct(
|
|
9831
|
+
[
|
|
9832
|
+
["contextVersion", u8()],
|
|
9833
|
+
["alts", array(publicKey$1())],
|
|
9834
|
+
["instructions", array(getInstructionSerializer())]
|
|
9835
|
+
],
|
|
9836
|
+
{ description: "LzReceiveTypesV2Result" }
|
|
9837
|
+
);
|
|
9838
|
+
}
|
|
9839
|
+
function addressLocator(kind, data) {
|
|
9840
|
+
return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...data ?? {} };
|
|
9841
|
+
}
|
|
9842
|
+
function isAddressLocator(kind, value) {
|
|
9843
|
+
return value.__kind === kind;
|
|
9844
|
+
}
|
|
9611
9845
|
|
|
9612
9846
|
// src/generated/kinobi/uln/events/index.ts
|
|
9613
9847
|
var events_exports4 = {};
|
|
@@ -10126,29 +10360,269 @@ function toWeb3Connection(rpc) {
|
|
|
10126
10360
|
}
|
|
10127
10361
|
}
|
|
10128
10362
|
|
|
10363
|
+
// src/receive-types-v1.ts
|
|
10364
|
+
async function getLzReceiveAccountsFromTypesV1(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
|
|
10365
|
+
const oappPDA = new OmniAppPDA(receiverProgram);
|
|
10366
|
+
const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
|
|
10367
|
+
const info = await rpc.getAccount(lzReceiveTypesAccountsPDA, { commitment });
|
|
10368
|
+
const accounts = [];
|
|
10369
|
+
if (info.exists) {
|
|
10370
|
+
const buffer = Buffer.from(info.data);
|
|
10371
|
+
const len = buffer.length - 8;
|
|
10372
|
+
if (len % 32 !== 0) {
|
|
10373
|
+
throw new Error(
|
|
10374
|
+
`Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
|
|
10375
|
+
);
|
|
10376
|
+
}
|
|
10377
|
+
for (let i = 8; i < len; i += 32) {
|
|
10378
|
+
const [address] = publicKey$1().deserialize(buffer, i);
|
|
10379
|
+
accounts.push({
|
|
10380
|
+
pubkey: address,
|
|
10381
|
+
isSigner: false,
|
|
10382
|
+
isWritable: false
|
|
10383
|
+
});
|
|
10384
|
+
}
|
|
10385
|
+
}
|
|
10386
|
+
const data = getLzReceiveParamsSerializer().serialize(params);
|
|
10387
|
+
const lzReceiveTypesIx = {
|
|
10388
|
+
programId: receiverProgram,
|
|
10389
|
+
keys: accounts,
|
|
10390
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive_types"), data])
|
|
10391
|
+
};
|
|
10392
|
+
const keys = await simulateWeb3JsTransaction(
|
|
10393
|
+
rpc.getEndpoint(),
|
|
10394
|
+
[toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10395
|
+
toWeb3JsPublicKey(receiverProgram),
|
|
10396
|
+
toWeb3JsPublicKey(payer),
|
|
10397
|
+
array(getLzReceiveAccountSerializer()),
|
|
10398
|
+
commitment
|
|
10399
|
+
);
|
|
10400
|
+
return updateAccountFromSimulatedResp(keys, payer);
|
|
10401
|
+
}
|
|
10402
|
+
function updateAccountFromSimulatedResp(accounts, payer) {
|
|
10403
|
+
return accounts.map((r) => {
|
|
10404
|
+
if (r.pubkey == defaultPublicKey() && r.isSigner) {
|
|
10405
|
+
if (!payer) throw new Error("payer is required");
|
|
10406
|
+
return {
|
|
10407
|
+
pubkey: payer,
|
|
10408
|
+
isSigner: true,
|
|
10409
|
+
isWritable: r.isWritable
|
|
10410
|
+
};
|
|
10411
|
+
} else {
|
|
10412
|
+
return {
|
|
10413
|
+
pubkey: r.pubkey,
|
|
10414
|
+
isSigner: r.isSigner,
|
|
10415
|
+
isWritable: r.isWritable
|
|
10416
|
+
};
|
|
10417
|
+
}
|
|
10418
|
+
});
|
|
10419
|
+
}
|
|
10420
|
+
async function buildLzReceiveExecutionPlan(rpc, executorProgram, payer, receiver, receiverProgram, params, receiveTypesAccounts, commitment = "confirmed") {
|
|
10421
|
+
receiveTypesAccounts = receiveTypesAccounts ?? await getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, params, commitment);
|
|
10422
|
+
const data = getLzReceiveParamsSerializer().serialize(params);
|
|
10423
|
+
const lzReceiveTypesIx = {
|
|
10424
|
+
programId: receiverProgram,
|
|
10425
|
+
keys: receiveTypesAccounts.accounts.map((pubkey) => {
|
|
10426
|
+
return {
|
|
10427
|
+
pubkey,
|
|
10428
|
+
isSigner: false,
|
|
10429
|
+
isWritable: false
|
|
10430
|
+
};
|
|
10431
|
+
}),
|
|
10432
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive_types_v2"), data])
|
|
10433
|
+
};
|
|
10434
|
+
const resp = await simulateWeb3JsTransaction(
|
|
10435
|
+
rpc.getEndpoint(),
|
|
10436
|
+
[toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10437
|
+
toWeb3JsPublicKey(receiverProgram),
|
|
10438
|
+
toWeb3JsPublicKey(payer),
|
|
10439
|
+
getLzReceiveTypesV2ResultSerializer(),
|
|
10440
|
+
commitment
|
|
10441
|
+
);
|
|
10442
|
+
const tables = await fetchAllAddressLookupTable({ rpc }, resp.alts);
|
|
10443
|
+
const signers = {};
|
|
10444
|
+
const lzReceiveDiscriminator = instructionDiscriminator("lz_receive").toString("hex");
|
|
10445
|
+
const instructionTracker = {};
|
|
10446
|
+
for (const ix of resp.instructions) {
|
|
10447
|
+
let programId = receiverProgram;
|
|
10448
|
+
let instructionType = "lz_receive";
|
|
10449
|
+
if (ix.__kind === "Standard") {
|
|
10450
|
+
const { programId: stdProgramId, data: data2 } = ix;
|
|
10451
|
+
programId = stdProgramId;
|
|
10452
|
+
const discriminator = Buffer.from(data2.slice(0, 8)).toString("hex");
|
|
10453
|
+
instructionType = discriminator === lzReceiveDiscriminator ? "lz_receive" : discriminator;
|
|
10454
|
+
}
|
|
10455
|
+
const key = `${programId}-${instructionType}`;
|
|
10456
|
+
if (instructionTracker[key]) {
|
|
10457
|
+
throw new Error(`Duplicate instruction found: ${instructionType} for program ${programId}`);
|
|
10458
|
+
}
|
|
10459
|
+
instructionTracker[key] = true;
|
|
10460
|
+
}
|
|
10461
|
+
const { contextVersion } = resp;
|
|
10462
|
+
const instructions = resp.instructions.map((ix) => {
|
|
10463
|
+
if (ix.__kind === "LzReceive") {
|
|
10464
|
+
return {
|
|
10465
|
+
programId: receiverProgram,
|
|
10466
|
+
keys: ix.accounts.map(
|
|
10467
|
+
(account) => accountMetaRefToAccountMeta(
|
|
10468
|
+
{ eddsa: EDDSA },
|
|
10469
|
+
executorProgram,
|
|
10470
|
+
tables,
|
|
10471
|
+
signers,
|
|
10472
|
+
account,
|
|
10473
|
+
payer,
|
|
10474
|
+
contextVersion
|
|
10475
|
+
)
|
|
10476
|
+
),
|
|
10477
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive"), data])
|
|
10478
|
+
};
|
|
10479
|
+
} else {
|
|
10480
|
+
return {
|
|
10481
|
+
programId: ix.programId,
|
|
10482
|
+
keys: ix.accounts.map(
|
|
10483
|
+
(account) => accountMetaRefToAccountMeta(
|
|
10484
|
+
{ eddsa: EDDSA },
|
|
10485
|
+
executorProgram,
|
|
10486
|
+
tables,
|
|
10487
|
+
signers,
|
|
10488
|
+
account,
|
|
10489
|
+
payer,
|
|
10490
|
+
contextVersion
|
|
10491
|
+
)
|
|
10492
|
+
),
|
|
10493
|
+
data: ix.data
|
|
10494
|
+
};
|
|
10495
|
+
}
|
|
10496
|
+
});
|
|
10497
|
+
return {
|
|
10498
|
+
contextVersion,
|
|
10499
|
+
signers: Object.values(signers).filter((signer) => signer !== void 0),
|
|
10500
|
+
instructions
|
|
10501
|
+
};
|
|
10502
|
+
}
|
|
10503
|
+
async function getLzReceiveTypesInfo(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
|
|
10504
|
+
const oappPDA = new OmniAppPDA(receiverProgram);
|
|
10505
|
+
const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
|
|
10506
|
+
const lzReceiveTypesIx = {
|
|
10507
|
+
programId: receiverProgram,
|
|
10508
|
+
keys: [
|
|
10509
|
+
{
|
|
10510
|
+
pubkey: receiver,
|
|
10511
|
+
isSigner: false,
|
|
10512
|
+
isWritable: false
|
|
10513
|
+
},
|
|
10514
|
+
{
|
|
10515
|
+
pubkey: lzReceiveTypesAccountsPDA,
|
|
10516
|
+
isSigner: false,
|
|
10517
|
+
isWritable: false
|
|
10518
|
+
}
|
|
10519
|
+
],
|
|
10520
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive_types_info")])
|
|
10521
|
+
};
|
|
10522
|
+
const resp = await simulateWeb3JsTransaction(
|
|
10523
|
+
rpc.getEndpoint(),
|
|
10524
|
+
[toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10525
|
+
toWeb3JsPublicKey(receiverProgram),
|
|
10526
|
+
toWeb3JsPublicKey(payer),
|
|
10527
|
+
bytes(),
|
|
10528
|
+
commitment
|
|
10529
|
+
);
|
|
10530
|
+
const version4 = resp.at(0);
|
|
10531
|
+
if (version4 !== 2) {
|
|
10532
|
+
throw new Error(`Invalid version ${version4}. Expected version 2.`);
|
|
10533
|
+
}
|
|
10534
|
+
return getLzReceiveTypesV2AccountsSerializer().deserialize(resp, 1)[0];
|
|
10535
|
+
}
|
|
10536
|
+
function accountMetaRefToAccountMeta(umi, executorProgram, tables, signers, accountMetaRef, payer, contextVersion) {
|
|
10537
|
+
const { isWritable, pubkey: locator } = accountMetaRef;
|
|
10538
|
+
const pubkey = addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion);
|
|
10539
|
+
return { pubkey, isSigner: locator.__kind === "Signer" || locator.__kind === "Payer", isWritable };
|
|
10540
|
+
}
|
|
10541
|
+
function addressLocatorToPublicKey(umi, executorProgram, tables, signers, locator, payer, contextVersion) {
|
|
10542
|
+
if (locator.__kind === "Payer") {
|
|
10543
|
+
return payer;
|
|
10544
|
+
} else if (locator.__kind === "Signer") {
|
|
10545
|
+
const index = locator.fields[0];
|
|
10546
|
+
let signer = signers[index];
|
|
10547
|
+
if (signer === void 0) {
|
|
10548
|
+
signer = generateSigner(umi);
|
|
10549
|
+
signers[index] = signer;
|
|
10550
|
+
}
|
|
10551
|
+
return signer.publicKey;
|
|
10552
|
+
} else if (locator.__kind === "Address") {
|
|
10553
|
+
return locator.fields[0];
|
|
10554
|
+
} else if (locator.__kind === "Context") {
|
|
10555
|
+
const pda = new ExecutorPDA(executorProgram);
|
|
10556
|
+
return pda.context(payer, contextVersion)[0];
|
|
10557
|
+
} else {
|
|
10558
|
+
const table = tables[locator.fields[0]];
|
|
10559
|
+
return table.addresses[locator.fields[1]];
|
|
10560
|
+
}
|
|
10561
|
+
}
|
|
10562
|
+
|
|
10129
10563
|
// src/receive.ts
|
|
10130
|
-
async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0, 0]), commitment = "confirmed") {
|
|
10131
|
-
const { message: message_, sender, srcEid, guid, receiver: receiver_ } = packet;
|
|
10132
|
-
const
|
|
10564
|
+
async function lzReceive(rpc, payer, packet, callerParams = Uint8Array.from([0, 0]), executorProgram = EXECUTOR_PROGRAM_ID, commitment = "confirmed") {
|
|
10565
|
+
const { message: message_, sender: sender_, srcEid, guid, receiver: receiver_, nonce } = packet;
|
|
10566
|
+
const sender = arrayify(sender_);
|
|
10567
|
+
const receiverBytes = addressToBytes32(receiver_);
|
|
10133
10568
|
const message = arrayify(message_);
|
|
10134
10569
|
const params = {
|
|
10135
10570
|
srcEid,
|
|
10136
|
-
sender
|
|
10571
|
+
sender,
|
|
10137
10572
|
guid: arrayify(guid),
|
|
10138
10573
|
message,
|
|
10139
10574
|
callerParams,
|
|
10140
|
-
nonce: BigInt(
|
|
10575
|
+
nonce: BigInt(nonce)
|
|
10141
10576
|
};
|
|
10142
|
-
const
|
|
10143
|
-
|
|
10577
|
+
const receiverPubkey = publicKey(receiverBytes);
|
|
10578
|
+
const receiverInfo = await rpc.getAccount(receiverPubkey, { commitment });
|
|
10579
|
+
invariant3(receiverInfo.exists, `Receiver account not found: ${receiverPubkey}`);
|
|
10144
10580
|
const receiverProgram = publicKey(receiverInfo.owner);
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10581
|
+
let version4 = 1;
|
|
10582
|
+
let receiveTypesAccounts;
|
|
10583
|
+
try {
|
|
10584
|
+
receiveTypesAccounts = await getLzReceiveTypesInfo(
|
|
10585
|
+
rpc,
|
|
10586
|
+
payer,
|
|
10587
|
+
receiverPubkey,
|
|
10588
|
+
receiverProgram,
|
|
10589
|
+
params,
|
|
10590
|
+
commitment
|
|
10591
|
+
);
|
|
10592
|
+
version4 = 2;
|
|
10593
|
+
} catch (e) {
|
|
10594
|
+
version4 = 1;
|
|
10595
|
+
}
|
|
10596
|
+
if (version4 === 2) {
|
|
10597
|
+
return buildLzReceiveExecutionPlan(
|
|
10598
|
+
rpc,
|
|
10599
|
+
executorProgram,
|
|
10600
|
+
payer,
|
|
10601
|
+
receiverPubkey,
|
|
10602
|
+
receiverProgram,
|
|
10603
|
+
params,
|
|
10604
|
+
receiveTypesAccounts,
|
|
10605
|
+
commitment
|
|
10606
|
+
);
|
|
10607
|
+
} else {
|
|
10608
|
+
const accounts = await getLzReceiveAccountsFromTypesV1(
|
|
10609
|
+
rpc,
|
|
10610
|
+
payer,
|
|
10611
|
+
receiverPubkey,
|
|
10612
|
+
receiverProgram,
|
|
10613
|
+
params,
|
|
10614
|
+
commitment
|
|
10615
|
+
);
|
|
10616
|
+
const data = getLzReceiveParamsSerializer().serialize(params);
|
|
10617
|
+
return {
|
|
10618
|
+
instruction: {
|
|
10619
|
+
programId: receiverProgram,
|
|
10620
|
+
keys: accounts,
|
|
10621
|
+
data: Buffer.concat([instructionDiscriminator("lz_receive"), data])
|
|
10622
|
+
},
|
|
10623
|
+
contextVersion: 1
|
|
10624
|
+
};
|
|
10625
|
+
}
|
|
10152
10626
|
}
|
|
10153
10627
|
async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]), commitment = "confirmed") {
|
|
10154
10628
|
const { to, from, guid, index, message } = event;
|
|
@@ -10173,47 +10647,6 @@ async function lzCompose(rpc, payer, event, extraData = Uint8Array.from([0, 0]),
|
|
|
10173
10647
|
data: Buffer.concat([instructionDiscriminator("lz_compose"), data])
|
|
10174
10648
|
};
|
|
10175
10649
|
}
|
|
10176
|
-
async function getLzReceiveAccounts(rpc, payer, receiver, receiverProgram, params, commitment = "confirmed") {
|
|
10177
|
-
const lzReceiveTypesAccounts = await (async () => {
|
|
10178
|
-
const oappPDA = new OmniAppPDA(receiverProgram);
|
|
10179
|
-
const [lzReceiveTypesAccountsPDA] = oappPDA.lzReceiveTypesAccounts(receiver);
|
|
10180
|
-
const info = await rpc.getAccount(lzReceiveTypesAccountsPDA, { commitment });
|
|
10181
|
-
const accounts = [];
|
|
10182
|
-
if (info.exists) {
|
|
10183
|
-
const buffer = Buffer.from(info.data);
|
|
10184
|
-
const len = buffer.length - 8;
|
|
10185
|
-
if (len % 32 !== 0) {
|
|
10186
|
-
throw new Error(
|
|
10187
|
-
`Invalid length of AccountInfo.data. The length must be a multiple of 32 plus 8.(n*32+8). Current length is ${buffer.length}`
|
|
10188
|
-
);
|
|
10189
|
-
}
|
|
10190
|
-
for (let i = 8; i < len; i += 32) {
|
|
10191
|
-
const [address] = publicKey$1().deserialize(buffer, i);
|
|
10192
|
-
accounts.push({
|
|
10193
|
-
pubkey: address,
|
|
10194
|
-
isSigner: false,
|
|
10195
|
-
isWritable: false
|
|
10196
|
-
});
|
|
10197
|
-
}
|
|
10198
|
-
}
|
|
10199
|
-
return accounts;
|
|
10200
|
-
})();
|
|
10201
|
-
const data = getLzReceiveParamsSerializer2().serialize(params);
|
|
10202
|
-
const lzReceiveTypesIx = {
|
|
10203
|
-
programId: receiverProgram,
|
|
10204
|
-
keys: lzReceiveTypesAccounts,
|
|
10205
|
-
data: Buffer.concat([instructionDiscriminator("lz_receive_types"), data])
|
|
10206
|
-
};
|
|
10207
|
-
const keys = await simulateWeb3JsTransaction(
|
|
10208
|
-
rpc.getEndpoint(),
|
|
10209
|
-
[toWeb3JsInstruction(lzReceiveTypesIx)],
|
|
10210
|
-
toWeb3JsPublicKey(receiverProgram),
|
|
10211
|
-
toWeb3JsPublicKey(payer),
|
|
10212
|
-
array(getLzReceiveAccountSerializer()),
|
|
10213
|
-
"confirmed"
|
|
10214
|
-
);
|
|
10215
|
-
return updateAccountFromSimulatedResp(keys, payer);
|
|
10216
|
-
}
|
|
10217
10650
|
async function getLzComposeAccountMeta(rpc, payer, to, composerProgram, params, commitment = "confirmed") {
|
|
10218
10651
|
const lzComposeTypesAccounts = await (async () => {
|
|
10219
10652
|
const oappPDA = new OmniAppPDA(composerProgram);
|
|
@@ -10253,9 +10686,9 @@ async function getLzComposeAccountMeta(rpc, payer, to, composerProgram, params,
|
|
|
10253
10686
|
array(getLzReceiveAccountSerializer()),
|
|
10254
10687
|
"confirmed"
|
|
10255
10688
|
);
|
|
10256
|
-
return
|
|
10689
|
+
return updateAccountFromSimulatedResp2(keys, payer);
|
|
10257
10690
|
}
|
|
10258
|
-
function
|
|
10691
|
+
function updateAccountFromSimulatedResp2(accounts, payer) {
|
|
10259
10692
|
return accounts.map((r) => {
|
|
10260
10693
|
if (r.pubkey == defaultPublicKey() && r.isSigner) {
|
|
10261
10694
|
if (!payer) throw new Error("payer is required");
|
|
@@ -10515,61 +10948,20 @@ var Executor = class {
|
|
|
10515
10948
|
].concat(ixAccounts);
|
|
10516
10949
|
}
|
|
10517
10950
|
async execute(rpc, executor, param, commitment = "confirmed") {
|
|
10518
|
-
const { packet, extraData, value = 0n
|
|
10519
|
-
const
|
|
10520
|
-
const
|
|
10521
|
-
const {
|
|
10522
|
-
const
|
|
10523
|
-
const
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
{
|
|
10533
|
-
srcEid,
|
|
10534
|
-
sender: arrayify(sender),
|
|
10535
|
-
guid: arrayify(guid),
|
|
10536
|
-
message,
|
|
10537
|
-
callerParams: extraData,
|
|
10538
|
-
nonce: BigInt(packet.nonce)
|
|
10539
|
-
},
|
|
10540
|
-
commitment
|
|
10541
|
-
);
|
|
10542
|
-
const txBuilder = execute(
|
|
10543
|
-
{ programs: this.programRepo },
|
|
10544
|
-
{
|
|
10545
|
-
executor,
|
|
10546
|
-
config: this.pda.config(),
|
|
10547
|
-
endpointProgram,
|
|
10548
|
-
endpointEventAuthority: endpointEventPDA.eventAuthority()[0],
|
|
10549
|
-
program: this.programId,
|
|
10550
|
-
eventAuthority: executorEventPDA.eventAuthority()[0],
|
|
10551
|
-
// param
|
|
10552
|
-
receiver,
|
|
10553
|
-
lzReceive: {
|
|
10554
|
-
srcEid,
|
|
10555
|
-
sender: arrayify(sender),
|
|
10556
|
-
nonce: parseInt(nonce),
|
|
10557
|
-
guid: arrayify(guid),
|
|
10558
|
-
message,
|
|
10559
|
-
extraData
|
|
10560
|
-
},
|
|
10561
|
-
value,
|
|
10562
|
-
computeUnits
|
|
10563
|
-
}
|
|
10564
|
-
);
|
|
10565
|
-
return txBuilder.addRemainingAccounts([
|
|
10566
|
-
{
|
|
10567
|
-
pubkey: receiverProgram,
|
|
10568
|
-
isWritable: false,
|
|
10569
|
-
isSigner: false
|
|
10570
|
-
},
|
|
10571
|
-
...accounts
|
|
10572
|
-
]).items[0];
|
|
10951
|
+
const { packet, extraData, value = 0n } = param;
|
|
10952
|
+
const payer = executor.publicKey;
|
|
10953
|
+
const lzReceiveResult = await lzReceive(rpc, payer, packet, extraData, this.programId, commitment);
|
|
10954
|
+
const { contextVersion } = lzReceiveResult;
|
|
10955
|
+
const instructions = [this.preExecute(executor, contextVersion, value).instruction];
|
|
10956
|
+
const signers = [];
|
|
10957
|
+
if ("instruction" in lzReceiveResult) {
|
|
10958
|
+
instructions.push(lzReceiveResult.instruction);
|
|
10959
|
+
} else {
|
|
10960
|
+
instructions.push(...lzReceiveResult.instructions);
|
|
10961
|
+
signers.push(...lzReceiveResult.signers);
|
|
10962
|
+
}
|
|
10963
|
+
instructions.push(this.postExecute(executor, contextVersion).instruction);
|
|
10964
|
+
return { signers, instructions };
|
|
10573
10965
|
}
|
|
10574
10966
|
async compose(rpc, executor, param, commitment = "confirmed") {
|
|
10575
10967
|
const { event, extraData, value = 0n, computeUnits = 4e5, endpointProgram = ENDPOINT_PROGRAM_ID } = param;
|
|
@@ -10625,6 +11017,17 @@ var Executor = class {
|
|
|
10625
11017
|
...accounts
|
|
10626
11018
|
]).items[0];
|
|
10627
11019
|
}
|
|
11020
|
+
preExecute(executor, version4, feeLimit) {
|
|
11021
|
+
const context = this.pda.context(executor.publicKey, version4);
|
|
11022
|
+
return preExecute(
|
|
11023
|
+
{ programs: this.programRepo },
|
|
11024
|
+
{ executor, context, feeLimit, contextVersion: version4 }
|
|
11025
|
+
).items[0];
|
|
11026
|
+
}
|
|
11027
|
+
postExecute(executor, version4) {
|
|
11028
|
+
const context = this.pda.context(executor.publicKey, version4);
|
|
11029
|
+
return postExecute({ programs: this.programRepo }, { context, executor, contextVersion: version4 }).items[0];
|
|
11030
|
+
}
|
|
10628
11031
|
};
|
|
10629
11032
|
|
|
10630
11033
|
// src/generated/kinobi/uln/accounts/index.ts
|
|
@@ -10681,17 +11084,17 @@ function deserializeConfirmations(rawAccount) {
|
|
|
10681
11084
|
getConfirmationsAccountDataSerializer()
|
|
10682
11085
|
);
|
|
10683
11086
|
}
|
|
10684
|
-
async function fetchConfirmations(context,
|
|
11087
|
+
async function fetchConfirmations(context, publicKey16, options) {
|
|
10685
11088
|
const maybeAccount = await context.rpc.getAccount(
|
|
10686
|
-
publicKey(
|
|
11089
|
+
publicKey(publicKey16, false),
|
|
10687
11090
|
options
|
|
10688
11091
|
);
|
|
10689
11092
|
assertAccountExists(maybeAccount, "Confirmations");
|
|
10690
11093
|
return deserializeConfirmations(maybeAccount);
|
|
10691
11094
|
}
|
|
10692
|
-
async function safeFetchConfirmations(context,
|
|
11095
|
+
async function safeFetchConfirmations(context, publicKey16, options) {
|
|
10693
11096
|
const maybeAccount = await context.rpc.getAccount(
|
|
10694
|
-
publicKey(
|
|
11097
|
+
publicKey(publicKey16, false),
|
|
10695
11098
|
options
|
|
10696
11099
|
);
|
|
10697
11100
|
return maybeAccount.exists ? deserializeConfirmations(maybeAccount) : null;
|
|
@@ -10753,17 +11156,17 @@ function deserializeReceiveConfig2(rawAccount) {
|
|
|
10753
11156
|
getReceiveConfigAccountDataSerializer2()
|
|
10754
11157
|
);
|
|
10755
11158
|
}
|
|
10756
|
-
async function fetchReceiveConfig2(context,
|
|
11159
|
+
async function fetchReceiveConfig2(context, publicKey16, options) {
|
|
10757
11160
|
const maybeAccount = await context.rpc.getAccount(
|
|
10758
|
-
publicKey(
|
|
11161
|
+
publicKey(publicKey16, false),
|
|
10759
11162
|
options
|
|
10760
11163
|
);
|
|
10761
11164
|
assertAccountExists(maybeAccount, "ReceiveConfig");
|
|
10762
11165
|
return deserializeReceiveConfig2(maybeAccount);
|
|
10763
11166
|
}
|
|
10764
|
-
async function safeFetchReceiveConfig2(context,
|
|
11167
|
+
async function safeFetchReceiveConfig2(context, publicKey16, options) {
|
|
10765
11168
|
const maybeAccount = await context.rpc.getAccount(
|
|
10766
|
-
publicKey(
|
|
11169
|
+
publicKey(publicKey16, false),
|
|
10767
11170
|
options
|
|
10768
11171
|
);
|
|
10769
11172
|
return maybeAccount.exists ? deserializeReceiveConfig2(maybeAccount) : null;
|
|
@@ -10823,17 +11226,17 @@ function getSendConfigAccountDataSerializer() {
|
|
|
10823
11226
|
function deserializeSendConfig(rawAccount) {
|
|
10824
11227
|
return deserializeAccount(rawAccount, getSendConfigAccountDataSerializer());
|
|
10825
11228
|
}
|
|
10826
|
-
async function fetchSendConfig(context,
|
|
11229
|
+
async function fetchSendConfig(context, publicKey16, options) {
|
|
10827
11230
|
const maybeAccount = await context.rpc.getAccount(
|
|
10828
|
-
publicKey(
|
|
11231
|
+
publicKey(publicKey16, false),
|
|
10829
11232
|
options
|
|
10830
11233
|
);
|
|
10831
11234
|
assertAccountExists(maybeAccount, "SendConfig");
|
|
10832
11235
|
return deserializeSendConfig(maybeAccount);
|
|
10833
11236
|
}
|
|
10834
|
-
async function safeFetchSendConfig(context,
|
|
11237
|
+
async function safeFetchSendConfig(context, publicKey16, options) {
|
|
10835
11238
|
const maybeAccount = await context.rpc.getAccount(
|
|
10836
|
-
publicKey(
|
|
11239
|
+
publicKey(publicKey16, false),
|
|
10837
11240
|
options
|
|
10838
11241
|
);
|
|
10839
11242
|
return maybeAccount.exists ? deserializeSendConfig(maybeAccount) : null;
|
|
@@ -10893,17 +11296,17 @@ function getUlnSettingsAccountDataSerializer() {
|
|
|
10893
11296
|
function deserializeUlnSettings(rawAccount) {
|
|
10894
11297
|
return deserializeAccount(rawAccount, getUlnSettingsAccountDataSerializer());
|
|
10895
11298
|
}
|
|
10896
|
-
async function fetchUlnSettings(context,
|
|
11299
|
+
async function fetchUlnSettings(context, publicKey16, options) {
|
|
10897
11300
|
const maybeAccount = await context.rpc.getAccount(
|
|
10898
|
-
publicKey(
|
|
11301
|
+
publicKey(publicKey16, false),
|
|
10899
11302
|
options
|
|
10900
11303
|
);
|
|
10901
11304
|
assertAccountExists(maybeAccount, "UlnSettings");
|
|
10902
11305
|
return deserializeUlnSettings(maybeAccount);
|
|
10903
11306
|
}
|
|
10904
|
-
async function safeFetchUlnSettings(context,
|
|
11307
|
+
async function safeFetchUlnSettings(context, publicKey16, options) {
|
|
10905
11308
|
const maybeAccount = await context.rpc.getAccount(
|
|
10906
|
-
publicKey(
|
|
11309
|
+
publicKey(publicKey16, false),
|
|
10907
11310
|
options
|
|
10908
11311
|
);
|
|
10909
11312
|
return maybeAccount.exists ? deserializeUlnSettings(maybeAccount) : null;
|
|
@@ -13313,17 +13716,17 @@ function getPriceFeedAccountDataSerializer() {
|
|
|
13313
13716
|
function deserializePriceFeed(rawAccount) {
|
|
13314
13717
|
return deserializeAccount(rawAccount, getPriceFeedAccountDataSerializer());
|
|
13315
13718
|
}
|
|
13316
|
-
async function fetchPriceFeed(context,
|
|
13719
|
+
async function fetchPriceFeed(context, publicKey16, options) {
|
|
13317
13720
|
const maybeAccount = await context.rpc.getAccount(
|
|
13318
|
-
publicKey(
|
|
13721
|
+
publicKey(publicKey16, false),
|
|
13319
13722
|
options
|
|
13320
13723
|
);
|
|
13321
13724
|
assertAccountExists(maybeAccount, "PriceFeed");
|
|
13322
13725
|
return deserializePriceFeed(maybeAccount);
|
|
13323
13726
|
}
|
|
13324
|
-
async function safeFetchPriceFeed(context,
|
|
13727
|
+
async function safeFetchPriceFeed(context, publicKey16, options) {
|
|
13325
13728
|
const maybeAccount = await context.rpc.getAccount(
|
|
13326
|
-
publicKey(
|
|
13729
|
+
publicKey(publicKey16, false),
|
|
13327
13730
|
options
|
|
13328
13731
|
);
|
|
13329
13732
|
return maybeAccount.exists ? deserializePriceFeed(maybeAccount) : null;
|
|
@@ -14625,6 +15028,6 @@ var SetConfigType2 = /* @__PURE__ */ ((SetConfigType3) => {
|
|
|
14625
15028
|
return SetConfigType3;
|
|
14626
15029
|
})(SetConfigType2 || {});
|
|
14627
15030
|
|
|
14628
|
-
export { blocked_messagelib_exports as BlockedMessageLibProgram, dvn_exports2 as DVNProgram, DvnPDA, dvn_exports as DvnProgram, EDDSA, ENFORCED_OPTIONS_SEED, EndpointPDA, endpoint_exports as EndpointProgram, EventPDA, ExecutorOptionType, ExecutorPDA, executor_exports as ExecutorProgram, FAUCET_URL, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDA, MessageType, OmniAppPDA, PEER_SEED, PriceFeedPDA, pricefeed_exports as PriceFeedProgram, SendHelper, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, UlnPDA, uln_exports as UlnProgram, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractPacketSentEventByTxHash, extractReceivedPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getLzComposeAccountMeta, getLzComposeParamsSerializer2 as getLzComposeParamsSerializer, getLzReceiveAccountSerializer,
|
|
15031
|
+
export { blocked_messagelib_exports as BlockedMessageLibProgram, dvn_exports2 as DVNProgram, DvnPDA, dvn_exports as DvnProgram, EDDSA, ENFORCED_OPTIONS_SEED, EndpointPDA, endpoint_exports as EndpointProgram, EventPDA, ExecutorOptionType, ExecutorPDA, executor_exports as ExecutorProgram, FAUCET_URL, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDA, MessageType, OmniAppPDA, PEER_SEED, PriceFeedPDA, pricefeed_exports as PriceFeedProgram, SendHelper, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, UlnPDA, uln_exports as UlnProgram, addressLocator, buildLzReceiveExecutionPlan, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractPacketSentEventByTxHash, extractReceivedPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getAccountMetaRefSerializer, getAddressLocatorSerializer, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getInstructionSerializer, getLzComposeAccountMeta, getLzComposeParamsSerializer2 as getLzComposeParamsSerializer, getLzReceiveAccountSerializer, getLzReceiveAccountsFromTypesV1, getLzReceiveParamsSerializer, getLzReceiveTypesInfo, getLzReceiveTypesV2AccountsSerializer, getLzReceiveTypesV2ResultSerializer, getNextNonceInstructionDataSerializer, getPricefeedProgramId, getProgramKeypair, getSimpleMessageLibProgramId, getULNProgramId, idlTypes, instructionDiscriminator, isAccountInitialized, isAddressLocator, lzCompose, lzReceive, messageLibs, nextNonce, simulateWeb3JsTransaction, toWeb3Connection, txWithAddressLookupTable, txWithNonce };
|
|
14629
15032
|
//# sourceMappingURL=umi.mjs.map
|
|
14630
15033
|
//# sourceMappingURL=umi.mjs.map
|