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