@layerzerolabs/lz-solana-sdk-v2 2.3.21 → 2.3.22
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 +10 -0
- package/dist/index.cjs +851 -1005
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1308 -1438
- package/dist/index.d.ts +1308 -1438
- package/dist/index.mjs +849 -1003
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var web35 = require('@solana/web3.js');
|
|
4
|
-
var
|
|
4
|
+
var BN2 = require('bn.js');
|
|
5
5
|
var beet201 = require('@metaplex-foundation/beet');
|
|
6
6
|
var beetSolana97 = require('@metaplex-foundation/beet-solana');
|
|
7
7
|
var splToken = require('@solana/spl-token');
|
|
8
8
|
var bytes = require('@ethersproject/bytes');
|
|
9
9
|
var keccak256 = require('@ethersproject/keccak256');
|
|
10
|
-
var
|
|
10
|
+
var invariant3 = require('tiny-invariant');
|
|
11
11
|
var address = require('@ethersproject/address');
|
|
12
12
|
require('@ethersproject/abi');
|
|
13
13
|
var bignumber = require('@ethersproject/bignumber');
|
|
@@ -39,11 +39,11 @@ function _interopNamespace(e) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
var web35__namespace = /*#__PURE__*/_interopNamespace(web35);
|
|
42
|
-
var
|
|
42
|
+
var BN2__default = /*#__PURE__*/_interopDefault(BN2);
|
|
43
43
|
var beet201__namespace = /*#__PURE__*/_interopNamespace(beet201);
|
|
44
44
|
var beetSolana97__namespace = /*#__PURE__*/_interopNamespace(beetSolana97);
|
|
45
45
|
var splToken__namespace = /*#__PURE__*/_interopNamespace(splToken);
|
|
46
|
-
var
|
|
46
|
+
var invariant3__default = /*#__PURE__*/_interopDefault(invariant3);
|
|
47
47
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
48
48
|
var base58__default = /*#__PURE__*/_interopDefault(base58);
|
|
49
49
|
|
|
@@ -115,7 +115,7 @@ var MaxExecutorOptionTypeLength = 10;
|
|
|
115
115
|
function oappIDPDA(program, seed = COUNT_SEED, id) {
|
|
116
116
|
if (id != void 0) {
|
|
117
117
|
return web35.PublicKey.findProgramAddressSync(
|
|
118
|
-
[Buffer.from(seed, "utf8"), new
|
|
118
|
+
[Buffer.from(seed, "utf8"), new BN2__default.default(id).toArrayLike(Buffer, "be", 1)],
|
|
119
119
|
program
|
|
120
120
|
);
|
|
121
121
|
} else {
|
|
@@ -159,121 +159,22 @@ var BaseOApp = class {
|
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
-
// src/generated/oft/index.ts
|
|
163
|
-
var
|
|
164
|
-
__export(
|
|
162
|
+
// src/generated/oft/accounts/index.ts
|
|
163
|
+
var accounts_exports = {};
|
|
164
|
+
__export(accounts_exports, {
|
|
165
165
|
EnforcedOptions: () => EnforcedOptions,
|
|
166
|
-
InvalidDecimalsError: () => InvalidDecimalsError,
|
|
167
|
-
InvalidEndpointProgramError: () => InvalidEndpointProgramError,
|
|
168
|
-
InvalidOptionsError: () => InvalidOptionsError,
|
|
169
|
-
InvalidSenderError: () => InvalidSenderError,
|
|
170
|
-
InvalidTokenDestError: () => InvalidTokenDestError,
|
|
171
|
-
InvalidTokenEscrowError: () => InvalidTokenEscrowError,
|
|
172
|
-
InvalidTokenMintError: () => InvalidTokenMintError,
|
|
173
166
|
LzReceiveTypesAccounts: () => LzReceiveTypesAccounts,
|
|
174
167
|
OftConfig: () => OftConfig,
|
|
175
|
-
PROGRAM_ADDRESS: () => PROGRAM_ADDRESS,
|
|
176
|
-
PROGRAM_ID: () => PROGRAM_ID,
|
|
177
168
|
Peer: () => Peer,
|
|
178
|
-
RateLimitExceededError: () => RateLimitExceededError,
|
|
179
|
-
SlippageExceededError: () => SlippageExceededError,
|
|
180
|
-
UnauthorizedError: () => UnauthorizedError,
|
|
181
169
|
accountProviders: () => accountProviders,
|
|
182
|
-
createInitAdapterOftInstruction: () => createInitAdapterOftInstruction,
|
|
183
|
-
createInitAdapterOftInstructionAccounts: () => createInitAdapterOftInstructionAccounts,
|
|
184
|
-
createInitOftInstruction: () => createInitOftInstruction,
|
|
185
|
-
createInitOftInstructionAccounts: () => createInitOftInstructionAccounts,
|
|
186
|
-
createLzReceiveInstruction: () => createLzReceiveInstruction,
|
|
187
|
-
createLzReceiveInstructionAccounts: () => createLzReceiveInstructionAccounts,
|
|
188
|
-
createLzReceiveTypesInstruction: () => createLzReceiveTypesInstruction,
|
|
189
|
-
createLzReceiveTypesInstructionAccounts: () => createLzReceiveTypesInstructionAccounts,
|
|
190
|
-
createMintToInstruction: () => createMintToInstruction,
|
|
191
|
-
createMintToInstructionAccounts: () => createMintToInstructionAccounts,
|
|
192
|
-
createQuoteInstruction: () => createQuoteInstruction,
|
|
193
|
-
createQuoteInstructionAccounts: () => createQuoteInstructionAccounts,
|
|
194
|
-
createQuoteOftInstruction: () => createQuoteOftInstruction,
|
|
195
|
-
createQuoteOftInstructionAccounts: () => createQuoteOftInstructionAccounts,
|
|
196
|
-
createSendInstruction: () => createSendInstruction,
|
|
197
|
-
createSendInstructionAccounts: () => createSendInstructionAccounts,
|
|
198
|
-
createSetDelegateInstruction: () => createSetDelegateInstruction,
|
|
199
|
-
createSetDelegateInstructionAccounts: () => createSetDelegateInstructionAccounts,
|
|
200
|
-
createSetEnforcedOptionsInstruction: () => createSetEnforcedOptionsInstruction,
|
|
201
|
-
createSetEnforcedOptionsInstructionAccounts: () => createSetEnforcedOptionsInstructionAccounts,
|
|
202
|
-
createSetMintAuthorityInstruction: () => createSetMintAuthorityInstruction,
|
|
203
|
-
createSetMintAuthorityInstructionAccounts: () => createSetMintAuthorityInstructionAccounts,
|
|
204
|
-
createSetPeerInstruction: () => createSetPeerInstruction,
|
|
205
|
-
createSetPeerInstructionAccounts: () => createSetPeerInstructionAccounts,
|
|
206
|
-
createSetRateLimitInstruction: () => createSetRateLimitInstruction,
|
|
207
|
-
createSetRateLimitInstructionAccounts: () => createSetRateLimitInstructionAccounts,
|
|
208
|
-
createTransferAdminInstruction: () => createTransferAdminInstruction,
|
|
209
|
-
createTransferAdminInstructionAccounts: () => createTransferAdminInstructionAccounts,
|
|
210
|
-
createVersionInstruction: () => createVersionInstruction,
|
|
211
|
-
createVersionInstructionAccounts: () => createVersionInstructionAccounts,
|
|
212
170
|
enforcedOptionsBeet: () => enforcedOptionsBeet,
|
|
213
171
|
enforcedOptionsDiscriminator: () => enforcedOptionsDiscriminator,
|
|
214
|
-
errorFromCode: () => errorFromCode,
|
|
215
|
-
errorFromName: () => errorFromName,
|
|
216
|
-
initAdapterOftInstructionDiscriminator: () => initAdapterOftInstructionDiscriminator,
|
|
217
|
-
initAdapterOftParamsBeet: () => initAdapterOftParamsBeet,
|
|
218
|
-
initAdapterOftStruct: () => initAdapterOftStruct,
|
|
219
|
-
initOftInstructionDiscriminator: () => initOftInstructionDiscriminator,
|
|
220
|
-
initOftParamsBeet: () => initOftParamsBeet,
|
|
221
|
-
initOftStruct: () => initOftStruct,
|
|
222
|
-
isOftConfigExtAdapter: () => isOftConfigExtAdapter,
|
|
223
|
-
isOftConfigExtNative: () => isOftConfigExtNative,
|
|
224
|
-
lzAccountBeet: () => lzAccountBeet,
|
|
225
|
-
lzReceiveInstructionDiscriminator: () => lzReceiveInstructionDiscriminator,
|
|
226
|
-
lzReceiveParamsBeet: () => lzReceiveParamsBeet,
|
|
227
|
-
lzReceiveStruct: () => lzReceiveStruct,
|
|
228
172
|
lzReceiveTypesAccountsBeet: () => lzReceiveTypesAccountsBeet,
|
|
229
173
|
lzReceiveTypesAccountsDiscriminator: () => lzReceiveTypesAccountsDiscriminator,
|
|
230
|
-
lzReceiveTypesInstructionDiscriminator: () => lzReceiveTypesInstructionDiscriminator,
|
|
231
|
-
lzReceiveTypesStruct: () => lzReceiveTypesStruct,
|
|
232
|
-
messagingFeeBeet: () => messagingFeeBeet,
|
|
233
|
-
messagingReceiptBeet: () => messagingReceiptBeet,
|
|
234
|
-
mintToInstructionDiscriminator: () => mintToInstructionDiscriminator,
|
|
235
|
-
mintToParamsBeet: () => mintToParamsBeet,
|
|
236
|
-
mintToStruct: () => mintToStruct,
|
|
237
|
-
oFTFeeDetailBeet: () => oFTFeeDetailBeet,
|
|
238
|
-
oFTLimitsBeet: () => oFTLimitsBeet,
|
|
239
|
-
oFTReceiptBeet: () => oFTReceiptBeet,
|
|
240
174
|
oftConfigBeet: () => oftConfigBeet,
|
|
241
175
|
oftConfigDiscriminator: () => oftConfigDiscriminator,
|
|
242
|
-
oftConfigExtBeet: () => oftConfigExtBeet,
|
|
243
176
|
peerBeet: () => peerBeet,
|
|
244
|
-
peerDiscriminator: () => peerDiscriminator
|
|
245
|
-
quoteInstructionDiscriminator: () => quoteInstructionDiscriminator,
|
|
246
|
-
quoteOftInstructionDiscriminator: () => quoteOftInstructionDiscriminator,
|
|
247
|
-
quoteOftParamsBeet: () => quoteOftParamsBeet,
|
|
248
|
-
quoteOftResultBeet: () => quoteOftResultBeet,
|
|
249
|
-
quoteOftStruct: () => quoteOftStruct,
|
|
250
|
-
quoteParamsBeet: () => quoteParamsBeet,
|
|
251
|
-
quoteStruct: () => quoteStruct,
|
|
252
|
-
rateLimiterBeet: () => rateLimiterBeet,
|
|
253
|
-
sendInstructionDiscriminator: () => sendInstructionDiscriminator,
|
|
254
|
-
sendParamsBeet: () => sendParamsBeet,
|
|
255
|
-
sendStruct: () => sendStruct,
|
|
256
|
-
setDelegateInstructionDiscriminator: () => setDelegateInstructionDiscriminator,
|
|
257
|
-
setDelegateParamsBeet: () => setDelegateParamsBeet,
|
|
258
|
-
setDelegateStruct: () => setDelegateStruct,
|
|
259
|
-
setEnforcedOptionsInstructionDiscriminator: () => setEnforcedOptionsInstructionDiscriminator,
|
|
260
|
-
setEnforcedOptionsParamsBeet: () => setEnforcedOptionsParamsBeet,
|
|
261
|
-
setEnforcedOptionsStruct: () => setEnforcedOptionsStruct,
|
|
262
|
-
setMintAuthorityInstructionDiscriminator: () => setMintAuthorityInstructionDiscriminator,
|
|
263
|
-
setMintAuthorityParamsBeet: () => setMintAuthorityParamsBeet,
|
|
264
|
-
setMintAuthorityStruct: () => setMintAuthorityStruct,
|
|
265
|
-
setPeerInstructionDiscriminator: () => setPeerInstructionDiscriminator,
|
|
266
|
-
setPeerParamsBeet: () => setPeerParamsBeet,
|
|
267
|
-
setPeerStruct: () => setPeerStruct,
|
|
268
|
-
setRateLimitInstructionDiscriminator: () => setRateLimitInstructionDiscriminator,
|
|
269
|
-
setRateLimitParamsBeet: () => setRateLimitParamsBeet,
|
|
270
|
-
setRateLimitStruct: () => setRateLimitStruct,
|
|
271
|
-
transferAdminInstructionDiscriminator: () => transferAdminInstructionDiscriminator,
|
|
272
|
-
transferAdminParamsBeet: () => transferAdminParamsBeet,
|
|
273
|
-
transferAdminStruct: () => transferAdminStruct,
|
|
274
|
-
versionBeet: () => versionBeet,
|
|
275
|
-
versionInstructionDiscriminator: () => versionInstructionDiscriminator,
|
|
276
|
-
versionStruct: () => versionStruct
|
|
177
|
+
peerDiscriminator: () => peerDiscriminator
|
|
277
178
|
});
|
|
278
179
|
var enforcedOptionsDiscriminator = [114, 221, 43, 174, 5, 37, 8, 20];
|
|
279
180
|
var EnforcedOptions = class _EnforcedOptions {
|
|
@@ -954,14 +855,71 @@ createErrorFromNameLookup.set(
|
|
|
954
855
|
"RateLimitExceeded",
|
|
955
856
|
() => new RateLimitExceededError()
|
|
956
857
|
);
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
858
|
+
|
|
859
|
+
// src/generated/oft/instructions/index.ts
|
|
860
|
+
var instructions_exports = {};
|
|
861
|
+
__export(instructions_exports, {
|
|
862
|
+
createInitAdapterOftInstruction: () => createInitAdapterOftInstruction,
|
|
863
|
+
createInitAdapterOftInstructionAccounts: () => createInitAdapterOftInstructionAccounts,
|
|
864
|
+
createInitOftInstruction: () => createInitOftInstruction,
|
|
865
|
+
createInitOftInstructionAccounts: () => createInitOftInstructionAccounts,
|
|
866
|
+
createLzReceiveInstruction: () => createLzReceiveInstruction,
|
|
867
|
+
createLzReceiveInstructionAccounts: () => createLzReceiveInstructionAccounts,
|
|
868
|
+
createLzReceiveTypesInstruction: () => createLzReceiveTypesInstruction,
|
|
869
|
+
createLzReceiveTypesInstructionAccounts: () => createLzReceiveTypesInstructionAccounts,
|
|
870
|
+
createMintToInstruction: () => createMintToInstruction,
|
|
871
|
+
createMintToInstructionAccounts: () => createMintToInstructionAccounts,
|
|
872
|
+
createQuoteInstruction: () => createQuoteInstruction,
|
|
873
|
+
createQuoteInstructionAccounts: () => createQuoteInstructionAccounts,
|
|
874
|
+
createQuoteOftInstruction: () => createQuoteOftInstruction,
|
|
875
|
+
createQuoteOftInstructionAccounts: () => createQuoteOftInstructionAccounts,
|
|
876
|
+
createSendInstruction: () => createSendInstruction,
|
|
877
|
+
createSendInstructionAccounts: () => createSendInstructionAccounts,
|
|
878
|
+
createSetDelegateInstruction: () => createSetDelegateInstruction,
|
|
879
|
+
createSetDelegateInstructionAccounts: () => createSetDelegateInstructionAccounts,
|
|
880
|
+
createSetEnforcedOptionsInstruction: () => createSetEnforcedOptionsInstruction,
|
|
881
|
+
createSetEnforcedOptionsInstructionAccounts: () => createSetEnforcedOptionsInstructionAccounts,
|
|
882
|
+
createSetMintAuthorityInstruction: () => createSetMintAuthorityInstruction,
|
|
883
|
+
createSetMintAuthorityInstructionAccounts: () => createSetMintAuthorityInstructionAccounts,
|
|
884
|
+
createSetPeerInstruction: () => createSetPeerInstruction,
|
|
885
|
+
createSetPeerInstructionAccounts: () => createSetPeerInstructionAccounts,
|
|
886
|
+
createSetRateLimitInstruction: () => createSetRateLimitInstruction,
|
|
887
|
+
createSetRateLimitInstructionAccounts: () => createSetRateLimitInstructionAccounts,
|
|
888
|
+
createTransferAdminInstruction: () => createTransferAdminInstruction,
|
|
889
|
+
createTransferAdminInstructionAccounts: () => createTransferAdminInstructionAccounts,
|
|
890
|
+
createVersionInstruction: () => createVersionInstruction,
|
|
891
|
+
createVersionInstructionAccounts: () => createVersionInstructionAccounts,
|
|
892
|
+
initAdapterOftInstructionDiscriminator: () => initAdapterOftInstructionDiscriminator,
|
|
893
|
+
initAdapterOftStruct: () => initAdapterOftStruct,
|
|
894
|
+
initOftInstructionDiscriminator: () => initOftInstructionDiscriminator,
|
|
895
|
+
initOftStruct: () => initOftStruct,
|
|
896
|
+
lzReceiveInstructionDiscriminator: () => lzReceiveInstructionDiscriminator,
|
|
897
|
+
lzReceiveStruct: () => lzReceiveStruct,
|
|
898
|
+
lzReceiveTypesInstructionDiscriminator: () => lzReceiveTypesInstructionDiscriminator,
|
|
899
|
+
lzReceiveTypesStruct: () => lzReceiveTypesStruct,
|
|
900
|
+
mintToInstructionDiscriminator: () => mintToInstructionDiscriminator,
|
|
901
|
+
mintToStruct: () => mintToStruct,
|
|
902
|
+
quoteInstructionDiscriminator: () => quoteInstructionDiscriminator,
|
|
903
|
+
quoteOftInstructionDiscriminator: () => quoteOftInstructionDiscriminator,
|
|
904
|
+
quoteOftStruct: () => quoteOftStruct,
|
|
905
|
+
quoteStruct: () => quoteStruct,
|
|
906
|
+
sendInstructionDiscriminator: () => sendInstructionDiscriminator,
|
|
907
|
+
sendStruct: () => sendStruct,
|
|
908
|
+
setDelegateInstructionDiscriminator: () => setDelegateInstructionDiscriminator,
|
|
909
|
+
setDelegateStruct: () => setDelegateStruct,
|
|
910
|
+
setEnforcedOptionsInstructionDiscriminator: () => setEnforcedOptionsInstructionDiscriminator,
|
|
911
|
+
setEnforcedOptionsStruct: () => setEnforcedOptionsStruct,
|
|
912
|
+
setMintAuthorityInstructionDiscriminator: () => setMintAuthorityInstructionDiscriminator,
|
|
913
|
+
setMintAuthorityStruct: () => setMintAuthorityStruct,
|
|
914
|
+
setPeerInstructionDiscriminator: () => setPeerInstructionDiscriminator,
|
|
915
|
+
setPeerStruct: () => setPeerStruct,
|
|
916
|
+
setRateLimitInstructionDiscriminator: () => setRateLimitInstructionDiscriminator,
|
|
917
|
+
setRateLimitStruct: () => setRateLimitStruct,
|
|
918
|
+
transferAdminInstructionDiscriminator: () => transferAdminInstructionDiscriminator,
|
|
919
|
+
transferAdminStruct: () => transferAdminStruct,
|
|
920
|
+
versionInstructionDiscriminator: () => versionInstructionDiscriminator,
|
|
921
|
+
versionStruct: () => versionStruct
|
|
922
|
+
});
|
|
965
923
|
var initAdapterOftParamsBeet = new beet201__namespace.FixableBeetArgsStruct(
|
|
966
924
|
[
|
|
967
925
|
["admin", beetSolana97__namespace.publicKey],
|
|
@@ -2418,6 +2376,36 @@ function createVersionInstructionAccounts(programId = new web35__namespace.Publi
|
|
|
2418
2376
|
const keys = [];
|
|
2419
2377
|
return keys;
|
|
2420
2378
|
}
|
|
2379
|
+
|
|
2380
|
+
// src/generated/oft/types/index.ts
|
|
2381
|
+
var types_exports = {};
|
|
2382
|
+
__export(types_exports, {
|
|
2383
|
+
initAdapterOftParamsBeet: () => initAdapterOftParamsBeet,
|
|
2384
|
+
initOftParamsBeet: () => initOftParamsBeet,
|
|
2385
|
+
isOftConfigExtAdapter: () => isOftConfigExtAdapter,
|
|
2386
|
+
isOftConfigExtNative: () => isOftConfigExtNative,
|
|
2387
|
+
lzAccountBeet: () => lzAccountBeet,
|
|
2388
|
+
lzReceiveParamsBeet: () => lzReceiveParamsBeet,
|
|
2389
|
+
messagingFeeBeet: () => messagingFeeBeet,
|
|
2390
|
+
messagingReceiptBeet: () => messagingReceiptBeet,
|
|
2391
|
+
mintToParamsBeet: () => mintToParamsBeet,
|
|
2392
|
+
oFTFeeDetailBeet: () => oFTFeeDetailBeet,
|
|
2393
|
+
oFTLimitsBeet: () => oFTLimitsBeet,
|
|
2394
|
+
oFTReceiptBeet: () => oFTReceiptBeet,
|
|
2395
|
+
oftConfigExtBeet: () => oftConfigExtBeet,
|
|
2396
|
+
quoteOftParamsBeet: () => quoteOftParamsBeet,
|
|
2397
|
+
quoteOftResultBeet: () => quoteOftResultBeet,
|
|
2398
|
+
quoteParamsBeet: () => quoteParamsBeet,
|
|
2399
|
+
rateLimiterBeet: () => rateLimiterBeet,
|
|
2400
|
+
sendParamsBeet: () => sendParamsBeet,
|
|
2401
|
+
setDelegateParamsBeet: () => setDelegateParamsBeet,
|
|
2402
|
+
setEnforcedOptionsParamsBeet: () => setEnforcedOptionsParamsBeet,
|
|
2403
|
+
setMintAuthorityParamsBeet: () => setMintAuthorityParamsBeet,
|
|
2404
|
+
setPeerParamsBeet: () => setPeerParamsBeet,
|
|
2405
|
+
setRateLimitParamsBeet: () => setRateLimitParamsBeet,
|
|
2406
|
+
transferAdminParamsBeet: () => transferAdminParamsBeet,
|
|
2407
|
+
versionBeet: () => versionBeet
|
|
2408
|
+
});
|
|
2421
2409
|
var lzAccountBeet = new beet201__namespace.BeetArgsStruct(
|
|
2422
2410
|
[
|
|
2423
2411
|
["pubkey", beetSolana97__namespace.publicKey],
|
|
@@ -2523,7 +2511,7 @@ var EndpointPDADeriver = class {
|
|
|
2523
2511
|
[
|
|
2524
2512
|
Buffer.from(SEND_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2525
2513
|
// U32 to Uint8Array([0,0,0,0])
|
|
2526
|
-
new
|
|
2514
|
+
new BN2__default.default(dstEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2527
2515
|
],
|
|
2528
2516
|
this.program
|
|
2529
2517
|
);
|
|
@@ -2534,7 +2522,7 @@ var EndpointPDADeriver = class {
|
|
|
2534
2522
|
Buffer.from(SEND_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2535
2523
|
sender.toBytes(),
|
|
2536
2524
|
// U32 to Uint8Array([0,0,0,0])
|
|
2537
|
-
new
|
|
2525
|
+
new BN2__default.default(dstEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2538
2526
|
],
|
|
2539
2527
|
this.program
|
|
2540
2528
|
);
|
|
@@ -2553,7 +2541,7 @@ var EndpointPDADeriver = class {
|
|
|
2553
2541
|
[
|
|
2554
2542
|
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2555
2543
|
// U32 to Uint8Array([0,0,0,0])
|
|
2556
|
-
new
|
|
2544
|
+
new BN2__default.default(srcEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2557
2545
|
],
|
|
2558
2546
|
this.program
|
|
2559
2547
|
);
|
|
@@ -2564,7 +2552,7 @@ var EndpointPDADeriver = class {
|
|
|
2564
2552
|
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2565
2553
|
receiver.toBytes(),
|
|
2566
2554
|
// U32 to Uint8Array([0,0,0,0])
|
|
2567
|
-
new
|
|
2555
|
+
new BN2__default.default(srcEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2568
2556
|
],
|
|
2569
2557
|
this.program
|
|
2570
2558
|
);
|
|
@@ -2592,7 +2580,7 @@ var EndpointPDADeriver = class {
|
|
|
2592
2580
|
Buffer.from(NONCE_SEED, "utf8"),
|
|
2593
2581
|
localOapp.toBytes(),
|
|
2594
2582
|
// U32 to Uint8Array([0,0,0,0])
|
|
2595
|
-
new
|
|
2583
|
+
new BN2__default.default(remoteChainId).toArrayLike(Buffer, "be", 4),
|
|
2596
2584
|
remoteOapp
|
|
2597
2585
|
],
|
|
2598
2586
|
this.program
|
|
@@ -2603,7 +2591,7 @@ var EndpointPDADeriver = class {
|
|
|
2603
2591
|
[
|
|
2604
2592
|
Buffer.from(PENDING_NONCE_SEED, "utf8"),
|
|
2605
2593
|
localOapp.toBytes(),
|
|
2606
|
-
new
|
|
2594
|
+
new BN2__default.default(remoteChainId).toArrayLike(Buffer, "be", 4),
|
|
2607
2595
|
remoteOapp
|
|
2608
2596
|
],
|
|
2609
2597
|
this.program
|
|
@@ -2628,9 +2616,9 @@ var EndpointPDADeriver = class {
|
|
|
2628
2616
|
[
|
|
2629
2617
|
Buffer.from(PAYLOAD_HASH_SEED, "utf8"),
|
|
2630
2618
|
receiver.toBytes(),
|
|
2631
|
-
new
|
|
2619
|
+
new BN2__default.default(srcEid).toArrayLike(Buffer, "be", 4),
|
|
2632
2620
|
sender,
|
|
2633
|
-
new
|
|
2621
|
+
new BN2__default.default(nonce).toArrayLike(Buffer, "be", 8)
|
|
2634
2622
|
],
|
|
2635
2623
|
this.program
|
|
2636
2624
|
);
|
|
@@ -2642,7 +2630,7 @@ var EndpointPDADeriver = class {
|
|
|
2642
2630
|
from.toBytes(),
|
|
2643
2631
|
to.toBytes(),
|
|
2644
2632
|
guid,
|
|
2645
|
-
new
|
|
2633
|
+
new BN2__default.default(index).toArrayLike(Buffer, "be", 2),
|
|
2646
2634
|
messageHash
|
|
2647
2635
|
],
|
|
2648
2636
|
this.program
|
|
@@ -2658,13 +2646,13 @@ var MessageLibPDADeriver = class {
|
|
|
2658
2646
|
}
|
|
2659
2647
|
sendConfig(eid, oapp) {
|
|
2660
2648
|
return web35.PublicKey.findProgramAddressSync(
|
|
2661
|
-
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new
|
|
2649
|
+
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4), oapp.toBuffer()],
|
|
2662
2650
|
this.program
|
|
2663
2651
|
);
|
|
2664
2652
|
}
|
|
2665
2653
|
receiveConfig(eid, oapp) {
|
|
2666
2654
|
return web35.PublicKey.findProgramAddressSync(
|
|
2667
|
-
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new
|
|
2655
|
+
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4), oapp.toBuffer()],
|
|
2668
2656
|
this.program
|
|
2669
2657
|
);
|
|
2670
2658
|
}
|
|
@@ -2675,25 +2663,25 @@ var UlnPDADeriver = class extends MessageLibPDADeriver {
|
|
|
2675
2663
|
}
|
|
2676
2664
|
config(eid) {
|
|
2677
2665
|
return web35.PublicKey.findProgramAddressSync(
|
|
2678
|
-
[Buffer.from(ULN_CONFIG_SEED, "utf8"), new
|
|
2666
|
+
[Buffer.from(ULN_CONFIG_SEED, "utf8"), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
2679
2667
|
this.program
|
|
2680
2668
|
);
|
|
2681
2669
|
}
|
|
2682
2670
|
defaultSendConfig(eid) {
|
|
2683
2671
|
return web35.PublicKey.findProgramAddressSync(
|
|
2684
|
-
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new
|
|
2672
|
+
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
2685
2673
|
this.program
|
|
2686
2674
|
);
|
|
2687
2675
|
}
|
|
2688
2676
|
defaultReceiveConfig(eid) {
|
|
2689
2677
|
return web35.PublicKey.findProgramAddressSync(
|
|
2690
|
-
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new
|
|
2678
|
+
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
2691
2679
|
this.program
|
|
2692
2680
|
);
|
|
2693
2681
|
}
|
|
2694
2682
|
options(eit) {
|
|
2695
2683
|
return web35.PublicKey.findProgramAddressSync(
|
|
2696
|
-
[Buffer.from(OPTIONS_SEED, "utf8"), new
|
|
2684
|
+
[Buffer.from(OPTIONS_SEED, "utf8"), new BN2__default.default(eit).toArrayLike(Buffer, "be", 4)],
|
|
2697
2685
|
this.program
|
|
2698
2686
|
);
|
|
2699
2687
|
}
|
|
@@ -2713,7 +2701,7 @@ var OAppBasePDADeriver = class {
|
|
|
2713
2701
|
}
|
|
2714
2702
|
remote(dstChainId) {
|
|
2715
2703
|
return web35.PublicKey.findProgramAddressSync(
|
|
2716
|
-
[Buffer.from(REMOTE_SEED), new
|
|
2704
|
+
[Buffer.from(REMOTE_SEED), new BN2__default.default(dstChainId).toArrayLike(Buffer, "be", 4)],
|
|
2717
2705
|
this.program
|
|
2718
2706
|
);
|
|
2719
2707
|
}
|
|
@@ -2734,7 +2722,7 @@ var OmniCounterPDADeriver = class extends OAppBasePDADeriver {
|
|
|
2734
2722
|
}
|
|
2735
2723
|
remote(dstChainId) {
|
|
2736
2724
|
return web35.PublicKey.findProgramAddressSync(
|
|
2737
|
-
[Buffer.from(REMOTE_SEED), this.count()[0].toBytes(), new
|
|
2725
|
+
[Buffer.from(REMOTE_SEED), this.count()[0].toBytes(), new BN2__default.default(dstChainId).toArrayLike(Buffer, "be", 4)],
|
|
2738
2726
|
this.program
|
|
2739
2727
|
);
|
|
2740
2728
|
}
|
|
@@ -2798,19 +2786,25 @@ var OftPDADeriver = class {
|
|
|
2798
2786
|
}
|
|
2799
2787
|
enforcedOptions(oftConfig, eid) {
|
|
2800
2788
|
return web35.PublicKey.findProgramAddressSync(
|
|
2801
|
-
[Buffer.from(ENFORCED_OPTIONS_SEED, "utf8"), oftConfig.toBytes(), new
|
|
2789
|
+
[Buffer.from(ENFORCED_OPTIONS_SEED, "utf8"), oftConfig.toBytes(), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
2802
2790
|
this.program
|
|
2803
2791
|
);
|
|
2804
2792
|
}
|
|
2805
2793
|
peer(oftConfig, eid) {
|
|
2806
2794
|
return web35.PublicKey.findProgramAddressSync(
|
|
2807
|
-
[Buffer.from(PEER_SEED, "utf8"), oftConfig.toBytes(), new
|
|
2795
|
+
[Buffer.from(PEER_SEED, "utf8"), oftConfig.toBytes(), new BN2__default.default(eid).toArrayLike(Buffer, "be", 4)],
|
|
2808
2796
|
this.program
|
|
2809
2797
|
);
|
|
2810
2798
|
}
|
|
2811
2799
|
oftConfig(mintOrEscrow) {
|
|
2812
2800
|
return web35.PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED, "utf8"), mintOrEscrow.toBuffer()], this.program);
|
|
2813
2801
|
}
|
|
2802
|
+
lzReceiveTypesAccounts(oftConfig) {
|
|
2803
|
+
return web35.PublicKey.findProgramAddressSync(
|
|
2804
|
+
[Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
|
|
2805
|
+
this.program
|
|
2806
|
+
);
|
|
2807
|
+
}
|
|
2814
2808
|
};
|
|
2815
2809
|
|
|
2816
2810
|
// src/endpoint.ts
|
|
@@ -2820,11 +2814,11 @@ __export(endpoint_exports, {
|
|
|
2820
2814
|
Endpoint: () => Endpoint,
|
|
2821
2815
|
EventEmitDiscriminator: () => EventEmitDiscriminator,
|
|
2822
2816
|
PROGRAM_ID: () => PROGRAM_ID2,
|
|
2823
|
-
accounts: () =>
|
|
2817
|
+
accounts: () => accounts_exports2,
|
|
2824
2818
|
errors: () => errors_exports,
|
|
2825
2819
|
events: () => events_exports,
|
|
2826
|
-
instructions: () =>
|
|
2827
|
-
types: () =>
|
|
2820
|
+
instructions: () => instructions_exports2,
|
|
2821
|
+
types: () => types_exports2
|
|
2828
2822
|
});
|
|
2829
2823
|
function hexZeroPadTo32(addr) {
|
|
2830
2824
|
return bytes.hexZeroPad(addr, 32);
|
|
@@ -2958,10 +2952,27 @@ var PacketV1Codec = class _PacketV1Codec {
|
|
|
2958
2952
|
};
|
|
2959
2953
|
}
|
|
2960
2954
|
};
|
|
2955
|
+
var PacketSerializer = class {
|
|
2956
|
+
static serialize(packet) {
|
|
2957
|
+
return PacketV1Codec.encode(packet);
|
|
2958
|
+
}
|
|
2959
|
+
static serializeBytes(packet) {
|
|
2960
|
+
return PacketV1Codec.encodeBytes(packet);
|
|
2961
|
+
}
|
|
2962
|
+
static deserialize(bytesLike) {
|
|
2963
|
+
let codec;
|
|
2964
|
+
if (bytesLike instanceof Uint8Array) {
|
|
2965
|
+
codec = PacketV1Codec.fromBytes(bytesLike);
|
|
2966
|
+
} else {
|
|
2967
|
+
codec = PacketV1Codec.from(bytesLike);
|
|
2968
|
+
}
|
|
2969
|
+
return codec.toPacket();
|
|
2970
|
+
}
|
|
2971
|
+
};
|
|
2961
2972
|
|
|
2962
2973
|
// src/generated/endpoint/accounts/index.ts
|
|
2963
|
-
var
|
|
2964
|
-
__export(
|
|
2974
|
+
var accounts_exports2 = {};
|
|
2975
|
+
__export(accounts_exports2, {
|
|
2965
2976
|
ComposeMessageState: () => ComposeMessageState,
|
|
2966
2977
|
EndpointSettings: () => EndpointSettings,
|
|
2967
2978
|
MessageLibInfo: () => MessageLibInfo,
|
|
@@ -4119,8 +4130,8 @@ __export(errors_exports, {
|
|
|
4119
4130
|
SameValueError: () => SameValueError,
|
|
4120
4131
|
UnauthorizedError: () => UnauthorizedError2,
|
|
4121
4132
|
WritableAccountNotAllowedError: () => WritableAccountNotAllowedError,
|
|
4122
|
-
errorFromCode: () =>
|
|
4123
|
-
errorFromName: () =>
|
|
4133
|
+
errorFromCode: () => errorFromCode,
|
|
4134
|
+
errorFromName: () => errorFromName
|
|
4124
4135
|
});
|
|
4125
4136
|
var createErrorFromCodeLookup2 = /* @__PURE__ */ new Map();
|
|
4126
4137
|
var createErrorFromNameLookup2 = /* @__PURE__ */ new Map();
|
|
@@ -4376,18 +4387,18 @@ createErrorFromNameLookup2.set(
|
|
|
4376
4387
|
"WritableAccountNotAllowed",
|
|
4377
4388
|
() => new WritableAccountNotAllowedError()
|
|
4378
4389
|
);
|
|
4379
|
-
function
|
|
4390
|
+
function errorFromCode(code) {
|
|
4380
4391
|
const createError = createErrorFromCodeLookup2.get(code);
|
|
4381
4392
|
return createError != null ? createError() : null;
|
|
4382
4393
|
}
|
|
4383
|
-
function
|
|
4394
|
+
function errorFromName(name) {
|
|
4384
4395
|
const createError = createErrorFromNameLookup2.get(name);
|
|
4385
4396
|
return createError != null ? createError() : null;
|
|
4386
4397
|
}
|
|
4387
4398
|
|
|
4388
4399
|
// src/generated/endpoint/instructions/index.ts
|
|
4389
|
-
var
|
|
4390
|
-
__export(
|
|
4400
|
+
var instructions_exports2 = {};
|
|
4401
|
+
__export(instructions_exports2, {
|
|
4391
4402
|
burnInstructionDiscriminator: () => burnInstructionDiscriminator,
|
|
4392
4403
|
burnStruct: () => burnStruct,
|
|
4393
4404
|
clearComposeInstructionDiscriminator: () => clearComposeInstructionDiscriminator,
|
|
@@ -8061,8 +8072,8 @@ function createWithdrawRentInstructionAccounts(accounts, programId = new web35__
|
|
|
8061
8072
|
}
|
|
8062
8073
|
|
|
8063
8074
|
// src/generated/endpoint/types/index.ts
|
|
8064
|
-
var
|
|
8065
|
-
__export(
|
|
8075
|
+
var types_exports2 = {};
|
|
8076
|
+
__export(types_exports2, {
|
|
8066
8077
|
MessageLibType: () => MessageLibType,
|
|
8067
8078
|
burnParamsBeet: () => burnParamsBeet,
|
|
8068
8079
|
clearComposeParamsBeet: () => clearComposeParamsBeet,
|
|
@@ -8525,12 +8536,16 @@ var Endpoint = class {
|
|
|
8525
8536
|
}
|
|
8526
8537
|
async initOAppNonce(connection, delegate, dstEid, oappIDPDA2, remoteOappAddr) {
|
|
8527
8538
|
const [nonce] = this.endpointDeriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8528
|
-
const [pendingNonce] = this.endpointDeriver.pendingNonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8529
|
-
const [oappRegistry] = this.endpointDeriver.oappRegistry(oappIDPDA2);
|
|
8530
8539
|
const info = await connection.getAccountInfo(nonce);
|
|
8531
8540
|
if (info) {
|
|
8532
8541
|
return null;
|
|
8533
8542
|
}
|
|
8543
|
+
return this.initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr);
|
|
8544
|
+
}
|
|
8545
|
+
initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr) {
|
|
8546
|
+
const [nonce] = this.endpointDeriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8547
|
+
const [pendingNonce] = this.endpointDeriver.pendingNonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8548
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(oappIDPDA2);
|
|
8534
8549
|
return createInitNonceInstruction(
|
|
8535
8550
|
{
|
|
8536
8551
|
nonce,
|
|
@@ -8549,12 +8564,16 @@ var Endpoint = class {
|
|
|
8549
8564
|
);
|
|
8550
8565
|
}
|
|
8551
8566
|
async initSendLibrary(connection, delegate, sender, dstEid, commitmentOrConfig) {
|
|
8552
|
-
const [oappRegistry] = this.endpointDeriver.oappRegistry(sender);
|
|
8553
8567
|
const [sendLibraryConfig] = this.endpointDeriver.sendLibraryConfig(sender, dstEid);
|
|
8554
8568
|
const info = await connection.getAccountInfo(sendLibraryConfig, commitmentOrConfig);
|
|
8555
8569
|
if (info) {
|
|
8556
8570
|
return null;
|
|
8557
8571
|
}
|
|
8572
|
+
return this.initSendLibraryWithoutChecks(delegate, sender, dstEid);
|
|
8573
|
+
}
|
|
8574
|
+
initSendLibraryWithoutChecks(delegate, sender, dstEid) {
|
|
8575
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(sender);
|
|
8576
|
+
const [sendLibraryConfig] = this.endpointDeriver.sendLibraryConfig(sender, dstEid);
|
|
8558
8577
|
return createInitSendLibraryInstruction(
|
|
8559
8578
|
{
|
|
8560
8579
|
delegate,
|
|
@@ -8570,7 +8589,7 @@ var Endpoint = class {
|
|
|
8570
8589
|
this.program
|
|
8571
8590
|
);
|
|
8572
8591
|
}
|
|
8573
|
-
async setSendLibrary(
|
|
8592
|
+
async setSendLibrary(oappAdmin, oappIDPDA2, newSendLibProgram, dstEid) {
|
|
8574
8593
|
const [newSendLib] = new MessageLibPDADeriver(newSendLibProgram).messageLib();
|
|
8575
8594
|
const [sendLibraryConfig] = this.endpointDeriver.sendLibraryConfig(oappIDPDA2, dstEid);
|
|
8576
8595
|
const [sendLibraryInfo] = this.endpointDeriver.messageLibraryInfo(newSendLib);
|
|
@@ -8596,12 +8615,16 @@ var Endpoint = class {
|
|
|
8596
8615
|
return Promise.resolve(ix);
|
|
8597
8616
|
}
|
|
8598
8617
|
async initReceiveLibrary(connection, delegate, receiver, srcEid, commitmentOrConfig) {
|
|
8599
|
-
const [oappRegistry] = this.endpointDeriver.oappRegistry(receiver);
|
|
8600
8618
|
const [receiveLibraryConfig] = this.endpointDeriver.receiveLibraryConfig(receiver, srcEid);
|
|
8601
8619
|
const info = await connection.getAccountInfo(receiveLibraryConfig, commitmentOrConfig);
|
|
8602
8620
|
if (info) {
|
|
8603
8621
|
return null;
|
|
8604
8622
|
}
|
|
8623
|
+
return this.initReceiveLibraryWithoutChecks(delegate, receiver, srcEid);
|
|
8624
|
+
}
|
|
8625
|
+
initReceiveLibraryWithoutChecks(delegate, receiver, srcEid) {
|
|
8626
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(receiver);
|
|
8627
|
+
const [receiveLibraryConfig] = this.endpointDeriver.receiveLibraryConfig(receiver, srcEid);
|
|
8605
8628
|
return createInitReceiveLibraryInstruction(
|
|
8606
8629
|
{
|
|
8607
8630
|
delegate,
|
|
@@ -8617,7 +8640,7 @@ var Endpoint = class {
|
|
|
8617
8640
|
this.program
|
|
8618
8641
|
);
|
|
8619
8642
|
}
|
|
8620
|
-
async setReceiveLibrary(
|
|
8643
|
+
async setReceiveLibrary(oappAdmin, oappIDPDA2, newReceiveLibProgram, srcEid, gracePeriod) {
|
|
8621
8644
|
const [newReceiveLib] = new MessageLibPDADeriver(newReceiveLibProgram).messageLib();
|
|
8622
8645
|
const [receiveLibraryConfig] = this.endpointDeriver.receiveLibraryConfig(oappIDPDA2, srcEid);
|
|
8623
8646
|
const [receiveLibraryInfo] = this.endpointDeriver.messageLibraryInfo(newReceiveLib);
|
|
@@ -8671,7 +8694,7 @@ var Endpoint = class {
|
|
|
8671
8694
|
params: {
|
|
8672
8695
|
eid,
|
|
8673
8696
|
configType: config.configType,
|
|
8674
|
-
config: uln_exports.Uln.constructSetConfigData(config.configType, config.value),
|
|
8697
|
+
config: msgLibProgram.toBase58() === simple_message_lib_exports.PROGRAM_ID.toBase58() ? new Uint8Array(10) : uln_exports.Uln.constructSetConfigData(config.configType, config.value),
|
|
8675
8698
|
oapp: oappID
|
|
8676
8699
|
}
|
|
8677
8700
|
},
|
|
@@ -8798,7 +8821,7 @@ var Endpoint = class {
|
|
|
8798
8821
|
receiver,
|
|
8799
8822
|
srcEid,
|
|
8800
8823
|
sender: Array.from(sender.toBytes()),
|
|
8801
|
-
nonce: new
|
|
8824
|
+
nonce: new BN2__default.default(nonce)
|
|
8802
8825
|
}
|
|
8803
8826
|
},
|
|
8804
8827
|
this.program
|
|
@@ -8823,7 +8846,7 @@ var Endpoint = class {
|
|
|
8823
8846
|
srcEid,
|
|
8824
8847
|
sender: Array.from(sender.toBytes()),
|
|
8825
8848
|
receiver,
|
|
8826
|
-
nonce: new
|
|
8849
|
+
nonce: new BN2__default.default(nonce)
|
|
8827
8850
|
}
|
|
8828
8851
|
},
|
|
8829
8852
|
this.program
|
|
@@ -9067,15 +9090,39 @@ var Endpoint = class {
|
|
|
9067
9090
|
// } as AccountMeta,
|
|
9068
9091
|
// ].concat(ix.keys)
|
|
9069
9092
|
// }
|
|
9093
|
+
getRegisterOappIxAccountMetaForCPI(payer, oapp) {
|
|
9094
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(oapp);
|
|
9095
|
+
const eventAuthority = this.eventAuthorityPDA;
|
|
9096
|
+
const keys = createRegisterOappInstructionAccounts(
|
|
9097
|
+
{
|
|
9098
|
+
payer,
|
|
9099
|
+
oapp,
|
|
9100
|
+
oappRegistry,
|
|
9101
|
+
eventAuthority,
|
|
9102
|
+
program: this.program
|
|
9103
|
+
},
|
|
9104
|
+
this.program
|
|
9105
|
+
);
|
|
9106
|
+
keys.forEach((key) => {
|
|
9107
|
+
key.isSigner = false;
|
|
9108
|
+
});
|
|
9109
|
+
return [
|
|
9110
|
+
{
|
|
9111
|
+
pubkey: this.program,
|
|
9112
|
+
isSigner: false,
|
|
9113
|
+
isWritable: false
|
|
9114
|
+
}
|
|
9115
|
+
].concat(keys);
|
|
9116
|
+
}
|
|
9070
9117
|
getSkipIxAccountMetaForCPI(receiver, sender, srcEid, nonce) {
|
|
9071
9118
|
const [noncePDA] = this.endpointDeriver.nonce(receiver, srcEid, sender);
|
|
9072
9119
|
const [pendingNonce] = this.endpointDeriver.pendingNonce(receiver, srcEid, sender);
|
|
9073
9120
|
const [payloadHash] = this.endpointDeriver.payloadHash(receiver, srcEid, sender, nonce);
|
|
9074
|
-
const
|
|
9121
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(receiver);
|
|
9122
|
+
const keys = createSkipInstructionAccounts(
|
|
9075
9123
|
{
|
|
9076
9124
|
signer: receiver,
|
|
9077
|
-
oappRegistry
|
|
9078
|
-
// FIXME: oappRegistry is wrong
|
|
9125
|
+
oappRegistry,
|
|
9079
9126
|
nonce: noncePDA,
|
|
9080
9127
|
pendingInboundNonce: pendingNonce,
|
|
9081
9128
|
payloadHash,
|
|
@@ -9083,16 +9130,9 @@ var Endpoint = class {
|
|
|
9083
9130
|
program: this.program,
|
|
9084
9131
|
eventAuthority: this.eventAuthorityPDA
|
|
9085
9132
|
},
|
|
9086
|
-
|
|
9087
|
-
params: {
|
|
9088
|
-
srcEid,
|
|
9089
|
-
sender: Array.from(sender),
|
|
9090
|
-
receiver,
|
|
9091
|
-
nonce
|
|
9092
|
-
}
|
|
9093
|
-
}
|
|
9133
|
+
this.program
|
|
9094
9134
|
);
|
|
9095
|
-
|
|
9135
|
+
keys.forEach((key) => {
|
|
9096
9136
|
key.isSigner = false;
|
|
9097
9137
|
});
|
|
9098
9138
|
return [
|
|
@@ -9101,7 +9141,7 @@ var Endpoint = class {
|
|
|
9101
9141
|
isSigner: false,
|
|
9102
9142
|
isWritable: false
|
|
9103
9143
|
}
|
|
9104
|
-
].concat(
|
|
9144
|
+
].concat(keys);
|
|
9105
9145
|
}
|
|
9106
9146
|
async isDefaultSendLibrary(connection, messageLibProgram, dstEid, commitmentOrConfig) {
|
|
9107
9147
|
const [msgLib] = new MessageLibPDADeriver(messageLibProgram).messageLib();
|
|
@@ -9242,7 +9282,7 @@ var Endpoint = class {
|
|
|
9242
9282
|
if (timeout2) {
|
|
9243
9283
|
const slot = await connection.getSlot();
|
|
9244
9284
|
const timestamp = await connection.getBlockTime(slot);
|
|
9245
|
-
|
|
9285
|
+
invariant3__default.default(timestamp, "timestamp should not be null");
|
|
9246
9286
|
const isValid = parseInt(timeout2.expiry.toString()) > timestamp;
|
|
9247
9287
|
return {
|
|
9248
9288
|
programId: defaultInfo.messageLib,
|
|
@@ -9260,12 +9300,12 @@ var Endpoint = class {
|
|
|
9260
9300
|
};
|
|
9261
9301
|
}
|
|
9262
9302
|
const messageLibInfo = await connection.getAccountInfo(info.messageLib, commitmentOrConfig);
|
|
9263
|
-
|
|
9303
|
+
invariant3__default.default(messageLibInfo, "messageLibInfo should not be null");
|
|
9264
9304
|
const { timeout } = info;
|
|
9265
9305
|
if (timeout) {
|
|
9266
9306
|
const slot = await connection.getSlot();
|
|
9267
9307
|
const timestamp = await connection.getBlockTime(slot);
|
|
9268
|
-
|
|
9308
|
+
invariant3__default.default(timestamp, "timestamp should not be null");
|
|
9269
9309
|
const isValid = parseInt(timeout.expiry.toString()) > timestamp;
|
|
9270
9310
|
return {
|
|
9271
9311
|
programId: messageLibInfo.owner,
|
|
@@ -9350,15 +9390,15 @@ var simple_message_lib_exports = {};
|
|
|
9350
9390
|
__export(simple_message_lib_exports, {
|
|
9351
9391
|
PROGRAM_ID: () => PROGRAM_ID3,
|
|
9352
9392
|
SimpleMessageLib: () => SimpleMessageLib,
|
|
9353
|
-
accounts: () =>
|
|
9393
|
+
accounts: () => accounts_exports3,
|
|
9354
9394
|
errors: () => errors_exports2,
|
|
9355
|
-
instructions: () =>
|
|
9356
|
-
types: () =>
|
|
9395
|
+
instructions: () => instructions_exports3,
|
|
9396
|
+
types: () => types_exports3
|
|
9357
9397
|
});
|
|
9358
9398
|
|
|
9359
9399
|
// src/generated/simple_messagelib/accounts/index.ts
|
|
9360
|
-
var
|
|
9361
|
-
__export(
|
|
9400
|
+
var accounts_exports3 = {};
|
|
9401
|
+
__export(accounts_exports3, {
|
|
9362
9402
|
MessageLib: () => MessageLib,
|
|
9363
9403
|
ReceiveConfigStore: () => ReceiveConfigStore,
|
|
9364
9404
|
SendConfigStore: () => SendConfigStore,
|
|
@@ -9776,8 +9816,8 @@ __export(errors_exports2, {
|
|
|
9776
9816
|
OnlyRevertError: () => OnlyRevertError,
|
|
9777
9817
|
OnlyWhitelistedCallerError: () => OnlyWhitelistedCallerError,
|
|
9778
9818
|
SendReentrancyError: () => SendReentrancyError,
|
|
9779
|
-
errorFromCode: () =>
|
|
9780
|
-
errorFromName: () =>
|
|
9819
|
+
errorFromCode: () => errorFromCode2,
|
|
9820
|
+
errorFromName: () => errorFromName2
|
|
9781
9821
|
});
|
|
9782
9822
|
var createErrorFromCodeLookup3 = /* @__PURE__ */ new Map();
|
|
9783
9823
|
var createErrorFromNameLookup3 = /* @__PURE__ */ new Map();
|
|
@@ -9892,18 +9932,18 @@ var OnlyRevertError = class _OnlyRevertError extends Error {
|
|
|
9892
9932
|
};
|
|
9893
9933
|
createErrorFromCodeLookup3.set(6007, () => new OnlyRevertError());
|
|
9894
9934
|
createErrorFromNameLookup3.set("OnlyRevert", () => new OnlyRevertError());
|
|
9895
|
-
function
|
|
9935
|
+
function errorFromCode2(code) {
|
|
9896
9936
|
const createError = createErrorFromCodeLookup3.get(code);
|
|
9897
9937
|
return createError != null ? createError() : null;
|
|
9898
9938
|
}
|
|
9899
|
-
function
|
|
9939
|
+
function errorFromName2(name) {
|
|
9900
9940
|
const createError = createErrorFromNameLookup3.get(name);
|
|
9901
9941
|
return createError != null ? createError() : null;
|
|
9902
9942
|
}
|
|
9903
9943
|
|
|
9904
9944
|
// src/generated/simple_messagelib/instructions/index.ts
|
|
9905
|
-
var
|
|
9906
|
-
__export(
|
|
9945
|
+
var instructions_exports3 = {};
|
|
9946
|
+
__export(instructions_exports3, {
|
|
9907
9947
|
createInitConfigInstruction: () => createInitConfigInstruction2,
|
|
9908
9948
|
createInitConfigInstructionAccounts: () => createInitConfigInstructionAccounts2,
|
|
9909
9949
|
createInitDefaultConfigInstruction: () => createInitDefaultConfigInstruction,
|
|
@@ -11228,8 +11268,8 @@ function createWithdrawFeesInstructionAccounts(accounts, programId = new web35__
|
|
|
11228
11268
|
}
|
|
11229
11269
|
|
|
11230
11270
|
// src/generated/simple_messagelib/types/index.ts
|
|
11231
|
-
var
|
|
11232
|
-
__export(
|
|
11271
|
+
var types_exports3 = {};
|
|
11272
|
+
__export(types_exports3, {
|
|
11233
11273
|
initConfigParamsBeet: () => initConfigParamsBeet2,
|
|
11234
11274
|
initDefaultConfigParamsBeet: () => initDefaultConfigParamsBeet,
|
|
11235
11275
|
initMessageLibParamsBeet: () => initMessageLibParamsBeet,
|
|
@@ -11349,36 +11389,21 @@ var SimpleMessageLib = class {
|
|
|
11349
11389
|
*/
|
|
11350
11390
|
async getSendIXAccountMetaForCPI(_connection, payer, _path) {
|
|
11351
11391
|
const [msgLib] = this.deriver.messageLib();
|
|
11352
|
-
const
|
|
11392
|
+
const cpiAccounts = createSendInstructionAccounts3(
|
|
11353
11393
|
{
|
|
11354
11394
|
endpoint: web35.PublicKey.default,
|
|
11355
11395
|
// useless
|
|
11356
11396
|
messageLib: msgLib,
|
|
11357
11397
|
payer
|
|
11358
11398
|
},
|
|
11359
|
-
|
|
11360
|
-
{
|
|
11361
|
-
params: {
|
|
11362
|
-
packet: {
|
|
11363
|
-
nonce: 0,
|
|
11364
|
-
srcEid: 0,
|
|
11365
|
-
sender: web35.PublicKey.default,
|
|
11366
|
-
dstEid: 0,
|
|
11367
|
-
receiver: Array.from(web35.PublicKey.default.toBytes()),
|
|
11368
|
-
message: Uint8Array.from(Buffer.from("test")),
|
|
11369
|
-
guid: Array.from(web35.PublicKey.default.toBytes())
|
|
11370
|
-
},
|
|
11371
|
-
options: Uint8Array.from(Buffer.from("test")),
|
|
11372
|
-
nativeFee: 0
|
|
11373
|
-
}
|
|
11374
|
-
}
|
|
11399
|
+
this.program
|
|
11375
11400
|
);
|
|
11376
|
-
|
|
11401
|
+
cpiAccounts.forEach((key) => {
|
|
11377
11402
|
if (!payer.equals(key.pubkey)) {
|
|
11378
11403
|
key.isSigner = false;
|
|
11379
11404
|
}
|
|
11380
11405
|
});
|
|
11381
|
-
return Promise.resolve(
|
|
11406
|
+
return Promise.resolve(cpiAccounts.slice(1));
|
|
11382
11407
|
}
|
|
11383
11408
|
async getQuoteIXAccountMetaForCPI(_connection, _payer, _path, _commitment) {
|
|
11384
11409
|
const [msgLib] = this.deriver.messageLib();
|
|
@@ -11414,7 +11439,7 @@ var SimpleMessageLib = class {
|
|
|
11414
11439
|
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
11415
11440
|
const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
|
|
11416
11441
|
const [messageLib] = this.deriver.messageLib();
|
|
11417
|
-
const
|
|
11442
|
+
const keys = createInitConfigInstructionAccounts2(
|
|
11418
11443
|
{
|
|
11419
11444
|
endpoint: web35.PublicKey.default,
|
|
11420
11445
|
// useless
|
|
@@ -11423,23 +11448,30 @@ var SimpleMessageLib = class {
|
|
|
11423
11448
|
sendConfig,
|
|
11424
11449
|
receiveConfig
|
|
11425
11450
|
},
|
|
11426
|
-
|
|
11427
|
-
{
|
|
11428
|
-
params: {
|
|
11429
|
-
eid,
|
|
11430
|
-
oapp: oappID
|
|
11431
|
-
}
|
|
11432
|
-
}
|
|
11451
|
+
this.program
|
|
11433
11452
|
);
|
|
11434
|
-
|
|
11453
|
+
keys.forEach((key) => {
|
|
11435
11454
|
if (!payer.equals(key.pubkey)) {
|
|
11436
11455
|
key.isSigner = false;
|
|
11437
11456
|
}
|
|
11438
11457
|
});
|
|
11439
|
-
return Promise.resolve(
|
|
11458
|
+
return Promise.resolve(keys.slice(1));
|
|
11440
11459
|
}
|
|
11441
|
-
async getSetConfigIXAccountMetaForCPI(
|
|
11442
|
-
|
|
11460
|
+
async getSetConfigIXAccountMetaForCPI(endpointProgram, oappID, eid) {
|
|
11461
|
+
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
11462
|
+
const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
|
|
11463
|
+
const [msgLib] = this.deriver.messageLib();
|
|
11464
|
+
const accounts = createSetConfigInstructionAccounts2(
|
|
11465
|
+
{
|
|
11466
|
+
endpoint: web35.PublicKey.default,
|
|
11467
|
+
// useless
|
|
11468
|
+
sendConfig,
|
|
11469
|
+
receiveConfig,
|
|
11470
|
+
messageLib: msgLib
|
|
11471
|
+
},
|
|
11472
|
+
this.program
|
|
11473
|
+
);
|
|
11474
|
+
return Promise.resolve(accounts.slice(1));
|
|
11443
11475
|
}
|
|
11444
11476
|
};
|
|
11445
11477
|
|
|
@@ -11487,7 +11519,7 @@ __export(uln_exports, {
|
|
|
11487
11519
|
VerifyingError: () => VerifyingError,
|
|
11488
11520
|
ZeroMessageSizeError: () => ZeroMessageSizeError,
|
|
11489
11521
|
accountProviders: () => accountProviders6,
|
|
11490
|
-
accounts: () =>
|
|
11522
|
+
accounts: () => accounts_exports6,
|
|
11491
11523
|
commitVerificationInstructionDiscriminator: () => commitVerificationInstructionDiscriminator,
|
|
11492
11524
|
commitVerificationParamsBeet: () => commitVerificationParamsBeet,
|
|
11493
11525
|
commitVerificationStruct: () => commitVerificationStruct,
|
|
@@ -11524,8 +11556,8 @@ __export(uln_exports, {
|
|
|
11524
11556
|
createVersionInstructionAccounts: () => createVersionInstructionAccounts3,
|
|
11525
11557
|
createWithdrawRentInstruction: () => createWithdrawRentInstruction2,
|
|
11526
11558
|
createWithdrawRentInstructionAccounts: () => createWithdrawRentInstructionAccounts2,
|
|
11527
|
-
errorFromCode: () =>
|
|
11528
|
-
errorFromName: () =>
|
|
11559
|
+
errorFromCode: () => errorFromCode5,
|
|
11560
|
+
errorFromName: () => errorFromName5,
|
|
11529
11561
|
errors: () => errors_exports4,
|
|
11530
11562
|
events: () => events_exports4,
|
|
11531
11563
|
executorConfigBeet: () => executorConfigBeet2,
|
|
@@ -11541,7 +11573,7 @@ __export(uln_exports, {
|
|
|
11541
11573
|
initVerifyInstructionDiscriminator: () => initVerifyInstructionDiscriminator2,
|
|
11542
11574
|
initVerifyParamsBeet: () => initVerifyParamsBeet2,
|
|
11543
11575
|
initVerifyStruct: () => initVerifyStruct2,
|
|
11544
|
-
instructions: () =>
|
|
11576
|
+
instructions: () => instructions_exports6,
|
|
11545
11577
|
isConfigExecutor: () => isConfigExecutor,
|
|
11546
11578
|
isConfigReceiveUln: () => isConfigReceiveUln,
|
|
11547
11579
|
isConfigSendUln: () => isConfigSendUln,
|
|
@@ -11575,7 +11607,7 @@ __export(uln_exports, {
|
|
|
11575
11607
|
transferAdminStruct: () => transferAdminStruct4,
|
|
11576
11608
|
treasuryBeet: () => treasuryBeet,
|
|
11577
11609
|
treasuryFeeBeet: () => treasuryFeeBeet,
|
|
11578
|
-
types: () =>
|
|
11610
|
+
types: () => types_exports6,
|
|
11579
11611
|
ulnConfigBeet: () => ulnConfigBeet2,
|
|
11580
11612
|
ulnSettingsBeet: () => ulnSettingsBeet,
|
|
11581
11613
|
ulnSettingsDiscriminator: () => ulnSettingsDiscriminator,
|
|
@@ -11597,11 +11629,11 @@ __export(dvn_exports2, {
|
|
|
11597
11629
|
DVN: () => DVN,
|
|
11598
11630
|
PROGRAM_ID: () => PROGRAM_ID4,
|
|
11599
11631
|
SolanaSignerExt: () => SolanaSignerExt,
|
|
11600
|
-
accounts: () =>
|
|
11632
|
+
accounts: () => accounts_exports4,
|
|
11601
11633
|
errors: () => errors_exports3,
|
|
11602
11634
|
events: () => events_exports2,
|
|
11603
|
-
instructions: () =>
|
|
11604
|
-
types: () =>
|
|
11635
|
+
instructions: () => instructions_exports4,
|
|
11636
|
+
types: () => types_exports4
|
|
11605
11637
|
});
|
|
11606
11638
|
|
|
11607
11639
|
// src/generated/dvn/index.ts
|
|
@@ -11653,8 +11685,8 @@ __export(dvn_exports, {
|
|
|
11653
11685
|
dstConfigBeet: () => dstConfigBeet,
|
|
11654
11686
|
dvnConfigBeet: () => dvnConfigBeet,
|
|
11655
11687
|
dvnConfigDiscriminator: () => dvnConfigDiscriminator,
|
|
11656
|
-
errorFromCode: () =>
|
|
11657
|
-
errorFromName: () =>
|
|
11688
|
+
errorFromCode: () => errorFromCode3,
|
|
11689
|
+
errorFromName: () => errorFromName3,
|
|
11658
11690
|
executeHashBeet: () => executeHashBeet,
|
|
11659
11691
|
executeHashDiscriminator: () => executeHashDiscriminator,
|
|
11660
11692
|
executeTransactionDigestBeet: () => executeTransactionDigestBeet,
|
|
@@ -11698,8 +11730,8 @@ __export(dvn_exports, {
|
|
|
11698
11730
|
});
|
|
11699
11731
|
|
|
11700
11732
|
// src/generated/dvn/accounts/index.ts
|
|
11701
|
-
var
|
|
11702
|
-
__export(
|
|
11733
|
+
var accounts_exports4 = {};
|
|
11734
|
+
__export(accounts_exports4, {
|
|
11703
11735
|
DvnConfig: () => DvnConfig,
|
|
11704
11736
|
ExecuteHash: () => ExecuteHash,
|
|
11705
11737
|
ReceiveConfig: () => ReceiveConfig,
|
|
@@ -12149,8 +12181,8 @@ __export(errors_exports3, {
|
|
|
12149
12181
|
TooManyOptionTypesError: () => TooManyOptionTypesError,
|
|
12150
12182
|
UnexpiredExecuteHashError: () => UnexpiredExecuteHashError,
|
|
12151
12183
|
UniqueOwnersError: () => UniqueOwnersError,
|
|
12152
|
-
errorFromCode: () =>
|
|
12153
|
-
errorFromName: () =>
|
|
12184
|
+
errorFromCode: () => errorFromCode3,
|
|
12185
|
+
errorFromName: () => errorFromName3
|
|
12154
12186
|
});
|
|
12155
12187
|
var createErrorFromCodeLookup4 = /* @__PURE__ */ new Map();
|
|
12156
12188
|
var createErrorFromNameLookup4 = /* @__PURE__ */ new Map();
|
|
@@ -12382,18 +12414,18 @@ createErrorFromNameLookup4.set(
|
|
|
12382
12414
|
"EidNotSupported",
|
|
12383
12415
|
() => new EidNotSupportedError()
|
|
12384
12416
|
);
|
|
12385
|
-
function
|
|
12417
|
+
function errorFromCode3(code) {
|
|
12386
12418
|
const createError = createErrorFromCodeLookup4.get(code);
|
|
12387
12419
|
return createError != null ? createError() : null;
|
|
12388
12420
|
}
|
|
12389
|
-
function
|
|
12421
|
+
function errorFromName3(name) {
|
|
12390
12422
|
const createError = createErrorFromNameLookup4.get(name);
|
|
12391
12423
|
return createError != null ? createError() : null;
|
|
12392
12424
|
}
|
|
12393
12425
|
|
|
12394
12426
|
// src/generated/dvn/instructions/index.ts
|
|
12395
|
-
var
|
|
12396
|
-
__export(
|
|
12427
|
+
var instructions_exports4 = {};
|
|
12428
|
+
__export(instructions_exports4, {
|
|
12397
12429
|
closeExecuteInstructionDiscriminator: () => closeExecuteInstructionDiscriminator,
|
|
12398
12430
|
closeExecuteStruct: () => closeExecuteStruct,
|
|
12399
12431
|
createCloseExecuteInstruction: () => createCloseExecuteInstruction,
|
|
@@ -13148,8 +13180,8 @@ function createWithdrawFeeInstructionAccounts(accounts, programId = new web35__n
|
|
|
13148
13180
|
}
|
|
13149
13181
|
|
|
13150
13182
|
// src/generated/dvn/types/index.ts
|
|
13151
|
-
var
|
|
13152
|
-
__export(
|
|
13183
|
+
var types_exports4 = {};
|
|
13184
|
+
__export(types_exports4, {
|
|
13153
13185
|
VerificationState: () => VerificationState,
|
|
13154
13186
|
aclBeet: () => aclBeet,
|
|
13155
13187
|
adminConfigBeet: () => adminConfigBeet,
|
|
@@ -13649,7 +13681,7 @@ __export(executor_exports, {
|
|
|
13649
13681
|
ZeroLzComposeGasProvidedError: () => ZeroLzComposeGasProvidedError,
|
|
13650
13682
|
ZeroLzReceiveGasProvidedError: () => ZeroLzReceiveGasProvidedError,
|
|
13651
13683
|
accountProviders: () => accountProviders5,
|
|
13652
|
-
accounts: () =>
|
|
13684
|
+
accounts: () => accounts_exports5,
|
|
13653
13685
|
aclBeet: () => aclBeet2,
|
|
13654
13686
|
adminSetConfigInstructionDiscriminator: () => adminSetConfigInstructionDiscriminator,
|
|
13655
13687
|
adminSetConfigParamsBeet: () => adminSetConfigParamsBeet,
|
|
@@ -13674,8 +13706,8 @@ __export(executor_exports, {
|
|
|
13674
13706
|
createQuoteExecutorInstruction: () => createQuoteExecutorInstruction,
|
|
13675
13707
|
createQuoteExecutorInstructionAccounts: () => createQuoteExecutorInstructionAccounts,
|
|
13676
13708
|
dstConfigBeet: () => dstConfigBeet2,
|
|
13677
|
-
errorFromCode: () =>
|
|
13678
|
-
errorFromName: () =>
|
|
13709
|
+
errorFromCode: () => errorFromCode4,
|
|
13710
|
+
errorFromName: () => errorFromName4,
|
|
13679
13711
|
events: () => events_exports3,
|
|
13680
13712
|
executableInstructionDiscriminator: () => executableInstructionDiscriminator,
|
|
13681
13713
|
executableParamsBeet: () => executableParamsBeet,
|
|
@@ -13689,7 +13721,7 @@ __export(executor_exports, {
|
|
|
13689
13721
|
initExecutorInstructionDiscriminator: () => initExecutorInstructionDiscriminator,
|
|
13690
13722
|
initExecutorParamsBeet: () => initExecutorParamsBeet,
|
|
13691
13723
|
initExecutorStruct: () => initExecutorStruct,
|
|
13692
|
-
instructions: () =>
|
|
13724
|
+
instructions: () => instructions_exports5,
|
|
13693
13725
|
isAdminSetConfigParamsDefaultMultiplierBps: () => isAdminSetConfigParamsDefaultMultiplierBps,
|
|
13694
13726
|
isAdminSetConfigParamsDstConfigs: () => isAdminSetConfigParamsDstConfigs,
|
|
13695
13727
|
isAdminSetConfigParamsPriceFeed: () => isAdminSetConfigParamsPriceFeed,
|
|
@@ -13715,12 +13747,12 @@ __export(executor_exports, {
|
|
|
13715
13747
|
quoteExecutorInstructionDiscriminator: () => quoteExecutorInstructionDiscriminator,
|
|
13716
13748
|
quoteExecutorParamsBeet: () => quoteExecutorParamsBeet,
|
|
13717
13749
|
quoteExecutorStruct: () => quoteExecutorStruct,
|
|
13718
|
-
types: () =>
|
|
13750
|
+
types: () => types_exports5
|
|
13719
13751
|
});
|
|
13720
13752
|
|
|
13721
13753
|
// src/generated/executor/accounts/index.ts
|
|
13722
|
-
var
|
|
13723
|
-
__export(
|
|
13754
|
+
var accounts_exports5 = {};
|
|
13755
|
+
__export(accounts_exports5, {
|
|
13724
13756
|
ExecutorConfig: () => ExecutorConfig,
|
|
13725
13757
|
Nonce: () => Nonce2,
|
|
13726
13758
|
accountProviders: () => accountProviders5,
|
|
@@ -14059,8 +14091,8 @@ var nativeDropAppliedEventBeet = new beet201__namespace.FixableBeetArgsStruct(
|
|
|
14059
14091
|
);
|
|
14060
14092
|
|
|
14061
14093
|
// src/generated/executor/instructions/index.ts
|
|
14062
|
-
var
|
|
14063
|
-
__export(
|
|
14094
|
+
var instructions_exports5 = {};
|
|
14095
|
+
__export(instructions_exports5, {
|
|
14064
14096
|
adminSetConfigInstructionDiscriminator: () => adminSetConfigInstructionDiscriminator,
|
|
14065
14097
|
adminSetConfigStruct: () => adminSetConfigStruct,
|
|
14066
14098
|
composeInstructionDiscriminator: () => composeInstructionDiscriminator,
|
|
@@ -14946,8 +14978,8 @@ function createQuoteExecutorInstructionAccounts(accounts, programId = new web35_
|
|
|
14946
14978
|
}
|
|
14947
14979
|
|
|
14948
14980
|
// src/generated/executor/types/index.ts
|
|
14949
|
-
var
|
|
14950
|
-
__export(
|
|
14981
|
+
var types_exports5 = {};
|
|
14982
|
+
__export(types_exports5, {
|
|
14951
14983
|
ExecutionState: () => ExecutionState,
|
|
14952
14984
|
aclBeet: () => aclBeet2,
|
|
14953
14985
|
adminSetConfigParamsBeet: () => adminSetConfigParamsBeet,
|
|
@@ -15345,7 +15377,7 @@ async function isAccountInitialized(connection, account, commitmentOrConfig) {
|
|
|
15345
15377
|
async function buildMessageV0(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash) {
|
|
15346
15378
|
return new web35.TransactionMessage({
|
|
15347
15379
|
payerKey,
|
|
15348
|
-
recentBlockhash: blockhash ?? (await connection.getLatestBlockhash()).blockhash,
|
|
15380
|
+
recentBlockhash: blockhash ?? (await connection.getLatestBlockhash(commitmentOrConfig)).blockhash,
|
|
15349
15381
|
instructions
|
|
15350
15382
|
}).compileToV0Message();
|
|
15351
15383
|
}
|
|
@@ -15772,11 +15804,11 @@ createErrorFromNameLookup5.set(
|
|
|
15772
15804
|
"ExecutorIsAdmin",
|
|
15773
15805
|
() => new ExecutorIsAdminError()
|
|
15774
15806
|
);
|
|
15775
|
-
function
|
|
15807
|
+
function errorFromCode4(code) {
|
|
15776
15808
|
const createError = createErrorFromCodeLookup5.get(code);
|
|
15777
15809
|
return createError != null ? createError() : null;
|
|
15778
15810
|
}
|
|
15779
|
-
function
|
|
15811
|
+
function errorFromName4(name) {
|
|
15780
15812
|
const createError = createErrorFromNameLookup5.get(name);
|
|
15781
15813
|
return createError != null ? createError() : null;
|
|
15782
15814
|
}
|
|
@@ -16021,7 +16053,7 @@ var Executor = class {
|
|
|
16021
16053
|
}
|
|
16022
16054
|
].concat(ixAccounts);
|
|
16023
16055
|
}
|
|
16024
|
-
async execute(connection, executor, endpointProgram, packet, extraData, value = new
|
|
16056
|
+
async execute(connection, executor, endpointProgram, packet, extraData, value = new BN2__default.default(0), computeUnits = 2e5, commitmentOrConfig) {
|
|
16025
16057
|
const [config] = this.deriver.config();
|
|
16026
16058
|
const endpointEventDeriver = new EventPDADeriver(endpointProgram);
|
|
16027
16059
|
const executorEventDeriver = new EventPDADeriver(this.program);
|
|
@@ -16080,7 +16112,7 @@ var Executor = class {
|
|
|
16080
16112
|
this.program
|
|
16081
16113
|
);
|
|
16082
16114
|
}
|
|
16083
|
-
async compose(connection, executor, endpointProgram, event, extraData, value = new
|
|
16115
|
+
async compose(connection, executor, endpointProgram, event, extraData, value = new BN2__default.default(0), computeUnits = 4e5, commitmentOrConfig) {
|
|
16084
16116
|
const [config] = this.deriver.config();
|
|
16085
16117
|
const endpointEventDeriver = new EventPDADeriver(endpointProgram);
|
|
16086
16118
|
const executorEventDeriver = new EventPDADeriver(this.program);
|
|
@@ -16139,8 +16171,8 @@ var Executor = class {
|
|
|
16139
16171
|
};
|
|
16140
16172
|
|
|
16141
16173
|
// src/generated/uln/accounts/index.ts
|
|
16142
|
-
var
|
|
16143
|
-
__export(
|
|
16174
|
+
var accounts_exports6 = {};
|
|
16175
|
+
__export(accounts_exports6, {
|
|
16144
16176
|
Confirmations: () => Confirmations,
|
|
16145
16177
|
ReceiveConfig: () => ReceiveConfig2,
|
|
16146
16178
|
SendConfig: () => SendConfig,
|
|
@@ -16666,8 +16698,8 @@ __export(errors_exports4, {
|
|
|
16666
16698
|
UnsortedError: () => UnsortedError,
|
|
16667
16699
|
VerifyingError: () => VerifyingError,
|
|
16668
16700
|
ZeroMessageSizeError: () => ZeroMessageSizeError,
|
|
16669
|
-
errorFromCode: () =>
|
|
16670
|
-
errorFromName: () =>
|
|
16701
|
+
errorFromCode: () => errorFromCode5,
|
|
16702
|
+
errorFromName: () => errorFromName5
|
|
16671
16703
|
});
|
|
16672
16704
|
var createErrorFromCodeLookup6 = /* @__PURE__ */ new Map();
|
|
16673
16705
|
var createErrorFromNameLookup6 = /* @__PURE__ */ new Map();
|
|
@@ -17136,18 +17168,18 @@ var InvalidPayerError = class _InvalidPayerError extends Error {
|
|
|
17136
17168
|
};
|
|
17137
17169
|
createErrorFromCodeLookup6.set(6032, () => new InvalidPayerError());
|
|
17138
17170
|
createErrorFromNameLookup6.set("InvalidPayer", () => new InvalidPayerError());
|
|
17139
|
-
function
|
|
17171
|
+
function errorFromCode5(code) {
|
|
17140
17172
|
const createError = createErrorFromCodeLookup6.get(code);
|
|
17141
17173
|
return createError != null ? createError() : null;
|
|
17142
17174
|
}
|
|
17143
|
-
function
|
|
17175
|
+
function errorFromName5(name) {
|
|
17144
17176
|
const createError = createErrorFromNameLookup6.get(name);
|
|
17145
17177
|
return createError != null ? createError() : null;
|
|
17146
17178
|
}
|
|
17147
17179
|
|
|
17148
17180
|
// src/generated/uln/instructions/index.ts
|
|
17149
|
-
var
|
|
17150
|
-
__export(
|
|
17181
|
+
var instructions_exports6 = {};
|
|
17182
|
+
__export(instructions_exports6, {
|
|
17151
17183
|
commitVerificationInstructionDiscriminator: () => commitVerificationInstructionDiscriminator,
|
|
17152
17184
|
commitVerificationStruct: () => commitVerificationStruct,
|
|
17153
17185
|
createCommitVerificationInstruction: () => createCommitVerificationInstruction,
|
|
@@ -18802,8 +18834,8 @@ function createWithdrawRentInstructionAccounts2(accounts, programId = new web35_
|
|
|
18802
18834
|
}
|
|
18803
18835
|
|
|
18804
18836
|
// src/generated/uln/types/index.ts
|
|
18805
|
-
var
|
|
18806
|
-
__export(
|
|
18837
|
+
var types_exports6 = {};
|
|
18838
|
+
__export(types_exports6, {
|
|
18807
18839
|
commitVerificationParamsBeet: () => commitVerificationParamsBeet,
|
|
18808
18840
|
configBeet: () => configBeet,
|
|
18809
18841
|
executorConfigBeet: () => executorConfigBeet2,
|
|
@@ -19150,7 +19182,7 @@ var Uln = class {
|
|
|
19150
19182
|
params: {
|
|
19151
19183
|
packetHeader: Array.from(Uint8Array.from(Buffer.from(packet.header().slice(2), "hex"))),
|
|
19152
19184
|
payloadHash: Array.from(payloadHashBytes),
|
|
19153
|
-
confirmations: typeof confirmations === "string" ? new
|
|
19185
|
+
confirmations: typeof confirmations === "string" ? new BN2__default.default(confirmations) : confirmations
|
|
19154
19186
|
}
|
|
19155
19187
|
},
|
|
19156
19188
|
this.program
|
|
@@ -19353,14 +19385,14 @@ var pricefeed_exports = {};
|
|
|
19353
19385
|
__export(pricefeed_exports, {
|
|
19354
19386
|
PROGRAM_ID: () => PROGRAM_ID7,
|
|
19355
19387
|
PriceFeed: () => PriceFeed2,
|
|
19356
|
-
accounts: () =>
|
|
19357
|
-
instructions: () =>
|
|
19358
|
-
types: () =>
|
|
19388
|
+
accounts: () => accounts_exports7,
|
|
19389
|
+
instructions: () => instructions_exports7,
|
|
19390
|
+
types: () => types_exports7
|
|
19359
19391
|
});
|
|
19360
19392
|
|
|
19361
19393
|
// src/generated/pricefeed/accounts/index.ts
|
|
19362
|
-
var
|
|
19363
|
-
__export(
|
|
19394
|
+
var accounts_exports7 = {};
|
|
19395
|
+
__export(accounts_exports7, {
|
|
19364
19396
|
PriceFeed: () => PriceFeed,
|
|
19365
19397
|
accountProviders: () => accountProviders7,
|
|
19366
19398
|
priceFeedBeet: () => priceFeedBeet,
|
|
@@ -19560,8 +19592,8 @@ var priceFeedBeet = new beet201__namespace.FixableBeetStruct(
|
|
|
19560
19592
|
var accountProviders7 = { PriceFeed };
|
|
19561
19593
|
|
|
19562
19594
|
// src/generated/pricefeed/instructions/index.ts
|
|
19563
|
-
var
|
|
19564
|
-
__export(
|
|
19595
|
+
var instructions_exports7 = {};
|
|
19596
|
+
__export(instructions_exports7, {
|
|
19565
19597
|
createGetFeeInstruction: () => createGetFeeInstruction,
|
|
19566
19598
|
createGetFeeInstructionAccounts: () => createGetFeeInstructionAccounts,
|
|
19567
19599
|
createInitPriceFeedInstruction: () => createInitPriceFeedInstruction,
|
|
@@ -20046,8 +20078,8 @@ function createTransferAdminInstructionAccounts5(accounts, programId = new web35
|
|
|
20046
20078
|
}
|
|
20047
20079
|
|
|
20048
20080
|
// src/generated/pricefeed/types/index.ts
|
|
20049
|
-
var
|
|
20050
|
-
__export(
|
|
20081
|
+
var types_exports7 = {};
|
|
20082
|
+
__export(types_exports7, {
|
|
20051
20083
|
getFeeParamsBeet: () => getFeeParamsBeet,
|
|
20052
20084
|
initPriceFeedParamsBeet: () => initPriceFeedParamsBeet,
|
|
20053
20085
|
isModelTypeArbitrum: () => isModelTypeArbitrum,
|
|
@@ -20221,11 +20253,9 @@ var PriceFeed2 = class {
|
|
|
20221
20253
|
}
|
|
20222
20254
|
};
|
|
20223
20255
|
|
|
20224
|
-
// src/
|
|
20225
|
-
var
|
|
20226
|
-
__export(
|
|
20227
|
-
ConfigType: () => ConfigType,
|
|
20228
|
-
OFT_SEED: () => OFT_SEED2,
|
|
20256
|
+
// src/oft-tools.ts
|
|
20257
|
+
var oft_tools_exports = {};
|
|
20258
|
+
__export(oft_tools_exports, {
|
|
20229
20259
|
SOLANA_EID: () => SOLANA_EID,
|
|
20230
20260
|
createInitAdapterOftIx: () => createInitAdapterOftIx,
|
|
20231
20261
|
createInitConfigIx: () => createInitConfigIx,
|
|
@@ -20248,211 +20278,443 @@ __export(OftTools_exports, {
|
|
|
20248
20278
|
getEndpointConfig: () => getEndpointConfig,
|
|
20249
20279
|
getEnforcedOptions: () => getEnforcedOptions,
|
|
20250
20280
|
getPeerAddress: () => getPeerAddress,
|
|
20251
|
-
isAccountInitialized: () => isAccountInitialized2,
|
|
20252
20281
|
quoteOft: () => quoteOft,
|
|
20253
20282
|
quoteWithUln: () => quoteWithUln,
|
|
20254
20283
|
sendWithUln: () => sendWithUln
|
|
20255
20284
|
});
|
|
20256
|
-
|
|
20257
|
-
|
|
20258
|
-
var
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
var
|
|
20268
|
-
var
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
return res !== null;
|
|
20281
|
-
});
|
|
20282
|
-
}
|
|
20283
|
-
async function createNonceTx(connection, nonceAccount, nonceAuthority, instructions, commitmentOrConfig = "confirmed") {
|
|
20284
|
-
const nonceAccountInfo = await connection.getNonce(nonceAccount, commitmentOrConfig);
|
|
20285
|
-
if (nonceAccountInfo === null) {
|
|
20286
|
-
throw new Error("Invalid nonce account");
|
|
20285
|
+
|
|
20286
|
+
// src/oft.ts
|
|
20287
|
+
var oft_exports = {};
|
|
20288
|
+
__export(oft_exports, {
|
|
20289
|
+
OFT_DECIMALS: () => OFT_DECIMALS,
|
|
20290
|
+
OFT_DEFAULT_PROGRAM_ID: () => PROGRAM_ID,
|
|
20291
|
+
Oft: () => Oft,
|
|
20292
|
+
accounts: () => accounts_exports,
|
|
20293
|
+
instructions: () => instructions_exports,
|
|
20294
|
+
types: () => types_exports
|
|
20295
|
+
});
|
|
20296
|
+
var OFT_DECIMALS = 6;
|
|
20297
|
+
var Oft = class {
|
|
20298
|
+
constructor(program, endpointProgram, _tokenProgram, mintKp, escrowKp) {
|
|
20299
|
+
this.program = program;
|
|
20300
|
+
this.endpointProgram = endpointProgram;
|
|
20301
|
+
this.deriver = new OftPDADeriver(this.program);
|
|
20302
|
+
this.endpoint = new endpoint_exports.Endpoint(endpointProgram);
|
|
20303
|
+
const [eventAuthorityPDA] = new EventPDADeriver(this.program).eventAuthority();
|
|
20304
|
+
this.eventAuthorityPDA = eventAuthorityPDA;
|
|
20305
|
+
this.mintKp = mintKp;
|
|
20306
|
+
this.escrowKp = escrowKp;
|
|
20307
|
+
this.isAdapter = escrowKp !== void 0;
|
|
20308
|
+
this.tokenProgram = _tokenProgram;
|
|
20287
20309
|
}
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
authorizedPubkey: nonceAuthority
|
|
20292
|
-
});
|
|
20293
|
-
return new web35.Transaction({
|
|
20294
|
-
recentBlockhash: nonce,
|
|
20295
|
-
nonceInfo: {
|
|
20296
|
-
nonce,
|
|
20297
|
-
nonceInstruction: nonceAdvanceIx
|
|
20298
|
-
}
|
|
20299
|
-
}).add(...instructions);
|
|
20300
|
-
}
|
|
20301
|
-
async function createInitAdapterOftIx(payer, admin, mint, lzDelegate, escrow, sharedDecimals = 6, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20302
|
-
const [oftConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20303
|
-
[Buffer.from(OFT_SEED2, "utf-8"), escrow.toBuffer()],
|
|
20304
|
-
PROGRAM_ID
|
|
20305
|
-
);
|
|
20306
|
-
const [oAppRegistry] = web35.PublicKey.findProgramAddressSync(
|
|
20307
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20308
|
-
PROGRAM_ID2
|
|
20309
|
-
);
|
|
20310
|
-
const [endpointEventAuthority] = web35.PublicKey.findProgramAddressSync(
|
|
20311
|
-
[Buffer.from(EVENT_SEED2, "utf-8")],
|
|
20312
|
-
PROGRAM_ID2
|
|
20313
|
-
);
|
|
20314
|
-
const [lzReceiveTypes] = web35.PublicKey.findProgramAddressSync(
|
|
20315
|
-
[Buffer.from(LZ_RECEIVE_TYPES_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20316
|
-
PROGRAM_ID
|
|
20317
|
-
);
|
|
20318
|
-
const registerOappIx = createRegisterOappInstruction(
|
|
20319
|
-
{
|
|
20320
|
-
payer,
|
|
20321
|
-
oapp: oftConfig,
|
|
20322
|
-
oappRegistry: oAppRegistry,
|
|
20323
|
-
eventAuthority: endpointEventAuthority,
|
|
20324
|
-
program: PROGRAM_ID
|
|
20325
|
-
},
|
|
20326
|
-
{
|
|
20327
|
-
params: {
|
|
20328
|
-
delegate: lzDelegate
|
|
20329
|
-
}
|
|
20310
|
+
getOftConfig() {
|
|
20311
|
+
if (this.isAdapter) {
|
|
20312
|
+
return this.deriver.oftConfig(this.escrowKp)[0];
|
|
20330
20313
|
}
|
|
20331
|
-
|
|
20332
|
-
for (const acc of registerOappIx.keys) {
|
|
20333
|
-
acc.isSigner = false;
|
|
20314
|
+
return this.deriver.oftConfig(this.mintKp)[0];
|
|
20334
20315
|
}
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20316
|
+
async getVersion() {
|
|
20317
|
+
return Promise.resolve([createVersionInstruction(this.program)]);
|
|
20318
|
+
}
|
|
20319
|
+
async setDelegate(admin, delegate) {
|
|
20320
|
+
const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
|
|
20321
|
+
const oftConfig = this.getOftConfig();
|
|
20322
|
+
const [oAppRegistry] = this.endpoint.endpointDeriver.oappRegistry(oftConfig);
|
|
20323
|
+
const endpointSetDelegateKeys = endpoint_exports.instructions.createSetDelegateInstructionAccounts(
|
|
20324
|
+
{
|
|
20325
|
+
oapp: oftConfig,
|
|
20326
|
+
oappRegistry: oAppRegistry,
|
|
20327
|
+
eventAuthority: endpointEventAuthority,
|
|
20328
|
+
program: this.endpointProgram
|
|
20329
|
+
},
|
|
20330
|
+
this.endpointProgram
|
|
20331
|
+
);
|
|
20332
|
+
for (const acc of endpointSetDelegateKeys) {
|
|
20333
|
+
acc.isSigner = false;
|
|
20334
|
+
}
|
|
20335
|
+
const ix = createSetDelegateInstruction(
|
|
20336
|
+
{
|
|
20337
|
+
admin,
|
|
20338
|
+
oftConfig: this.getOftConfig(),
|
|
20339
|
+
anchorRemainingAccounts: [
|
|
20340
|
+
{
|
|
20341
|
+
pubkey: this.endpointProgram,
|
|
20342
|
+
isSigner: false,
|
|
20343
|
+
isWritable: false
|
|
20344
|
+
},
|
|
20345
|
+
...endpointSetDelegateKeys
|
|
20346
|
+
]
|
|
20347
|
+
},
|
|
20348
|
+
{
|
|
20349
|
+
params: {
|
|
20350
|
+
delegate
|
|
20360
20351
|
}
|
|
20352
|
+
},
|
|
20353
|
+
this.program
|
|
20354
|
+
);
|
|
20355
|
+
return Promise.resolve(ix);
|
|
20356
|
+
}
|
|
20357
|
+
async initOft(connection, payer, admin) {
|
|
20358
|
+
const oftConfig = this.getOftConfig();
|
|
20359
|
+
const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
|
|
20360
|
+
const [oAppRegistry] = this.endpoint.endpointDeriver.oappRegistry(oftConfig);
|
|
20361
|
+
const [lzReceiveTypes] = web35.PublicKey.findProgramAddressSync(
|
|
20362
|
+
[Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
|
|
20363
|
+
this.program
|
|
20364
|
+
);
|
|
20365
|
+
const registerOappIxKeys = endpoint_exports.instructions.createRegisterOappInstructionAccounts(
|
|
20366
|
+
{
|
|
20367
|
+
payer: admin,
|
|
20368
|
+
oapp: oftConfig,
|
|
20369
|
+
oappRegistry: oAppRegistry,
|
|
20370
|
+
eventAuthority: endpointEventAuthority,
|
|
20371
|
+
program: this.program
|
|
20372
|
+
},
|
|
20373
|
+
this.program
|
|
20374
|
+
);
|
|
20375
|
+
for (const acc of registerOappIxKeys) {
|
|
20376
|
+
acc.isSigner = false;
|
|
20377
|
+
}
|
|
20378
|
+
const ret = [
|
|
20379
|
+
web35.SystemProgram.createAccount({
|
|
20380
|
+
fromPubkey: admin,
|
|
20381
|
+
newAccountPubkey: this.mintKp,
|
|
20382
|
+
space: splToken.getMintLen([]),
|
|
20383
|
+
lamports: await connection.getMinimumBalanceForRentExemption(splToken.getMintLen([])),
|
|
20384
|
+
programId: this.tokenProgram
|
|
20385
|
+
}),
|
|
20386
|
+
splToken.createInitializeMintInstruction(
|
|
20387
|
+
this.mintKp,
|
|
20388
|
+
OFT_DECIMALS,
|
|
20389
|
+
this.isAdapter ? admin : oftConfig,
|
|
20390
|
+
null,
|
|
20391
|
+
this.tokenProgram
|
|
20361
20392
|
)
|
|
20362
|
-
|
|
20363
|
-
{
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20393
|
+
];
|
|
20394
|
+
if (this.isAdapter) {
|
|
20395
|
+
return ret.concat(
|
|
20396
|
+
createInitAdapterOftInstruction(
|
|
20397
|
+
{
|
|
20398
|
+
payer,
|
|
20399
|
+
oftConfig,
|
|
20400
|
+
tokenMint: this.mintKp,
|
|
20401
|
+
tokenEscrow: this.escrowKp,
|
|
20402
|
+
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20403
|
+
tokenProgram: this.tokenProgram,
|
|
20404
|
+
anchorRemainingAccounts: [
|
|
20405
|
+
{
|
|
20406
|
+
pubkey: this.endpointProgram,
|
|
20407
|
+
isSigner: false,
|
|
20408
|
+
isWritable: false
|
|
20409
|
+
}
|
|
20410
|
+
].concat(
|
|
20411
|
+
...registerOappIxKeys,
|
|
20412
|
+
{
|
|
20413
|
+
pubkey: endpointEventAuthority,
|
|
20414
|
+
isSigner: false,
|
|
20415
|
+
isWritable: false
|
|
20416
|
+
},
|
|
20417
|
+
{
|
|
20418
|
+
pubkey: this.endpointProgram,
|
|
20419
|
+
isSigner: false,
|
|
20420
|
+
isWritable: false
|
|
20421
|
+
}
|
|
20422
|
+
)
|
|
20423
|
+
},
|
|
20424
|
+
{
|
|
20425
|
+
params: {
|
|
20426
|
+
admin,
|
|
20427
|
+
sharedDecimals: OFT_DECIMALS,
|
|
20428
|
+
endpointProgram: this.endpointProgram
|
|
20429
|
+
}
|
|
20430
|
+
}
|
|
20431
|
+
)
|
|
20432
|
+
);
|
|
20433
|
+
} else {
|
|
20434
|
+
return ret.concat(
|
|
20435
|
+
createInitOftInstruction(
|
|
20436
|
+
{
|
|
20437
|
+
payer,
|
|
20438
|
+
oftConfig,
|
|
20439
|
+
tokenMint: this.mintKp,
|
|
20440
|
+
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20441
|
+
tokenProgram: this.tokenProgram,
|
|
20442
|
+
anchorRemainingAccounts: [
|
|
20443
|
+
{
|
|
20444
|
+
pubkey: this.endpointProgram,
|
|
20445
|
+
isSigner: false,
|
|
20446
|
+
isWritable: false
|
|
20447
|
+
}
|
|
20448
|
+
].concat(
|
|
20449
|
+
...registerOappIxKeys,
|
|
20450
|
+
{
|
|
20451
|
+
pubkey: endpointEventAuthority,
|
|
20452
|
+
isSigner: false,
|
|
20453
|
+
isWritable: false
|
|
20454
|
+
},
|
|
20455
|
+
{
|
|
20456
|
+
pubkey: this.endpointProgram,
|
|
20457
|
+
isSigner: false,
|
|
20458
|
+
isWritable: false
|
|
20459
|
+
}
|
|
20460
|
+
)
|
|
20461
|
+
},
|
|
20462
|
+
{
|
|
20463
|
+
params: {
|
|
20464
|
+
admin,
|
|
20465
|
+
sharedDecimals: OFT_DECIMALS,
|
|
20466
|
+
endpointProgram: this.endpointProgram,
|
|
20467
|
+
mintAuthority: admin
|
|
20468
|
+
}
|
|
20469
|
+
},
|
|
20470
|
+
this.program
|
|
20471
|
+
)
|
|
20472
|
+
);
|
|
20473
|
+
}
|
|
20474
|
+
}
|
|
20475
|
+
getAddressB32() {
|
|
20476
|
+
const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
|
|
20477
|
+
const ret = new Uint8Array(32);
|
|
20478
|
+
ret.fill(0).set(oftConfig.toBytes());
|
|
20479
|
+
return ret;
|
|
20480
|
+
}
|
|
20481
|
+
async mint_to(signer, to, amount) {
|
|
20482
|
+
const ix = createMintToInstruction(
|
|
20483
|
+
{
|
|
20484
|
+
minter: signer,
|
|
20485
|
+
oftConfig: this.getOftConfig(),
|
|
20486
|
+
tokenDest: to,
|
|
20487
|
+
tokenMint: this.mintKp,
|
|
20488
|
+
tokenProgram: this.tokenProgram
|
|
20489
|
+
},
|
|
20490
|
+
{
|
|
20491
|
+
params: {
|
|
20492
|
+
amount: new BN2__default.default(amount.toString())
|
|
20493
|
+
}
|
|
20368
20494
|
}
|
|
20495
|
+
);
|
|
20496
|
+
return Promise.resolve(ix);
|
|
20497
|
+
}
|
|
20498
|
+
async setPeer(_peer, admin, dstEid) {
|
|
20499
|
+
const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
|
|
20500
|
+
const [peer] = this.deriver.peer(oftConfig, dstEid);
|
|
20501
|
+
const ix = createSetPeerInstruction(
|
|
20502
|
+
{
|
|
20503
|
+
admin,
|
|
20504
|
+
peer,
|
|
20505
|
+
oftConfig
|
|
20506
|
+
},
|
|
20507
|
+
{
|
|
20508
|
+
params: {
|
|
20509
|
+
dstEid,
|
|
20510
|
+
peer: new Array(32 - _peer.length).fill(0).concat(_peer)
|
|
20511
|
+
}
|
|
20512
|
+
},
|
|
20513
|
+
this.program
|
|
20514
|
+
);
|
|
20515
|
+
return Promise.resolve(ix);
|
|
20516
|
+
}
|
|
20517
|
+
async setEnforcedOptions(admin, send, sendAndCall, dstEid) {
|
|
20518
|
+
const oftConfig = this.getOftConfig();
|
|
20519
|
+
const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
|
|
20520
|
+
const ix = createSetEnforcedOptionsInstruction(
|
|
20521
|
+
{
|
|
20522
|
+
admin,
|
|
20523
|
+
enforcedOptions,
|
|
20524
|
+
oftConfig
|
|
20525
|
+
},
|
|
20526
|
+
{
|
|
20527
|
+
params: {
|
|
20528
|
+
dstEid,
|
|
20529
|
+
send,
|
|
20530
|
+
sendAndCall
|
|
20531
|
+
}
|
|
20532
|
+
},
|
|
20533
|
+
this.program
|
|
20534
|
+
);
|
|
20535
|
+
return Promise.resolve(ix);
|
|
20536
|
+
}
|
|
20537
|
+
async send(connection, payer, tokenSource, to, dstEid, amountLd, minAmountLd, fee, options = new Uint8Array(), composeMsg = null, commitmentOrConfig = "confirmed") {
|
|
20538
|
+
const oftConfig = this.getOftConfig();
|
|
20539
|
+
const [peer] = this.deriver.peer(oftConfig, dstEid);
|
|
20540
|
+
const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
|
|
20541
|
+
const peerinfo = await connection.getAccountInfo(peer);
|
|
20542
|
+
const peerAddress = peerinfo.data.subarray(8, 32 + 8);
|
|
20543
|
+
const msgLibProgram = await this.getSendLibraryProgram(connection, payer, dstEid);
|
|
20544
|
+
const [endpointSettings] = this.endpoint.endpointDeriver.setting();
|
|
20545
|
+
const receiverInfo = await Peer.fromAccountAddress(connection, peer, commitmentOrConfig);
|
|
20546
|
+
const packetPath = {
|
|
20547
|
+
srcEid: 0,
|
|
20548
|
+
dstEid,
|
|
20549
|
+
sender: bytes.hexlify(oftConfig.toBytes()),
|
|
20550
|
+
receiver: bytes.hexlify(receiverInfo.address)
|
|
20551
|
+
};
|
|
20552
|
+
invariant3__default.default(await isAccountInitialized(connection, endpointSettings), "endpointSettings account not initialized");
|
|
20553
|
+
invariant3__default.default(await isAccountInitialized(connection, peer), "peer account not initialized");
|
|
20554
|
+
invariant3__default.default(await isAccountInitialized(connection, enforcedOptions), "enforcedOptions account not initialized");
|
|
20555
|
+
invariant3__default.default(await isAccountInitialized(connection, payer), "payer account not initialized");
|
|
20556
|
+
invariant3__default.default(
|
|
20557
|
+
await isAccountInitialized(
|
|
20558
|
+
connection,
|
|
20559
|
+
this.endpoint.endpointDeriver.nonce(oftConfig, dstEid, peerAddress)[0]
|
|
20560
|
+
),
|
|
20561
|
+
"nonce account not initialized"
|
|
20562
|
+
);
|
|
20563
|
+
return createSendInstruction(
|
|
20564
|
+
{
|
|
20565
|
+
signer: payer,
|
|
20566
|
+
peer,
|
|
20567
|
+
enforcedOptions,
|
|
20568
|
+
oftConfig,
|
|
20569
|
+
tokenSource,
|
|
20570
|
+
tokenEscrow: this.escrowKp,
|
|
20571
|
+
tokenMint: this.mintKp,
|
|
20572
|
+
tokenProgram: this.tokenProgram,
|
|
20573
|
+
eventAuthority: this.eventAuthorityPDA,
|
|
20574
|
+
program: this.program,
|
|
20575
|
+
// Get remaining accounts from msgLib(simple_msgLib or uln)
|
|
20576
|
+
anchorRemainingAccounts: await this.endpoint.getSendIXAccountMetaForCPI(
|
|
20577
|
+
connection,
|
|
20578
|
+
payer,
|
|
20579
|
+
packetPath,
|
|
20580
|
+
msgLibProgram,
|
|
20581
|
+
commitmentOrConfig
|
|
20582
|
+
)
|
|
20583
|
+
},
|
|
20584
|
+
{
|
|
20585
|
+
params: {
|
|
20586
|
+
dstEid,
|
|
20587
|
+
to,
|
|
20588
|
+
amountLd: new BN2__default.default(amountLd.toString()),
|
|
20589
|
+
minAmountLd: new BN2__default.default(minAmountLd.toString()),
|
|
20590
|
+
options,
|
|
20591
|
+
composeMsg,
|
|
20592
|
+
nativeFee: fee.nativeFee,
|
|
20593
|
+
lzTokenFee: fee.lzTokenFee
|
|
20594
|
+
}
|
|
20595
|
+
},
|
|
20596
|
+
this.program
|
|
20597
|
+
);
|
|
20598
|
+
}
|
|
20599
|
+
async setRateLimit(signer, dstEid, capacity, refillPerSecond, enabled) {
|
|
20600
|
+
const [peerPda] = this.deriver.peer(this.getOftConfig(), dstEid);
|
|
20601
|
+
const ix = createSetRateLimitInstruction(
|
|
20602
|
+
{
|
|
20603
|
+
admin: signer,
|
|
20604
|
+
peer: peerPda,
|
|
20605
|
+
oftConfig: this.getOftConfig()
|
|
20606
|
+
},
|
|
20607
|
+
{
|
|
20608
|
+
params: {
|
|
20609
|
+
dstEid,
|
|
20610
|
+
capacity: new BN2__default.default(capacity.toString()),
|
|
20611
|
+
refillPerSecond: new BN2__default.default(refillPerSecond.toString()),
|
|
20612
|
+
enabled
|
|
20613
|
+
}
|
|
20614
|
+
},
|
|
20615
|
+
this.program
|
|
20616
|
+
);
|
|
20617
|
+
return Promise.resolve(ix);
|
|
20618
|
+
}
|
|
20619
|
+
async lzReceive(connection, payer, packet) {
|
|
20620
|
+
const deserializedPacket = PacketSerializer.deserialize(packet);
|
|
20621
|
+
return lzReceive(connection, payer, deserializedPacket);
|
|
20622
|
+
}
|
|
20623
|
+
async getSendLibraryProgram(connection, payer, dstEid) {
|
|
20624
|
+
const oftConfig = this.getOftConfig();
|
|
20625
|
+
const sendLibInfo = await this.endpoint.getSendLibrary(connection, oftConfig, dstEid);
|
|
20626
|
+
if (!sendLibInfo?.programId) {
|
|
20627
|
+
throw new Error("Send library not initialized or blocked message library");
|
|
20369
20628
|
}
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
);
|
|
20385
|
-
const
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
const registerOappIx = createRegisterOappInstruction(
|
|
20629
|
+
const { programId: msgLibProgram } = sendLibInfo;
|
|
20630
|
+
const msgLibVersion = await this.endpoint.getMessageLibVersion(connection, payer, msgLibProgram);
|
|
20631
|
+
if (msgLibVersion?.major.toString() === "0" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
|
|
20632
|
+
return new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
|
|
20633
|
+
} else if (msgLibVersion?.major.toString() === "3" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
|
|
20634
|
+
return new uln_exports.Uln(msgLibProgram);
|
|
20635
|
+
}
|
|
20636
|
+
throw new Error(`Unsupported message library version: ${JSON.stringify(msgLibVersion, null, 2)}`);
|
|
20637
|
+
}
|
|
20638
|
+
};
|
|
20639
|
+
|
|
20640
|
+
// src/oft-tools.ts
|
|
20641
|
+
var SOLANA_EID = 1;
|
|
20642
|
+
async function createInitAdapterOftIx(payer, admin, mint, escrow, sharedDecimals = 6, tokenProgram = splToken.TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20643
|
+
const deriver = new OftPDADeriver(oftProgramId);
|
|
20644
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20645
|
+
const [oftConfig] = deriver.oftConfig(escrow);
|
|
20646
|
+
const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
|
|
20647
|
+
return instructions_exports.createInitAdapterOftInstruction(
|
|
20390
20648
|
{
|
|
20391
20649
|
payer,
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20650
|
+
oftConfig,
|
|
20651
|
+
tokenMint: mint,
|
|
20652
|
+
tokenEscrow: escrow,
|
|
20653
|
+
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20654
|
+
tokenProgram,
|
|
20655
|
+
anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
|
|
20396
20656
|
},
|
|
20397
20657
|
{
|
|
20398
20658
|
params: {
|
|
20399
|
-
|
|
20659
|
+
admin,
|
|
20660
|
+
sharedDecimals,
|
|
20661
|
+
endpointProgram
|
|
20400
20662
|
}
|
|
20401
20663
|
}
|
|
20402
20664
|
);
|
|
20403
|
-
|
|
20404
|
-
|
|
20665
|
+
}
|
|
20666
|
+
async function createNonceTx(connection, nonceAccount, nonceAuthority, instructions, commitmentOrConfig = "confirmed") {
|
|
20667
|
+
const nonceAccountInfo = await connection.getNonce(nonceAccount, commitmentOrConfig);
|
|
20668
|
+
if (nonceAccountInfo === null) {
|
|
20669
|
+
throw new Error("Invalid nonce account");
|
|
20405
20670
|
}
|
|
20406
|
-
|
|
20671
|
+
const { nonce } = nonceAccountInfo;
|
|
20672
|
+
const nonceAdvanceIx = web35.SystemProgram.nonceAdvance({
|
|
20673
|
+
noncePubkey: nonceAccount,
|
|
20674
|
+
authorizedPubkey: nonceAuthority
|
|
20675
|
+
});
|
|
20676
|
+
return new web35.Transaction({
|
|
20677
|
+
recentBlockhash: nonce,
|
|
20678
|
+
nonceInfo: {
|
|
20679
|
+
nonce,
|
|
20680
|
+
nonceInstruction: nonceAdvanceIx
|
|
20681
|
+
}
|
|
20682
|
+
}).add(...instructions);
|
|
20683
|
+
}
|
|
20684
|
+
async function createInitNativeOftIx(payer, admin, mint, oftMintAuthority, sharedDecimals = 6, tokenProgram = splToken.TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20685
|
+
const deriver = new OftPDADeriver(oftProgramId);
|
|
20686
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20687
|
+
const [oftConfig] = deriver.oftConfig(mint);
|
|
20688
|
+
const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
|
|
20689
|
+
return instructions_exports.createInitOftInstruction(
|
|
20407
20690
|
{
|
|
20408
20691
|
payer,
|
|
20409
20692
|
oftConfig,
|
|
20410
20693
|
tokenMint: mint,
|
|
20411
20694
|
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20412
20695
|
tokenProgram,
|
|
20413
|
-
anchorRemainingAccounts:
|
|
20414
|
-
{
|
|
20415
|
-
pubkey: PROGRAM_ID2,
|
|
20416
|
-
isSigner: false,
|
|
20417
|
-
isWritable: false
|
|
20418
|
-
}
|
|
20419
|
-
].concat(
|
|
20420
|
-
...registerOappIx.keys,
|
|
20421
|
-
{
|
|
20422
|
-
pubkey: endpointEventAuthority,
|
|
20423
|
-
isSigner: false,
|
|
20424
|
-
isWritable: false
|
|
20425
|
-
},
|
|
20426
|
-
{
|
|
20427
|
-
pubkey: PROGRAM_ID2,
|
|
20428
|
-
isSigner: false,
|
|
20429
|
-
isWritable: false
|
|
20430
|
-
}
|
|
20431
|
-
)
|
|
20696
|
+
anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
|
|
20432
20697
|
},
|
|
20433
20698
|
{
|
|
20434
20699
|
params: {
|
|
20435
20700
|
admin,
|
|
20436
20701
|
sharedDecimals,
|
|
20437
|
-
|
|
20438
|
-
|
|
20702
|
+
mintAuthority: oftMintAuthority,
|
|
20703
|
+
endpointProgram
|
|
20439
20704
|
}
|
|
20440
20705
|
},
|
|
20441
|
-
|
|
20706
|
+
oftProgramId
|
|
20442
20707
|
);
|
|
20443
20708
|
}
|
|
20444
|
-
async function createSetPeerIx(admin, oftConfig, dstEid, peer) {
|
|
20709
|
+
async function createSetPeerIx(admin, oftConfig, dstEid, peer, oftProgramId = PROGRAM_ID) {
|
|
20445
20710
|
if (peer.length !== 32) {
|
|
20446
20711
|
throw new Error("Peer must be 32 bytes (left-padded with zeroes)");
|
|
20447
20712
|
}
|
|
20448
20713
|
if (dstEid % 3e4 == 0) {
|
|
20449
20714
|
throw new Error("Invalid dstEid");
|
|
20450
20715
|
}
|
|
20451
|
-
const [peerPda] =
|
|
20452
|
-
|
|
20453
|
-
PROGRAM_ID
|
|
20454
|
-
);
|
|
20455
|
-
return createSetPeerInstruction(
|
|
20716
|
+
const [peerPda] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
|
|
20717
|
+
return instructions_exports.createSetPeerInstruction(
|
|
20456
20718
|
{
|
|
20457
20719
|
admin,
|
|
20458
20720
|
peer: peerPda,
|
|
@@ -20464,45 +20726,36 @@ async function createSetPeerIx(admin, oftConfig, dstEid, peer) {
|
|
|
20464
20726
|
peer
|
|
20465
20727
|
}
|
|
20466
20728
|
},
|
|
20467
|
-
|
|
20729
|
+
oftProgramId
|
|
20468
20730
|
);
|
|
20469
20731
|
}
|
|
20470
|
-
async function createSetDelegateIx(admin, oftConfig, delegate) {
|
|
20471
|
-
const
|
|
20472
|
-
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
const [endpointEventAuthority] = web35.PublicKey.findProgramAddressSync(
|
|
20476
|
-
[Buffer.from(EVENT_SEED2, "utf-8")],
|
|
20477
|
-
PROGRAM_ID2
|
|
20478
|
-
);
|
|
20479
|
-
const endpointSetDelegateIx = createSetDelegateInstruction2(
|
|
20732
|
+
async function createSetDelegateIx(admin, oftConfig, delegate, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20733
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20734
|
+
const [oAppRegistry] = endpoint.endpointDeriver.oappRegistry(oftConfig);
|
|
20735
|
+
const endpointEventAuthority = endpoint.eventAuthorityPDA;
|
|
20736
|
+
const keys = instructions_exports2.createSetDelegateInstructionAccounts(
|
|
20480
20737
|
{
|
|
20481
20738
|
oapp: oftConfig,
|
|
20482
20739
|
oappRegistry: oAppRegistry,
|
|
20483
20740
|
eventAuthority: endpointEventAuthority,
|
|
20484
|
-
program:
|
|
20741
|
+
program: endpointProgram
|
|
20485
20742
|
},
|
|
20486
|
-
|
|
20487
|
-
params: {
|
|
20488
|
-
delegate
|
|
20489
|
-
}
|
|
20490
|
-
}
|
|
20743
|
+
endpointProgram
|
|
20491
20744
|
);
|
|
20492
|
-
for (const acc of
|
|
20745
|
+
for (const acc of keys) {
|
|
20493
20746
|
acc.isSigner = false;
|
|
20494
20747
|
}
|
|
20495
|
-
return createSetDelegateInstruction(
|
|
20748
|
+
return instructions_exports.createSetDelegateInstruction(
|
|
20496
20749
|
{
|
|
20497
20750
|
admin,
|
|
20498
20751
|
oftConfig,
|
|
20499
20752
|
anchorRemainingAccounts: [
|
|
20500
20753
|
{
|
|
20501
|
-
pubkey:
|
|
20754
|
+
pubkey: endpointProgram,
|
|
20502
20755
|
isSigner: false,
|
|
20503
20756
|
isWritable: false
|
|
20504
20757
|
},
|
|
20505
|
-
...
|
|
20758
|
+
...keys
|
|
20506
20759
|
]
|
|
20507
20760
|
},
|
|
20508
20761
|
{
|
|
@@ -20510,151 +20763,34 @@ async function createSetDelegateIx(admin, oftConfig, delegate) {
|
|
|
20510
20763
|
delegate
|
|
20511
20764
|
}
|
|
20512
20765
|
},
|
|
20513
|
-
|
|
20514
|
-
);
|
|
20515
|
-
}
|
|
20516
|
-
async function createInitSendLibraryIx(signer, oftConfig, dstEid) {
|
|
20517
|
-
const [oAppRegistry] = web35.PublicKey.findProgramAddressSync(
|
|
20518
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20519
|
-
PROGRAM_ID2
|
|
20520
|
-
);
|
|
20521
|
-
const [sendLibraryConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20522
|
-
[
|
|
20523
|
-
Buffer.from(SEND_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
20524
|
-
oftConfig.toBuffer(),
|
|
20525
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)
|
|
20526
|
-
],
|
|
20527
|
-
PROGRAM_ID2
|
|
20528
|
-
);
|
|
20529
|
-
return createInitSendLibraryInstruction(
|
|
20530
|
-
{
|
|
20531
|
-
delegate: signer,
|
|
20532
|
-
oappRegistry: oAppRegistry,
|
|
20533
|
-
sendLibraryConfig
|
|
20534
|
-
},
|
|
20535
|
-
{
|
|
20536
|
-
params: {
|
|
20537
|
-
sender: oftConfig,
|
|
20538
|
-
eid: dstEid
|
|
20539
|
-
}
|
|
20540
|
-
},
|
|
20541
|
-
PROGRAM_ID2
|
|
20542
|
-
);
|
|
20543
|
-
}
|
|
20544
|
-
async function createInitReceiveLibraryIx(signer, oftConfig, remoteEid) {
|
|
20545
|
-
const [oAppRegistry] = web35.PublicKey.findProgramAddressSync(
|
|
20546
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20547
|
-
PROGRAM_ID2
|
|
20548
|
-
);
|
|
20549
|
-
const [receiveLibraryConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20550
|
-
[
|
|
20551
|
-
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
20552
|
-
oftConfig.toBuffer(),
|
|
20553
|
-
new BN6__default.default(remoteEid).toArrayLike(Buffer, "be", 4)
|
|
20554
|
-
],
|
|
20555
|
-
PROGRAM_ID2
|
|
20556
|
-
);
|
|
20557
|
-
return createInitReceiveLibraryInstruction(
|
|
20558
|
-
{
|
|
20559
|
-
delegate: signer,
|
|
20560
|
-
oappRegistry: oAppRegistry,
|
|
20561
|
-
receiveLibraryConfig
|
|
20562
|
-
},
|
|
20563
|
-
{
|
|
20564
|
-
params: {
|
|
20565
|
-
receiver: oftConfig,
|
|
20566
|
-
eid: remoteEid
|
|
20567
|
-
}
|
|
20568
|
-
},
|
|
20569
|
-
PROGRAM_ID2
|
|
20766
|
+
oftProgramId
|
|
20570
20767
|
);
|
|
20571
20768
|
}
|
|
20572
|
-
async function
|
|
20573
|
-
const
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20577
|
-
);
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
);
|
|
20586
|
-
|
|
20587
|
-
|
|
20588
|
-
|
|
20589
|
-
|
|
20590
|
-
|
|
20591
|
-
|
|
20592
|
-
{
|
|
20593
|
-
signer,
|
|
20594
|
-
oappRegistry: oAppRegistry,
|
|
20595
|
-
sendLibraryConfig,
|
|
20596
|
-
messageLibInfo: sendLibraryInfo,
|
|
20597
|
-
eventAuthority,
|
|
20598
|
-
program: PROGRAM_ID2
|
|
20599
|
-
},
|
|
20600
|
-
{
|
|
20601
|
-
params: {
|
|
20602
|
-
sender: oftConfig,
|
|
20603
|
-
eid: dstEid,
|
|
20604
|
-
newLib: newSendLib
|
|
20605
|
-
}
|
|
20606
|
-
},
|
|
20607
|
-
PROGRAM_ID2
|
|
20769
|
+
async function createInitSendLibraryIx(signer, oftConfig, dstEid, endpointProgram = PROGRAM_ID2) {
|
|
20770
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20771
|
+
return endpoint.initSendLibraryWithoutChecks(signer, oftConfig, dstEid);
|
|
20772
|
+
}
|
|
20773
|
+
async function createInitReceiveLibraryIx(signer, oftConfig, remoteEid, endpointProgram = PROGRAM_ID2) {
|
|
20774
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20775
|
+
return endpoint.initReceiveLibraryWithoutChecks(signer, oftConfig, remoteEid);
|
|
20776
|
+
}
|
|
20777
|
+
async function createSetSendLibraryIx(signer, oftConfig, sendLibraryProgram, dstEid, endpointProgram = PROGRAM_ID2) {
|
|
20778
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20779
|
+
return endpoint.setSendLibrary(signer, oftConfig, sendLibraryProgram, dstEid);
|
|
20780
|
+
}
|
|
20781
|
+
async function createSetReceiveLibraryIx(signer, oftConfig, receiveLibraryProgram, dstEid, gracePeriod, endpointProgram = PROGRAM_ID2) {
|
|
20782
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20783
|
+
return endpoint.setReceiveLibrary(
|
|
20784
|
+
signer,
|
|
20785
|
+
oftConfig,
|
|
20786
|
+
receiveLibraryProgram,
|
|
20787
|
+
dstEid,
|
|
20788
|
+
parseInt(gracePeriod.toString())
|
|
20608
20789
|
);
|
|
20609
20790
|
}
|
|
20610
|
-
async function
|
|
20611
|
-
const [
|
|
20612
|
-
|
|
20613
|
-
receiveLibraryProgram
|
|
20614
|
-
);
|
|
20615
|
-
const [oAppRegistry] = web35.PublicKey.findProgramAddressSync(
|
|
20616
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20617
|
-
PROGRAM_ID2
|
|
20618
|
-
);
|
|
20619
|
-
const [receiveLibraryConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20620
|
-
[
|
|
20621
|
-
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
20622
|
-
oftConfig.toBuffer(),
|
|
20623
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)
|
|
20624
|
-
],
|
|
20625
|
-
PROGRAM_ID2
|
|
20626
|
-
);
|
|
20627
|
-
const [receiveLibraryInfo] = web35.PublicKey.findProgramAddressSync(
|
|
20628
|
-
[Buffer.from(MESSAGE_LIB_SEED2, "utf-8"), newReceiveLib.toBuffer()],
|
|
20629
|
-
PROGRAM_ID2
|
|
20630
|
-
);
|
|
20631
|
-
const [eventAuthority] = web35.PublicKey.findProgramAddressSync([Buffer.from(EVENT_SEED2, "utf-8")], PROGRAM_ID2);
|
|
20632
|
-
return createSetReceiveLibraryInstruction(
|
|
20633
|
-
{
|
|
20634
|
-
signer,
|
|
20635
|
-
oappRegistry: oAppRegistry,
|
|
20636
|
-
receiveLibraryConfig,
|
|
20637
|
-
messageLibInfo: receiveLibraryInfo,
|
|
20638
|
-
eventAuthority,
|
|
20639
|
-
program: PROGRAM_ID2
|
|
20640
|
-
},
|
|
20641
|
-
{
|
|
20642
|
-
params: {
|
|
20643
|
-
receiver: oftConfig,
|
|
20644
|
-
eid: dstEid,
|
|
20645
|
-
newLib: newReceiveLib,
|
|
20646
|
-
gracePeriod: new BN6__default.default(gracePeriod.toString())
|
|
20647
|
-
}
|
|
20648
|
-
},
|
|
20649
|
-
PROGRAM_ID2
|
|
20650
|
-
);
|
|
20651
|
-
}
|
|
20652
|
-
async function createMintToIx(signer, tokenMint, tokenDest, amount, tokenProgram = splToken.TOKEN_PROGRAM_ID) {
|
|
20653
|
-
const [oftConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20654
|
-
[Buffer.from(OFT_SEED2, "utf-8"), tokenMint.toBytes()],
|
|
20655
|
-
PROGRAM_ID
|
|
20656
|
-
);
|
|
20657
|
-
return createMintToInstruction(
|
|
20791
|
+
async function createMintToIx(signer, tokenMint, tokenDest, amount, tokenProgram = splToken.TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID) {
|
|
20792
|
+
const [oftConfig] = new OftPDADeriver(oftProgramId).oftConfig(tokenMint);
|
|
20793
|
+
return instructions_exports.createMintToInstruction(
|
|
20658
20794
|
{
|
|
20659
20795
|
minter: signer,
|
|
20660
20796
|
oftConfig,
|
|
@@ -20664,18 +20800,15 @@ async function createMintToIx(signer, tokenMint, tokenDest, amount, tokenProgram
|
|
|
20664
20800
|
},
|
|
20665
20801
|
{
|
|
20666
20802
|
params: {
|
|
20667
|
-
amount: new
|
|
20803
|
+
amount: new BN2__default.default(amount.toString())
|
|
20668
20804
|
}
|
|
20669
20805
|
},
|
|
20670
|
-
|
|
20806
|
+
oftProgramId
|
|
20671
20807
|
);
|
|
20672
20808
|
}
|
|
20673
|
-
async function createSetRateLimitIx(signer, oftConfig, dstEid, capacity, refillPerSecond, enabled) {
|
|
20674
|
-
const [peer] =
|
|
20675
|
-
|
|
20676
|
-
PROGRAM_ID
|
|
20677
|
-
);
|
|
20678
|
-
return createSetRateLimitInstruction(
|
|
20809
|
+
async function createSetRateLimitIx(signer, oftConfig, dstEid, capacity, refillPerSecond, enabled, oftProgramId = PROGRAM_ID) {
|
|
20810
|
+
const [peer] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
|
|
20811
|
+
return instructions_exports.createSetRateLimitInstruction(
|
|
20679
20812
|
{
|
|
20680
20813
|
admin: signer,
|
|
20681
20814
|
peer,
|
|
@@ -20684,160 +20817,31 @@ async function createSetRateLimitIx(signer, oftConfig, dstEid, capacity, refillP
|
|
|
20684
20817
|
{
|
|
20685
20818
|
params: {
|
|
20686
20819
|
dstEid,
|
|
20687
|
-
capacity: new
|
|
20688
|
-
refillPerSecond: new
|
|
20820
|
+
capacity: new BN2__default.default(capacity.toString()),
|
|
20821
|
+
refillPerSecond: new BN2__default.default(refillPerSecond.toString()),
|
|
20689
20822
|
enabled
|
|
20690
20823
|
}
|
|
20691
20824
|
},
|
|
20692
|
-
|
|
20825
|
+
oftProgramId
|
|
20693
20826
|
);
|
|
20694
20827
|
}
|
|
20695
|
-
async function createInitConfigIx(signer, oftConfig,
|
|
20696
|
-
const
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
[Buffer.from(MESSAGE_LIB_SEED2, "utf-8"), messageLib.toBytes()],
|
|
20703
|
-
PROGRAM_ID2
|
|
20704
|
-
);
|
|
20705
|
-
const [endpointSettings] = web35.PublicKey.findProgramAddressSync(
|
|
20706
|
-
[Buffer.from(ENDPOINT_SEED2, "utf-8")],
|
|
20707
|
-
PROGRAM_ID2
|
|
20708
|
-
);
|
|
20709
|
-
const [sendConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20710
|
-
[Buffer.from(SEND_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20711
|
-
messageLibProgram
|
|
20712
|
-
);
|
|
20713
|
-
const [receiveConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20714
|
-
[Buffer.from(RECEIVE_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20715
|
-
messageLibProgram
|
|
20716
|
-
);
|
|
20717
|
-
const initConfigMessageLibIx = createInitConfigInstruction3(
|
|
20718
|
-
{
|
|
20719
|
-
endpoint: endpointSettings,
|
|
20720
|
-
payer: signer,
|
|
20721
|
-
uln: messageLib,
|
|
20722
|
-
sendConfig,
|
|
20723
|
-
receiveConfig
|
|
20724
|
-
},
|
|
20725
|
-
{
|
|
20726
|
-
params: {
|
|
20727
|
-
oapp: oftConfig,
|
|
20728
|
-
eid: dstEid
|
|
20729
|
-
}
|
|
20730
|
-
}
|
|
20731
|
-
);
|
|
20732
|
-
for (const acc of initConfigMessageLibIx.keys) {
|
|
20733
|
-
if (!signer.equals(acc.pubkey)) {
|
|
20734
|
-
acc.isSigner = false;
|
|
20735
|
-
}
|
|
20828
|
+
async function createInitConfigIx(signer, oftConfig, dstEid, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20829
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20830
|
+
let msgLib;
|
|
20831
|
+
if (msgLibProgram.toBase58() === simple_message_lib_exports.PROGRAM_ID.toBase58()) {
|
|
20832
|
+
msgLib = new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
|
|
20833
|
+
} else {
|
|
20834
|
+
msgLib = new Uln(msgLibProgram);
|
|
20736
20835
|
}
|
|
20737
|
-
return
|
|
20738
|
-
{
|
|
20739
|
-
delegate: signer,
|
|
20740
|
-
oappRegistry: oAppRegistry,
|
|
20741
|
-
messageLibInfo,
|
|
20742
|
-
messageLib,
|
|
20743
|
-
messageLibProgram,
|
|
20744
|
-
anchorRemainingAccounts: initConfigMessageLibIx.keys.slice(1)
|
|
20745
|
-
},
|
|
20746
|
-
{
|
|
20747
|
-
params: {
|
|
20748
|
-
oapp: oftConfig,
|
|
20749
|
-
eid: dstEid
|
|
20750
|
-
}
|
|
20751
|
-
}
|
|
20752
|
-
);
|
|
20836
|
+
return endpoint.initOappConfig(signer, msgLib, signer, oftConfig, dstEid);
|
|
20753
20837
|
}
|
|
20754
|
-
async function createSetConfigIx(signer, oftConfig, dstEid, configType, config,
|
|
20755
|
-
const
|
|
20756
|
-
|
|
20757
|
-
PROGRAM_ID2
|
|
20758
|
-
);
|
|
20759
|
-
const [messageLib] = web35.PublicKey.findProgramAddressSync([Buffer.from(MESSAGE_LIB_SEED2, "utf-8")], messageLibProgram);
|
|
20760
|
-
const [messageLibInfo] = web35.PublicKey.findProgramAddressSync(
|
|
20761
|
-
[Buffer.from(MESSAGE_LIB_SEED2, "utf-8"), messageLib.toBytes()],
|
|
20762
|
-
PROGRAM_ID2
|
|
20763
|
-
);
|
|
20764
|
-
const [endpointSettings] = web35.PublicKey.findProgramAddressSync(
|
|
20765
|
-
[Buffer.from(ENDPOINT_SEED2, "utf-8")],
|
|
20766
|
-
PROGRAM_ID2
|
|
20767
|
-
);
|
|
20768
|
-
const [defaultSendConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20769
|
-
[Buffer.from(SEND_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20770
|
-
messageLibProgram
|
|
20771
|
-
);
|
|
20772
|
-
const [sendConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20773
|
-
[Buffer.from(SEND_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20774
|
-
messageLibProgram
|
|
20775
|
-
);
|
|
20776
|
-
const [defaultReceiveConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20777
|
-
[Buffer.from(RECEIVE_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20778
|
-
messageLibProgram
|
|
20779
|
-
);
|
|
20780
|
-
const [receiveConfig] = web35.PublicKey.findProgramAddressSync(
|
|
20781
|
-
[Buffer.from(RECEIVE_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20782
|
-
messageLibProgram
|
|
20783
|
-
);
|
|
20784
|
-
const [messageLibEventAuthority] = web35.PublicKey.findProgramAddressSync(
|
|
20785
|
-
[Buffer.from(EVENT_SEED2, "utf-8")],
|
|
20786
|
-
messageLibProgram
|
|
20787
|
-
);
|
|
20788
|
-
const [ulnSettings] = web35.PublicKey.findProgramAddressSync([Buffer.from(ULN_SEED2, "utf-8")], messageLibProgram);
|
|
20789
|
-
const messageLibSetConfigIx = createSetConfigInstruction4(
|
|
20790
|
-
{
|
|
20791
|
-
endpoint: endpointSettings,
|
|
20792
|
-
uln: ulnSettings,
|
|
20793
|
-
sendConfig,
|
|
20794
|
-
receiveConfig,
|
|
20795
|
-
defaultSendConfig,
|
|
20796
|
-
defaultReceiveConfig,
|
|
20797
|
-
eventAuthority: messageLibEventAuthority,
|
|
20798
|
-
program: messageLibProgram
|
|
20799
|
-
},
|
|
20800
|
-
{
|
|
20801
|
-
params: {
|
|
20802
|
-
oapp: oftConfig,
|
|
20803
|
-
eid: dstEid,
|
|
20804
|
-
configType,
|
|
20805
|
-
config
|
|
20806
|
-
}
|
|
20807
|
-
},
|
|
20808
|
-
messageLibProgram
|
|
20809
|
-
);
|
|
20810
|
-
for (const acc of messageLibSetConfigIx.keys) {
|
|
20811
|
-
if (!signer.equals(acc.pubkey)) {
|
|
20812
|
-
acc.isSigner = false;
|
|
20813
|
-
}
|
|
20814
|
-
}
|
|
20815
|
-
return createSetConfigInstruction(
|
|
20816
|
-
{
|
|
20817
|
-
signer,
|
|
20818
|
-
oappRegistry: oAppRegistry,
|
|
20819
|
-
messageLibInfo,
|
|
20820
|
-
messageLib,
|
|
20821
|
-
messageLibProgram,
|
|
20822
|
-
anchorRemainingAccounts: messageLibSetConfigIx.keys.slice(1)
|
|
20823
|
-
},
|
|
20824
|
-
{
|
|
20825
|
-
params: {
|
|
20826
|
-
oapp: oftConfig,
|
|
20827
|
-
eid: dstEid,
|
|
20828
|
-
configType,
|
|
20829
|
-
config
|
|
20830
|
-
}
|
|
20831
|
-
},
|
|
20832
|
-
PROGRAM_ID2
|
|
20833
|
-
);
|
|
20838
|
+
async function createSetConfigIx(connection, signer, oftConfig, dstEid, configType, config, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20839
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20840
|
+
return endpoint.setOappConfig(connection, signer, oftConfig, msgLibProgram, dstEid, { configType, value: config });
|
|
20834
20841
|
}
|
|
20835
|
-
async function createSetEnforcedOptionsIx(admin, oftConfig, dstEid, sendOptions, sendAndCallOptions) {
|
|
20836
|
-
const [enforcedOptions] =
|
|
20837
|
-
|
|
20838
|
-
PROGRAM_ID
|
|
20839
|
-
);
|
|
20840
|
-
return createSetEnforcedOptionsInstruction(
|
|
20842
|
+
async function createSetEnforcedOptionsIx(admin, oftConfig, dstEid, sendOptions, sendAndCallOptions, oftProgramId = PROGRAM_ID) {
|
|
20843
|
+
const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftConfig, dstEid);
|
|
20844
|
+
return instructions_exports.createSetEnforcedOptionsInstruction(
|
|
20841
20845
|
{
|
|
20842
20846
|
admin,
|
|
20843
20847
|
enforcedOptions,
|
|
@@ -20850,11 +20854,11 @@ async function createSetEnforcedOptionsIx(admin, oftConfig, dstEid, sendOptions,
|
|
|
20850
20854
|
sendAndCall: sendAndCallOptions
|
|
20851
20855
|
}
|
|
20852
20856
|
},
|
|
20853
|
-
|
|
20857
|
+
oftProgramId
|
|
20854
20858
|
);
|
|
20855
20859
|
}
|
|
20856
|
-
async function createTransferAdminIx(signer, oftConfig, newAdmin) {
|
|
20857
|
-
return createTransferAdminInstruction(
|
|
20860
|
+
async function createTransferAdminIx(signer, oftConfig, newAdmin, oftProgramId = PROGRAM_ID) {
|
|
20861
|
+
return instructions_exports.createTransferAdminInstruction(
|
|
20858
20862
|
{
|
|
20859
20863
|
admin: signer,
|
|
20860
20864
|
oftConfig
|
|
@@ -20864,115 +20868,36 @@ async function createTransferAdminIx(signer, oftConfig, newAdmin) {
|
|
|
20864
20868
|
admin: newAdmin
|
|
20865
20869
|
}
|
|
20866
20870
|
},
|
|
20867
|
-
|
|
20871
|
+
oftProgramId
|
|
20868
20872
|
);
|
|
20869
20873
|
}
|
|
20870
|
-
async function sendWithUln(connection, payer, tokenMint, tokenSource, dstEid, amountLd, minAmountLd, options, to, nativeFee, tokenEscrow = void 0, lzTokenFee = 0n, tokenProgram = splToken.TOKEN_PROGRAM_ID, composeMsg = null) {
|
|
20871
|
-
const
|
|
20872
|
-
|
|
20873
|
-
PROGRAM_ID
|
|
20874
|
-
);
|
|
20875
|
-
const [peer] = web35.PublicKey.findProgramAddressSync(
|
|
20876
|
-
[Buffer.from(PEER_SEED2, "utf-8"), oftInstance.toBuffer(), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20877
|
-
PROGRAM_ID
|
|
20878
|
-
);
|
|
20879
|
-
const [oftEventAuthority] = web35.PublicKey.findProgramAddressSync([Buffer.from(EVENT_SEED2, "utf-8")], PROGRAM_ID);
|
|
20880
|
-
const peerInfo = await Peer.fromAccountAddress(connection, peer);
|
|
20881
|
-
const peerAddress = peerInfo.address;
|
|
20882
|
-
const [enforcedOptions] = web35.PublicKey.findProgramAddressSync(
|
|
20883
|
-
[
|
|
20884
|
-
Buffer.from(ENFORCED_OPTIONS_SEED2, "utf-8"),
|
|
20885
|
-
oftInstance.toBuffer(),
|
|
20886
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)
|
|
20887
|
-
],
|
|
20888
|
-
PROGRAM_ID
|
|
20889
|
-
);
|
|
20890
|
-
const messageLib = new Uln(PROGRAM_ID6);
|
|
20891
|
-
const endpoint = new Endpoint(PROGRAM_ID2);
|
|
20892
|
-
const remainingAccounts = await endpoint.getSendIXAccountMetaForCPI(
|
|
20874
|
+
async function sendWithUln(connection, payer, tokenMint, tokenSource, dstEid, amountLd, minAmountLd, options, to, nativeFee, tokenEscrow = void 0, lzTokenFee = 0n, tokenProgram = splToken.TOKEN_PROGRAM_ID, composeMsg = null, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20875
|
+
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20876
|
+
return oft.send(
|
|
20893
20877
|
connection,
|
|
20894
20878
|
payer,
|
|
20879
|
+
tokenSource,
|
|
20880
|
+
to,
|
|
20881
|
+
dstEid,
|
|
20882
|
+
amountLd,
|
|
20883
|
+
minAmountLd,
|
|
20895
20884
|
{
|
|
20896
|
-
|
|
20897
|
-
|
|
20898
|
-
dstEid,
|
|
20899
|
-
receiver: bytes.hexlify(peerAddress)
|
|
20900
|
-
},
|
|
20901
|
-
messageLib
|
|
20902
|
-
);
|
|
20903
|
-
return createSendInstruction(
|
|
20904
|
-
{
|
|
20905
|
-
signer: payer,
|
|
20906
|
-
peer,
|
|
20907
|
-
enforcedOptions,
|
|
20908
|
-
oftConfig: oftInstance,
|
|
20909
|
-
tokenSource,
|
|
20910
|
-
tokenEscrow,
|
|
20911
|
-
tokenMint,
|
|
20912
|
-
tokenProgram,
|
|
20913
|
-
eventAuthority: oftEventAuthority,
|
|
20914
|
-
program: PROGRAM_ID,
|
|
20915
|
-
anchorRemainingAccounts: remainingAccounts
|
|
20885
|
+
nativeFee: new BN2__default.default(nativeFee.toString()),
|
|
20886
|
+
lzTokenFee: new BN2__default.default(lzTokenFee.toString())
|
|
20916
20887
|
},
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
dstEid,
|
|
20920
|
-
to,
|
|
20921
|
-
amountLd: new BN6__default.default(amountLd.toString()),
|
|
20922
|
-
minAmountLd: new BN6__default.default(minAmountLd.toString()),
|
|
20923
|
-
options,
|
|
20924
|
-
composeMsg,
|
|
20925
|
-
nativeFee: new BN6__default.default(nativeFee.toString()),
|
|
20926
|
-
lzTokenFee: new BN6__default.default(lzTokenFee.toString())
|
|
20927
|
-
}
|
|
20928
|
-
}
|
|
20888
|
+
options,
|
|
20889
|
+
composeMsg
|
|
20929
20890
|
);
|
|
20930
20891
|
}
|
|
20931
|
-
async function createInitNonceIx(delegate, dstEid, oftInstance, remoteOappAddr) {
|
|
20932
|
-
const
|
|
20933
|
-
|
|
20934
|
-
PROGRAM_ID2
|
|
20935
|
-
);
|
|
20936
|
-
const [pendingNonce] = web35.PublicKey.findProgramAddressSync(
|
|
20937
|
-
[
|
|
20938
|
-
Buffer.from(PENDING_NONCE_SEED2),
|
|
20939
|
-
oftInstance.toBuffer(),
|
|
20940
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4),
|
|
20941
|
-
remoteOappAddr
|
|
20942
|
-
],
|
|
20943
|
-
PROGRAM_ID2
|
|
20944
|
-
);
|
|
20945
|
-
const [oAppRegistry] = web35.PublicKey.findProgramAddressSync(
|
|
20946
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftInstance.toBuffer()],
|
|
20947
|
-
PROGRAM_ID2
|
|
20948
|
-
);
|
|
20949
|
-
return createInitNonceInstruction(
|
|
20950
|
-
{
|
|
20951
|
-
nonce,
|
|
20952
|
-
pendingInboundNonce: pendingNonce,
|
|
20953
|
-
oappRegistry: oAppRegistry,
|
|
20954
|
-
delegate
|
|
20955
|
-
},
|
|
20956
|
-
{
|
|
20957
|
-
params: {
|
|
20958
|
-
localOapp: oftInstance,
|
|
20959
|
-
remoteOapp: Array.from(remoteOappAddr),
|
|
20960
|
-
remoteEid: dstEid
|
|
20961
|
-
}
|
|
20962
|
-
},
|
|
20963
|
-
PROGRAM_ID2
|
|
20964
|
-
);
|
|
20892
|
+
async function createInitNonceIx(delegate, dstEid, oftInstance, remoteOappAddr, endpointProgram = PROGRAM_ID2) {
|
|
20893
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20894
|
+
return endpoint.initOAppNonceWithoutChecks(delegate, dstEid, oftInstance, remoteOappAddr);
|
|
20965
20895
|
}
|
|
20966
|
-
async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null) {
|
|
20967
|
-
const
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
const [peer] = web35.PublicKey.findProgramAddressSync(
|
|
20972
|
-
[Buffer.from(PEER_SEED2, "utf-8"), oftInstance.toBuffer(), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20973
|
-
PROGRAM_ID
|
|
20974
|
-
);
|
|
20975
|
-
const ix = createQuoteOftInstruction(
|
|
20896
|
+
async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null, tokenProgram = splToken.TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20897
|
+
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20898
|
+
const oftInstance = oft.getOftConfig();
|
|
20899
|
+
const [peer] = oft.deriver.peer(oftInstance, dstEid);
|
|
20900
|
+
const ix = instructions_exports.createQuoteOftInstruction(
|
|
20976
20901
|
{
|
|
20977
20902
|
oftConfig: oftInstance,
|
|
20978
20903
|
peer,
|
|
@@ -20982,8 +20907,8 @@ async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmoun
|
|
|
20982
20907
|
params: {
|
|
20983
20908
|
dstEid,
|
|
20984
20909
|
to,
|
|
20985
|
-
amountLd: new
|
|
20986
|
-
minAmountLd: new
|
|
20910
|
+
amountLd: new BN2__default.default(amountLd.toString()),
|
|
20911
|
+
minAmountLd: new BN2__default.default(minAmountLd.toString()),
|
|
20987
20912
|
options,
|
|
20988
20913
|
payInLzToken,
|
|
20989
20914
|
composeMsg
|
|
@@ -20991,45 +20916,18 @@ async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmoun
|
|
|
20991
20916
|
}
|
|
20992
20917
|
);
|
|
20993
20918
|
const returnedValues = await simulateTransaction(connection, [ix], ix.programId, payer, "confirmed");
|
|
20994
|
-
const
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
oftReceipt: {
|
|
21007
|
-
amountSentLd: oftReceipt.amountSentLd.toString(),
|
|
21008
|
-
amountReceivedLd: oftReceipt.amountReceivedLd.toString()
|
|
21009
|
-
}
|
|
21010
|
-
};
|
|
21011
|
-
}
|
|
21012
|
-
async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null) {
|
|
21013
|
-
const [oftInstance] = tokenEscrow === void 0 ? web35.PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED2, "utf-8"), tokenMint.toBuffer()], PROGRAM_ID) : web35.PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED2, "utf-8"), tokenEscrow.toBuffer()], PROGRAM_ID);
|
|
21014
|
-
const [peer] = web35.PublicKey.findProgramAddressSync(
|
|
21015
|
-
[Buffer.from(PEER_SEED2, "utf-8"), oftInstance.toBytes(), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
21016
|
-
PROGRAM_ID
|
|
21017
|
-
);
|
|
21018
|
-
const peerinfo = await connection.getAccountInfo(peer);
|
|
21019
|
-
if (peerinfo === null) {
|
|
21020
|
-
throw new Error("Peer not found");
|
|
21021
|
-
}
|
|
21022
|
-
const peerAddress = peerinfo.data.subarray(8, 32 + 8);
|
|
21023
|
-
const [enforcedOptions] = web35.PublicKey.findProgramAddressSync(
|
|
21024
|
-
[
|
|
21025
|
-
Buffer.from(ENFORCED_OPTIONS_SEED2, "utf-8"),
|
|
21026
|
-
oftInstance.toBuffer(),
|
|
21027
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)
|
|
21028
|
-
],
|
|
21029
|
-
PROGRAM_ID
|
|
21030
|
-
);
|
|
21031
|
-
const messageLib = new Uln(PROGRAM_ID6);
|
|
21032
|
-
const endpoint = new Endpoint(PROGRAM_ID2);
|
|
20919
|
+
const [result] = types_exports.quoteOftResultBeet.deserialize(returnedValues, 0);
|
|
20920
|
+
return result;
|
|
20921
|
+
}
|
|
20922
|
+
async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null, tokenProgram = splToken.TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20923
|
+
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20924
|
+
const oftInstance = oft.getOftConfig();
|
|
20925
|
+
const [enforcedOptions] = oft.deriver.enforcedOptions(oftInstance, dstEid);
|
|
20926
|
+
const [peer] = oft.deriver.peer(oftInstance, dstEid);
|
|
20927
|
+
const peerInfo = await accounts_exports.Peer.fromAccountAddress(connection, peer);
|
|
20928
|
+
const peerAddress = peerInfo.address;
|
|
20929
|
+
const messageLib = new Uln(msgLibProgram);
|
|
20930
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
21033
20931
|
const remainingAccounts = await endpoint.getQuoteIXAccountMetaForCPI(
|
|
21034
20932
|
connection,
|
|
21035
20933
|
payer,
|
|
@@ -21041,7 +20939,7 @@ async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minA
|
|
|
21041
20939
|
},
|
|
21042
20940
|
messageLib
|
|
21043
20941
|
);
|
|
21044
|
-
const ix = createQuoteInstruction(
|
|
20942
|
+
const ix = instructions_exports.createQuoteInstruction(
|
|
21045
20943
|
{
|
|
21046
20944
|
oftConfig: oftInstance,
|
|
21047
20945
|
peer,
|
|
@@ -21053,8 +20951,8 @@ async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minA
|
|
|
21053
20951
|
params: {
|
|
21054
20952
|
dstEid,
|
|
21055
20953
|
to,
|
|
21056
|
-
amountLd: new
|
|
21057
|
-
minAmountLd: new
|
|
20954
|
+
amountLd: new BN2__default.default(amountLd.toString()),
|
|
20955
|
+
minAmountLd: new BN2__default.default(minAmountLd.toString()),
|
|
21058
20956
|
options,
|
|
21059
20957
|
payInLzToken,
|
|
21060
20958
|
composeMsg
|
|
@@ -21065,11 +20963,11 @@ async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minA
|
|
|
21065
20963
|
units: 1e6
|
|
21066
20964
|
});
|
|
21067
20965
|
const buffer = await simulateTransaction(connection, [modifyComputeUnits, ix], ix.programId, payer, "confirmed");
|
|
21068
|
-
const fee =
|
|
20966
|
+
const fee = types_exports2.messagingFeeBeet.read(buffer, 0);
|
|
21069
20967
|
return { nativeFee: BigInt(fee.nativeFee.toString()), lzTokenFee: BigInt(fee.lzTokenFee.toString()) };
|
|
21070
20968
|
}
|
|
21071
|
-
async function createSetMintAuthorityIx(signer, oftInstance, newAuthority) {
|
|
21072
|
-
return createSetMintAuthorityInstruction(
|
|
20969
|
+
async function createSetMintAuthorityIx(signer, oftInstance, newAuthority, oftProgramId = PROGRAM_ID) {
|
|
20970
|
+
return instructions_exports.createSetMintAuthorityInstruction(
|
|
21073
20971
|
{
|
|
21074
20972
|
signer,
|
|
21075
20973
|
oftConfig: oftInstance
|
|
@@ -21079,40 +20977,22 @@ async function createSetMintAuthorityIx(signer, oftInstance, newAuthority) {
|
|
|
21079
20977
|
mintAuthority: newAuthority
|
|
21080
20978
|
}
|
|
21081
20979
|
},
|
|
21082
|
-
|
|
20980
|
+
oftProgramId
|
|
21083
20981
|
);
|
|
21084
20982
|
}
|
|
21085
|
-
async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
21086
|
-
const
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
);
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
);
|
|
21098
|
-
const [receiveLib] = web35.PublicKey.findProgramAddressSync(
|
|
21099
|
-
[
|
|
21100
|
-
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
21101
|
-
oftInstance.toBuffer(),
|
|
21102
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)
|
|
21103
|
-
],
|
|
21104
|
-
PROGRAM_ID2
|
|
21105
|
-
);
|
|
21106
|
-
const [defaultReceiveLib] = web35.PublicKey.findProgramAddressSync(
|
|
21107
|
-
[Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"), new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
21108
|
-
PROGRAM_ID2
|
|
21109
|
-
);
|
|
21110
|
-
const [ulnSettings] = web35.PublicKey.findProgramAddressSync([Buffer.from(ULN_SEED2, "utf-8")], PROGRAM_ID6);
|
|
21111
|
-
let sendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, sendLib);
|
|
21112
|
-
let receiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, receiveLib);
|
|
21113
|
-
const defaultSendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, defaultSendLib);
|
|
21114
|
-
const defaultReceiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, defaultReceiveLib);
|
|
21115
|
-
const nil64 = new BN6__default.default("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "hex");
|
|
20983
|
+
async function getEndpointConfig(connection, oftInstance, dstEid, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20984
|
+
const endpointDeriver = new EndpointPDADeriver(endpointProgram);
|
|
20985
|
+
const ulnDeriver = new UlnPDADeriver(msgLibProgram);
|
|
20986
|
+
const [sendLib] = endpointDeriver.sendLibraryConfig(oftInstance, dstEid);
|
|
20987
|
+
const [defaultSendLib] = endpointDeriver.defaultSendLibraryConfig(dstEid);
|
|
20988
|
+
const [receiveLib] = endpointDeriver.receiveLibraryConfig(oftInstance, dstEid);
|
|
20989
|
+
const [defaultReceiveLib] = endpointDeriver.defaultReceiveLibraryConfig(dstEid);
|
|
20990
|
+
const [msgLib] = ulnDeriver.messageLib();
|
|
20991
|
+
let sendLibraryConfig = await accounts_exports2.SendLibraryConfig.fromAccountAddress(connection, sendLib);
|
|
20992
|
+
let receiveLibraryConfig = await accounts_exports2.ReceiveLibraryConfig.fromAccountAddress(connection, receiveLib);
|
|
20993
|
+
const defaultSendLibraryConfig = await accounts_exports2.SendLibraryConfig.fromAccountAddress(connection, defaultSendLib);
|
|
20994
|
+
const defaultReceiveLibraryConfig = await accounts_exports2.ReceiveLibraryConfig.fromAccountAddress(connection, defaultReceiveLib);
|
|
20995
|
+
const nil64 = new BN2__default.default("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "hex");
|
|
21116
20996
|
const nil8 = 255;
|
|
21117
20997
|
if (sendLibraryConfig.messageLib.equals(web35.PublicKey.default)) {
|
|
21118
20998
|
sendLibraryConfig = defaultSendLibraryConfig;
|
|
@@ -21120,25 +21000,15 @@ async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
|
21120
21000
|
if (receiveLibraryConfig.messageLib.equals(web35.PublicKey.default)) {
|
|
21121
21001
|
receiveLibraryConfig = defaultReceiveLibraryConfig;
|
|
21122
21002
|
}
|
|
21123
|
-
if (sendLibraryConfig.messageLib.equals(
|
|
21124
|
-
const [ulnDefaultSendConfigPDA] =
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21128
|
-
const [ulnSendConfigPDA] = web35.PublicKey.findProgramAddressSync(
|
|
21129
|
-
[
|
|
21130
|
-
Buffer.from(SEND_CONFIG_SEED2, "utf-8"),
|
|
21131
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4),
|
|
21132
|
-
oftInstance.toBuffer()
|
|
21133
|
-
],
|
|
21134
|
-
PROGRAM_ID6
|
|
21135
|
-
);
|
|
21136
|
-
const ulnSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(connection, ulnSendConfigPDA);
|
|
21137
|
-
const ulnDefaultSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(
|
|
21003
|
+
if (sendLibraryConfig.messageLib.equals(msgLib)) {
|
|
21004
|
+
const [ulnDefaultSendConfigPDA] = ulnDeriver.defaultSendConfig(dstEid);
|
|
21005
|
+
const [ulnSendConfigPDA] = ulnDeriver.sendConfig(dstEid, oftInstance);
|
|
21006
|
+
const ulnSendConfig = await accounts_exports6.SendConfig.fromAccountAddress(connection, ulnSendConfigPDA);
|
|
21007
|
+
const ulnDefaultSendConfig = await accounts_exports6.SendConfig.fromAccountAddress(
|
|
21138
21008
|
connection,
|
|
21139
21009
|
ulnDefaultSendConfigPDA
|
|
21140
21010
|
);
|
|
21141
|
-
if (nil64.eq(new
|
|
21011
|
+
if (nil64.eq(new BN2__default.default(ulnSendConfig.uln.confirmations.toString()))) {
|
|
21142
21012
|
ulnSendConfig.uln.confirmations = 0;
|
|
21143
21013
|
} else if (ulnSendConfig.uln.confirmations == 0) {
|
|
21144
21014
|
ulnSendConfig.uln.confirmations = ulnDefaultSendConfig.uln.confirmations;
|
|
@@ -21159,25 +21029,15 @@ async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
|
21159
21029
|
}
|
|
21160
21030
|
sendLibraryConfig.ulnSendConfig = ulnSendConfig;
|
|
21161
21031
|
}
|
|
21162
|
-
if (receiveLibraryConfig.messageLib.equals(
|
|
21163
|
-
const [ulnDefaultReceiveConfigPDA] =
|
|
21164
|
-
|
|
21165
|
-
|
|
21166
|
-
|
|
21167
|
-
const [ulnReceiveConfigPDA] = web35.PublicKey.findProgramAddressSync(
|
|
21168
|
-
[
|
|
21169
|
-
Buffer.from(SEND_CONFIG_SEED2, "utf-8"),
|
|
21170
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4),
|
|
21171
|
-
oftInstance.toBuffer()
|
|
21172
|
-
],
|
|
21173
|
-
PROGRAM_ID6
|
|
21174
|
-
);
|
|
21175
|
-
const ulnReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(connection, ulnReceiveConfigPDA);
|
|
21176
|
-
const ulnDefaultReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(
|
|
21032
|
+
if (receiveLibraryConfig.messageLib.equals(msgLib)) {
|
|
21033
|
+
const [ulnDefaultReceiveConfigPDA] = ulnDeriver.defaultReceiveConfig(dstEid);
|
|
21034
|
+
const [ulnReceiveConfigPDA] = ulnDeriver.receiveConfig(dstEid, oftInstance);
|
|
21035
|
+
const ulnReceiveConfig = await accounts_exports6.ReceiveConfig.fromAccountAddress(connection, ulnReceiveConfigPDA);
|
|
21036
|
+
const ulnDefaultReceiveConfig = await accounts_exports6.ReceiveConfig.fromAccountAddress(
|
|
21177
21037
|
connection,
|
|
21178
21038
|
ulnDefaultReceiveConfigPDA
|
|
21179
21039
|
);
|
|
21180
|
-
if (nil64.eq(new
|
|
21040
|
+
if (nil64.eq(new BN2__default.default(ulnReceiveConfig.uln.confirmations.toString()))) {
|
|
21181
21041
|
ulnReceiveConfig.uln.confirmations = 0;
|
|
21182
21042
|
} else if (ulnReceiveConfig.uln.confirmations == 0) {
|
|
21183
21043
|
ulnReceiveConfig.uln.confirmations = ulnDefaultReceiveConfig.uln.confirmations;
|
|
@@ -21203,33 +21063,19 @@ async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
|
21203
21063
|
receiveLibraryConfig
|
|
21204
21064
|
};
|
|
21205
21065
|
}
|
|
21206
|
-
async function getPeerAddress(connection, oftInstance, dstEid) {
|
|
21207
|
-
const [peer] =
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
);
|
|
21211
|
-
const peerinfo = await connection.getAccountInfo(peer);
|
|
21212
|
-
return bytes.hexlify(peerinfo.data.subarray(8, 32 + 8));
|
|
21066
|
+
async function getPeerAddress(connection, oftInstance, dstEid, oftProgramId = PROGRAM_ID) {
|
|
21067
|
+
const [peer] = new OftPDADeriver(oftProgramId).peer(oftInstance, dstEid);
|
|
21068
|
+
const peerInfo = await accounts_exports.Peer.fromAccountAddress(connection, peer);
|
|
21069
|
+
return bytes.hexlify(peerInfo.address);
|
|
21213
21070
|
}
|
|
21214
|
-
async function getDelegate(connection, oftInstance) {
|
|
21215
|
-
const [oAppRegistry] =
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
|
|
21221
|
-
|
|
21222
|
-
async function getEnforcedOptions(connection, oftInstance, dstEid) {
|
|
21223
|
-
const [enforcedOptions] = web35.PublicKey.findProgramAddressSync(
|
|
21224
|
-
[
|
|
21225
|
-
Buffer.from(ENFORCED_OPTIONS_SEED2, "utf-8"),
|
|
21226
|
-
oftInstance.toBuffer(),
|
|
21227
|
-
new BN6__default.default(dstEid).toArrayLike(Buffer, "be", 4)
|
|
21228
|
-
],
|
|
21229
|
-
PROGRAM_ID
|
|
21230
|
-
);
|
|
21231
|
-
const enforcedOptionsInfo = await connection.getAccountInfo(enforcedOptions);
|
|
21232
|
-
return enforcedOptionsBeet.deserialize(enforcedOptionsInfo.data);
|
|
21071
|
+
async function getDelegate(connection, oftInstance, endpointProgram = PROGRAM_ID2) {
|
|
21072
|
+
const [oAppRegistry] = new EndpointPDADeriver(endpointProgram).oappRegistry(oftInstance);
|
|
21073
|
+
const oAppRegistryInfo = await accounts_exports2.OAppRegistry.fromAccountAddress(connection, oAppRegistry);
|
|
21074
|
+
return oAppRegistryInfo.delegate;
|
|
21075
|
+
}
|
|
21076
|
+
async function getEnforcedOptions(connection, oftInstance, dstEid, oftProgramId = PROGRAM_ID) {
|
|
21077
|
+
const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftInstance, dstEid);
|
|
21078
|
+
return accounts_exports.EnforcedOptions.fromAccountAddress(connection, enforcedOptions);
|
|
21233
21079
|
}
|
|
21234
21080
|
var idlTypes = [
|
|
21235
21081
|
"MessageLibQuoteParams",
|
|
@@ -22859,11 +22705,11 @@ var types = [
|
|
|
22859
22705
|
var IdlTypes = {
|
|
22860
22706
|
endpoint: types
|
|
22861
22707
|
};
|
|
22862
|
-
var SetConfigType2 = /* @__PURE__ */ ((
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
return
|
|
22708
|
+
var SetConfigType2 = /* @__PURE__ */ ((SetConfigType4) => {
|
|
22709
|
+
SetConfigType4[SetConfigType4["EXECUTOR"] = 1] = "EXECUTOR";
|
|
22710
|
+
SetConfigType4[SetConfigType4["SEND_ULN"] = 2] = "SEND_ULN";
|
|
22711
|
+
SetConfigType4[SetConfigType4["RECEIVE_ULN"] = 3] = "RECEIVE_ULN";
|
|
22712
|
+
return SetConfigType4;
|
|
22867
22713
|
})(SetConfigType2 || {});
|
|
22868
22714
|
|
|
22869
22715
|
exports.AddressType = AddressType;
|
|
@@ -22904,9 +22750,9 @@ exports.OAPP_SEED = OAPP_SEED;
|
|
|
22904
22750
|
exports.OAppBasePDADeriver = OAppBasePDADeriver;
|
|
22905
22751
|
exports.OFT_SEED = OFT_SEED;
|
|
22906
22752
|
exports.OPTIONS_SEED = OPTIONS_SEED;
|
|
22907
|
-
exports.Oft = oft_exports;
|
|
22908
22753
|
exports.OftPDADeriver = OftPDADeriver;
|
|
22909
|
-
exports.
|
|
22754
|
+
exports.OftProgram = oft_exports;
|
|
22755
|
+
exports.OftTools = oft_tools_exports;
|
|
22910
22756
|
exports.OmniCounterPDADeriver = OmniCounterPDADeriver;
|
|
22911
22757
|
exports.PAYLOAD_HASH_SEED = PAYLOAD_HASH_SEED;
|
|
22912
22758
|
exports.PEER_SEED = PEER_SEED;
|