@layerzerolabs/lz-solana-sdk-v2 2.3.21 → 2.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +851 -1005
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1308 -1438
- package/dist/index.d.ts +1308 -1438
- package/dist/index.mjs +849 -1003
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as web35 from '@solana/web3.js';
|
|
2
2
|
import { PublicKey, TransactionInstruction, AddressLookupTableProgram, VersionedTransaction, TransactionMessage, Keypair, NONCE_ACCOUNT_LENGTH, Transaction, SystemProgram, NonceAccount, ComputeBudgetProgram } from '@solana/web3.js';
|
|
3
|
-
import
|
|
3
|
+
import BN2 from 'bn.js';
|
|
4
4
|
import * as beet201 from '@metaplex-foundation/beet';
|
|
5
5
|
import { uniformFixedSizeArray, u8, FixableBeetArgsStruct, u32, u64, bytes, u16, BeetArgsStruct, bool, array } from '@metaplex-foundation/beet';
|
|
6
6
|
import * as beetSolana97 from '@metaplex-foundation/beet-solana';
|
|
7
7
|
import * as splToken from '@solana/spl-token';
|
|
8
|
-
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
8
|
+
import { getMintLen, createInitializeMintInstruction, TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
9
9
|
import { arrayify, hexlify, hexZeroPad } from '@ethersproject/bytes';
|
|
10
10
|
import { keccak256 } from '@ethersproject/keccak256';
|
|
11
|
-
import
|
|
11
|
+
import invariant3 from 'tiny-invariant';
|
|
12
12
|
import { getAddress } from '@ethersproject/address';
|
|
13
13
|
import '@ethersproject/abi';
|
|
14
14
|
import { BigNumber } from '@ethersproject/bignumber';
|
|
@@ -87,7 +87,7 @@ var MaxExecutorOptionTypeLength = 10;
|
|
|
87
87
|
function oappIDPDA(program, seed = COUNT_SEED, id) {
|
|
88
88
|
if (id != void 0) {
|
|
89
89
|
return PublicKey.findProgramAddressSync(
|
|
90
|
-
[Buffer.from(seed, "utf8"), new
|
|
90
|
+
[Buffer.from(seed, "utf8"), new BN2(id).toArrayLike(Buffer, "be", 1)],
|
|
91
91
|
program
|
|
92
92
|
);
|
|
93
93
|
} else {
|
|
@@ -131,121 +131,22 @@ var BaseOApp = class {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
// src/generated/oft/index.ts
|
|
135
|
-
var
|
|
136
|
-
__export(
|
|
134
|
+
// src/generated/oft/accounts/index.ts
|
|
135
|
+
var accounts_exports = {};
|
|
136
|
+
__export(accounts_exports, {
|
|
137
137
|
EnforcedOptions: () => EnforcedOptions,
|
|
138
|
-
InvalidDecimalsError: () => InvalidDecimalsError,
|
|
139
|
-
InvalidEndpointProgramError: () => InvalidEndpointProgramError,
|
|
140
|
-
InvalidOptionsError: () => InvalidOptionsError,
|
|
141
|
-
InvalidSenderError: () => InvalidSenderError,
|
|
142
|
-
InvalidTokenDestError: () => InvalidTokenDestError,
|
|
143
|
-
InvalidTokenEscrowError: () => InvalidTokenEscrowError,
|
|
144
|
-
InvalidTokenMintError: () => InvalidTokenMintError,
|
|
145
138
|
LzReceiveTypesAccounts: () => LzReceiveTypesAccounts,
|
|
146
139
|
OftConfig: () => OftConfig,
|
|
147
|
-
PROGRAM_ADDRESS: () => PROGRAM_ADDRESS,
|
|
148
|
-
PROGRAM_ID: () => PROGRAM_ID,
|
|
149
140
|
Peer: () => Peer,
|
|
150
|
-
RateLimitExceededError: () => RateLimitExceededError,
|
|
151
|
-
SlippageExceededError: () => SlippageExceededError,
|
|
152
|
-
UnauthorizedError: () => UnauthorizedError,
|
|
153
141
|
accountProviders: () => accountProviders,
|
|
154
|
-
createInitAdapterOftInstruction: () => createInitAdapterOftInstruction,
|
|
155
|
-
createInitAdapterOftInstructionAccounts: () => createInitAdapterOftInstructionAccounts,
|
|
156
|
-
createInitOftInstruction: () => createInitOftInstruction,
|
|
157
|
-
createInitOftInstructionAccounts: () => createInitOftInstructionAccounts,
|
|
158
|
-
createLzReceiveInstruction: () => createLzReceiveInstruction,
|
|
159
|
-
createLzReceiveInstructionAccounts: () => createLzReceiveInstructionAccounts,
|
|
160
|
-
createLzReceiveTypesInstruction: () => createLzReceiveTypesInstruction,
|
|
161
|
-
createLzReceiveTypesInstructionAccounts: () => createLzReceiveTypesInstructionAccounts,
|
|
162
|
-
createMintToInstruction: () => createMintToInstruction,
|
|
163
|
-
createMintToInstructionAccounts: () => createMintToInstructionAccounts,
|
|
164
|
-
createQuoteInstruction: () => createQuoteInstruction,
|
|
165
|
-
createQuoteInstructionAccounts: () => createQuoteInstructionAccounts,
|
|
166
|
-
createQuoteOftInstruction: () => createQuoteOftInstruction,
|
|
167
|
-
createQuoteOftInstructionAccounts: () => createQuoteOftInstructionAccounts,
|
|
168
|
-
createSendInstruction: () => createSendInstruction,
|
|
169
|
-
createSendInstructionAccounts: () => createSendInstructionAccounts,
|
|
170
|
-
createSetDelegateInstruction: () => createSetDelegateInstruction,
|
|
171
|
-
createSetDelegateInstructionAccounts: () => createSetDelegateInstructionAccounts,
|
|
172
|
-
createSetEnforcedOptionsInstruction: () => createSetEnforcedOptionsInstruction,
|
|
173
|
-
createSetEnforcedOptionsInstructionAccounts: () => createSetEnforcedOptionsInstructionAccounts,
|
|
174
|
-
createSetMintAuthorityInstruction: () => createSetMintAuthorityInstruction,
|
|
175
|
-
createSetMintAuthorityInstructionAccounts: () => createSetMintAuthorityInstructionAccounts,
|
|
176
|
-
createSetPeerInstruction: () => createSetPeerInstruction,
|
|
177
|
-
createSetPeerInstructionAccounts: () => createSetPeerInstructionAccounts,
|
|
178
|
-
createSetRateLimitInstruction: () => createSetRateLimitInstruction,
|
|
179
|
-
createSetRateLimitInstructionAccounts: () => createSetRateLimitInstructionAccounts,
|
|
180
|
-
createTransferAdminInstruction: () => createTransferAdminInstruction,
|
|
181
|
-
createTransferAdminInstructionAccounts: () => createTransferAdminInstructionAccounts,
|
|
182
|
-
createVersionInstruction: () => createVersionInstruction,
|
|
183
|
-
createVersionInstructionAccounts: () => createVersionInstructionAccounts,
|
|
184
142
|
enforcedOptionsBeet: () => enforcedOptionsBeet,
|
|
185
143
|
enforcedOptionsDiscriminator: () => enforcedOptionsDiscriminator,
|
|
186
|
-
errorFromCode: () => errorFromCode,
|
|
187
|
-
errorFromName: () => errorFromName,
|
|
188
|
-
initAdapterOftInstructionDiscriminator: () => initAdapterOftInstructionDiscriminator,
|
|
189
|
-
initAdapterOftParamsBeet: () => initAdapterOftParamsBeet,
|
|
190
|
-
initAdapterOftStruct: () => initAdapterOftStruct,
|
|
191
|
-
initOftInstructionDiscriminator: () => initOftInstructionDiscriminator,
|
|
192
|
-
initOftParamsBeet: () => initOftParamsBeet,
|
|
193
|
-
initOftStruct: () => initOftStruct,
|
|
194
|
-
isOftConfigExtAdapter: () => isOftConfigExtAdapter,
|
|
195
|
-
isOftConfigExtNative: () => isOftConfigExtNative,
|
|
196
|
-
lzAccountBeet: () => lzAccountBeet,
|
|
197
|
-
lzReceiveInstructionDiscriminator: () => lzReceiveInstructionDiscriminator,
|
|
198
|
-
lzReceiveParamsBeet: () => lzReceiveParamsBeet,
|
|
199
|
-
lzReceiveStruct: () => lzReceiveStruct,
|
|
200
144
|
lzReceiveTypesAccountsBeet: () => lzReceiveTypesAccountsBeet,
|
|
201
145
|
lzReceiveTypesAccountsDiscriminator: () => lzReceiveTypesAccountsDiscriminator,
|
|
202
|
-
lzReceiveTypesInstructionDiscriminator: () => lzReceiveTypesInstructionDiscriminator,
|
|
203
|
-
lzReceiveTypesStruct: () => lzReceiveTypesStruct,
|
|
204
|
-
messagingFeeBeet: () => messagingFeeBeet,
|
|
205
|
-
messagingReceiptBeet: () => messagingReceiptBeet,
|
|
206
|
-
mintToInstructionDiscriminator: () => mintToInstructionDiscriminator,
|
|
207
|
-
mintToParamsBeet: () => mintToParamsBeet,
|
|
208
|
-
mintToStruct: () => mintToStruct,
|
|
209
|
-
oFTFeeDetailBeet: () => oFTFeeDetailBeet,
|
|
210
|
-
oFTLimitsBeet: () => oFTLimitsBeet,
|
|
211
|
-
oFTReceiptBeet: () => oFTReceiptBeet,
|
|
212
146
|
oftConfigBeet: () => oftConfigBeet,
|
|
213
147
|
oftConfigDiscriminator: () => oftConfigDiscriminator,
|
|
214
|
-
oftConfigExtBeet: () => oftConfigExtBeet,
|
|
215
148
|
peerBeet: () => peerBeet,
|
|
216
|
-
peerDiscriminator: () => peerDiscriminator
|
|
217
|
-
quoteInstructionDiscriminator: () => quoteInstructionDiscriminator,
|
|
218
|
-
quoteOftInstructionDiscriminator: () => quoteOftInstructionDiscriminator,
|
|
219
|
-
quoteOftParamsBeet: () => quoteOftParamsBeet,
|
|
220
|
-
quoteOftResultBeet: () => quoteOftResultBeet,
|
|
221
|
-
quoteOftStruct: () => quoteOftStruct,
|
|
222
|
-
quoteParamsBeet: () => quoteParamsBeet,
|
|
223
|
-
quoteStruct: () => quoteStruct,
|
|
224
|
-
rateLimiterBeet: () => rateLimiterBeet,
|
|
225
|
-
sendInstructionDiscriminator: () => sendInstructionDiscriminator,
|
|
226
|
-
sendParamsBeet: () => sendParamsBeet,
|
|
227
|
-
sendStruct: () => sendStruct,
|
|
228
|
-
setDelegateInstructionDiscriminator: () => setDelegateInstructionDiscriminator,
|
|
229
|
-
setDelegateParamsBeet: () => setDelegateParamsBeet,
|
|
230
|
-
setDelegateStruct: () => setDelegateStruct,
|
|
231
|
-
setEnforcedOptionsInstructionDiscriminator: () => setEnforcedOptionsInstructionDiscriminator,
|
|
232
|
-
setEnforcedOptionsParamsBeet: () => setEnforcedOptionsParamsBeet,
|
|
233
|
-
setEnforcedOptionsStruct: () => setEnforcedOptionsStruct,
|
|
234
|
-
setMintAuthorityInstructionDiscriminator: () => setMintAuthorityInstructionDiscriminator,
|
|
235
|
-
setMintAuthorityParamsBeet: () => setMintAuthorityParamsBeet,
|
|
236
|
-
setMintAuthorityStruct: () => setMintAuthorityStruct,
|
|
237
|
-
setPeerInstructionDiscriminator: () => setPeerInstructionDiscriminator,
|
|
238
|
-
setPeerParamsBeet: () => setPeerParamsBeet,
|
|
239
|
-
setPeerStruct: () => setPeerStruct,
|
|
240
|
-
setRateLimitInstructionDiscriminator: () => setRateLimitInstructionDiscriminator,
|
|
241
|
-
setRateLimitParamsBeet: () => setRateLimitParamsBeet,
|
|
242
|
-
setRateLimitStruct: () => setRateLimitStruct,
|
|
243
|
-
transferAdminInstructionDiscriminator: () => transferAdminInstructionDiscriminator,
|
|
244
|
-
transferAdminParamsBeet: () => transferAdminParamsBeet,
|
|
245
|
-
transferAdminStruct: () => transferAdminStruct,
|
|
246
|
-
versionBeet: () => versionBeet,
|
|
247
|
-
versionInstructionDiscriminator: () => versionInstructionDiscriminator,
|
|
248
|
-
versionStruct: () => versionStruct
|
|
149
|
+
peerDiscriminator: () => peerDiscriminator
|
|
249
150
|
});
|
|
250
151
|
var enforcedOptionsDiscriminator = [114, 221, 43, 174, 5, 37, 8, 20];
|
|
251
152
|
var EnforcedOptions = class _EnforcedOptions {
|
|
@@ -926,14 +827,71 @@ createErrorFromNameLookup.set(
|
|
|
926
827
|
"RateLimitExceeded",
|
|
927
828
|
() => new RateLimitExceededError()
|
|
928
829
|
);
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
830
|
+
|
|
831
|
+
// src/generated/oft/instructions/index.ts
|
|
832
|
+
var instructions_exports = {};
|
|
833
|
+
__export(instructions_exports, {
|
|
834
|
+
createInitAdapterOftInstruction: () => createInitAdapterOftInstruction,
|
|
835
|
+
createInitAdapterOftInstructionAccounts: () => createInitAdapterOftInstructionAccounts,
|
|
836
|
+
createInitOftInstruction: () => createInitOftInstruction,
|
|
837
|
+
createInitOftInstructionAccounts: () => createInitOftInstructionAccounts,
|
|
838
|
+
createLzReceiveInstruction: () => createLzReceiveInstruction,
|
|
839
|
+
createLzReceiveInstructionAccounts: () => createLzReceiveInstructionAccounts,
|
|
840
|
+
createLzReceiveTypesInstruction: () => createLzReceiveTypesInstruction,
|
|
841
|
+
createLzReceiveTypesInstructionAccounts: () => createLzReceiveTypesInstructionAccounts,
|
|
842
|
+
createMintToInstruction: () => createMintToInstruction,
|
|
843
|
+
createMintToInstructionAccounts: () => createMintToInstructionAccounts,
|
|
844
|
+
createQuoteInstruction: () => createQuoteInstruction,
|
|
845
|
+
createQuoteInstructionAccounts: () => createQuoteInstructionAccounts,
|
|
846
|
+
createQuoteOftInstruction: () => createQuoteOftInstruction,
|
|
847
|
+
createQuoteOftInstructionAccounts: () => createQuoteOftInstructionAccounts,
|
|
848
|
+
createSendInstruction: () => createSendInstruction,
|
|
849
|
+
createSendInstructionAccounts: () => createSendInstructionAccounts,
|
|
850
|
+
createSetDelegateInstruction: () => createSetDelegateInstruction,
|
|
851
|
+
createSetDelegateInstructionAccounts: () => createSetDelegateInstructionAccounts,
|
|
852
|
+
createSetEnforcedOptionsInstruction: () => createSetEnforcedOptionsInstruction,
|
|
853
|
+
createSetEnforcedOptionsInstructionAccounts: () => createSetEnforcedOptionsInstructionAccounts,
|
|
854
|
+
createSetMintAuthorityInstruction: () => createSetMintAuthorityInstruction,
|
|
855
|
+
createSetMintAuthorityInstructionAccounts: () => createSetMintAuthorityInstructionAccounts,
|
|
856
|
+
createSetPeerInstruction: () => createSetPeerInstruction,
|
|
857
|
+
createSetPeerInstructionAccounts: () => createSetPeerInstructionAccounts,
|
|
858
|
+
createSetRateLimitInstruction: () => createSetRateLimitInstruction,
|
|
859
|
+
createSetRateLimitInstructionAccounts: () => createSetRateLimitInstructionAccounts,
|
|
860
|
+
createTransferAdminInstruction: () => createTransferAdminInstruction,
|
|
861
|
+
createTransferAdminInstructionAccounts: () => createTransferAdminInstructionAccounts,
|
|
862
|
+
createVersionInstruction: () => createVersionInstruction,
|
|
863
|
+
createVersionInstructionAccounts: () => createVersionInstructionAccounts,
|
|
864
|
+
initAdapterOftInstructionDiscriminator: () => initAdapterOftInstructionDiscriminator,
|
|
865
|
+
initAdapterOftStruct: () => initAdapterOftStruct,
|
|
866
|
+
initOftInstructionDiscriminator: () => initOftInstructionDiscriminator,
|
|
867
|
+
initOftStruct: () => initOftStruct,
|
|
868
|
+
lzReceiveInstructionDiscriminator: () => lzReceiveInstructionDiscriminator,
|
|
869
|
+
lzReceiveStruct: () => lzReceiveStruct,
|
|
870
|
+
lzReceiveTypesInstructionDiscriminator: () => lzReceiveTypesInstructionDiscriminator,
|
|
871
|
+
lzReceiveTypesStruct: () => lzReceiveTypesStruct,
|
|
872
|
+
mintToInstructionDiscriminator: () => mintToInstructionDiscriminator,
|
|
873
|
+
mintToStruct: () => mintToStruct,
|
|
874
|
+
quoteInstructionDiscriminator: () => quoteInstructionDiscriminator,
|
|
875
|
+
quoteOftInstructionDiscriminator: () => quoteOftInstructionDiscriminator,
|
|
876
|
+
quoteOftStruct: () => quoteOftStruct,
|
|
877
|
+
quoteStruct: () => quoteStruct,
|
|
878
|
+
sendInstructionDiscriminator: () => sendInstructionDiscriminator,
|
|
879
|
+
sendStruct: () => sendStruct,
|
|
880
|
+
setDelegateInstructionDiscriminator: () => setDelegateInstructionDiscriminator,
|
|
881
|
+
setDelegateStruct: () => setDelegateStruct,
|
|
882
|
+
setEnforcedOptionsInstructionDiscriminator: () => setEnforcedOptionsInstructionDiscriminator,
|
|
883
|
+
setEnforcedOptionsStruct: () => setEnforcedOptionsStruct,
|
|
884
|
+
setMintAuthorityInstructionDiscriminator: () => setMintAuthorityInstructionDiscriminator,
|
|
885
|
+
setMintAuthorityStruct: () => setMintAuthorityStruct,
|
|
886
|
+
setPeerInstructionDiscriminator: () => setPeerInstructionDiscriminator,
|
|
887
|
+
setPeerStruct: () => setPeerStruct,
|
|
888
|
+
setRateLimitInstructionDiscriminator: () => setRateLimitInstructionDiscriminator,
|
|
889
|
+
setRateLimitStruct: () => setRateLimitStruct,
|
|
890
|
+
transferAdminInstructionDiscriminator: () => transferAdminInstructionDiscriminator,
|
|
891
|
+
transferAdminStruct: () => transferAdminStruct,
|
|
892
|
+
versionInstructionDiscriminator: () => versionInstructionDiscriminator,
|
|
893
|
+
versionStruct: () => versionStruct
|
|
894
|
+
});
|
|
937
895
|
var initAdapterOftParamsBeet = new beet201.FixableBeetArgsStruct(
|
|
938
896
|
[
|
|
939
897
|
["admin", beetSolana97.publicKey],
|
|
@@ -2390,6 +2348,36 @@ function createVersionInstructionAccounts(programId = new web35.PublicKey("HRPXL
|
|
|
2390
2348
|
const keys = [];
|
|
2391
2349
|
return keys;
|
|
2392
2350
|
}
|
|
2351
|
+
|
|
2352
|
+
// src/generated/oft/types/index.ts
|
|
2353
|
+
var types_exports = {};
|
|
2354
|
+
__export(types_exports, {
|
|
2355
|
+
initAdapterOftParamsBeet: () => initAdapterOftParamsBeet,
|
|
2356
|
+
initOftParamsBeet: () => initOftParamsBeet,
|
|
2357
|
+
isOftConfigExtAdapter: () => isOftConfigExtAdapter,
|
|
2358
|
+
isOftConfigExtNative: () => isOftConfigExtNative,
|
|
2359
|
+
lzAccountBeet: () => lzAccountBeet,
|
|
2360
|
+
lzReceiveParamsBeet: () => lzReceiveParamsBeet,
|
|
2361
|
+
messagingFeeBeet: () => messagingFeeBeet,
|
|
2362
|
+
messagingReceiptBeet: () => messagingReceiptBeet,
|
|
2363
|
+
mintToParamsBeet: () => mintToParamsBeet,
|
|
2364
|
+
oFTFeeDetailBeet: () => oFTFeeDetailBeet,
|
|
2365
|
+
oFTLimitsBeet: () => oFTLimitsBeet,
|
|
2366
|
+
oFTReceiptBeet: () => oFTReceiptBeet,
|
|
2367
|
+
oftConfigExtBeet: () => oftConfigExtBeet,
|
|
2368
|
+
quoteOftParamsBeet: () => quoteOftParamsBeet,
|
|
2369
|
+
quoteOftResultBeet: () => quoteOftResultBeet,
|
|
2370
|
+
quoteParamsBeet: () => quoteParamsBeet,
|
|
2371
|
+
rateLimiterBeet: () => rateLimiterBeet,
|
|
2372
|
+
sendParamsBeet: () => sendParamsBeet,
|
|
2373
|
+
setDelegateParamsBeet: () => setDelegateParamsBeet,
|
|
2374
|
+
setEnforcedOptionsParamsBeet: () => setEnforcedOptionsParamsBeet,
|
|
2375
|
+
setMintAuthorityParamsBeet: () => setMintAuthorityParamsBeet,
|
|
2376
|
+
setPeerParamsBeet: () => setPeerParamsBeet,
|
|
2377
|
+
setRateLimitParamsBeet: () => setRateLimitParamsBeet,
|
|
2378
|
+
transferAdminParamsBeet: () => transferAdminParamsBeet,
|
|
2379
|
+
versionBeet: () => versionBeet
|
|
2380
|
+
});
|
|
2393
2381
|
var lzAccountBeet = new beet201.BeetArgsStruct(
|
|
2394
2382
|
[
|
|
2395
2383
|
["pubkey", beetSolana97.publicKey],
|
|
@@ -2495,7 +2483,7 @@ var EndpointPDADeriver = class {
|
|
|
2495
2483
|
[
|
|
2496
2484
|
Buffer.from(SEND_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2497
2485
|
// U32 to Uint8Array([0,0,0,0])
|
|
2498
|
-
new
|
|
2486
|
+
new BN2(dstEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2499
2487
|
],
|
|
2500
2488
|
this.program
|
|
2501
2489
|
);
|
|
@@ -2506,7 +2494,7 @@ var EndpointPDADeriver = class {
|
|
|
2506
2494
|
Buffer.from(SEND_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2507
2495
|
sender.toBytes(),
|
|
2508
2496
|
// U32 to Uint8Array([0,0,0,0])
|
|
2509
|
-
new
|
|
2497
|
+
new BN2(dstEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2510
2498
|
],
|
|
2511
2499
|
this.program
|
|
2512
2500
|
);
|
|
@@ -2525,7 +2513,7 @@ var EndpointPDADeriver = class {
|
|
|
2525
2513
|
[
|
|
2526
2514
|
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2527
2515
|
// U32 to Uint8Array([0,0,0,0])
|
|
2528
|
-
new
|
|
2516
|
+
new BN2(srcEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2529
2517
|
],
|
|
2530
2518
|
this.program
|
|
2531
2519
|
);
|
|
@@ -2536,7 +2524,7 @@ var EndpointPDADeriver = class {
|
|
|
2536
2524
|
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED, "utf8"),
|
|
2537
2525
|
receiver.toBytes(),
|
|
2538
2526
|
// U32 to Uint8Array([0,0,0,0])
|
|
2539
|
-
new
|
|
2527
|
+
new BN2(srcEndpointId).toArrayLike(Buffer, "be", 4)
|
|
2540
2528
|
],
|
|
2541
2529
|
this.program
|
|
2542
2530
|
);
|
|
@@ -2564,7 +2552,7 @@ var EndpointPDADeriver = class {
|
|
|
2564
2552
|
Buffer.from(NONCE_SEED, "utf8"),
|
|
2565
2553
|
localOapp.toBytes(),
|
|
2566
2554
|
// U32 to Uint8Array([0,0,0,0])
|
|
2567
|
-
new
|
|
2555
|
+
new BN2(remoteChainId).toArrayLike(Buffer, "be", 4),
|
|
2568
2556
|
remoteOapp
|
|
2569
2557
|
],
|
|
2570
2558
|
this.program
|
|
@@ -2575,7 +2563,7 @@ var EndpointPDADeriver = class {
|
|
|
2575
2563
|
[
|
|
2576
2564
|
Buffer.from(PENDING_NONCE_SEED, "utf8"),
|
|
2577
2565
|
localOapp.toBytes(),
|
|
2578
|
-
new
|
|
2566
|
+
new BN2(remoteChainId).toArrayLike(Buffer, "be", 4),
|
|
2579
2567
|
remoteOapp
|
|
2580
2568
|
],
|
|
2581
2569
|
this.program
|
|
@@ -2600,9 +2588,9 @@ var EndpointPDADeriver = class {
|
|
|
2600
2588
|
[
|
|
2601
2589
|
Buffer.from(PAYLOAD_HASH_SEED, "utf8"),
|
|
2602
2590
|
receiver.toBytes(),
|
|
2603
|
-
new
|
|
2591
|
+
new BN2(srcEid).toArrayLike(Buffer, "be", 4),
|
|
2604
2592
|
sender,
|
|
2605
|
-
new
|
|
2593
|
+
new BN2(nonce).toArrayLike(Buffer, "be", 8)
|
|
2606
2594
|
],
|
|
2607
2595
|
this.program
|
|
2608
2596
|
);
|
|
@@ -2614,7 +2602,7 @@ var EndpointPDADeriver = class {
|
|
|
2614
2602
|
from.toBytes(),
|
|
2615
2603
|
to.toBytes(),
|
|
2616
2604
|
guid,
|
|
2617
|
-
new
|
|
2605
|
+
new BN2(index).toArrayLike(Buffer, "be", 2),
|
|
2618
2606
|
messageHash
|
|
2619
2607
|
],
|
|
2620
2608
|
this.program
|
|
@@ -2630,13 +2618,13 @@ var MessageLibPDADeriver = class {
|
|
|
2630
2618
|
}
|
|
2631
2619
|
sendConfig(eid, oapp) {
|
|
2632
2620
|
return PublicKey.findProgramAddressSync(
|
|
2633
|
-
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new
|
|
2621
|
+
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new BN2(eid).toArrayLike(Buffer, "be", 4), oapp.toBuffer()],
|
|
2634
2622
|
this.program
|
|
2635
2623
|
);
|
|
2636
2624
|
}
|
|
2637
2625
|
receiveConfig(eid, oapp) {
|
|
2638
2626
|
return PublicKey.findProgramAddressSync(
|
|
2639
|
-
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new
|
|
2627
|
+
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new BN2(eid).toArrayLike(Buffer, "be", 4), oapp.toBuffer()],
|
|
2640
2628
|
this.program
|
|
2641
2629
|
);
|
|
2642
2630
|
}
|
|
@@ -2647,25 +2635,25 @@ var UlnPDADeriver = class extends MessageLibPDADeriver {
|
|
|
2647
2635
|
}
|
|
2648
2636
|
config(eid) {
|
|
2649
2637
|
return PublicKey.findProgramAddressSync(
|
|
2650
|
-
[Buffer.from(ULN_CONFIG_SEED, "utf8"), new
|
|
2638
|
+
[Buffer.from(ULN_CONFIG_SEED, "utf8"), new BN2(eid).toArrayLike(Buffer, "be", 4)],
|
|
2651
2639
|
this.program
|
|
2652
2640
|
);
|
|
2653
2641
|
}
|
|
2654
2642
|
defaultSendConfig(eid) {
|
|
2655
2643
|
return PublicKey.findProgramAddressSync(
|
|
2656
|
-
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new
|
|
2644
|
+
[Buffer.from(SEND_CONFIG_SEED, "utf8"), new BN2(eid).toArrayLike(Buffer, "be", 4)],
|
|
2657
2645
|
this.program
|
|
2658
2646
|
);
|
|
2659
2647
|
}
|
|
2660
2648
|
defaultReceiveConfig(eid) {
|
|
2661
2649
|
return PublicKey.findProgramAddressSync(
|
|
2662
|
-
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new
|
|
2650
|
+
[Buffer.from(RECEIVE_CONFIG_SEED, "utf8"), new BN2(eid).toArrayLike(Buffer, "be", 4)],
|
|
2663
2651
|
this.program
|
|
2664
2652
|
);
|
|
2665
2653
|
}
|
|
2666
2654
|
options(eit) {
|
|
2667
2655
|
return PublicKey.findProgramAddressSync(
|
|
2668
|
-
[Buffer.from(OPTIONS_SEED, "utf8"), new
|
|
2656
|
+
[Buffer.from(OPTIONS_SEED, "utf8"), new BN2(eit).toArrayLike(Buffer, "be", 4)],
|
|
2669
2657
|
this.program
|
|
2670
2658
|
);
|
|
2671
2659
|
}
|
|
@@ -2685,7 +2673,7 @@ var OAppBasePDADeriver = class {
|
|
|
2685
2673
|
}
|
|
2686
2674
|
remote(dstChainId) {
|
|
2687
2675
|
return PublicKey.findProgramAddressSync(
|
|
2688
|
-
[Buffer.from(REMOTE_SEED), new
|
|
2676
|
+
[Buffer.from(REMOTE_SEED), new BN2(dstChainId).toArrayLike(Buffer, "be", 4)],
|
|
2689
2677
|
this.program
|
|
2690
2678
|
);
|
|
2691
2679
|
}
|
|
@@ -2706,7 +2694,7 @@ var OmniCounterPDADeriver = class extends OAppBasePDADeriver {
|
|
|
2706
2694
|
}
|
|
2707
2695
|
remote(dstChainId) {
|
|
2708
2696
|
return PublicKey.findProgramAddressSync(
|
|
2709
|
-
[Buffer.from(REMOTE_SEED), this.count()[0].toBytes(), new
|
|
2697
|
+
[Buffer.from(REMOTE_SEED), this.count()[0].toBytes(), new BN2(dstChainId).toArrayLike(Buffer, "be", 4)],
|
|
2710
2698
|
this.program
|
|
2711
2699
|
);
|
|
2712
2700
|
}
|
|
@@ -2770,19 +2758,25 @@ var OftPDADeriver = class {
|
|
|
2770
2758
|
}
|
|
2771
2759
|
enforcedOptions(oftConfig, eid) {
|
|
2772
2760
|
return PublicKey.findProgramAddressSync(
|
|
2773
|
-
[Buffer.from(ENFORCED_OPTIONS_SEED, "utf8"), oftConfig.toBytes(), new
|
|
2761
|
+
[Buffer.from(ENFORCED_OPTIONS_SEED, "utf8"), oftConfig.toBytes(), new BN2(eid).toArrayLike(Buffer, "be", 4)],
|
|
2774
2762
|
this.program
|
|
2775
2763
|
);
|
|
2776
2764
|
}
|
|
2777
2765
|
peer(oftConfig, eid) {
|
|
2778
2766
|
return PublicKey.findProgramAddressSync(
|
|
2779
|
-
[Buffer.from(PEER_SEED, "utf8"), oftConfig.toBytes(), new
|
|
2767
|
+
[Buffer.from(PEER_SEED, "utf8"), oftConfig.toBytes(), new BN2(eid).toArrayLike(Buffer, "be", 4)],
|
|
2780
2768
|
this.program
|
|
2781
2769
|
);
|
|
2782
2770
|
}
|
|
2783
2771
|
oftConfig(mintOrEscrow) {
|
|
2784
2772
|
return PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED, "utf8"), mintOrEscrow.toBuffer()], this.program);
|
|
2785
2773
|
}
|
|
2774
|
+
lzReceiveTypesAccounts(oftConfig) {
|
|
2775
|
+
return PublicKey.findProgramAddressSync(
|
|
2776
|
+
[Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
|
|
2777
|
+
this.program
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2786
2780
|
};
|
|
2787
2781
|
|
|
2788
2782
|
// src/endpoint.ts
|
|
@@ -2792,11 +2786,11 @@ __export(endpoint_exports, {
|
|
|
2792
2786
|
Endpoint: () => Endpoint,
|
|
2793
2787
|
EventEmitDiscriminator: () => EventEmitDiscriminator,
|
|
2794
2788
|
PROGRAM_ID: () => PROGRAM_ID2,
|
|
2795
|
-
accounts: () =>
|
|
2789
|
+
accounts: () => accounts_exports2,
|
|
2796
2790
|
errors: () => errors_exports,
|
|
2797
2791
|
events: () => events_exports,
|
|
2798
|
-
instructions: () =>
|
|
2799
|
-
types: () =>
|
|
2792
|
+
instructions: () => instructions_exports2,
|
|
2793
|
+
types: () => types_exports2
|
|
2800
2794
|
});
|
|
2801
2795
|
function hexZeroPadTo32(addr) {
|
|
2802
2796
|
return hexZeroPad(addr, 32);
|
|
@@ -2930,10 +2924,27 @@ var PacketV1Codec = class _PacketV1Codec {
|
|
|
2930
2924
|
};
|
|
2931
2925
|
}
|
|
2932
2926
|
};
|
|
2927
|
+
var PacketSerializer = class {
|
|
2928
|
+
static serialize(packet) {
|
|
2929
|
+
return PacketV1Codec.encode(packet);
|
|
2930
|
+
}
|
|
2931
|
+
static serializeBytes(packet) {
|
|
2932
|
+
return PacketV1Codec.encodeBytes(packet);
|
|
2933
|
+
}
|
|
2934
|
+
static deserialize(bytesLike) {
|
|
2935
|
+
let codec;
|
|
2936
|
+
if (bytesLike instanceof Uint8Array) {
|
|
2937
|
+
codec = PacketV1Codec.fromBytes(bytesLike);
|
|
2938
|
+
} else {
|
|
2939
|
+
codec = PacketV1Codec.from(bytesLike);
|
|
2940
|
+
}
|
|
2941
|
+
return codec.toPacket();
|
|
2942
|
+
}
|
|
2943
|
+
};
|
|
2933
2944
|
|
|
2934
2945
|
// src/generated/endpoint/accounts/index.ts
|
|
2935
|
-
var
|
|
2936
|
-
__export(
|
|
2946
|
+
var accounts_exports2 = {};
|
|
2947
|
+
__export(accounts_exports2, {
|
|
2937
2948
|
ComposeMessageState: () => ComposeMessageState,
|
|
2938
2949
|
EndpointSettings: () => EndpointSettings,
|
|
2939
2950
|
MessageLibInfo: () => MessageLibInfo,
|
|
@@ -4091,8 +4102,8 @@ __export(errors_exports, {
|
|
|
4091
4102
|
SameValueError: () => SameValueError,
|
|
4092
4103
|
UnauthorizedError: () => UnauthorizedError2,
|
|
4093
4104
|
WritableAccountNotAllowedError: () => WritableAccountNotAllowedError,
|
|
4094
|
-
errorFromCode: () =>
|
|
4095
|
-
errorFromName: () =>
|
|
4105
|
+
errorFromCode: () => errorFromCode,
|
|
4106
|
+
errorFromName: () => errorFromName
|
|
4096
4107
|
});
|
|
4097
4108
|
var createErrorFromCodeLookup2 = /* @__PURE__ */ new Map();
|
|
4098
4109
|
var createErrorFromNameLookup2 = /* @__PURE__ */ new Map();
|
|
@@ -4348,18 +4359,18 @@ createErrorFromNameLookup2.set(
|
|
|
4348
4359
|
"WritableAccountNotAllowed",
|
|
4349
4360
|
() => new WritableAccountNotAllowedError()
|
|
4350
4361
|
);
|
|
4351
|
-
function
|
|
4362
|
+
function errorFromCode(code) {
|
|
4352
4363
|
const createError = createErrorFromCodeLookup2.get(code);
|
|
4353
4364
|
return createError != null ? createError() : null;
|
|
4354
4365
|
}
|
|
4355
|
-
function
|
|
4366
|
+
function errorFromName(name) {
|
|
4356
4367
|
const createError = createErrorFromNameLookup2.get(name);
|
|
4357
4368
|
return createError != null ? createError() : null;
|
|
4358
4369
|
}
|
|
4359
4370
|
|
|
4360
4371
|
// src/generated/endpoint/instructions/index.ts
|
|
4361
|
-
var
|
|
4362
|
-
__export(
|
|
4372
|
+
var instructions_exports2 = {};
|
|
4373
|
+
__export(instructions_exports2, {
|
|
4363
4374
|
burnInstructionDiscriminator: () => burnInstructionDiscriminator,
|
|
4364
4375
|
burnStruct: () => burnStruct,
|
|
4365
4376
|
clearComposeInstructionDiscriminator: () => clearComposeInstructionDiscriminator,
|
|
@@ -8033,8 +8044,8 @@ function createWithdrawRentInstructionAccounts(accounts, programId = new web35.P
|
|
|
8033
8044
|
}
|
|
8034
8045
|
|
|
8035
8046
|
// src/generated/endpoint/types/index.ts
|
|
8036
|
-
var
|
|
8037
|
-
__export(
|
|
8047
|
+
var types_exports2 = {};
|
|
8048
|
+
__export(types_exports2, {
|
|
8038
8049
|
MessageLibType: () => MessageLibType,
|
|
8039
8050
|
burnParamsBeet: () => burnParamsBeet,
|
|
8040
8051
|
clearComposeParamsBeet: () => clearComposeParamsBeet,
|
|
@@ -8497,12 +8508,16 @@ var Endpoint = class {
|
|
|
8497
8508
|
}
|
|
8498
8509
|
async initOAppNonce(connection, delegate, dstEid, oappIDPDA2, remoteOappAddr) {
|
|
8499
8510
|
const [nonce] = this.endpointDeriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8500
|
-
const [pendingNonce] = this.endpointDeriver.pendingNonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8501
|
-
const [oappRegistry] = this.endpointDeriver.oappRegistry(oappIDPDA2);
|
|
8502
8511
|
const info = await connection.getAccountInfo(nonce);
|
|
8503
8512
|
if (info) {
|
|
8504
8513
|
return null;
|
|
8505
8514
|
}
|
|
8515
|
+
return this.initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr);
|
|
8516
|
+
}
|
|
8517
|
+
initOAppNonceWithoutChecks(delegate, dstEid, oappIDPDA2, remoteOappAddr) {
|
|
8518
|
+
const [nonce] = this.endpointDeriver.nonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8519
|
+
const [pendingNonce] = this.endpointDeriver.pendingNonce(oappIDPDA2, dstEid, remoteOappAddr);
|
|
8520
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(oappIDPDA2);
|
|
8506
8521
|
return createInitNonceInstruction(
|
|
8507
8522
|
{
|
|
8508
8523
|
nonce,
|
|
@@ -8521,12 +8536,16 @@ var Endpoint = class {
|
|
|
8521
8536
|
);
|
|
8522
8537
|
}
|
|
8523
8538
|
async initSendLibrary(connection, delegate, sender, dstEid, commitmentOrConfig) {
|
|
8524
|
-
const [oappRegistry] = this.endpointDeriver.oappRegistry(sender);
|
|
8525
8539
|
const [sendLibraryConfig] = this.endpointDeriver.sendLibraryConfig(sender, dstEid);
|
|
8526
8540
|
const info = await connection.getAccountInfo(sendLibraryConfig, commitmentOrConfig);
|
|
8527
8541
|
if (info) {
|
|
8528
8542
|
return null;
|
|
8529
8543
|
}
|
|
8544
|
+
return this.initSendLibraryWithoutChecks(delegate, sender, dstEid);
|
|
8545
|
+
}
|
|
8546
|
+
initSendLibraryWithoutChecks(delegate, sender, dstEid) {
|
|
8547
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(sender);
|
|
8548
|
+
const [sendLibraryConfig] = this.endpointDeriver.sendLibraryConfig(sender, dstEid);
|
|
8530
8549
|
return createInitSendLibraryInstruction(
|
|
8531
8550
|
{
|
|
8532
8551
|
delegate,
|
|
@@ -8542,7 +8561,7 @@ var Endpoint = class {
|
|
|
8542
8561
|
this.program
|
|
8543
8562
|
);
|
|
8544
8563
|
}
|
|
8545
|
-
async setSendLibrary(
|
|
8564
|
+
async setSendLibrary(oappAdmin, oappIDPDA2, newSendLibProgram, dstEid) {
|
|
8546
8565
|
const [newSendLib] = new MessageLibPDADeriver(newSendLibProgram).messageLib();
|
|
8547
8566
|
const [sendLibraryConfig] = this.endpointDeriver.sendLibraryConfig(oappIDPDA2, dstEid);
|
|
8548
8567
|
const [sendLibraryInfo] = this.endpointDeriver.messageLibraryInfo(newSendLib);
|
|
@@ -8568,12 +8587,16 @@ var Endpoint = class {
|
|
|
8568
8587
|
return Promise.resolve(ix);
|
|
8569
8588
|
}
|
|
8570
8589
|
async initReceiveLibrary(connection, delegate, receiver, srcEid, commitmentOrConfig) {
|
|
8571
|
-
const [oappRegistry] = this.endpointDeriver.oappRegistry(receiver);
|
|
8572
8590
|
const [receiveLibraryConfig] = this.endpointDeriver.receiveLibraryConfig(receiver, srcEid);
|
|
8573
8591
|
const info = await connection.getAccountInfo(receiveLibraryConfig, commitmentOrConfig);
|
|
8574
8592
|
if (info) {
|
|
8575
8593
|
return null;
|
|
8576
8594
|
}
|
|
8595
|
+
return this.initReceiveLibraryWithoutChecks(delegate, receiver, srcEid);
|
|
8596
|
+
}
|
|
8597
|
+
initReceiveLibraryWithoutChecks(delegate, receiver, srcEid) {
|
|
8598
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(receiver);
|
|
8599
|
+
const [receiveLibraryConfig] = this.endpointDeriver.receiveLibraryConfig(receiver, srcEid);
|
|
8577
8600
|
return createInitReceiveLibraryInstruction(
|
|
8578
8601
|
{
|
|
8579
8602
|
delegate,
|
|
@@ -8589,7 +8612,7 @@ var Endpoint = class {
|
|
|
8589
8612
|
this.program
|
|
8590
8613
|
);
|
|
8591
8614
|
}
|
|
8592
|
-
async setReceiveLibrary(
|
|
8615
|
+
async setReceiveLibrary(oappAdmin, oappIDPDA2, newReceiveLibProgram, srcEid, gracePeriod) {
|
|
8593
8616
|
const [newReceiveLib] = new MessageLibPDADeriver(newReceiveLibProgram).messageLib();
|
|
8594
8617
|
const [receiveLibraryConfig] = this.endpointDeriver.receiveLibraryConfig(oappIDPDA2, srcEid);
|
|
8595
8618
|
const [receiveLibraryInfo] = this.endpointDeriver.messageLibraryInfo(newReceiveLib);
|
|
@@ -8643,7 +8666,7 @@ var Endpoint = class {
|
|
|
8643
8666
|
params: {
|
|
8644
8667
|
eid,
|
|
8645
8668
|
configType: config.configType,
|
|
8646
|
-
config: uln_exports.Uln.constructSetConfigData(config.configType, config.value),
|
|
8669
|
+
config: msgLibProgram.toBase58() === simple_message_lib_exports.PROGRAM_ID.toBase58() ? new Uint8Array(10) : uln_exports.Uln.constructSetConfigData(config.configType, config.value),
|
|
8647
8670
|
oapp: oappID
|
|
8648
8671
|
}
|
|
8649
8672
|
},
|
|
@@ -8770,7 +8793,7 @@ var Endpoint = class {
|
|
|
8770
8793
|
receiver,
|
|
8771
8794
|
srcEid,
|
|
8772
8795
|
sender: Array.from(sender.toBytes()),
|
|
8773
|
-
nonce: new
|
|
8796
|
+
nonce: new BN2(nonce)
|
|
8774
8797
|
}
|
|
8775
8798
|
},
|
|
8776
8799
|
this.program
|
|
@@ -8795,7 +8818,7 @@ var Endpoint = class {
|
|
|
8795
8818
|
srcEid,
|
|
8796
8819
|
sender: Array.from(sender.toBytes()),
|
|
8797
8820
|
receiver,
|
|
8798
|
-
nonce: new
|
|
8821
|
+
nonce: new BN2(nonce)
|
|
8799
8822
|
}
|
|
8800
8823
|
},
|
|
8801
8824
|
this.program
|
|
@@ -9039,15 +9062,39 @@ var Endpoint = class {
|
|
|
9039
9062
|
// } as AccountMeta,
|
|
9040
9063
|
// ].concat(ix.keys)
|
|
9041
9064
|
// }
|
|
9065
|
+
getRegisterOappIxAccountMetaForCPI(payer, oapp) {
|
|
9066
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(oapp);
|
|
9067
|
+
const eventAuthority = this.eventAuthorityPDA;
|
|
9068
|
+
const keys = createRegisterOappInstructionAccounts(
|
|
9069
|
+
{
|
|
9070
|
+
payer,
|
|
9071
|
+
oapp,
|
|
9072
|
+
oappRegistry,
|
|
9073
|
+
eventAuthority,
|
|
9074
|
+
program: this.program
|
|
9075
|
+
},
|
|
9076
|
+
this.program
|
|
9077
|
+
);
|
|
9078
|
+
keys.forEach((key) => {
|
|
9079
|
+
key.isSigner = false;
|
|
9080
|
+
});
|
|
9081
|
+
return [
|
|
9082
|
+
{
|
|
9083
|
+
pubkey: this.program,
|
|
9084
|
+
isSigner: false,
|
|
9085
|
+
isWritable: false
|
|
9086
|
+
}
|
|
9087
|
+
].concat(keys);
|
|
9088
|
+
}
|
|
9042
9089
|
getSkipIxAccountMetaForCPI(receiver, sender, srcEid, nonce) {
|
|
9043
9090
|
const [noncePDA] = this.endpointDeriver.nonce(receiver, srcEid, sender);
|
|
9044
9091
|
const [pendingNonce] = this.endpointDeriver.pendingNonce(receiver, srcEid, sender);
|
|
9045
9092
|
const [payloadHash] = this.endpointDeriver.payloadHash(receiver, srcEid, sender, nonce);
|
|
9046
|
-
const
|
|
9093
|
+
const [oappRegistry] = this.endpointDeriver.oappRegistry(receiver);
|
|
9094
|
+
const keys = createSkipInstructionAccounts(
|
|
9047
9095
|
{
|
|
9048
9096
|
signer: receiver,
|
|
9049
|
-
oappRegistry
|
|
9050
|
-
// FIXME: oappRegistry is wrong
|
|
9097
|
+
oappRegistry,
|
|
9051
9098
|
nonce: noncePDA,
|
|
9052
9099
|
pendingInboundNonce: pendingNonce,
|
|
9053
9100
|
payloadHash,
|
|
@@ -9055,16 +9102,9 @@ var Endpoint = class {
|
|
|
9055
9102
|
program: this.program,
|
|
9056
9103
|
eventAuthority: this.eventAuthorityPDA
|
|
9057
9104
|
},
|
|
9058
|
-
|
|
9059
|
-
params: {
|
|
9060
|
-
srcEid,
|
|
9061
|
-
sender: Array.from(sender),
|
|
9062
|
-
receiver,
|
|
9063
|
-
nonce
|
|
9064
|
-
}
|
|
9065
|
-
}
|
|
9105
|
+
this.program
|
|
9066
9106
|
);
|
|
9067
|
-
|
|
9107
|
+
keys.forEach((key) => {
|
|
9068
9108
|
key.isSigner = false;
|
|
9069
9109
|
});
|
|
9070
9110
|
return [
|
|
@@ -9073,7 +9113,7 @@ var Endpoint = class {
|
|
|
9073
9113
|
isSigner: false,
|
|
9074
9114
|
isWritable: false
|
|
9075
9115
|
}
|
|
9076
|
-
].concat(
|
|
9116
|
+
].concat(keys);
|
|
9077
9117
|
}
|
|
9078
9118
|
async isDefaultSendLibrary(connection, messageLibProgram, dstEid, commitmentOrConfig) {
|
|
9079
9119
|
const [msgLib] = new MessageLibPDADeriver(messageLibProgram).messageLib();
|
|
@@ -9214,7 +9254,7 @@ var Endpoint = class {
|
|
|
9214
9254
|
if (timeout2) {
|
|
9215
9255
|
const slot = await connection.getSlot();
|
|
9216
9256
|
const timestamp = await connection.getBlockTime(slot);
|
|
9217
|
-
|
|
9257
|
+
invariant3(timestamp, "timestamp should not be null");
|
|
9218
9258
|
const isValid = parseInt(timeout2.expiry.toString()) > timestamp;
|
|
9219
9259
|
return {
|
|
9220
9260
|
programId: defaultInfo.messageLib,
|
|
@@ -9232,12 +9272,12 @@ var Endpoint = class {
|
|
|
9232
9272
|
};
|
|
9233
9273
|
}
|
|
9234
9274
|
const messageLibInfo = await connection.getAccountInfo(info.messageLib, commitmentOrConfig);
|
|
9235
|
-
|
|
9275
|
+
invariant3(messageLibInfo, "messageLibInfo should not be null");
|
|
9236
9276
|
const { timeout } = info;
|
|
9237
9277
|
if (timeout) {
|
|
9238
9278
|
const slot = await connection.getSlot();
|
|
9239
9279
|
const timestamp = await connection.getBlockTime(slot);
|
|
9240
|
-
|
|
9280
|
+
invariant3(timestamp, "timestamp should not be null");
|
|
9241
9281
|
const isValid = parseInt(timeout.expiry.toString()) > timestamp;
|
|
9242
9282
|
return {
|
|
9243
9283
|
programId: messageLibInfo.owner,
|
|
@@ -9322,15 +9362,15 @@ var simple_message_lib_exports = {};
|
|
|
9322
9362
|
__export(simple_message_lib_exports, {
|
|
9323
9363
|
PROGRAM_ID: () => PROGRAM_ID3,
|
|
9324
9364
|
SimpleMessageLib: () => SimpleMessageLib,
|
|
9325
|
-
accounts: () =>
|
|
9365
|
+
accounts: () => accounts_exports3,
|
|
9326
9366
|
errors: () => errors_exports2,
|
|
9327
|
-
instructions: () =>
|
|
9328
|
-
types: () =>
|
|
9367
|
+
instructions: () => instructions_exports3,
|
|
9368
|
+
types: () => types_exports3
|
|
9329
9369
|
});
|
|
9330
9370
|
|
|
9331
9371
|
// src/generated/simple_messagelib/accounts/index.ts
|
|
9332
|
-
var
|
|
9333
|
-
__export(
|
|
9372
|
+
var accounts_exports3 = {};
|
|
9373
|
+
__export(accounts_exports3, {
|
|
9334
9374
|
MessageLib: () => MessageLib,
|
|
9335
9375
|
ReceiveConfigStore: () => ReceiveConfigStore,
|
|
9336
9376
|
SendConfigStore: () => SendConfigStore,
|
|
@@ -9748,8 +9788,8 @@ __export(errors_exports2, {
|
|
|
9748
9788
|
OnlyRevertError: () => OnlyRevertError,
|
|
9749
9789
|
OnlyWhitelistedCallerError: () => OnlyWhitelistedCallerError,
|
|
9750
9790
|
SendReentrancyError: () => SendReentrancyError,
|
|
9751
|
-
errorFromCode: () =>
|
|
9752
|
-
errorFromName: () =>
|
|
9791
|
+
errorFromCode: () => errorFromCode2,
|
|
9792
|
+
errorFromName: () => errorFromName2
|
|
9753
9793
|
});
|
|
9754
9794
|
var createErrorFromCodeLookup3 = /* @__PURE__ */ new Map();
|
|
9755
9795
|
var createErrorFromNameLookup3 = /* @__PURE__ */ new Map();
|
|
@@ -9864,18 +9904,18 @@ var OnlyRevertError = class _OnlyRevertError extends Error {
|
|
|
9864
9904
|
};
|
|
9865
9905
|
createErrorFromCodeLookup3.set(6007, () => new OnlyRevertError());
|
|
9866
9906
|
createErrorFromNameLookup3.set("OnlyRevert", () => new OnlyRevertError());
|
|
9867
|
-
function
|
|
9907
|
+
function errorFromCode2(code) {
|
|
9868
9908
|
const createError = createErrorFromCodeLookup3.get(code);
|
|
9869
9909
|
return createError != null ? createError() : null;
|
|
9870
9910
|
}
|
|
9871
|
-
function
|
|
9911
|
+
function errorFromName2(name) {
|
|
9872
9912
|
const createError = createErrorFromNameLookup3.get(name);
|
|
9873
9913
|
return createError != null ? createError() : null;
|
|
9874
9914
|
}
|
|
9875
9915
|
|
|
9876
9916
|
// src/generated/simple_messagelib/instructions/index.ts
|
|
9877
|
-
var
|
|
9878
|
-
__export(
|
|
9917
|
+
var instructions_exports3 = {};
|
|
9918
|
+
__export(instructions_exports3, {
|
|
9879
9919
|
createInitConfigInstruction: () => createInitConfigInstruction2,
|
|
9880
9920
|
createInitConfigInstructionAccounts: () => createInitConfigInstructionAccounts2,
|
|
9881
9921
|
createInitDefaultConfigInstruction: () => createInitDefaultConfigInstruction,
|
|
@@ -11200,8 +11240,8 @@ function createWithdrawFeesInstructionAccounts(accounts, programId = new web35.P
|
|
|
11200
11240
|
}
|
|
11201
11241
|
|
|
11202
11242
|
// src/generated/simple_messagelib/types/index.ts
|
|
11203
|
-
var
|
|
11204
|
-
__export(
|
|
11243
|
+
var types_exports3 = {};
|
|
11244
|
+
__export(types_exports3, {
|
|
11205
11245
|
initConfigParamsBeet: () => initConfigParamsBeet2,
|
|
11206
11246
|
initDefaultConfigParamsBeet: () => initDefaultConfigParamsBeet,
|
|
11207
11247
|
initMessageLibParamsBeet: () => initMessageLibParamsBeet,
|
|
@@ -11321,36 +11361,21 @@ var SimpleMessageLib = class {
|
|
|
11321
11361
|
*/
|
|
11322
11362
|
async getSendIXAccountMetaForCPI(_connection, payer, _path) {
|
|
11323
11363
|
const [msgLib] = this.deriver.messageLib();
|
|
11324
|
-
const
|
|
11364
|
+
const cpiAccounts = createSendInstructionAccounts3(
|
|
11325
11365
|
{
|
|
11326
11366
|
endpoint: PublicKey.default,
|
|
11327
11367
|
// useless
|
|
11328
11368
|
messageLib: msgLib,
|
|
11329
11369
|
payer
|
|
11330
11370
|
},
|
|
11331
|
-
|
|
11332
|
-
{
|
|
11333
|
-
params: {
|
|
11334
|
-
packet: {
|
|
11335
|
-
nonce: 0,
|
|
11336
|
-
srcEid: 0,
|
|
11337
|
-
sender: PublicKey.default,
|
|
11338
|
-
dstEid: 0,
|
|
11339
|
-
receiver: Array.from(PublicKey.default.toBytes()),
|
|
11340
|
-
message: Uint8Array.from(Buffer.from("test")),
|
|
11341
|
-
guid: Array.from(PublicKey.default.toBytes())
|
|
11342
|
-
},
|
|
11343
|
-
options: Uint8Array.from(Buffer.from("test")),
|
|
11344
|
-
nativeFee: 0
|
|
11345
|
-
}
|
|
11346
|
-
}
|
|
11371
|
+
this.program
|
|
11347
11372
|
);
|
|
11348
|
-
|
|
11373
|
+
cpiAccounts.forEach((key) => {
|
|
11349
11374
|
if (!payer.equals(key.pubkey)) {
|
|
11350
11375
|
key.isSigner = false;
|
|
11351
11376
|
}
|
|
11352
11377
|
});
|
|
11353
|
-
return Promise.resolve(
|
|
11378
|
+
return Promise.resolve(cpiAccounts.slice(1));
|
|
11354
11379
|
}
|
|
11355
11380
|
async getQuoteIXAccountMetaForCPI(_connection, _payer, _path, _commitment) {
|
|
11356
11381
|
const [msgLib] = this.deriver.messageLib();
|
|
@@ -11386,7 +11411,7 @@ var SimpleMessageLib = class {
|
|
|
11386
11411
|
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
11387
11412
|
const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
|
|
11388
11413
|
const [messageLib] = this.deriver.messageLib();
|
|
11389
|
-
const
|
|
11414
|
+
const keys = createInitConfigInstructionAccounts2(
|
|
11390
11415
|
{
|
|
11391
11416
|
endpoint: PublicKey.default,
|
|
11392
11417
|
// useless
|
|
@@ -11395,23 +11420,30 @@ var SimpleMessageLib = class {
|
|
|
11395
11420
|
sendConfig,
|
|
11396
11421
|
receiveConfig
|
|
11397
11422
|
},
|
|
11398
|
-
|
|
11399
|
-
{
|
|
11400
|
-
params: {
|
|
11401
|
-
eid,
|
|
11402
|
-
oapp: oappID
|
|
11403
|
-
}
|
|
11404
|
-
}
|
|
11423
|
+
this.program
|
|
11405
11424
|
);
|
|
11406
|
-
|
|
11425
|
+
keys.forEach((key) => {
|
|
11407
11426
|
if (!payer.equals(key.pubkey)) {
|
|
11408
11427
|
key.isSigner = false;
|
|
11409
11428
|
}
|
|
11410
11429
|
});
|
|
11411
|
-
return Promise.resolve(
|
|
11430
|
+
return Promise.resolve(keys.slice(1));
|
|
11412
11431
|
}
|
|
11413
|
-
async getSetConfigIXAccountMetaForCPI(
|
|
11414
|
-
|
|
11432
|
+
async getSetConfigIXAccountMetaForCPI(endpointProgram, oappID, eid) {
|
|
11433
|
+
const [sendConfig] = this.deriver.sendConfig(eid, oappID);
|
|
11434
|
+
const [receiveConfig] = this.deriver.receiveConfig(eid, oappID);
|
|
11435
|
+
const [msgLib] = this.deriver.messageLib();
|
|
11436
|
+
const accounts = createSetConfigInstructionAccounts2(
|
|
11437
|
+
{
|
|
11438
|
+
endpoint: PublicKey.default,
|
|
11439
|
+
// useless
|
|
11440
|
+
sendConfig,
|
|
11441
|
+
receiveConfig,
|
|
11442
|
+
messageLib: msgLib
|
|
11443
|
+
},
|
|
11444
|
+
this.program
|
|
11445
|
+
);
|
|
11446
|
+
return Promise.resolve(accounts.slice(1));
|
|
11415
11447
|
}
|
|
11416
11448
|
};
|
|
11417
11449
|
|
|
@@ -11459,7 +11491,7 @@ __export(uln_exports, {
|
|
|
11459
11491
|
VerifyingError: () => VerifyingError,
|
|
11460
11492
|
ZeroMessageSizeError: () => ZeroMessageSizeError,
|
|
11461
11493
|
accountProviders: () => accountProviders6,
|
|
11462
|
-
accounts: () =>
|
|
11494
|
+
accounts: () => accounts_exports6,
|
|
11463
11495
|
commitVerificationInstructionDiscriminator: () => commitVerificationInstructionDiscriminator,
|
|
11464
11496
|
commitVerificationParamsBeet: () => commitVerificationParamsBeet,
|
|
11465
11497
|
commitVerificationStruct: () => commitVerificationStruct,
|
|
@@ -11496,8 +11528,8 @@ __export(uln_exports, {
|
|
|
11496
11528
|
createVersionInstructionAccounts: () => createVersionInstructionAccounts3,
|
|
11497
11529
|
createWithdrawRentInstruction: () => createWithdrawRentInstruction2,
|
|
11498
11530
|
createWithdrawRentInstructionAccounts: () => createWithdrawRentInstructionAccounts2,
|
|
11499
|
-
errorFromCode: () =>
|
|
11500
|
-
errorFromName: () =>
|
|
11531
|
+
errorFromCode: () => errorFromCode5,
|
|
11532
|
+
errorFromName: () => errorFromName5,
|
|
11501
11533
|
errors: () => errors_exports4,
|
|
11502
11534
|
events: () => events_exports4,
|
|
11503
11535
|
executorConfigBeet: () => executorConfigBeet2,
|
|
@@ -11513,7 +11545,7 @@ __export(uln_exports, {
|
|
|
11513
11545
|
initVerifyInstructionDiscriminator: () => initVerifyInstructionDiscriminator2,
|
|
11514
11546
|
initVerifyParamsBeet: () => initVerifyParamsBeet2,
|
|
11515
11547
|
initVerifyStruct: () => initVerifyStruct2,
|
|
11516
|
-
instructions: () =>
|
|
11548
|
+
instructions: () => instructions_exports6,
|
|
11517
11549
|
isConfigExecutor: () => isConfigExecutor,
|
|
11518
11550
|
isConfigReceiveUln: () => isConfigReceiveUln,
|
|
11519
11551
|
isConfigSendUln: () => isConfigSendUln,
|
|
@@ -11547,7 +11579,7 @@ __export(uln_exports, {
|
|
|
11547
11579
|
transferAdminStruct: () => transferAdminStruct4,
|
|
11548
11580
|
treasuryBeet: () => treasuryBeet,
|
|
11549
11581
|
treasuryFeeBeet: () => treasuryFeeBeet,
|
|
11550
|
-
types: () =>
|
|
11582
|
+
types: () => types_exports6,
|
|
11551
11583
|
ulnConfigBeet: () => ulnConfigBeet2,
|
|
11552
11584
|
ulnSettingsBeet: () => ulnSettingsBeet,
|
|
11553
11585
|
ulnSettingsDiscriminator: () => ulnSettingsDiscriminator,
|
|
@@ -11569,11 +11601,11 @@ __export(dvn_exports2, {
|
|
|
11569
11601
|
DVN: () => DVN,
|
|
11570
11602
|
PROGRAM_ID: () => PROGRAM_ID4,
|
|
11571
11603
|
SolanaSignerExt: () => SolanaSignerExt,
|
|
11572
|
-
accounts: () =>
|
|
11604
|
+
accounts: () => accounts_exports4,
|
|
11573
11605
|
errors: () => errors_exports3,
|
|
11574
11606
|
events: () => events_exports2,
|
|
11575
|
-
instructions: () =>
|
|
11576
|
-
types: () =>
|
|
11607
|
+
instructions: () => instructions_exports4,
|
|
11608
|
+
types: () => types_exports4
|
|
11577
11609
|
});
|
|
11578
11610
|
|
|
11579
11611
|
// src/generated/dvn/index.ts
|
|
@@ -11625,8 +11657,8 @@ __export(dvn_exports, {
|
|
|
11625
11657
|
dstConfigBeet: () => dstConfigBeet,
|
|
11626
11658
|
dvnConfigBeet: () => dvnConfigBeet,
|
|
11627
11659
|
dvnConfigDiscriminator: () => dvnConfigDiscriminator,
|
|
11628
|
-
errorFromCode: () =>
|
|
11629
|
-
errorFromName: () =>
|
|
11660
|
+
errorFromCode: () => errorFromCode3,
|
|
11661
|
+
errorFromName: () => errorFromName3,
|
|
11630
11662
|
executeHashBeet: () => executeHashBeet,
|
|
11631
11663
|
executeHashDiscriminator: () => executeHashDiscriminator,
|
|
11632
11664
|
executeTransactionDigestBeet: () => executeTransactionDigestBeet,
|
|
@@ -11670,8 +11702,8 @@ __export(dvn_exports, {
|
|
|
11670
11702
|
});
|
|
11671
11703
|
|
|
11672
11704
|
// src/generated/dvn/accounts/index.ts
|
|
11673
|
-
var
|
|
11674
|
-
__export(
|
|
11705
|
+
var accounts_exports4 = {};
|
|
11706
|
+
__export(accounts_exports4, {
|
|
11675
11707
|
DvnConfig: () => DvnConfig,
|
|
11676
11708
|
ExecuteHash: () => ExecuteHash,
|
|
11677
11709
|
ReceiveConfig: () => ReceiveConfig,
|
|
@@ -12121,8 +12153,8 @@ __export(errors_exports3, {
|
|
|
12121
12153
|
TooManyOptionTypesError: () => TooManyOptionTypesError,
|
|
12122
12154
|
UnexpiredExecuteHashError: () => UnexpiredExecuteHashError,
|
|
12123
12155
|
UniqueOwnersError: () => UniqueOwnersError,
|
|
12124
|
-
errorFromCode: () =>
|
|
12125
|
-
errorFromName: () =>
|
|
12156
|
+
errorFromCode: () => errorFromCode3,
|
|
12157
|
+
errorFromName: () => errorFromName3
|
|
12126
12158
|
});
|
|
12127
12159
|
var createErrorFromCodeLookup4 = /* @__PURE__ */ new Map();
|
|
12128
12160
|
var createErrorFromNameLookup4 = /* @__PURE__ */ new Map();
|
|
@@ -12354,18 +12386,18 @@ createErrorFromNameLookup4.set(
|
|
|
12354
12386
|
"EidNotSupported",
|
|
12355
12387
|
() => new EidNotSupportedError()
|
|
12356
12388
|
);
|
|
12357
|
-
function
|
|
12389
|
+
function errorFromCode3(code) {
|
|
12358
12390
|
const createError = createErrorFromCodeLookup4.get(code);
|
|
12359
12391
|
return createError != null ? createError() : null;
|
|
12360
12392
|
}
|
|
12361
|
-
function
|
|
12393
|
+
function errorFromName3(name) {
|
|
12362
12394
|
const createError = createErrorFromNameLookup4.get(name);
|
|
12363
12395
|
return createError != null ? createError() : null;
|
|
12364
12396
|
}
|
|
12365
12397
|
|
|
12366
12398
|
// src/generated/dvn/instructions/index.ts
|
|
12367
|
-
var
|
|
12368
|
-
__export(
|
|
12399
|
+
var instructions_exports4 = {};
|
|
12400
|
+
__export(instructions_exports4, {
|
|
12369
12401
|
closeExecuteInstructionDiscriminator: () => closeExecuteInstructionDiscriminator,
|
|
12370
12402
|
closeExecuteStruct: () => closeExecuteStruct,
|
|
12371
12403
|
createCloseExecuteInstruction: () => createCloseExecuteInstruction,
|
|
@@ -13120,8 +13152,8 @@ function createWithdrawFeeInstructionAccounts(accounts, programId = new web35.Pu
|
|
|
13120
13152
|
}
|
|
13121
13153
|
|
|
13122
13154
|
// src/generated/dvn/types/index.ts
|
|
13123
|
-
var
|
|
13124
|
-
__export(
|
|
13155
|
+
var types_exports4 = {};
|
|
13156
|
+
__export(types_exports4, {
|
|
13125
13157
|
VerificationState: () => VerificationState,
|
|
13126
13158
|
aclBeet: () => aclBeet,
|
|
13127
13159
|
adminConfigBeet: () => adminConfigBeet,
|
|
@@ -13621,7 +13653,7 @@ __export(executor_exports, {
|
|
|
13621
13653
|
ZeroLzComposeGasProvidedError: () => ZeroLzComposeGasProvidedError,
|
|
13622
13654
|
ZeroLzReceiveGasProvidedError: () => ZeroLzReceiveGasProvidedError,
|
|
13623
13655
|
accountProviders: () => accountProviders5,
|
|
13624
|
-
accounts: () =>
|
|
13656
|
+
accounts: () => accounts_exports5,
|
|
13625
13657
|
aclBeet: () => aclBeet2,
|
|
13626
13658
|
adminSetConfigInstructionDiscriminator: () => adminSetConfigInstructionDiscriminator,
|
|
13627
13659
|
adminSetConfigParamsBeet: () => adminSetConfigParamsBeet,
|
|
@@ -13646,8 +13678,8 @@ __export(executor_exports, {
|
|
|
13646
13678
|
createQuoteExecutorInstruction: () => createQuoteExecutorInstruction,
|
|
13647
13679
|
createQuoteExecutorInstructionAccounts: () => createQuoteExecutorInstructionAccounts,
|
|
13648
13680
|
dstConfigBeet: () => dstConfigBeet2,
|
|
13649
|
-
errorFromCode: () =>
|
|
13650
|
-
errorFromName: () =>
|
|
13681
|
+
errorFromCode: () => errorFromCode4,
|
|
13682
|
+
errorFromName: () => errorFromName4,
|
|
13651
13683
|
events: () => events_exports3,
|
|
13652
13684
|
executableInstructionDiscriminator: () => executableInstructionDiscriminator,
|
|
13653
13685
|
executableParamsBeet: () => executableParamsBeet,
|
|
@@ -13661,7 +13693,7 @@ __export(executor_exports, {
|
|
|
13661
13693
|
initExecutorInstructionDiscriminator: () => initExecutorInstructionDiscriminator,
|
|
13662
13694
|
initExecutorParamsBeet: () => initExecutorParamsBeet,
|
|
13663
13695
|
initExecutorStruct: () => initExecutorStruct,
|
|
13664
|
-
instructions: () =>
|
|
13696
|
+
instructions: () => instructions_exports5,
|
|
13665
13697
|
isAdminSetConfigParamsDefaultMultiplierBps: () => isAdminSetConfigParamsDefaultMultiplierBps,
|
|
13666
13698
|
isAdminSetConfigParamsDstConfigs: () => isAdminSetConfigParamsDstConfigs,
|
|
13667
13699
|
isAdminSetConfigParamsPriceFeed: () => isAdminSetConfigParamsPriceFeed,
|
|
@@ -13687,12 +13719,12 @@ __export(executor_exports, {
|
|
|
13687
13719
|
quoteExecutorInstructionDiscriminator: () => quoteExecutorInstructionDiscriminator,
|
|
13688
13720
|
quoteExecutorParamsBeet: () => quoteExecutorParamsBeet,
|
|
13689
13721
|
quoteExecutorStruct: () => quoteExecutorStruct,
|
|
13690
|
-
types: () =>
|
|
13722
|
+
types: () => types_exports5
|
|
13691
13723
|
});
|
|
13692
13724
|
|
|
13693
13725
|
// src/generated/executor/accounts/index.ts
|
|
13694
|
-
var
|
|
13695
|
-
__export(
|
|
13726
|
+
var accounts_exports5 = {};
|
|
13727
|
+
__export(accounts_exports5, {
|
|
13696
13728
|
ExecutorConfig: () => ExecutorConfig,
|
|
13697
13729
|
Nonce: () => Nonce2,
|
|
13698
13730
|
accountProviders: () => accountProviders5,
|
|
@@ -14031,8 +14063,8 @@ var nativeDropAppliedEventBeet = new beet201.FixableBeetArgsStruct(
|
|
|
14031
14063
|
);
|
|
14032
14064
|
|
|
14033
14065
|
// src/generated/executor/instructions/index.ts
|
|
14034
|
-
var
|
|
14035
|
-
__export(
|
|
14066
|
+
var instructions_exports5 = {};
|
|
14067
|
+
__export(instructions_exports5, {
|
|
14036
14068
|
adminSetConfigInstructionDiscriminator: () => adminSetConfigInstructionDiscriminator,
|
|
14037
14069
|
adminSetConfigStruct: () => adminSetConfigStruct,
|
|
14038
14070
|
composeInstructionDiscriminator: () => composeInstructionDiscriminator,
|
|
@@ -14918,8 +14950,8 @@ function createQuoteExecutorInstructionAccounts(accounts, programId = new web35.
|
|
|
14918
14950
|
}
|
|
14919
14951
|
|
|
14920
14952
|
// src/generated/executor/types/index.ts
|
|
14921
|
-
var
|
|
14922
|
-
__export(
|
|
14953
|
+
var types_exports5 = {};
|
|
14954
|
+
__export(types_exports5, {
|
|
14923
14955
|
ExecutionState: () => ExecutionState,
|
|
14924
14956
|
aclBeet: () => aclBeet2,
|
|
14925
14957
|
adminSetConfigParamsBeet: () => adminSetConfigParamsBeet,
|
|
@@ -15317,7 +15349,7 @@ async function isAccountInitialized(connection, account, commitmentOrConfig) {
|
|
|
15317
15349
|
async function buildMessageV0(connection, payerKey, instructions, commitmentOrConfig = "confirmed", blockhash) {
|
|
15318
15350
|
return new TransactionMessage({
|
|
15319
15351
|
payerKey,
|
|
15320
|
-
recentBlockhash: blockhash ?? (await connection.getLatestBlockhash()).blockhash,
|
|
15352
|
+
recentBlockhash: blockhash ?? (await connection.getLatestBlockhash(commitmentOrConfig)).blockhash,
|
|
15321
15353
|
instructions
|
|
15322
15354
|
}).compileToV0Message();
|
|
15323
15355
|
}
|
|
@@ -15744,11 +15776,11 @@ createErrorFromNameLookup5.set(
|
|
|
15744
15776
|
"ExecutorIsAdmin",
|
|
15745
15777
|
() => new ExecutorIsAdminError()
|
|
15746
15778
|
);
|
|
15747
|
-
function
|
|
15779
|
+
function errorFromCode4(code) {
|
|
15748
15780
|
const createError = createErrorFromCodeLookup5.get(code);
|
|
15749
15781
|
return createError != null ? createError() : null;
|
|
15750
15782
|
}
|
|
15751
|
-
function
|
|
15783
|
+
function errorFromName4(name) {
|
|
15752
15784
|
const createError = createErrorFromNameLookup5.get(name);
|
|
15753
15785
|
return createError != null ? createError() : null;
|
|
15754
15786
|
}
|
|
@@ -15993,7 +16025,7 @@ var Executor = class {
|
|
|
15993
16025
|
}
|
|
15994
16026
|
].concat(ixAccounts);
|
|
15995
16027
|
}
|
|
15996
|
-
async execute(connection, executor, endpointProgram, packet, extraData, value = new
|
|
16028
|
+
async execute(connection, executor, endpointProgram, packet, extraData, value = new BN2(0), computeUnits = 2e5, commitmentOrConfig) {
|
|
15997
16029
|
const [config] = this.deriver.config();
|
|
15998
16030
|
const endpointEventDeriver = new EventPDADeriver(endpointProgram);
|
|
15999
16031
|
const executorEventDeriver = new EventPDADeriver(this.program);
|
|
@@ -16052,7 +16084,7 @@ var Executor = class {
|
|
|
16052
16084
|
this.program
|
|
16053
16085
|
);
|
|
16054
16086
|
}
|
|
16055
|
-
async compose(connection, executor, endpointProgram, event, extraData, value = new
|
|
16087
|
+
async compose(connection, executor, endpointProgram, event, extraData, value = new BN2(0), computeUnits = 4e5, commitmentOrConfig) {
|
|
16056
16088
|
const [config] = this.deriver.config();
|
|
16057
16089
|
const endpointEventDeriver = new EventPDADeriver(endpointProgram);
|
|
16058
16090
|
const executorEventDeriver = new EventPDADeriver(this.program);
|
|
@@ -16111,8 +16143,8 @@ var Executor = class {
|
|
|
16111
16143
|
};
|
|
16112
16144
|
|
|
16113
16145
|
// src/generated/uln/accounts/index.ts
|
|
16114
|
-
var
|
|
16115
|
-
__export(
|
|
16146
|
+
var accounts_exports6 = {};
|
|
16147
|
+
__export(accounts_exports6, {
|
|
16116
16148
|
Confirmations: () => Confirmations,
|
|
16117
16149
|
ReceiveConfig: () => ReceiveConfig2,
|
|
16118
16150
|
SendConfig: () => SendConfig,
|
|
@@ -16638,8 +16670,8 @@ __export(errors_exports4, {
|
|
|
16638
16670
|
UnsortedError: () => UnsortedError,
|
|
16639
16671
|
VerifyingError: () => VerifyingError,
|
|
16640
16672
|
ZeroMessageSizeError: () => ZeroMessageSizeError,
|
|
16641
|
-
errorFromCode: () =>
|
|
16642
|
-
errorFromName: () =>
|
|
16673
|
+
errorFromCode: () => errorFromCode5,
|
|
16674
|
+
errorFromName: () => errorFromName5
|
|
16643
16675
|
});
|
|
16644
16676
|
var createErrorFromCodeLookup6 = /* @__PURE__ */ new Map();
|
|
16645
16677
|
var createErrorFromNameLookup6 = /* @__PURE__ */ new Map();
|
|
@@ -17108,18 +17140,18 @@ var InvalidPayerError = class _InvalidPayerError extends Error {
|
|
|
17108
17140
|
};
|
|
17109
17141
|
createErrorFromCodeLookup6.set(6032, () => new InvalidPayerError());
|
|
17110
17142
|
createErrorFromNameLookup6.set("InvalidPayer", () => new InvalidPayerError());
|
|
17111
|
-
function
|
|
17143
|
+
function errorFromCode5(code) {
|
|
17112
17144
|
const createError = createErrorFromCodeLookup6.get(code);
|
|
17113
17145
|
return createError != null ? createError() : null;
|
|
17114
17146
|
}
|
|
17115
|
-
function
|
|
17147
|
+
function errorFromName5(name) {
|
|
17116
17148
|
const createError = createErrorFromNameLookup6.get(name);
|
|
17117
17149
|
return createError != null ? createError() : null;
|
|
17118
17150
|
}
|
|
17119
17151
|
|
|
17120
17152
|
// src/generated/uln/instructions/index.ts
|
|
17121
|
-
var
|
|
17122
|
-
__export(
|
|
17153
|
+
var instructions_exports6 = {};
|
|
17154
|
+
__export(instructions_exports6, {
|
|
17123
17155
|
commitVerificationInstructionDiscriminator: () => commitVerificationInstructionDiscriminator,
|
|
17124
17156
|
commitVerificationStruct: () => commitVerificationStruct,
|
|
17125
17157
|
createCommitVerificationInstruction: () => createCommitVerificationInstruction,
|
|
@@ -18774,8 +18806,8 @@ function createWithdrawRentInstructionAccounts2(accounts, programId = new web35.
|
|
|
18774
18806
|
}
|
|
18775
18807
|
|
|
18776
18808
|
// src/generated/uln/types/index.ts
|
|
18777
|
-
var
|
|
18778
|
-
__export(
|
|
18809
|
+
var types_exports6 = {};
|
|
18810
|
+
__export(types_exports6, {
|
|
18779
18811
|
commitVerificationParamsBeet: () => commitVerificationParamsBeet,
|
|
18780
18812
|
configBeet: () => configBeet,
|
|
18781
18813
|
executorConfigBeet: () => executorConfigBeet2,
|
|
@@ -19122,7 +19154,7 @@ var Uln = class {
|
|
|
19122
19154
|
params: {
|
|
19123
19155
|
packetHeader: Array.from(Uint8Array.from(Buffer.from(packet.header().slice(2), "hex"))),
|
|
19124
19156
|
payloadHash: Array.from(payloadHashBytes),
|
|
19125
|
-
confirmations: typeof confirmations === "string" ? new
|
|
19157
|
+
confirmations: typeof confirmations === "string" ? new BN2(confirmations) : confirmations
|
|
19126
19158
|
}
|
|
19127
19159
|
},
|
|
19128
19160
|
this.program
|
|
@@ -19325,14 +19357,14 @@ var pricefeed_exports = {};
|
|
|
19325
19357
|
__export(pricefeed_exports, {
|
|
19326
19358
|
PROGRAM_ID: () => PROGRAM_ID7,
|
|
19327
19359
|
PriceFeed: () => PriceFeed2,
|
|
19328
|
-
accounts: () =>
|
|
19329
|
-
instructions: () =>
|
|
19330
|
-
types: () =>
|
|
19360
|
+
accounts: () => accounts_exports7,
|
|
19361
|
+
instructions: () => instructions_exports7,
|
|
19362
|
+
types: () => types_exports7
|
|
19331
19363
|
});
|
|
19332
19364
|
|
|
19333
19365
|
// src/generated/pricefeed/accounts/index.ts
|
|
19334
|
-
var
|
|
19335
|
-
__export(
|
|
19366
|
+
var accounts_exports7 = {};
|
|
19367
|
+
__export(accounts_exports7, {
|
|
19336
19368
|
PriceFeed: () => PriceFeed,
|
|
19337
19369
|
accountProviders: () => accountProviders7,
|
|
19338
19370
|
priceFeedBeet: () => priceFeedBeet,
|
|
@@ -19532,8 +19564,8 @@ var priceFeedBeet = new beet201.FixableBeetStruct(
|
|
|
19532
19564
|
var accountProviders7 = { PriceFeed };
|
|
19533
19565
|
|
|
19534
19566
|
// src/generated/pricefeed/instructions/index.ts
|
|
19535
|
-
var
|
|
19536
|
-
__export(
|
|
19567
|
+
var instructions_exports7 = {};
|
|
19568
|
+
__export(instructions_exports7, {
|
|
19537
19569
|
createGetFeeInstruction: () => createGetFeeInstruction,
|
|
19538
19570
|
createGetFeeInstructionAccounts: () => createGetFeeInstructionAccounts,
|
|
19539
19571
|
createInitPriceFeedInstruction: () => createInitPriceFeedInstruction,
|
|
@@ -20018,8 +20050,8 @@ function createTransferAdminInstructionAccounts5(accounts, programId = new web35
|
|
|
20018
20050
|
}
|
|
20019
20051
|
|
|
20020
20052
|
// src/generated/pricefeed/types/index.ts
|
|
20021
|
-
var
|
|
20022
|
-
__export(
|
|
20053
|
+
var types_exports7 = {};
|
|
20054
|
+
__export(types_exports7, {
|
|
20023
20055
|
getFeeParamsBeet: () => getFeeParamsBeet,
|
|
20024
20056
|
initPriceFeedParamsBeet: () => initPriceFeedParamsBeet,
|
|
20025
20057
|
isModelTypeArbitrum: () => isModelTypeArbitrum,
|
|
@@ -20193,11 +20225,9 @@ var PriceFeed2 = class {
|
|
|
20193
20225
|
}
|
|
20194
20226
|
};
|
|
20195
20227
|
|
|
20196
|
-
// src/
|
|
20197
|
-
var
|
|
20198
|
-
__export(
|
|
20199
|
-
ConfigType: () => ConfigType,
|
|
20200
|
-
OFT_SEED: () => OFT_SEED2,
|
|
20228
|
+
// src/oft-tools.ts
|
|
20229
|
+
var oft_tools_exports = {};
|
|
20230
|
+
__export(oft_tools_exports, {
|
|
20201
20231
|
SOLANA_EID: () => SOLANA_EID,
|
|
20202
20232
|
createInitAdapterOftIx: () => createInitAdapterOftIx,
|
|
20203
20233
|
createInitConfigIx: () => createInitConfigIx,
|
|
@@ -20220,211 +20250,443 @@ __export(OftTools_exports, {
|
|
|
20220
20250
|
getEndpointConfig: () => getEndpointConfig,
|
|
20221
20251
|
getEnforcedOptions: () => getEnforcedOptions,
|
|
20222
20252
|
getPeerAddress: () => getPeerAddress,
|
|
20223
|
-
isAccountInitialized: () => isAccountInitialized2,
|
|
20224
20253
|
quoteOft: () => quoteOft,
|
|
20225
20254
|
quoteWithUln: () => quoteWithUln,
|
|
20226
20255
|
sendWithUln: () => sendWithUln
|
|
20227
20256
|
});
|
|
20228
|
-
|
|
20229
|
-
|
|
20230
|
-
var
|
|
20231
|
-
|
|
20232
|
-
|
|
20233
|
-
|
|
20234
|
-
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
var
|
|
20240
|
-
var
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
return res !== null;
|
|
20253
|
-
});
|
|
20254
|
-
}
|
|
20255
|
-
async function createNonceTx(connection, nonceAccount, nonceAuthority, instructions, commitmentOrConfig = "confirmed") {
|
|
20256
|
-
const nonceAccountInfo = await connection.getNonce(nonceAccount, commitmentOrConfig);
|
|
20257
|
-
if (nonceAccountInfo === null) {
|
|
20258
|
-
throw new Error("Invalid nonce account");
|
|
20257
|
+
|
|
20258
|
+
// src/oft.ts
|
|
20259
|
+
var oft_exports = {};
|
|
20260
|
+
__export(oft_exports, {
|
|
20261
|
+
OFT_DECIMALS: () => OFT_DECIMALS,
|
|
20262
|
+
OFT_DEFAULT_PROGRAM_ID: () => PROGRAM_ID,
|
|
20263
|
+
Oft: () => Oft,
|
|
20264
|
+
accounts: () => accounts_exports,
|
|
20265
|
+
instructions: () => instructions_exports,
|
|
20266
|
+
types: () => types_exports
|
|
20267
|
+
});
|
|
20268
|
+
var OFT_DECIMALS = 6;
|
|
20269
|
+
var Oft = class {
|
|
20270
|
+
constructor(program, endpointProgram, _tokenProgram, mintKp, escrowKp) {
|
|
20271
|
+
this.program = program;
|
|
20272
|
+
this.endpointProgram = endpointProgram;
|
|
20273
|
+
this.deriver = new OftPDADeriver(this.program);
|
|
20274
|
+
this.endpoint = new endpoint_exports.Endpoint(endpointProgram);
|
|
20275
|
+
const [eventAuthorityPDA] = new EventPDADeriver(this.program).eventAuthority();
|
|
20276
|
+
this.eventAuthorityPDA = eventAuthorityPDA;
|
|
20277
|
+
this.mintKp = mintKp;
|
|
20278
|
+
this.escrowKp = escrowKp;
|
|
20279
|
+
this.isAdapter = escrowKp !== void 0;
|
|
20280
|
+
this.tokenProgram = _tokenProgram;
|
|
20259
20281
|
}
|
|
20260
|
-
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
authorizedPubkey: nonceAuthority
|
|
20264
|
-
});
|
|
20265
|
-
return new Transaction({
|
|
20266
|
-
recentBlockhash: nonce,
|
|
20267
|
-
nonceInfo: {
|
|
20268
|
-
nonce,
|
|
20269
|
-
nonceInstruction: nonceAdvanceIx
|
|
20270
|
-
}
|
|
20271
|
-
}).add(...instructions);
|
|
20272
|
-
}
|
|
20273
|
-
async function createInitAdapterOftIx(payer, admin, mint, lzDelegate, escrow, sharedDecimals = 6, tokenProgram = TOKEN_PROGRAM_ID) {
|
|
20274
|
-
const [oftConfig] = PublicKey.findProgramAddressSync(
|
|
20275
|
-
[Buffer.from(OFT_SEED2, "utf-8"), escrow.toBuffer()],
|
|
20276
|
-
PROGRAM_ID
|
|
20277
|
-
);
|
|
20278
|
-
const [oAppRegistry] = PublicKey.findProgramAddressSync(
|
|
20279
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20280
|
-
PROGRAM_ID2
|
|
20281
|
-
);
|
|
20282
|
-
const [endpointEventAuthority] = PublicKey.findProgramAddressSync(
|
|
20283
|
-
[Buffer.from(EVENT_SEED2, "utf-8")],
|
|
20284
|
-
PROGRAM_ID2
|
|
20285
|
-
);
|
|
20286
|
-
const [lzReceiveTypes] = PublicKey.findProgramAddressSync(
|
|
20287
|
-
[Buffer.from(LZ_RECEIVE_TYPES_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20288
|
-
PROGRAM_ID
|
|
20289
|
-
);
|
|
20290
|
-
const registerOappIx = createRegisterOappInstruction(
|
|
20291
|
-
{
|
|
20292
|
-
payer,
|
|
20293
|
-
oapp: oftConfig,
|
|
20294
|
-
oappRegistry: oAppRegistry,
|
|
20295
|
-
eventAuthority: endpointEventAuthority,
|
|
20296
|
-
program: PROGRAM_ID
|
|
20297
|
-
},
|
|
20298
|
-
{
|
|
20299
|
-
params: {
|
|
20300
|
-
delegate: lzDelegate
|
|
20301
|
-
}
|
|
20282
|
+
getOftConfig() {
|
|
20283
|
+
if (this.isAdapter) {
|
|
20284
|
+
return this.deriver.oftConfig(this.escrowKp)[0];
|
|
20302
20285
|
}
|
|
20303
|
-
|
|
20304
|
-
for (const acc of registerOappIx.keys) {
|
|
20305
|
-
acc.isSigner = false;
|
|
20286
|
+
return this.deriver.oftConfig(this.mintKp)[0];
|
|
20306
20287
|
}
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20288
|
+
async getVersion() {
|
|
20289
|
+
return Promise.resolve([createVersionInstruction(this.program)]);
|
|
20290
|
+
}
|
|
20291
|
+
async setDelegate(admin, delegate) {
|
|
20292
|
+
const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
|
|
20293
|
+
const oftConfig = this.getOftConfig();
|
|
20294
|
+
const [oAppRegistry] = this.endpoint.endpointDeriver.oappRegistry(oftConfig);
|
|
20295
|
+
const endpointSetDelegateKeys = endpoint_exports.instructions.createSetDelegateInstructionAccounts(
|
|
20296
|
+
{
|
|
20297
|
+
oapp: oftConfig,
|
|
20298
|
+
oappRegistry: oAppRegistry,
|
|
20299
|
+
eventAuthority: endpointEventAuthority,
|
|
20300
|
+
program: this.endpointProgram
|
|
20301
|
+
},
|
|
20302
|
+
this.endpointProgram
|
|
20303
|
+
);
|
|
20304
|
+
for (const acc of endpointSetDelegateKeys) {
|
|
20305
|
+
acc.isSigner = false;
|
|
20306
|
+
}
|
|
20307
|
+
const ix = createSetDelegateInstruction(
|
|
20308
|
+
{
|
|
20309
|
+
admin,
|
|
20310
|
+
oftConfig: this.getOftConfig(),
|
|
20311
|
+
anchorRemainingAccounts: [
|
|
20312
|
+
{
|
|
20313
|
+
pubkey: this.endpointProgram,
|
|
20314
|
+
isSigner: false,
|
|
20315
|
+
isWritable: false
|
|
20316
|
+
},
|
|
20317
|
+
...endpointSetDelegateKeys
|
|
20318
|
+
]
|
|
20319
|
+
},
|
|
20320
|
+
{
|
|
20321
|
+
params: {
|
|
20322
|
+
delegate
|
|
20332
20323
|
}
|
|
20324
|
+
},
|
|
20325
|
+
this.program
|
|
20326
|
+
);
|
|
20327
|
+
return Promise.resolve(ix);
|
|
20328
|
+
}
|
|
20329
|
+
async initOft(connection, payer, admin) {
|
|
20330
|
+
const oftConfig = this.getOftConfig();
|
|
20331
|
+
const endpointEventAuthority = this.endpoint.eventAuthorityPDA;
|
|
20332
|
+
const [oAppRegistry] = this.endpoint.endpointDeriver.oappRegistry(oftConfig);
|
|
20333
|
+
const [lzReceiveTypes] = PublicKey.findProgramAddressSync(
|
|
20334
|
+
[Buffer.from(LZ_RECEIVE_TYPES_SEED, "utf-8"), oftConfig.toBuffer()],
|
|
20335
|
+
this.program
|
|
20336
|
+
);
|
|
20337
|
+
const registerOappIxKeys = endpoint_exports.instructions.createRegisterOappInstructionAccounts(
|
|
20338
|
+
{
|
|
20339
|
+
payer: admin,
|
|
20340
|
+
oapp: oftConfig,
|
|
20341
|
+
oappRegistry: oAppRegistry,
|
|
20342
|
+
eventAuthority: endpointEventAuthority,
|
|
20343
|
+
program: this.program
|
|
20344
|
+
},
|
|
20345
|
+
this.program
|
|
20346
|
+
);
|
|
20347
|
+
for (const acc of registerOappIxKeys) {
|
|
20348
|
+
acc.isSigner = false;
|
|
20349
|
+
}
|
|
20350
|
+
const ret = [
|
|
20351
|
+
SystemProgram.createAccount({
|
|
20352
|
+
fromPubkey: admin,
|
|
20353
|
+
newAccountPubkey: this.mintKp,
|
|
20354
|
+
space: getMintLen([]),
|
|
20355
|
+
lamports: await connection.getMinimumBalanceForRentExemption(getMintLen([])),
|
|
20356
|
+
programId: this.tokenProgram
|
|
20357
|
+
}),
|
|
20358
|
+
createInitializeMintInstruction(
|
|
20359
|
+
this.mintKp,
|
|
20360
|
+
OFT_DECIMALS,
|
|
20361
|
+
this.isAdapter ? admin : oftConfig,
|
|
20362
|
+
null,
|
|
20363
|
+
this.tokenProgram
|
|
20333
20364
|
)
|
|
20334
|
-
|
|
20335
|
-
{
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20365
|
+
];
|
|
20366
|
+
if (this.isAdapter) {
|
|
20367
|
+
return ret.concat(
|
|
20368
|
+
createInitAdapterOftInstruction(
|
|
20369
|
+
{
|
|
20370
|
+
payer,
|
|
20371
|
+
oftConfig,
|
|
20372
|
+
tokenMint: this.mintKp,
|
|
20373
|
+
tokenEscrow: this.escrowKp,
|
|
20374
|
+
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20375
|
+
tokenProgram: this.tokenProgram,
|
|
20376
|
+
anchorRemainingAccounts: [
|
|
20377
|
+
{
|
|
20378
|
+
pubkey: this.endpointProgram,
|
|
20379
|
+
isSigner: false,
|
|
20380
|
+
isWritable: false
|
|
20381
|
+
}
|
|
20382
|
+
].concat(
|
|
20383
|
+
...registerOappIxKeys,
|
|
20384
|
+
{
|
|
20385
|
+
pubkey: endpointEventAuthority,
|
|
20386
|
+
isSigner: false,
|
|
20387
|
+
isWritable: false
|
|
20388
|
+
},
|
|
20389
|
+
{
|
|
20390
|
+
pubkey: this.endpointProgram,
|
|
20391
|
+
isSigner: false,
|
|
20392
|
+
isWritable: false
|
|
20393
|
+
}
|
|
20394
|
+
)
|
|
20395
|
+
},
|
|
20396
|
+
{
|
|
20397
|
+
params: {
|
|
20398
|
+
admin,
|
|
20399
|
+
sharedDecimals: OFT_DECIMALS,
|
|
20400
|
+
endpointProgram: this.endpointProgram
|
|
20401
|
+
}
|
|
20402
|
+
}
|
|
20403
|
+
)
|
|
20404
|
+
);
|
|
20405
|
+
} else {
|
|
20406
|
+
return ret.concat(
|
|
20407
|
+
createInitOftInstruction(
|
|
20408
|
+
{
|
|
20409
|
+
payer,
|
|
20410
|
+
oftConfig,
|
|
20411
|
+
tokenMint: this.mintKp,
|
|
20412
|
+
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20413
|
+
tokenProgram: this.tokenProgram,
|
|
20414
|
+
anchorRemainingAccounts: [
|
|
20415
|
+
{
|
|
20416
|
+
pubkey: this.endpointProgram,
|
|
20417
|
+
isSigner: false,
|
|
20418
|
+
isWritable: false
|
|
20419
|
+
}
|
|
20420
|
+
].concat(
|
|
20421
|
+
...registerOappIxKeys,
|
|
20422
|
+
{
|
|
20423
|
+
pubkey: endpointEventAuthority,
|
|
20424
|
+
isSigner: false,
|
|
20425
|
+
isWritable: false
|
|
20426
|
+
},
|
|
20427
|
+
{
|
|
20428
|
+
pubkey: this.endpointProgram,
|
|
20429
|
+
isSigner: false,
|
|
20430
|
+
isWritable: false
|
|
20431
|
+
}
|
|
20432
|
+
)
|
|
20433
|
+
},
|
|
20434
|
+
{
|
|
20435
|
+
params: {
|
|
20436
|
+
admin,
|
|
20437
|
+
sharedDecimals: OFT_DECIMALS,
|
|
20438
|
+
endpointProgram: this.endpointProgram,
|
|
20439
|
+
mintAuthority: admin
|
|
20440
|
+
}
|
|
20441
|
+
},
|
|
20442
|
+
this.program
|
|
20443
|
+
)
|
|
20444
|
+
);
|
|
20445
|
+
}
|
|
20446
|
+
}
|
|
20447
|
+
getAddressB32() {
|
|
20448
|
+
const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
|
|
20449
|
+
const ret = new Uint8Array(32);
|
|
20450
|
+
ret.fill(0).set(oftConfig.toBytes());
|
|
20451
|
+
return ret;
|
|
20452
|
+
}
|
|
20453
|
+
async mint_to(signer, to, amount) {
|
|
20454
|
+
const ix = createMintToInstruction(
|
|
20455
|
+
{
|
|
20456
|
+
minter: signer,
|
|
20457
|
+
oftConfig: this.getOftConfig(),
|
|
20458
|
+
tokenDest: to,
|
|
20459
|
+
tokenMint: this.mintKp,
|
|
20460
|
+
tokenProgram: this.tokenProgram
|
|
20461
|
+
},
|
|
20462
|
+
{
|
|
20463
|
+
params: {
|
|
20464
|
+
amount: new BN2(amount.toString())
|
|
20465
|
+
}
|
|
20340
20466
|
}
|
|
20467
|
+
);
|
|
20468
|
+
return Promise.resolve(ix);
|
|
20469
|
+
}
|
|
20470
|
+
async setPeer(_peer, admin, dstEid) {
|
|
20471
|
+
const [oftConfig] = this.deriver.oftConfig(this.isAdapter ? this.escrowKp : this.mintKp);
|
|
20472
|
+
const [peer] = this.deriver.peer(oftConfig, dstEid);
|
|
20473
|
+
const ix = createSetPeerInstruction(
|
|
20474
|
+
{
|
|
20475
|
+
admin,
|
|
20476
|
+
peer,
|
|
20477
|
+
oftConfig
|
|
20478
|
+
},
|
|
20479
|
+
{
|
|
20480
|
+
params: {
|
|
20481
|
+
dstEid,
|
|
20482
|
+
peer: new Array(32 - _peer.length).fill(0).concat(_peer)
|
|
20483
|
+
}
|
|
20484
|
+
},
|
|
20485
|
+
this.program
|
|
20486
|
+
);
|
|
20487
|
+
return Promise.resolve(ix);
|
|
20488
|
+
}
|
|
20489
|
+
async setEnforcedOptions(admin, send, sendAndCall, dstEid) {
|
|
20490
|
+
const oftConfig = this.getOftConfig();
|
|
20491
|
+
const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
|
|
20492
|
+
const ix = createSetEnforcedOptionsInstruction(
|
|
20493
|
+
{
|
|
20494
|
+
admin,
|
|
20495
|
+
enforcedOptions,
|
|
20496
|
+
oftConfig
|
|
20497
|
+
},
|
|
20498
|
+
{
|
|
20499
|
+
params: {
|
|
20500
|
+
dstEid,
|
|
20501
|
+
send,
|
|
20502
|
+
sendAndCall
|
|
20503
|
+
}
|
|
20504
|
+
},
|
|
20505
|
+
this.program
|
|
20506
|
+
);
|
|
20507
|
+
return Promise.resolve(ix);
|
|
20508
|
+
}
|
|
20509
|
+
async send(connection, payer, tokenSource, to, dstEid, amountLd, minAmountLd, fee, options = new Uint8Array(), composeMsg = null, commitmentOrConfig = "confirmed") {
|
|
20510
|
+
const oftConfig = this.getOftConfig();
|
|
20511
|
+
const [peer] = this.deriver.peer(oftConfig, dstEid);
|
|
20512
|
+
const [enforcedOptions] = this.deriver.enforcedOptions(oftConfig, dstEid);
|
|
20513
|
+
const peerinfo = await connection.getAccountInfo(peer);
|
|
20514
|
+
const peerAddress = peerinfo.data.subarray(8, 32 + 8);
|
|
20515
|
+
const msgLibProgram = await this.getSendLibraryProgram(connection, payer, dstEid);
|
|
20516
|
+
const [endpointSettings] = this.endpoint.endpointDeriver.setting();
|
|
20517
|
+
const receiverInfo = await Peer.fromAccountAddress(connection, peer, commitmentOrConfig);
|
|
20518
|
+
const packetPath = {
|
|
20519
|
+
srcEid: 0,
|
|
20520
|
+
dstEid,
|
|
20521
|
+
sender: hexlify(oftConfig.toBytes()),
|
|
20522
|
+
receiver: hexlify(receiverInfo.address)
|
|
20523
|
+
};
|
|
20524
|
+
invariant3(await isAccountInitialized(connection, endpointSettings), "endpointSettings account not initialized");
|
|
20525
|
+
invariant3(await isAccountInitialized(connection, peer), "peer account not initialized");
|
|
20526
|
+
invariant3(await isAccountInitialized(connection, enforcedOptions), "enforcedOptions account not initialized");
|
|
20527
|
+
invariant3(await isAccountInitialized(connection, payer), "payer account not initialized");
|
|
20528
|
+
invariant3(
|
|
20529
|
+
await isAccountInitialized(
|
|
20530
|
+
connection,
|
|
20531
|
+
this.endpoint.endpointDeriver.nonce(oftConfig, dstEid, peerAddress)[0]
|
|
20532
|
+
),
|
|
20533
|
+
"nonce account not initialized"
|
|
20534
|
+
);
|
|
20535
|
+
return createSendInstruction(
|
|
20536
|
+
{
|
|
20537
|
+
signer: payer,
|
|
20538
|
+
peer,
|
|
20539
|
+
enforcedOptions,
|
|
20540
|
+
oftConfig,
|
|
20541
|
+
tokenSource,
|
|
20542
|
+
tokenEscrow: this.escrowKp,
|
|
20543
|
+
tokenMint: this.mintKp,
|
|
20544
|
+
tokenProgram: this.tokenProgram,
|
|
20545
|
+
eventAuthority: this.eventAuthorityPDA,
|
|
20546
|
+
program: this.program,
|
|
20547
|
+
// Get remaining accounts from msgLib(simple_msgLib or uln)
|
|
20548
|
+
anchorRemainingAccounts: await this.endpoint.getSendIXAccountMetaForCPI(
|
|
20549
|
+
connection,
|
|
20550
|
+
payer,
|
|
20551
|
+
packetPath,
|
|
20552
|
+
msgLibProgram,
|
|
20553
|
+
commitmentOrConfig
|
|
20554
|
+
)
|
|
20555
|
+
},
|
|
20556
|
+
{
|
|
20557
|
+
params: {
|
|
20558
|
+
dstEid,
|
|
20559
|
+
to,
|
|
20560
|
+
amountLd: new BN2(amountLd.toString()),
|
|
20561
|
+
minAmountLd: new BN2(minAmountLd.toString()),
|
|
20562
|
+
options,
|
|
20563
|
+
composeMsg,
|
|
20564
|
+
nativeFee: fee.nativeFee,
|
|
20565
|
+
lzTokenFee: fee.lzTokenFee
|
|
20566
|
+
}
|
|
20567
|
+
},
|
|
20568
|
+
this.program
|
|
20569
|
+
);
|
|
20570
|
+
}
|
|
20571
|
+
async setRateLimit(signer, dstEid, capacity, refillPerSecond, enabled) {
|
|
20572
|
+
const [peerPda] = this.deriver.peer(this.getOftConfig(), dstEid);
|
|
20573
|
+
const ix = createSetRateLimitInstruction(
|
|
20574
|
+
{
|
|
20575
|
+
admin: signer,
|
|
20576
|
+
peer: peerPda,
|
|
20577
|
+
oftConfig: this.getOftConfig()
|
|
20578
|
+
},
|
|
20579
|
+
{
|
|
20580
|
+
params: {
|
|
20581
|
+
dstEid,
|
|
20582
|
+
capacity: new BN2(capacity.toString()),
|
|
20583
|
+
refillPerSecond: new BN2(refillPerSecond.toString()),
|
|
20584
|
+
enabled
|
|
20585
|
+
}
|
|
20586
|
+
},
|
|
20587
|
+
this.program
|
|
20588
|
+
);
|
|
20589
|
+
return Promise.resolve(ix);
|
|
20590
|
+
}
|
|
20591
|
+
async lzReceive(connection, payer, packet) {
|
|
20592
|
+
const deserializedPacket = PacketSerializer.deserialize(packet);
|
|
20593
|
+
return lzReceive(connection, payer, deserializedPacket);
|
|
20594
|
+
}
|
|
20595
|
+
async getSendLibraryProgram(connection, payer, dstEid) {
|
|
20596
|
+
const oftConfig = this.getOftConfig();
|
|
20597
|
+
const sendLibInfo = await this.endpoint.getSendLibrary(connection, oftConfig, dstEid);
|
|
20598
|
+
if (!sendLibInfo?.programId) {
|
|
20599
|
+
throw new Error("Send library not initialized or blocked message library");
|
|
20341
20600
|
}
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
);
|
|
20357
|
-
const
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
const registerOappIx = createRegisterOappInstruction(
|
|
20601
|
+
const { programId: msgLibProgram } = sendLibInfo;
|
|
20602
|
+
const msgLibVersion = await this.endpoint.getMessageLibVersion(connection, payer, msgLibProgram);
|
|
20603
|
+
if (msgLibVersion?.major.toString() === "0" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
|
|
20604
|
+
return new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
|
|
20605
|
+
} else if (msgLibVersion?.major.toString() === "3" && msgLibVersion.minor == 0 && msgLibVersion.endpointVersion == 2) {
|
|
20606
|
+
return new uln_exports.Uln(msgLibProgram);
|
|
20607
|
+
}
|
|
20608
|
+
throw new Error(`Unsupported message library version: ${JSON.stringify(msgLibVersion, null, 2)}`);
|
|
20609
|
+
}
|
|
20610
|
+
};
|
|
20611
|
+
|
|
20612
|
+
// src/oft-tools.ts
|
|
20613
|
+
var SOLANA_EID = 1;
|
|
20614
|
+
async function createInitAdapterOftIx(payer, admin, mint, escrow, sharedDecimals = 6, tokenProgram = TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20615
|
+
const deriver = new OftPDADeriver(oftProgramId);
|
|
20616
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20617
|
+
const [oftConfig] = deriver.oftConfig(escrow);
|
|
20618
|
+
const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
|
|
20619
|
+
return instructions_exports.createInitAdapterOftInstruction(
|
|
20362
20620
|
{
|
|
20363
20621
|
payer,
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20622
|
+
oftConfig,
|
|
20623
|
+
tokenMint: mint,
|
|
20624
|
+
tokenEscrow: escrow,
|
|
20625
|
+
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20626
|
+
tokenProgram,
|
|
20627
|
+
anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
|
|
20368
20628
|
},
|
|
20369
20629
|
{
|
|
20370
20630
|
params: {
|
|
20371
|
-
|
|
20631
|
+
admin,
|
|
20632
|
+
sharedDecimals,
|
|
20633
|
+
endpointProgram
|
|
20372
20634
|
}
|
|
20373
20635
|
}
|
|
20374
20636
|
);
|
|
20375
|
-
|
|
20376
|
-
|
|
20637
|
+
}
|
|
20638
|
+
async function createNonceTx(connection, nonceAccount, nonceAuthority, instructions, commitmentOrConfig = "confirmed") {
|
|
20639
|
+
const nonceAccountInfo = await connection.getNonce(nonceAccount, commitmentOrConfig);
|
|
20640
|
+
if (nonceAccountInfo === null) {
|
|
20641
|
+
throw new Error("Invalid nonce account");
|
|
20377
20642
|
}
|
|
20378
|
-
|
|
20643
|
+
const { nonce } = nonceAccountInfo;
|
|
20644
|
+
const nonceAdvanceIx = SystemProgram.nonceAdvance({
|
|
20645
|
+
noncePubkey: nonceAccount,
|
|
20646
|
+
authorizedPubkey: nonceAuthority
|
|
20647
|
+
});
|
|
20648
|
+
return new Transaction({
|
|
20649
|
+
recentBlockhash: nonce,
|
|
20650
|
+
nonceInfo: {
|
|
20651
|
+
nonce,
|
|
20652
|
+
nonceInstruction: nonceAdvanceIx
|
|
20653
|
+
}
|
|
20654
|
+
}).add(...instructions);
|
|
20655
|
+
}
|
|
20656
|
+
async function createInitNativeOftIx(payer, admin, mint, oftMintAuthority, sharedDecimals = 6, tokenProgram = TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20657
|
+
const deriver = new OftPDADeriver(oftProgramId);
|
|
20658
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20659
|
+
const [oftConfig] = deriver.oftConfig(mint);
|
|
20660
|
+
const [lzReceiveTypes] = deriver.lzReceiveTypesAccounts(oftConfig);
|
|
20661
|
+
return instructions_exports.createInitOftInstruction(
|
|
20379
20662
|
{
|
|
20380
20663
|
payer,
|
|
20381
20664
|
oftConfig,
|
|
20382
20665
|
tokenMint: mint,
|
|
20383
20666
|
lzReceiveTypesAccounts: lzReceiveTypes,
|
|
20384
20667
|
tokenProgram,
|
|
20385
|
-
anchorRemainingAccounts:
|
|
20386
|
-
{
|
|
20387
|
-
pubkey: PROGRAM_ID2,
|
|
20388
|
-
isSigner: false,
|
|
20389
|
-
isWritable: false
|
|
20390
|
-
}
|
|
20391
|
-
].concat(
|
|
20392
|
-
...registerOappIx.keys,
|
|
20393
|
-
{
|
|
20394
|
-
pubkey: endpointEventAuthority,
|
|
20395
|
-
isSigner: false,
|
|
20396
|
-
isWritable: false
|
|
20397
|
-
},
|
|
20398
|
-
{
|
|
20399
|
-
pubkey: PROGRAM_ID2,
|
|
20400
|
-
isSigner: false,
|
|
20401
|
-
isWritable: false
|
|
20402
|
-
}
|
|
20403
|
-
)
|
|
20668
|
+
anchorRemainingAccounts: endpoint.getRegisterOappIxAccountMetaForCPI(payer, oftConfig)
|
|
20404
20669
|
},
|
|
20405
20670
|
{
|
|
20406
20671
|
params: {
|
|
20407
20672
|
admin,
|
|
20408
20673
|
sharedDecimals,
|
|
20409
|
-
|
|
20410
|
-
|
|
20674
|
+
mintAuthority: oftMintAuthority,
|
|
20675
|
+
endpointProgram
|
|
20411
20676
|
}
|
|
20412
20677
|
},
|
|
20413
|
-
|
|
20678
|
+
oftProgramId
|
|
20414
20679
|
);
|
|
20415
20680
|
}
|
|
20416
|
-
async function createSetPeerIx(admin, oftConfig, dstEid, peer) {
|
|
20681
|
+
async function createSetPeerIx(admin, oftConfig, dstEid, peer, oftProgramId = PROGRAM_ID) {
|
|
20417
20682
|
if (peer.length !== 32) {
|
|
20418
20683
|
throw new Error("Peer must be 32 bytes (left-padded with zeroes)");
|
|
20419
20684
|
}
|
|
20420
20685
|
if (dstEid % 3e4 == 0) {
|
|
20421
20686
|
throw new Error("Invalid dstEid");
|
|
20422
20687
|
}
|
|
20423
|
-
const [peerPda] =
|
|
20424
|
-
|
|
20425
|
-
PROGRAM_ID
|
|
20426
|
-
);
|
|
20427
|
-
return createSetPeerInstruction(
|
|
20688
|
+
const [peerPda] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
|
|
20689
|
+
return instructions_exports.createSetPeerInstruction(
|
|
20428
20690
|
{
|
|
20429
20691
|
admin,
|
|
20430
20692
|
peer: peerPda,
|
|
@@ -20436,45 +20698,36 @@ async function createSetPeerIx(admin, oftConfig, dstEid, peer) {
|
|
|
20436
20698
|
peer
|
|
20437
20699
|
}
|
|
20438
20700
|
},
|
|
20439
|
-
|
|
20701
|
+
oftProgramId
|
|
20440
20702
|
);
|
|
20441
20703
|
}
|
|
20442
|
-
async function createSetDelegateIx(admin, oftConfig, delegate) {
|
|
20443
|
-
const
|
|
20444
|
-
|
|
20445
|
-
|
|
20446
|
-
|
|
20447
|
-
const [endpointEventAuthority] = PublicKey.findProgramAddressSync(
|
|
20448
|
-
[Buffer.from(EVENT_SEED2, "utf-8")],
|
|
20449
|
-
PROGRAM_ID2
|
|
20450
|
-
);
|
|
20451
|
-
const endpointSetDelegateIx = createSetDelegateInstruction2(
|
|
20704
|
+
async function createSetDelegateIx(admin, oftConfig, delegate, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20705
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20706
|
+
const [oAppRegistry] = endpoint.endpointDeriver.oappRegistry(oftConfig);
|
|
20707
|
+
const endpointEventAuthority = endpoint.eventAuthorityPDA;
|
|
20708
|
+
const keys = instructions_exports2.createSetDelegateInstructionAccounts(
|
|
20452
20709
|
{
|
|
20453
20710
|
oapp: oftConfig,
|
|
20454
20711
|
oappRegistry: oAppRegistry,
|
|
20455
20712
|
eventAuthority: endpointEventAuthority,
|
|
20456
|
-
program:
|
|
20713
|
+
program: endpointProgram
|
|
20457
20714
|
},
|
|
20458
|
-
|
|
20459
|
-
params: {
|
|
20460
|
-
delegate
|
|
20461
|
-
}
|
|
20462
|
-
}
|
|
20715
|
+
endpointProgram
|
|
20463
20716
|
);
|
|
20464
|
-
for (const acc of
|
|
20717
|
+
for (const acc of keys) {
|
|
20465
20718
|
acc.isSigner = false;
|
|
20466
20719
|
}
|
|
20467
|
-
return createSetDelegateInstruction(
|
|
20720
|
+
return instructions_exports.createSetDelegateInstruction(
|
|
20468
20721
|
{
|
|
20469
20722
|
admin,
|
|
20470
20723
|
oftConfig,
|
|
20471
20724
|
anchorRemainingAccounts: [
|
|
20472
20725
|
{
|
|
20473
|
-
pubkey:
|
|
20726
|
+
pubkey: endpointProgram,
|
|
20474
20727
|
isSigner: false,
|
|
20475
20728
|
isWritable: false
|
|
20476
20729
|
},
|
|
20477
|
-
...
|
|
20730
|
+
...keys
|
|
20478
20731
|
]
|
|
20479
20732
|
},
|
|
20480
20733
|
{
|
|
@@ -20482,151 +20735,34 @@ async function createSetDelegateIx(admin, oftConfig, delegate) {
|
|
|
20482
20735
|
delegate
|
|
20483
20736
|
}
|
|
20484
20737
|
},
|
|
20485
|
-
|
|
20486
|
-
);
|
|
20487
|
-
}
|
|
20488
|
-
async function createInitSendLibraryIx(signer, oftConfig, dstEid) {
|
|
20489
|
-
const [oAppRegistry] = PublicKey.findProgramAddressSync(
|
|
20490
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20491
|
-
PROGRAM_ID2
|
|
20492
|
-
);
|
|
20493
|
-
const [sendLibraryConfig] = PublicKey.findProgramAddressSync(
|
|
20494
|
-
[
|
|
20495
|
-
Buffer.from(SEND_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
20496
|
-
oftConfig.toBuffer(),
|
|
20497
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4)
|
|
20498
|
-
],
|
|
20499
|
-
PROGRAM_ID2
|
|
20500
|
-
);
|
|
20501
|
-
return createInitSendLibraryInstruction(
|
|
20502
|
-
{
|
|
20503
|
-
delegate: signer,
|
|
20504
|
-
oappRegistry: oAppRegistry,
|
|
20505
|
-
sendLibraryConfig
|
|
20506
|
-
},
|
|
20507
|
-
{
|
|
20508
|
-
params: {
|
|
20509
|
-
sender: oftConfig,
|
|
20510
|
-
eid: dstEid
|
|
20511
|
-
}
|
|
20512
|
-
},
|
|
20513
|
-
PROGRAM_ID2
|
|
20514
|
-
);
|
|
20515
|
-
}
|
|
20516
|
-
async function createInitReceiveLibraryIx(signer, oftConfig, remoteEid) {
|
|
20517
|
-
const [oAppRegistry] = PublicKey.findProgramAddressSync(
|
|
20518
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20519
|
-
PROGRAM_ID2
|
|
20520
|
-
);
|
|
20521
|
-
const [receiveLibraryConfig] = PublicKey.findProgramAddressSync(
|
|
20522
|
-
[
|
|
20523
|
-
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
20524
|
-
oftConfig.toBuffer(),
|
|
20525
|
-
new BN6(remoteEid).toArrayLike(Buffer, "be", 4)
|
|
20526
|
-
],
|
|
20527
|
-
PROGRAM_ID2
|
|
20528
|
-
);
|
|
20529
|
-
return createInitReceiveLibraryInstruction(
|
|
20530
|
-
{
|
|
20531
|
-
delegate: signer,
|
|
20532
|
-
oappRegistry: oAppRegistry,
|
|
20533
|
-
receiveLibraryConfig
|
|
20534
|
-
},
|
|
20535
|
-
{
|
|
20536
|
-
params: {
|
|
20537
|
-
receiver: oftConfig,
|
|
20538
|
-
eid: remoteEid
|
|
20539
|
-
}
|
|
20540
|
-
},
|
|
20541
|
-
PROGRAM_ID2
|
|
20738
|
+
oftProgramId
|
|
20542
20739
|
);
|
|
20543
20740
|
}
|
|
20544
|
-
async function
|
|
20545
|
-
const
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
);
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
);
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
|
|
20564
|
-
{
|
|
20565
|
-
signer,
|
|
20566
|
-
oappRegistry: oAppRegistry,
|
|
20567
|
-
sendLibraryConfig,
|
|
20568
|
-
messageLibInfo: sendLibraryInfo,
|
|
20569
|
-
eventAuthority,
|
|
20570
|
-
program: PROGRAM_ID2
|
|
20571
|
-
},
|
|
20572
|
-
{
|
|
20573
|
-
params: {
|
|
20574
|
-
sender: oftConfig,
|
|
20575
|
-
eid: dstEid,
|
|
20576
|
-
newLib: newSendLib
|
|
20577
|
-
}
|
|
20578
|
-
},
|
|
20579
|
-
PROGRAM_ID2
|
|
20741
|
+
async function createInitSendLibraryIx(signer, oftConfig, dstEid, endpointProgram = PROGRAM_ID2) {
|
|
20742
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20743
|
+
return endpoint.initSendLibraryWithoutChecks(signer, oftConfig, dstEid);
|
|
20744
|
+
}
|
|
20745
|
+
async function createInitReceiveLibraryIx(signer, oftConfig, remoteEid, endpointProgram = PROGRAM_ID2) {
|
|
20746
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20747
|
+
return endpoint.initReceiveLibraryWithoutChecks(signer, oftConfig, remoteEid);
|
|
20748
|
+
}
|
|
20749
|
+
async function createSetSendLibraryIx(signer, oftConfig, sendLibraryProgram, dstEid, endpointProgram = PROGRAM_ID2) {
|
|
20750
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20751
|
+
return endpoint.setSendLibrary(signer, oftConfig, sendLibraryProgram, dstEid);
|
|
20752
|
+
}
|
|
20753
|
+
async function createSetReceiveLibraryIx(signer, oftConfig, receiveLibraryProgram, dstEid, gracePeriod, endpointProgram = PROGRAM_ID2) {
|
|
20754
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20755
|
+
return endpoint.setReceiveLibrary(
|
|
20756
|
+
signer,
|
|
20757
|
+
oftConfig,
|
|
20758
|
+
receiveLibraryProgram,
|
|
20759
|
+
dstEid,
|
|
20760
|
+
parseInt(gracePeriod.toString())
|
|
20580
20761
|
);
|
|
20581
20762
|
}
|
|
20582
|
-
async function
|
|
20583
|
-
const [
|
|
20584
|
-
|
|
20585
|
-
receiveLibraryProgram
|
|
20586
|
-
);
|
|
20587
|
-
const [oAppRegistry] = PublicKey.findProgramAddressSync(
|
|
20588
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftConfig.toBuffer()],
|
|
20589
|
-
PROGRAM_ID2
|
|
20590
|
-
);
|
|
20591
|
-
const [receiveLibraryConfig] = PublicKey.findProgramAddressSync(
|
|
20592
|
-
[
|
|
20593
|
-
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
20594
|
-
oftConfig.toBuffer(),
|
|
20595
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4)
|
|
20596
|
-
],
|
|
20597
|
-
PROGRAM_ID2
|
|
20598
|
-
);
|
|
20599
|
-
const [receiveLibraryInfo] = PublicKey.findProgramAddressSync(
|
|
20600
|
-
[Buffer.from(MESSAGE_LIB_SEED2, "utf-8"), newReceiveLib.toBuffer()],
|
|
20601
|
-
PROGRAM_ID2
|
|
20602
|
-
);
|
|
20603
|
-
const [eventAuthority] = PublicKey.findProgramAddressSync([Buffer.from(EVENT_SEED2, "utf-8")], PROGRAM_ID2);
|
|
20604
|
-
return createSetReceiveLibraryInstruction(
|
|
20605
|
-
{
|
|
20606
|
-
signer,
|
|
20607
|
-
oappRegistry: oAppRegistry,
|
|
20608
|
-
receiveLibraryConfig,
|
|
20609
|
-
messageLibInfo: receiveLibraryInfo,
|
|
20610
|
-
eventAuthority,
|
|
20611
|
-
program: PROGRAM_ID2
|
|
20612
|
-
},
|
|
20613
|
-
{
|
|
20614
|
-
params: {
|
|
20615
|
-
receiver: oftConfig,
|
|
20616
|
-
eid: dstEid,
|
|
20617
|
-
newLib: newReceiveLib,
|
|
20618
|
-
gracePeriod: new BN6(gracePeriod.toString())
|
|
20619
|
-
}
|
|
20620
|
-
},
|
|
20621
|
-
PROGRAM_ID2
|
|
20622
|
-
);
|
|
20623
|
-
}
|
|
20624
|
-
async function createMintToIx(signer, tokenMint, tokenDest, amount, tokenProgram = TOKEN_PROGRAM_ID) {
|
|
20625
|
-
const [oftConfig] = PublicKey.findProgramAddressSync(
|
|
20626
|
-
[Buffer.from(OFT_SEED2, "utf-8"), tokenMint.toBytes()],
|
|
20627
|
-
PROGRAM_ID
|
|
20628
|
-
);
|
|
20629
|
-
return createMintToInstruction(
|
|
20763
|
+
async function createMintToIx(signer, tokenMint, tokenDest, amount, tokenProgram = TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID) {
|
|
20764
|
+
const [oftConfig] = new OftPDADeriver(oftProgramId).oftConfig(tokenMint);
|
|
20765
|
+
return instructions_exports.createMintToInstruction(
|
|
20630
20766
|
{
|
|
20631
20767
|
minter: signer,
|
|
20632
20768
|
oftConfig,
|
|
@@ -20636,18 +20772,15 @@ async function createMintToIx(signer, tokenMint, tokenDest, amount, tokenProgram
|
|
|
20636
20772
|
},
|
|
20637
20773
|
{
|
|
20638
20774
|
params: {
|
|
20639
|
-
amount: new
|
|
20775
|
+
amount: new BN2(amount.toString())
|
|
20640
20776
|
}
|
|
20641
20777
|
},
|
|
20642
|
-
|
|
20778
|
+
oftProgramId
|
|
20643
20779
|
);
|
|
20644
20780
|
}
|
|
20645
|
-
async function createSetRateLimitIx(signer, oftConfig, dstEid, capacity, refillPerSecond, enabled) {
|
|
20646
|
-
const [peer] =
|
|
20647
|
-
|
|
20648
|
-
PROGRAM_ID
|
|
20649
|
-
);
|
|
20650
|
-
return createSetRateLimitInstruction(
|
|
20781
|
+
async function createSetRateLimitIx(signer, oftConfig, dstEid, capacity, refillPerSecond, enabled, oftProgramId = PROGRAM_ID) {
|
|
20782
|
+
const [peer] = new OftPDADeriver(oftProgramId).peer(oftConfig, dstEid);
|
|
20783
|
+
return instructions_exports.createSetRateLimitInstruction(
|
|
20651
20784
|
{
|
|
20652
20785
|
admin: signer,
|
|
20653
20786
|
peer,
|
|
@@ -20656,160 +20789,31 @@ async function createSetRateLimitIx(signer, oftConfig, dstEid, capacity, refillP
|
|
|
20656
20789
|
{
|
|
20657
20790
|
params: {
|
|
20658
20791
|
dstEid,
|
|
20659
|
-
capacity: new
|
|
20660
|
-
refillPerSecond: new
|
|
20792
|
+
capacity: new BN2(capacity.toString()),
|
|
20793
|
+
refillPerSecond: new BN2(refillPerSecond.toString()),
|
|
20661
20794
|
enabled
|
|
20662
20795
|
}
|
|
20663
20796
|
},
|
|
20664
|
-
|
|
20797
|
+
oftProgramId
|
|
20665
20798
|
);
|
|
20666
20799
|
}
|
|
20667
|
-
async function createInitConfigIx(signer, oftConfig,
|
|
20668
|
-
const
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
[Buffer.from(MESSAGE_LIB_SEED2, "utf-8"), messageLib.toBytes()],
|
|
20675
|
-
PROGRAM_ID2
|
|
20676
|
-
);
|
|
20677
|
-
const [endpointSettings] = PublicKey.findProgramAddressSync(
|
|
20678
|
-
[Buffer.from(ENDPOINT_SEED2, "utf-8")],
|
|
20679
|
-
PROGRAM_ID2
|
|
20680
|
-
);
|
|
20681
|
-
const [sendConfig] = PublicKey.findProgramAddressSync(
|
|
20682
|
-
[Buffer.from(SEND_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20683
|
-
messageLibProgram
|
|
20684
|
-
);
|
|
20685
|
-
const [receiveConfig] = PublicKey.findProgramAddressSync(
|
|
20686
|
-
[Buffer.from(RECEIVE_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20687
|
-
messageLibProgram
|
|
20688
|
-
);
|
|
20689
|
-
const initConfigMessageLibIx = createInitConfigInstruction3(
|
|
20690
|
-
{
|
|
20691
|
-
endpoint: endpointSettings,
|
|
20692
|
-
payer: signer,
|
|
20693
|
-
uln: messageLib,
|
|
20694
|
-
sendConfig,
|
|
20695
|
-
receiveConfig
|
|
20696
|
-
},
|
|
20697
|
-
{
|
|
20698
|
-
params: {
|
|
20699
|
-
oapp: oftConfig,
|
|
20700
|
-
eid: dstEid
|
|
20701
|
-
}
|
|
20702
|
-
}
|
|
20703
|
-
);
|
|
20704
|
-
for (const acc of initConfigMessageLibIx.keys) {
|
|
20705
|
-
if (!signer.equals(acc.pubkey)) {
|
|
20706
|
-
acc.isSigner = false;
|
|
20707
|
-
}
|
|
20800
|
+
async function createInitConfigIx(signer, oftConfig, dstEid, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20801
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20802
|
+
let msgLib;
|
|
20803
|
+
if (msgLibProgram.toBase58() === simple_message_lib_exports.PROGRAM_ID.toBase58()) {
|
|
20804
|
+
msgLib = new simple_message_lib_exports.SimpleMessageLib(msgLibProgram);
|
|
20805
|
+
} else {
|
|
20806
|
+
msgLib = new Uln(msgLibProgram);
|
|
20708
20807
|
}
|
|
20709
|
-
return
|
|
20710
|
-
{
|
|
20711
|
-
delegate: signer,
|
|
20712
|
-
oappRegistry: oAppRegistry,
|
|
20713
|
-
messageLibInfo,
|
|
20714
|
-
messageLib,
|
|
20715
|
-
messageLibProgram,
|
|
20716
|
-
anchorRemainingAccounts: initConfigMessageLibIx.keys.slice(1)
|
|
20717
|
-
},
|
|
20718
|
-
{
|
|
20719
|
-
params: {
|
|
20720
|
-
oapp: oftConfig,
|
|
20721
|
-
eid: dstEid
|
|
20722
|
-
}
|
|
20723
|
-
}
|
|
20724
|
-
);
|
|
20808
|
+
return endpoint.initOappConfig(signer, msgLib, signer, oftConfig, dstEid);
|
|
20725
20809
|
}
|
|
20726
|
-
async function createSetConfigIx(signer, oftConfig, dstEid, configType, config,
|
|
20727
|
-
const
|
|
20728
|
-
|
|
20729
|
-
PROGRAM_ID2
|
|
20730
|
-
);
|
|
20731
|
-
const [messageLib] = PublicKey.findProgramAddressSync([Buffer.from(MESSAGE_LIB_SEED2, "utf-8")], messageLibProgram);
|
|
20732
|
-
const [messageLibInfo] = PublicKey.findProgramAddressSync(
|
|
20733
|
-
[Buffer.from(MESSAGE_LIB_SEED2, "utf-8"), messageLib.toBytes()],
|
|
20734
|
-
PROGRAM_ID2
|
|
20735
|
-
);
|
|
20736
|
-
const [endpointSettings] = PublicKey.findProgramAddressSync(
|
|
20737
|
-
[Buffer.from(ENDPOINT_SEED2, "utf-8")],
|
|
20738
|
-
PROGRAM_ID2
|
|
20739
|
-
);
|
|
20740
|
-
const [defaultSendConfig] = PublicKey.findProgramAddressSync(
|
|
20741
|
-
[Buffer.from(SEND_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20742
|
-
messageLibProgram
|
|
20743
|
-
);
|
|
20744
|
-
const [sendConfig] = PublicKey.findProgramAddressSync(
|
|
20745
|
-
[Buffer.from(SEND_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20746
|
-
messageLibProgram
|
|
20747
|
-
);
|
|
20748
|
-
const [defaultReceiveConfig] = PublicKey.findProgramAddressSync(
|
|
20749
|
-
[Buffer.from(RECEIVE_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20750
|
-
messageLibProgram
|
|
20751
|
-
);
|
|
20752
|
-
const [receiveConfig] = PublicKey.findProgramAddressSync(
|
|
20753
|
-
[Buffer.from(RECEIVE_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4), oftConfig.toBytes()],
|
|
20754
|
-
messageLibProgram
|
|
20755
|
-
);
|
|
20756
|
-
const [messageLibEventAuthority] = PublicKey.findProgramAddressSync(
|
|
20757
|
-
[Buffer.from(EVENT_SEED2, "utf-8")],
|
|
20758
|
-
messageLibProgram
|
|
20759
|
-
);
|
|
20760
|
-
const [ulnSettings] = PublicKey.findProgramAddressSync([Buffer.from(ULN_SEED2, "utf-8")], messageLibProgram);
|
|
20761
|
-
const messageLibSetConfigIx = createSetConfigInstruction4(
|
|
20762
|
-
{
|
|
20763
|
-
endpoint: endpointSettings,
|
|
20764
|
-
uln: ulnSettings,
|
|
20765
|
-
sendConfig,
|
|
20766
|
-
receiveConfig,
|
|
20767
|
-
defaultSendConfig,
|
|
20768
|
-
defaultReceiveConfig,
|
|
20769
|
-
eventAuthority: messageLibEventAuthority,
|
|
20770
|
-
program: messageLibProgram
|
|
20771
|
-
},
|
|
20772
|
-
{
|
|
20773
|
-
params: {
|
|
20774
|
-
oapp: oftConfig,
|
|
20775
|
-
eid: dstEid,
|
|
20776
|
-
configType,
|
|
20777
|
-
config
|
|
20778
|
-
}
|
|
20779
|
-
},
|
|
20780
|
-
messageLibProgram
|
|
20781
|
-
);
|
|
20782
|
-
for (const acc of messageLibSetConfigIx.keys) {
|
|
20783
|
-
if (!signer.equals(acc.pubkey)) {
|
|
20784
|
-
acc.isSigner = false;
|
|
20785
|
-
}
|
|
20786
|
-
}
|
|
20787
|
-
return createSetConfigInstruction(
|
|
20788
|
-
{
|
|
20789
|
-
signer,
|
|
20790
|
-
oappRegistry: oAppRegistry,
|
|
20791
|
-
messageLibInfo,
|
|
20792
|
-
messageLib,
|
|
20793
|
-
messageLibProgram,
|
|
20794
|
-
anchorRemainingAccounts: messageLibSetConfigIx.keys.slice(1)
|
|
20795
|
-
},
|
|
20796
|
-
{
|
|
20797
|
-
params: {
|
|
20798
|
-
oapp: oftConfig,
|
|
20799
|
-
eid: dstEid,
|
|
20800
|
-
configType,
|
|
20801
|
-
config
|
|
20802
|
-
}
|
|
20803
|
-
},
|
|
20804
|
-
PROGRAM_ID2
|
|
20805
|
-
);
|
|
20810
|
+
async function createSetConfigIx(connection, signer, oftConfig, dstEid, configType, config, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20811
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20812
|
+
return endpoint.setOappConfig(connection, signer, oftConfig, msgLibProgram, dstEid, { configType, value: config });
|
|
20806
20813
|
}
|
|
20807
|
-
async function createSetEnforcedOptionsIx(admin, oftConfig, dstEid, sendOptions, sendAndCallOptions) {
|
|
20808
|
-
const [enforcedOptions] =
|
|
20809
|
-
|
|
20810
|
-
PROGRAM_ID
|
|
20811
|
-
);
|
|
20812
|
-
return createSetEnforcedOptionsInstruction(
|
|
20814
|
+
async function createSetEnforcedOptionsIx(admin, oftConfig, dstEid, sendOptions, sendAndCallOptions, oftProgramId = PROGRAM_ID) {
|
|
20815
|
+
const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftConfig, dstEid);
|
|
20816
|
+
return instructions_exports.createSetEnforcedOptionsInstruction(
|
|
20813
20817
|
{
|
|
20814
20818
|
admin,
|
|
20815
20819
|
enforcedOptions,
|
|
@@ -20822,11 +20826,11 @@ async function createSetEnforcedOptionsIx(admin, oftConfig, dstEid, sendOptions,
|
|
|
20822
20826
|
sendAndCall: sendAndCallOptions
|
|
20823
20827
|
}
|
|
20824
20828
|
},
|
|
20825
|
-
|
|
20829
|
+
oftProgramId
|
|
20826
20830
|
);
|
|
20827
20831
|
}
|
|
20828
|
-
async function createTransferAdminIx(signer, oftConfig, newAdmin) {
|
|
20829
|
-
return createTransferAdminInstruction(
|
|
20832
|
+
async function createTransferAdminIx(signer, oftConfig, newAdmin, oftProgramId = PROGRAM_ID) {
|
|
20833
|
+
return instructions_exports.createTransferAdminInstruction(
|
|
20830
20834
|
{
|
|
20831
20835
|
admin: signer,
|
|
20832
20836
|
oftConfig
|
|
@@ -20836,115 +20840,36 @@ async function createTransferAdminIx(signer, oftConfig, newAdmin) {
|
|
|
20836
20840
|
admin: newAdmin
|
|
20837
20841
|
}
|
|
20838
20842
|
},
|
|
20839
|
-
|
|
20843
|
+
oftProgramId
|
|
20840
20844
|
);
|
|
20841
20845
|
}
|
|
20842
|
-
async function sendWithUln(connection, payer, tokenMint, tokenSource, dstEid, amountLd, minAmountLd, options, to, nativeFee, tokenEscrow = void 0, lzTokenFee = 0n, tokenProgram = TOKEN_PROGRAM_ID, composeMsg = null) {
|
|
20843
|
-
const
|
|
20844
|
-
|
|
20845
|
-
PROGRAM_ID
|
|
20846
|
-
);
|
|
20847
|
-
const [peer] = PublicKey.findProgramAddressSync(
|
|
20848
|
-
[Buffer.from(PEER_SEED2, "utf-8"), oftInstance.toBuffer(), new BN6(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20849
|
-
PROGRAM_ID
|
|
20850
|
-
);
|
|
20851
|
-
const [oftEventAuthority] = PublicKey.findProgramAddressSync([Buffer.from(EVENT_SEED2, "utf-8")], PROGRAM_ID);
|
|
20852
|
-
const peerInfo = await Peer.fromAccountAddress(connection, peer);
|
|
20853
|
-
const peerAddress = peerInfo.address;
|
|
20854
|
-
const [enforcedOptions] = PublicKey.findProgramAddressSync(
|
|
20855
|
-
[
|
|
20856
|
-
Buffer.from(ENFORCED_OPTIONS_SEED2, "utf-8"),
|
|
20857
|
-
oftInstance.toBuffer(),
|
|
20858
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4)
|
|
20859
|
-
],
|
|
20860
|
-
PROGRAM_ID
|
|
20861
|
-
);
|
|
20862
|
-
const messageLib = new Uln(PROGRAM_ID6);
|
|
20863
|
-
const endpoint = new Endpoint(PROGRAM_ID2);
|
|
20864
|
-
const remainingAccounts = await endpoint.getSendIXAccountMetaForCPI(
|
|
20846
|
+
async function sendWithUln(connection, payer, tokenMint, tokenSource, dstEid, amountLd, minAmountLd, options, to, nativeFee, tokenEscrow = void 0, lzTokenFee = 0n, tokenProgram = TOKEN_PROGRAM_ID, composeMsg = null, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20847
|
+
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20848
|
+
return oft.send(
|
|
20865
20849
|
connection,
|
|
20866
20850
|
payer,
|
|
20851
|
+
tokenSource,
|
|
20852
|
+
to,
|
|
20853
|
+
dstEid,
|
|
20854
|
+
amountLd,
|
|
20855
|
+
minAmountLd,
|
|
20867
20856
|
{
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
dstEid,
|
|
20871
|
-
receiver: hexlify(peerAddress)
|
|
20872
|
-
},
|
|
20873
|
-
messageLib
|
|
20874
|
-
);
|
|
20875
|
-
return createSendInstruction(
|
|
20876
|
-
{
|
|
20877
|
-
signer: payer,
|
|
20878
|
-
peer,
|
|
20879
|
-
enforcedOptions,
|
|
20880
|
-
oftConfig: oftInstance,
|
|
20881
|
-
tokenSource,
|
|
20882
|
-
tokenEscrow,
|
|
20883
|
-
tokenMint,
|
|
20884
|
-
tokenProgram,
|
|
20885
|
-
eventAuthority: oftEventAuthority,
|
|
20886
|
-
program: PROGRAM_ID,
|
|
20887
|
-
anchorRemainingAccounts: remainingAccounts
|
|
20857
|
+
nativeFee: new BN2(nativeFee.toString()),
|
|
20858
|
+
lzTokenFee: new BN2(lzTokenFee.toString())
|
|
20888
20859
|
},
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
dstEid,
|
|
20892
|
-
to,
|
|
20893
|
-
amountLd: new BN6(amountLd.toString()),
|
|
20894
|
-
minAmountLd: new BN6(minAmountLd.toString()),
|
|
20895
|
-
options,
|
|
20896
|
-
composeMsg,
|
|
20897
|
-
nativeFee: new BN6(nativeFee.toString()),
|
|
20898
|
-
lzTokenFee: new BN6(lzTokenFee.toString())
|
|
20899
|
-
}
|
|
20900
|
-
}
|
|
20860
|
+
options,
|
|
20861
|
+
composeMsg
|
|
20901
20862
|
);
|
|
20902
20863
|
}
|
|
20903
|
-
async function createInitNonceIx(delegate, dstEid, oftInstance, remoteOappAddr) {
|
|
20904
|
-
const
|
|
20905
|
-
|
|
20906
|
-
PROGRAM_ID2
|
|
20907
|
-
);
|
|
20908
|
-
const [pendingNonce] = PublicKey.findProgramAddressSync(
|
|
20909
|
-
[
|
|
20910
|
-
Buffer.from(PENDING_NONCE_SEED2),
|
|
20911
|
-
oftInstance.toBuffer(),
|
|
20912
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4),
|
|
20913
|
-
remoteOappAddr
|
|
20914
|
-
],
|
|
20915
|
-
PROGRAM_ID2
|
|
20916
|
-
);
|
|
20917
|
-
const [oAppRegistry] = PublicKey.findProgramAddressSync(
|
|
20918
|
-
[Buffer.from(OAPP_SEED2, "utf-8"), oftInstance.toBuffer()],
|
|
20919
|
-
PROGRAM_ID2
|
|
20920
|
-
);
|
|
20921
|
-
return createInitNonceInstruction(
|
|
20922
|
-
{
|
|
20923
|
-
nonce,
|
|
20924
|
-
pendingInboundNonce: pendingNonce,
|
|
20925
|
-
oappRegistry: oAppRegistry,
|
|
20926
|
-
delegate
|
|
20927
|
-
},
|
|
20928
|
-
{
|
|
20929
|
-
params: {
|
|
20930
|
-
localOapp: oftInstance,
|
|
20931
|
-
remoteOapp: Array.from(remoteOappAddr),
|
|
20932
|
-
remoteEid: dstEid
|
|
20933
|
-
}
|
|
20934
|
-
},
|
|
20935
|
-
PROGRAM_ID2
|
|
20936
|
-
);
|
|
20864
|
+
async function createInitNonceIx(delegate, dstEid, oftInstance, remoteOappAddr, endpointProgram = PROGRAM_ID2) {
|
|
20865
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
20866
|
+
return endpoint.initOAppNonceWithoutChecks(delegate, dstEid, oftInstance, remoteOappAddr);
|
|
20937
20867
|
}
|
|
20938
|
-
async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null) {
|
|
20939
|
-
const
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
const [peer] = PublicKey.findProgramAddressSync(
|
|
20944
|
-
[Buffer.from(PEER_SEED2, "utf-8"), oftInstance.toBuffer(), new BN6(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20945
|
-
PROGRAM_ID
|
|
20946
|
-
);
|
|
20947
|
-
const ix = createQuoteOftInstruction(
|
|
20868
|
+
async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null, tokenProgram = TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, endpointProgram = PROGRAM_ID2) {
|
|
20869
|
+
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20870
|
+
const oftInstance = oft.getOftConfig();
|
|
20871
|
+
const [peer] = oft.deriver.peer(oftInstance, dstEid);
|
|
20872
|
+
const ix = instructions_exports.createQuoteOftInstruction(
|
|
20948
20873
|
{
|
|
20949
20874
|
oftConfig: oftInstance,
|
|
20950
20875
|
peer,
|
|
@@ -20954,8 +20879,8 @@ async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmoun
|
|
|
20954
20879
|
params: {
|
|
20955
20880
|
dstEid,
|
|
20956
20881
|
to,
|
|
20957
|
-
amountLd: new
|
|
20958
|
-
minAmountLd: new
|
|
20882
|
+
amountLd: new BN2(amountLd.toString()),
|
|
20883
|
+
minAmountLd: new BN2(minAmountLd.toString()),
|
|
20959
20884
|
options,
|
|
20960
20885
|
payInLzToken,
|
|
20961
20886
|
composeMsg
|
|
@@ -20963,45 +20888,18 @@ async function quoteOft(connection, payer, tokenMint, dstEid, amountLd, minAmoun
|
|
|
20963
20888
|
}
|
|
20964
20889
|
);
|
|
20965
20890
|
const returnedValues = await simulateTransaction(connection, [ix], ix.programId, payer, "confirmed");
|
|
20966
|
-
const
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
oftReceipt: {
|
|
20979
|
-
amountSentLd: oftReceipt.amountSentLd.toString(),
|
|
20980
|
-
amountReceivedLd: oftReceipt.amountReceivedLd.toString()
|
|
20981
|
-
}
|
|
20982
|
-
};
|
|
20983
|
-
}
|
|
20984
|
-
async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null) {
|
|
20985
|
-
const [oftInstance] = tokenEscrow === void 0 ? PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED2, "utf-8"), tokenMint.toBuffer()], PROGRAM_ID) : PublicKey.findProgramAddressSync([Buffer.from(OFT_SEED2, "utf-8"), tokenEscrow.toBuffer()], PROGRAM_ID);
|
|
20986
|
-
const [peer] = PublicKey.findProgramAddressSync(
|
|
20987
|
-
[Buffer.from(PEER_SEED2, "utf-8"), oftInstance.toBytes(), new BN6(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
20988
|
-
PROGRAM_ID
|
|
20989
|
-
);
|
|
20990
|
-
const peerinfo = await connection.getAccountInfo(peer);
|
|
20991
|
-
if (peerinfo === null) {
|
|
20992
|
-
throw new Error("Peer not found");
|
|
20993
|
-
}
|
|
20994
|
-
const peerAddress = peerinfo.data.subarray(8, 32 + 8);
|
|
20995
|
-
const [enforcedOptions] = PublicKey.findProgramAddressSync(
|
|
20996
|
-
[
|
|
20997
|
-
Buffer.from(ENFORCED_OPTIONS_SEED2, "utf-8"),
|
|
20998
|
-
oftInstance.toBuffer(),
|
|
20999
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4)
|
|
21000
|
-
],
|
|
21001
|
-
PROGRAM_ID
|
|
21002
|
-
);
|
|
21003
|
-
const messageLib = new Uln(PROGRAM_ID6);
|
|
21004
|
-
const endpoint = new Endpoint(PROGRAM_ID2);
|
|
20891
|
+
const [result] = types_exports.quoteOftResultBeet.deserialize(returnedValues, 0);
|
|
20892
|
+
return result;
|
|
20893
|
+
}
|
|
20894
|
+
async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minAmountLd, options, to, tokenEscrow = void 0, payInLzToken = false, composeMsg = null, tokenProgram = TOKEN_PROGRAM_ID, oftProgramId = PROGRAM_ID, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20895
|
+
const oft = new Oft(oftProgramId, endpointProgram, tokenProgram, tokenMint, tokenEscrow);
|
|
20896
|
+
const oftInstance = oft.getOftConfig();
|
|
20897
|
+
const [enforcedOptions] = oft.deriver.enforcedOptions(oftInstance, dstEid);
|
|
20898
|
+
const [peer] = oft.deriver.peer(oftInstance, dstEid);
|
|
20899
|
+
const peerInfo = await accounts_exports.Peer.fromAccountAddress(connection, peer);
|
|
20900
|
+
const peerAddress = peerInfo.address;
|
|
20901
|
+
const messageLib = new Uln(msgLibProgram);
|
|
20902
|
+
const endpoint = new Endpoint(endpointProgram);
|
|
21005
20903
|
const remainingAccounts = await endpoint.getQuoteIXAccountMetaForCPI(
|
|
21006
20904
|
connection,
|
|
21007
20905
|
payer,
|
|
@@ -21013,7 +20911,7 @@ async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minA
|
|
|
21013
20911
|
},
|
|
21014
20912
|
messageLib
|
|
21015
20913
|
);
|
|
21016
|
-
const ix = createQuoteInstruction(
|
|
20914
|
+
const ix = instructions_exports.createQuoteInstruction(
|
|
21017
20915
|
{
|
|
21018
20916
|
oftConfig: oftInstance,
|
|
21019
20917
|
peer,
|
|
@@ -21025,8 +20923,8 @@ async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minA
|
|
|
21025
20923
|
params: {
|
|
21026
20924
|
dstEid,
|
|
21027
20925
|
to,
|
|
21028
|
-
amountLd: new
|
|
21029
|
-
minAmountLd: new
|
|
20926
|
+
amountLd: new BN2(amountLd.toString()),
|
|
20927
|
+
minAmountLd: new BN2(minAmountLd.toString()),
|
|
21030
20928
|
options,
|
|
21031
20929
|
payInLzToken,
|
|
21032
20930
|
composeMsg
|
|
@@ -21037,11 +20935,11 @@ async function quoteWithUln(connection, payer, tokenMint, dstEid, amountLd, minA
|
|
|
21037
20935
|
units: 1e6
|
|
21038
20936
|
});
|
|
21039
20937
|
const buffer = await simulateTransaction(connection, [modifyComputeUnits, ix], ix.programId, payer, "confirmed");
|
|
21040
|
-
const fee =
|
|
20938
|
+
const fee = types_exports2.messagingFeeBeet.read(buffer, 0);
|
|
21041
20939
|
return { nativeFee: BigInt(fee.nativeFee.toString()), lzTokenFee: BigInt(fee.lzTokenFee.toString()) };
|
|
21042
20940
|
}
|
|
21043
|
-
async function createSetMintAuthorityIx(signer, oftInstance, newAuthority) {
|
|
21044
|
-
return createSetMintAuthorityInstruction(
|
|
20941
|
+
async function createSetMintAuthorityIx(signer, oftInstance, newAuthority, oftProgramId = PROGRAM_ID) {
|
|
20942
|
+
return instructions_exports.createSetMintAuthorityInstruction(
|
|
21045
20943
|
{
|
|
21046
20944
|
signer,
|
|
21047
20945
|
oftConfig: oftInstance
|
|
@@ -21051,40 +20949,22 @@ async function createSetMintAuthorityIx(signer, oftInstance, newAuthority) {
|
|
|
21051
20949
|
mintAuthority: newAuthority
|
|
21052
20950
|
}
|
|
21053
20951
|
},
|
|
21054
|
-
|
|
20952
|
+
oftProgramId
|
|
21055
20953
|
);
|
|
21056
20954
|
}
|
|
21057
|
-
async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
21058
|
-
const
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
);
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
);
|
|
21070
|
-
const [receiveLib] = PublicKey.findProgramAddressSync(
|
|
21071
|
-
[
|
|
21072
|
-
Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"),
|
|
21073
|
-
oftInstance.toBuffer(),
|
|
21074
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4)
|
|
21075
|
-
],
|
|
21076
|
-
PROGRAM_ID2
|
|
21077
|
-
);
|
|
21078
|
-
const [defaultReceiveLib] = PublicKey.findProgramAddressSync(
|
|
21079
|
-
[Buffer.from(RECEIVE_LIBRARY_CONFIG_SEED2, "utf-8"), new BN6(dstEid).toArrayLike(Buffer, "be", 4)],
|
|
21080
|
-
PROGRAM_ID2
|
|
21081
|
-
);
|
|
21082
|
-
const [ulnSettings] = PublicKey.findProgramAddressSync([Buffer.from(ULN_SEED2, "utf-8")], PROGRAM_ID6);
|
|
21083
|
-
let sendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, sendLib);
|
|
21084
|
-
let receiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, receiveLib);
|
|
21085
|
-
const defaultSendLibraryConfig = await accounts_exports.SendLibraryConfig.fromAccountAddress(connection, defaultSendLib);
|
|
21086
|
-
const defaultReceiveLibraryConfig = await accounts_exports.ReceiveLibraryConfig.fromAccountAddress(connection, defaultReceiveLib);
|
|
21087
|
-
const nil64 = new BN6("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "hex");
|
|
20955
|
+
async function getEndpointConfig(connection, oftInstance, dstEid, msgLibProgram = PROGRAM_ID6, endpointProgram = PROGRAM_ID2) {
|
|
20956
|
+
const endpointDeriver = new EndpointPDADeriver(endpointProgram);
|
|
20957
|
+
const ulnDeriver = new UlnPDADeriver(msgLibProgram);
|
|
20958
|
+
const [sendLib] = endpointDeriver.sendLibraryConfig(oftInstance, dstEid);
|
|
20959
|
+
const [defaultSendLib] = endpointDeriver.defaultSendLibraryConfig(dstEid);
|
|
20960
|
+
const [receiveLib] = endpointDeriver.receiveLibraryConfig(oftInstance, dstEid);
|
|
20961
|
+
const [defaultReceiveLib] = endpointDeriver.defaultReceiveLibraryConfig(dstEid);
|
|
20962
|
+
const [msgLib] = ulnDeriver.messageLib();
|
|
20963
|
+
let sendLibraryConfig = await accounts_exports2.SendLibraryConfig.fromAccountAddress(connection, sendLib);
|
|
20964
|
+
let receiveLibraryConfig = await accounts_exports2.ReceiveLibraryConfig.fromAccountAddress(connection, receiveLib);
|
|
20965
|
+
const defaultSendLibraryConfig = await accounts_exports2.SendLibraryConfig.fromAccountAddress(connection, defaultSendLib);
|
|
20966
|
+
const defaultReceiveLibraryConfig = await accounts_exports2.ReceiveLibraryConfig.fromAccountAddress(connection, defaultReceiveLib);
|
|
20967
|
+
const nil64 = new BN2("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "hex");
|
|
21088
20968
|
const nil8 = 255;
|
|
21089
20969
|
if (sendLibraryConfig.messageLib.equals(PublicKey.default)) {
|
|
21090
20970
|
sendLibraryConfig = defaultSendLibraryConfig;
|
|
@@ -21092,25 +20972,15 @@ async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
|
21092
20972
|
if (receiveLibraryConfig.messageLib.equals(PublicKey.default)) {
|
|
21093
20973
|
receiveLibraryConfig = defaultReceiveLibraryConfig;
|
|
21094
20974
|
}
|
|
21095
|
-
if (sendLibraryConfig.messageLib.equals(
|
|
21096
|
-
const [ulnDefaultSendConfigPDA] =
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
const [ulnSendConfigPDA] = PublicKey.findProgramAddressSync(
|
|
21101
|
-
[
|
|
21102
|
-
Buffer.from(SEND_CONFIG_SEED2, "utf-8"),
|
|
21103
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4),
|
|
21104
|
-
oftInstance.toBuffer()
|
|
21105
|
-
],
|
|
21106
|
-
PROGRAM_ID6
|
|
21107
|
-
);
|
|
21108
|
-
const ulnSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(connection, ulnSendConfigPDA);
|
|
21109
|
-
const ulnDefaultSendConfig = await accounts_exports5.SendConfig.fromAccountAddress(
|
|
20975
|
+
if (sendLibraryConfig.messageLib.equals(msgLib)) {
|
|
20976
|
+
const [ulnDefaultSendConfigPDA] = ulnDeriver.defaultSendConfig(dstEid);
|
|
20977
|
+
const [ulnSendConfigPDA] = ulnDeriver.sendConfig(dstEid, oftInstance);
|
|
20978
|
+
const ulnSendConfig = await accounts_exports6.SendConfig.fromAccountAddress(connection, ulnSendConfigPDA);
|
|
20979
|
+
const ulnDefaultSendConfig = await accounts_exports6.SendConfig.fromAccountAddress(
|
|
21110
20980
|
connection,
|
|
21111
20981
|
ulnDefaultSendConfigPDA
|
|
21112
20982
|
);
|
|
21113
|
-
if (nil64.eq(new
|
|
20983
|
+
if (nil64.eq(new BN2(ulnSendConfig.uln.confirmations.toString()))) {
|
|
21114
20984
|
ulnSendConfig.uln.confirmations = 0;
|
|
21115
20985
|
} else if (ulnSendConfig.uln.confirmations == 0) {
|
|
21116
20986
|
ulnSendConfig.uln.confirmations = ulnDefaultSendConfig.uln.confirmations;
|
|
@@ -21131,25 +21001,15 @@ async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
|
21131
21001
|
}
|
|
21132
21002
|
sendLibraryConfig.ulnSendConfig = ulnSendConfig;
|
|
21133
21003
|
}
|
|
21134
|
-
if (receiveLibraryConfig.messageLib.equals(
|
|
21135
|
-
const [ulnDefaultReceiveConfigPDA] =
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
const [ulnReceiveConfigPDA] = PublicKey.findProgramAddressSync(
|
|
21140
|
-
[
|
|
21141
|
-
Buffer.from(SEND_CONFIG_SEED2, "utf-8"),
|
|
21142
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4),
|
|
21143
|
-
oftInstance.toBuffer()
|
|
21144
|
-
],
|
|
21145
|
-
PROGRAM_ID6
|
|
21146
|
-
);
|
|
21147
|
-
const ulnReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(connection, ulnReceiveConfigPDA);
|
|
21148
|
-
const ulnDefaultReceiveConfig = await accounts_exports5.ReceiveConfig.fromAccountAddress(
|
|
21004
|
+
if (receiveLibraryConfig.messageLib.equals(msgLib)) {
|
|
21005
|
+
const [ulnDefaultReceiveConfigPDA] = ulnDeriver.defaultReceiveConfig(dstEid);
|
|
21006
|
+
const [ulnReceiveConfigPDA] = ulnDeriver.receiveConfig(dstEid, oftInstance);
|
|
21007
|
+
const ulnReceiveConfig = await accounts_exports6.ReceiveConfig.fromAccountAddress(connection, ulnReceiveConfigPDA);
|
|
21008
|
+
const ulnDefaultReceiveConfig = await accounts_exports6.ReceiveConfig.fromAccountAddress(
|
|
21149
21009
|
connection,
|
|
21150
21010
|
ulnDefaultReceiveConfigPDA
|
|
21151
21011
|
);
|
|
21152
|
-
if (nil64.eq(new
|
|
21012
|
+
if (nil64.eq(new BN2(ulnReceiveConfig.uln.confirmations.toString()))) {
|
|
21153
21013
|
ulnReceiveConfig.uln.confirmations = 0;
|
|
21154
21014
|
} else if (ulnReceiveConfig.uln.confirmations == 0) {
|
|
21155
21015
|
ulnReceiveConfig.uln.confirmations = ulnDefaultReceiveConfig.uln.confirmations;
|
|
@@ -21175,33 +21035,19 @@ async function getEndpointConfig(connection, oftInstance, dstEid) {
|
|
|
21175
21035
|
receiveLibraryConfig
|
|
21176
21036
|
};
|
|
21177
21037
|
}
|
|
21178
|
-
async function getPeerAddress(connection, oftInstance, dstEid) {
|
|
21179
|
-
const [peer] =
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
);
|
|
21183
|
-
const peerinfo = await connection.getAccountInfo(peer);
|
|
21184
|
-
return hexlify(peerinfo.data.subarray(8, 32 + 8));
|
|
21038
|
+
async function getPeerAddress(connection, oftInstance, dstEid, oftProgramId = PROGRAM_ID) {
|
|
21039
|
+
const [peer] = new OftPDADeriver(oftProgramId).peer(oftInstance, dstEid);
|
|
21040
|
+
const peerInfo = await accounts_exports.Peer.fromAccountAddress(connection, peer);
|
|
21041
|
+
return hexlify(peerInfo.address);
|
|
21185
21042
|
}
|
|
21186
|
-
async function getDelegate(connection, oftInstance) {
|
|
21187
|
-
const [oAppRegistry] =
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
async function getEnforcedOptions(connection, oftInstance, dstEid) {
|
|
21195
|
-
const [enforcedOptions] = PublicKey.findProgramAddressSync(
|
|
21196
|
-
[
|
|
21197
|
-
Buffer.from(ENFORCED_OPTIONS_SEED2, "utf-8"),
|
|
21198
|
-
oftInstance.toBuffer(),
|
|
21199
|
-
new BN6(dstEid).toArrayLike(Buffer, "be", 4)
|
|
21200
|
-
],
|
|
21201
|
-
PROGRAM_ID
|
|
21202
|
-
);
|
|
21203
|
-
const enforcedOptionsInfo = await connection.getAccountInfo(enforcedOptions);
|
|
21204
|
-
return enforcedOptionsBeet.deserialize(enforcedOptionsInfo.data);
|
|
21043
|
+
async function getDelegate(connection, oftInstance, endpointProgram = PROGRAM_ID2) {
|
|
21044
|
+
const [oAppRegistry] = new EndpointPDADeriver(endpointProgram).oappRegistry(oftInstance);
|
|
21045
|
+
const oAppRegistryInfo = await accounts_exports2.OAppRegistry.fromAccountAddress(connection, oAppRegistry);
|
|
21046
|
+
return oAppRegistryInfo.delegate;
|
|
21047
|
+
}
|
|
21048
|
+
async function getEnforcedOptions(connection, oftInstance, dstEid, oftProgramId = PROGRAM_ID) {
|
|
21049
|
+
const [enforcedOptions] = new OftPDADeriver(oftProgramId).enforcedOptions(oftInstance, dstEid);
|
|
21050
|
+
return accounts_exports.EnforcedOptions.fromAccountAddress(connection, enforcedOptions);
|
|
21205
21051
|
}
|
|
21206
21052
|
var idlTypes = [
|
|
21207
21053
|
"MessageLibQuoteParams",
|
|
@@ -22831,13 +22677,13 @@ var types = [
|
|
|
22831
22677
|
var IdlTypes = {
|
|
22832
22678
|
endpoint: types
|
|
22833
22679
|
};
|
|
22834
|
-
var SetConfigType2 = /* @__PURE__ */ ((
|
|
22835
|
-
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
return
|
|
22680
|
+
var SetConfigType2 = /* @__PURE__ */ ((SetConfigType4) => {
|
|
22681
|
+
SetConfigType4[SetConfigType4["EXECUTOR"] = 1] = "EXECUTOR";
|
|
22682
|
+
SetConfigType4[SetConfigType4["SEND_ULN"] = 2] = "SEND_ULN";
|
|
22683
|
+
SetConfigType4[SetConfigType4["RECEIVE_ULN"] = 3] = "RECEIVE_ULN";
|
|
22684
|
+
return SetConfigType4;
|
|
22839
22685
|
})(SetConfigType2 || {});
|
|
22840
22686
|
|
|
22841
|
-
export { AddressType, BaseOApp, blocked_messagelib_exports as BlockedMessageLibProgram, COMPOSED_MESSAGE_HASH_SEED, CONFIRMATIONS_SEED, COUNT_SEED, DVNDeriver, dvn_exports2 as DVNProgram, DVN_CONFIG_SEED, dvn_exports as DvnProgram, ENDPOINT_SEED, ENFORCED_OPTIONS_SEED, EVENT_SEED, EXECUTOR_CONFIG_SEED, EndpointPDADeriver, endpoint_exports as EndpointProgram, EventPDADeriver, ExecutorOptionType, ExecutorPDADeriver, executor_exports as ExecutorProgram, FAUCET_URL, IdlTypes, LZ_COMPOSE_TYPES_SEED, LZ_RECEIVE_TYPES_SEED, LzComposeParamsBeet, LzReceiveAccountBeet, LzReceiveParamsBeet, MESSAGE_LIB_SEED, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDADeriver, MessageType, NONCE_SEED, OAPP_SEED, OAppBasePDADeriver, OFT_SEED, OPTIONS_SEED, oft_exports as
|
|
22687
|
+
export { AddressType, BaseOApp, blocked_messagelib_exports as BlockedMessageLibProgram, COMPOSED_MESSAGE_HASH_SEED, CONFIRMATIONS_SEED, COUNT_SEED, DVNDeriver, dvn_exports2 as DVNProgram, DVN_CONFIG_SEED, dvn_exports as DvnProgram, ENDPOINT_SEED, ENFORCED_OPTIONS_SEED, EVENT_SEED, EXECUTOR_CONFIG_SEED, EndpointPDADeriver, endpoint_exports as EndpointProgram, EventPDADeriver, ExecutorOptionType, ExecutorPDADeriver, executor_exports as ExecutorProgram, FAUCET_URL, IdlTypes, LZ_COMPOSE_TYPES_SEED, LZ_RECEIVE_TYPES_SEED, LzComposeParamsBeet, LzReceiveAccountBeet, LzReceiveParamsBeet, MESSAGE_LIB_SEED, MINT_SEED, MSG_TYPE_OFFSET, MaxExecutorOptionTypeLength, MessageLibPDADeriver, MessageType, NONCE_SEED, OAPP_SEED, OAppBasePDADeriver, OFT_SEED, OPTIONS_SEED, OftPDADeriver, oft_exports as OftProgram, oft_tools_exports as OftTools, OmniCounterPDADeriver, PAYLOAD_HASH_SEED, PEER_SEED, PENDING_NONCE_SEED, PRICE_FEED_SEED, PriceFeedPDADeriver, pricefeed_exports as PriceFeedProgram, RECEIVE_CONFIG_SEED, RECEIVE_LIBRARY_CONFIG_SEED, REMOTE_SEED, SEND_CONFIG_SEED, SEND_LIBRARY_CONFIG_SEED, SetConfigType2 as SetConfigType, simple_message_lib_exports as SimpleMessageLibProgram, ULN_CONFIG_SEED, ULN_SEED, UlnPDADeriver, uln_exports as UlnProgram, WORKER_SEED, buildMessageV0, buildVersionedTransaction, closeLookupTable, createNonceAccountTX, deactivateLookupTable, deriveLzComposeTypesAccountsPDA, deriveLzReceiveTypesAccountsPDA, extractComposeDeliveredEventByTxHash, extractComposeSentEventByTxHash, extractEventFromTransactionSignature, extractReceivedPacketEventByTxHash, extractSentPacketEventByTxHash, extractVerifiedPacketEventByTxHash, extractWorkerFeePaidEventByTxHash, generateAddressLookupTable, getBlockedMessageLibProgramId, getDVNProgramId, getEndpointProgramId, getExecutorProgramId, getLzComposeAccountMeta, getLzReceiveAccounts, getPricefeedProgramId, getProgramKeypair, getSimpleMessageLibProgramId, getULNProgramId, idlTypes, instructionDiscriminator, isAccountInitialized, lzCompose, lzReceive, messageLibs, oappIDPDA, simulateTransaction, txWithAddressLookupTable, txWithNonce };
|
|
22842
22688
|
//# sourceMappingURL=out.js.map
|
|
22843
22689
|
//# sourceMappingURL=index.mjs.map
|