@layerzerolabs/lz-solana-sdk-v2 3.0.47 → 3.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +11 -10
- package/src/base-oapp.ts +159 -0
- package/src/config.ts +32 -0
- package/src/deployment.test.ts +11 -0
- package/src/deployment.ts +128 -0
- package/src/dvn.ts +606 -0
- package/src/endpoint.ts +1518 -0
- package/src/executor.ts +577 -0
- package/src/generated/blocked_messagelib/index.ts +18 -0
- package/src/generated/blocked_messagelib/instructions/index.ts +1 -0
- package/src/generated/blocked_messagelib/instructions/version.ts +59 -0
- package/src/generated/dvn/accounts/DvnConfig.ts +217 -0
- package/src/generated/dvn/accounts/ExecuteHash.ts +179 -0
- package/src/generated/dvn/accounts/ReceiveConfig.ts +169 -0
- package/src/generated/dvn/accounts/index.ts +9 -0
- package/src/generated/dvn/errors/index.ts +396 -0
- package/src/generated/dvn/events/AdminConfigSetEvent.ts +22 -0
- package/src/generated/dvn/events/FeeWithdrawnEvent.ts +26 -0
- package/src/generated/dvn/events/MultisigConfigSetEvent.ts +22 -0
- package/src/generated/dvn/events/index.ts +3 -0
- package/src/generated/dvn/index.ts +21 -0
- package/src/generated/dvn/instructions/closeExecute.ts +148 -0
- package/src/generated/dvn/instructions/index.ts +7 -0
- package/src/generated/dvn/instructions/initDvn.ts +144 -0
- package/src/generated/dvn/instructions/invoke.ts +178 -0
- package/src/generated/dvn/instructions/quoteDvn.ts +145 -0
- package/src/generated/dvn/instructions/setConfig.ts +157 -0
- package/src/generated/dvn/instructions/verifiable.ts +160 -0
- package/src/generated/dvn/instructions/withdrawFee.ts +172 -0
- package/src/generated/dvn/types/Acl.ts +26 -0
- package/src/generated/dvn/types/AdminConfig.ts +100 -0
- package/src/generated/dvn/types/CloseExecuteParams.ts +21 -0
- package/src/generated/dvn/types/DstConfig.ts +28 -0
- package/src/generated/dvn/types/ExecuteTransactionDigest.ts +37 -0
- package/src/generated/dvn/types/InitDvnParams.ts +34 -0
- package/src/generated/dvn/types/InvokeParams.ts +28 -0
- package/src/generated/dvn/types/LzOption.ts +24 -0
- package/src/generated/dvn/types/Multisig.ts +24 -0
- package/src/generated/dvn/types/MultisigConfig.ts +124 -0
- package/src/generated/dvn/types/QuoteDvnParams.ts +38 -0
- package/src/generated/dvn/types/SetConfigParams.ts +22 -0
- package/src/generated/dvn/types/TransactionAccount.ts +29 -0
- package/src/generated/dvn/types/UlnConfig.ts +34 -0
- package/src/generated/dvn/types/VerifiableParams.ts +24 -0
- package/src/generated/dvn/types/VerificationState.ts +27 -0
- package/src/generated/dvn/types/WithdrawFeeParams.ts +20 -0
- package/src/generated/dvn/types/index.ts +17 -0
- package/src/generated/endpoint/accounts/ComposeMessageState.ts +170 -0
- package/src/generated/endpoint/accounts/EndpointSettings.ts +184 -0
- package/src/generated/endpoint/accounts/MessageLibInfo.ts +178 -0
- package/src/generated/endpoint/accounts/Nonce.ts +193 -0
- package/src/generated/endpoint/accounts/OAppRegistry.ts +169 -0
- package/src/generated/endpoint/accounts/PayloadHash.ts +169 -0
- package/src/generated/endpoint/accounts/PendingInboundNonce.ts +172 -0
- package/src/generated/endpoint/accounts/ReceiveLibraryConfig.ts +183 -0
- package/src/generated/endpoint/accounts/SendLibraryConfig.ts +171 -0
- package/src/generated/endpoint/accounts/index.ts +31 -0
- package/src/generated/endpoint/errors/index.ts +428 -0
- package/src/generated/endpoint/events/AdminTransferredEvent.ts +23 -0
- package/src/generated/endpoint/events/ComposeDeliveredEvent.ts +31 -0
- package/src/generated/endpoint/events/ComposeSentEvent.ts +33 -0
- package/src/generated/endpoint/events/DefaultReceiveLibrarySetEvent.ts +27 -0
- package/src/generated/endpoint/events/DefaultReceiveLibraryTimeoutSetEvent.ts +29 -0
- package/src/generated/endpoint/events/DefaultSendLibrarySetEvent.ts +27 -0
- package/src/generated/endpoint/events/DelegateSetEvent.ts +22 -0
- package/src/generated/endpoint/events/InboundNonceSkippedEvent.ts +31 -0
- package/src/generated/endpoint/events/LibraryRegisteredEvent.ts +27 -0
- package/src/generated/endpoint/events/LzComposeAlertEvent.ts +43 -0
- package/src/generated/endpoint/events/LzReceiveAlertEvent.ts +45 -0
- package/src/generated/endpoint/events/LzTokenSetEvent.ts +23 -0
- package/src/generated/endpoint/events/OAppRegisteredEvent.ts +27 -0
- package/src/generated/endpoint/events/PacketBurntEvent.ts +32 -0
- package/src/generated/endpoint/events/PacketDeliveredEvent.ts +31 -0
- package/src/generated/endpoint/events/PacketNilifiedEvent.ts +33 -0
- package/src/generated/endpoint/events/PacketSentEvent.ts +29 -0
- package/src/generated/endpoint/events/PacketVerifiedEvent.ts +33 -0
- package/src/generated/endpoint/events/ReceiveLibrarySetEvent.ts +29 -0
- package/src/generated/endpoint/events/ReceiveLibraryTimeoutSetEvent.ts +33 -0
- package/src/generated/endpoint/events/RentWithdrawnEvent.ts +27 -0
- package/src/generated/endpoint/events/SendLibrarySetEvent.ts +29 -0
- package/src/generated/endpoint/events/index.ts +22 -0
- package/src/generated/endpoint/index.ts +21 -0
- package/src/generated/endpoint/instructions/burn.ts +191 -0
- package/src/generated/endpoint/instructions/clear.ts +193 -0
- package/src/generated/endpoint/instructions/clearCompose.ts +160 -0
- package/src/generated/endpoint/instructions/index.ts +32 -0
- package/src/generated/endpoint/instructions/initConfig.ts +172 -0
- package/src/generated/endpoint/instructions/initDefaultReceiveLibrary.ts +195 -0
- package/src/generated/endpoint/instructions/initDefaultSendLibrary.ts +195 -0
- package/src/generated/endpoint/instructions/initEndpoint.ts +147 -0
- package/src/generated/endpoint/instructions/initNonce.ts +168 -0
- package/src/generated/endpoint/instructions/initReceiveLibrary.ts +159 -0
- package/src/generated/endpoint/instructions/initSendLibrary.ts +159 -0
- package/src/generated/endpoint/instructions/initVerify.ts +159 -0
- package/src/generated/endpoint/instructions/lzComposeAlert.ts +148 -0
- package/src/generated/endpoint/instructions/lzReceiveAlert.ts +148 -0
- package/src/generated/endpoint/instructions/nilify.ts +193 -0
- package/src/generated/endpoint/instructions/quote.ts +181 -0
- package/src/generated/endpoint/instructions/registerLibrary.ts +183 -0
- package/src/generated/endpoint/instructions/registerOapp.ts +183 -0
- package/src/generated/endpoint/instructions/send.ts +215 -0
- package/src/generated/endpoint/instructions/sendCompose.ts +183 -0
- package/src/generated/endpoint/instructions/setConfig.ts +169 -0
- package/src/generated/endpoint/instructions/setDefaultReceiveLibrary.ts +184 -0
- package/src/generated/endpoint/instructions/setDefaultReceiveLibraryTimeout.ts +185 -0
- package/src/generated/endpoint/instructions/setDefaultSendLibrary.ts +184 -0
- package/src/generated/endpoint/instructions/setDelegate.ts +160 -0
- package/src/generated/endpoint/instructions/setLzToken.ts +160 -0
- package/src/generated/endpoint/instructions/setReceiveLibrary.ts +190 -0
- package/src/generated/endpoint/instructions/setReceiveLibraryTimeout.ts +184 -0
- package/src/generated/endpoint/instructions/setSendLibrary.ts +190 -0
- package/src/generated/endpoint/instructions/skip.ts +203 -0
- package/src/generated/endpoint/instructions/transferAdmin.ts +160 -0
- package/src/generated/endpoint/instructions/verify.ts +205 -0
- package/src/generated/endpoint/instructions/withdrawRent.ts +172 -0
- package/src/generated/endpoint/types/BurnParams.ts +32 -0
- package/src/generated/endpoint/types/ClearComposeParams.ts +31 -0
- package/src/generated/endpoint/types/ClearParams.ts +34 -0
- package/src/generated/endpoint/types/InitConfigParams.ts +26 -0
- package/src/generated/endpoint/types/InitDefaultReceiveLibraryParams.ts +27 -0
- package/src/generated/endpoint/types/InitDefaultSendLibraryParams.ts +27 -0
- package/src/generated/endpoint/types/InitEndpointParams.ts +27 -0
- package/src/generated/endpoint/types/InitNonceParams.ts +28 -0
- package/src/generated/endpoint/types/InitReceiveLibraryParams.ts +27 -0
- package/src/generated/endpoint/types/InitSendLibraryParams.ts +27 -0
- package/src/generated/endpoint/types/InitVerifyParams.ts +30 -0
- package/src/generated/endpoint/types/LzComposeAlertParams.ts +41 -0
- package/src/generated/endpoint/types/LzReceiveAlertParams.ts +43 -0
- package/src/generated/endpoint/types/MessageLibType.ts +25 -0
- package/src/generated/endpoint/types/MessagingFee.ts +24 -0
- package/src/generated/endpoint/types/MessagingReceipt.ts +27 -0
- package/src/generated/endpoint/types/NilifyParams.ts +32 -0
- package/src/generated/endpoint/types/QuoteParams.ts +34 -0
- package/src/generated/endpoint/types/ReceiveLibraryTimeout.ts +27 -0
- package/src/generated/endpoint/types/RegisterLibraryParams.ts +28 -0
- package/src/generated/endpoint/types/RegisterOAppParams.ts +23 -0
- package/src/generated/endpoint/types/SendComposeParams.ts +31 -0
- package/src/generated/endpoint/types/SendParams.ts +32 -0
- package/src/generated/endpoint/types/SetConfigParams.ts +31 -0
- package/src/generated/endpoint/types/SetDefaultReceiveLibraryParams.ts +29 -0
- package/src/generated/endpoint/types/SetDefaultReceiveLibraryTimeoutParams.ts +29 -0
- package/src/generated/endpoint/types/SetDefaultSendLibraryParams.ts +27 -0
- package/src/generated/endpoint/types/SetDelegateParams.ts +22 -0
- package/src/generated/endpoint/types/SetLzTokenParams.ts +23 -0
- package/src/generated/endpoint/types/SetReceiveLibraryParams.ts +31 -0
- package/src/generated/endpoint/types/SetReceiveLibraryTimeoutParams.ts +31 -0
- package/src/generated/endpoint/types/SetSendLibraryParams.ts +29 -0
- package/src/generated/endpoint/types/SkipParams.ts +30 -0
- package/src/generated/endpoint/types/TransferAdminParams.ts +23 -0
- package/src/generated/endpoint/types/VerifyParams.ts +32 -0
- package/src/generated/endpoint/types/WithdrawRentParams.ts +21 -0
- package/src/generated/endpoint/types/index.ts +36 -0
- package/src/generated/executor/accounts/ExecutorConfig.ts +216 -0
- package/src/generated/executor/accounts/Nonce.ts +193 -0
- package/src/generated/executor/accounts/index.ts +7 -0
- package/src/generated/executor/errors/index.ts +434 -0
- package/src/generated/executor/events/NativeDropAppliedEvent.ts +38 -0
- package/src/generated/executor/events/index.ts +1 -0
- package/src/generated/executor/index.ts +21 -0
- package/src/generated/executor/instructions/adminSetConfig.ts +136 -0
- package/src/generated/executor/instructions/compose.ts +181 -0
- package/src/generated/executor/instructions/executable.ts +136 -0
- package/src/generated/executor/instructions/execute.ts +181 -0
- package/src/generated/executor/instructions/index.ts +8 -0
- package/src/generated/executor/instructions/initExecutor.ts +147 -0
- package/src/generated/executor/instructions/nativeDrop.ts +171 -0
- package/src/generated/executor/instructions/ownerSetConfig.ts +136 -0
- package/src/generated/executor/instructions/quoteExecutor.ts +148 -0
- package/src/generated/executor/types/Acl.ts +26 -0
- package/src/generated/executor/types/AdminSetConfigParams.ts +83 -0
- package/src/generated/executor/types/ComposeParams.ts +27 -0
- package/src/generated/executor/types/DstConfig.ts +32 -0
- package/src/generated/executor/types/ExecutableParams.ts +30 -0
- package/src/generated/executor/types/ExecuteParams.ts +31 -0
- package/src/generated/executor/types/ExecutionState.ts +26 -0
- package/src/generated/executor/types/InitExecutorParams.ts +33 -0
- package/src/generated/executor/types/LzComposeParams.ts +35 -0
- package/src/generated/executor/types/LzOption.ts +24 -0
- package/src/generated/executor/types/LzReceiveParams.ts +33 -0
- package/src/generated/executor/types/NativeDropParams.ts +36 -0
- package/src/generated/executor/types/NativeDropRequest.ts +26 -0
- package/src/generated/executor/types/OwnerSetConfigParams.ts +123 -0
- package/src/generated/executor/types/QuoteExecutorParams.ts +34 -0
- package/src/generated/executor/types/index.ts +15 -0
- package/src/generated/pricefeed/accounts/PriceFeed.ts +220 -0
- package/src/generated/pricefeed/accounts/index.ts +5 -0
- package/src/generated/pricefeed/errors/index.ts +115 -0
- package/src/generated/pricefeed/index.ts +21 -0
- package/src/generated/pricefeed/instructions/getFee.ts +121 -0
- package/src/generated/pricefeed/instructions/index.ts +6 -0
- package/src/generated/pricefeed/instructions/initPriceFeed.ts +147 -0
- package/src/generated/pricefeed/instructions/setPrice.ts +133 -0
- package/src/generated/pricefeed/instructions/setPriceFeed.ts +136 -0
- package/src/generated/pricefeed/instructions/setSolPrice.ts +136 -0
- package/src/generated/pricefeed/instructions/transferAdmin.ts +136 -0
- package/src/generated/pricefeed/types/GetFeeParams.ts +26 -0
- package/src/generated/pricefeed/types/InitPriceFeedParams.ts +27 -0
- package/src/generated/pricefeed/types/ModelType.ts +66 -0
- package/src/generated/pricefeed/types/Price.ts +31 -0
- package/src/generated/pricefeed/types/PriceParams.ts +29 -0
- package/src/generated/pricefeed/types/SetPriceFeedParams.ts +29 -0
- package/src/generated/pricefeed/types/SetPriceParams.ts +26 -0
- package/src/generated/pricefeed/types/SetSolPriceParams.ts +21 -0
- package/src/generated/pricefeed/types/TransferAdminParams.ts +23 -0
- package/src/generated/pricefeed/types/index.ts +9 -0
- package/src/generated/simple_messagelib/accounts/MessageLib.ts +222 -0
- package/src/generated/simple_messagelib/accounts/ReceiveConfigStore.ts +168 -0
- package/src/generated/simple_messagelib/accounts/SendConfigStore.ts +170 -0
- package/src/generated/simple_messagelib/accounts/index.ts +13 -0
- package/src/generated/simple_messagelib/errors/index.ts +207 -0
- package/src/generated/simple_messagelib/index.ts +21 -0
- package/src/generated/simple_messagelib/instructions/index.ts +15 -0
- package/src/generated/simple_messagelib/instructions/initConfig.ts +183 -0
- package/src/generated/simple_messagelib/instructions/initDefaultConfig.ts +171 -0
- package/src/generated/simple_messagelib/instructions/initMessageLib.ts +147 -0
- package/src/generated/simple_messagelib/instructions/quote.ts +133 -0
- package/src/generated/simple_messagelib/instructions/revertCall.ts +59 -0
- package/src/generated/simple_messagelib/instructions/send.ts +154 -0
- package/src/generated/simple_messagelib/instructions/sendWithLzToken.ts +207 -0
- package/src/generated/simple_messagelib/instructions/setConfig.ts +157 -0
- package/src/generated/simple_messagelib/instructions/setDefaultConfig.ts +171 -0
- package/src/generated/simple_messagelib/instructions/setFee.ts +133 -0
- package/src/generated/simple_messagelib/instructions/setWlCaller.ts +136 -0
- package/src/generated/simple_messagelib/instructions/transferAdmin.ts +136 -0
- package/src/generated/simple_messagelib/instructions/validatePacket.ts +136 -0
- package/src/generated/simple_messagelib/instructions/version.ts +59 -0
- package/src/generated/simple_messagelib/instructions/withdrawFees.ts +148 -0
- package/src/generated/simple_messagelib/types/InitConfigParams.ts +26 -0
- package/src/generated/simple_messagelib/types/InitDefaultConfigParams.ts +27 -0
- package/src/generated/simple_messagelib/types/InitMessageLibParams.ts +35 -0
- package/src/generated/simple_messagelib/types/MessagingFee.ts +24 -0
- package/src/generated/simple_messagelib/types/Packet.ts +36 -0
- package/src/generated/simple_messagelib/types/QuoteParams.ts +27 -0
- package/src/generated/simple_messagelib/types/SendParams.ts +27 -0
- package/src/generated/simple_messagelib/types/SendWithLzTokenParams.ts +34 -0
- package/src/generated/simple_messagelib/types/SetConfigParams.ts +31 -0
- package/src/generated/simple_messagelib/types/SetDefaultConfigParams.ts +27 -0
- package/src/generated/simple_messagelib/types/SetFeeParams.ts +24 -0
- package/src/generated/simple_messagelib/types/SetWlCallerParams.ts +22 -0
- package/src/generated/simple_messagelib/types/TransferAdminParams.ts +23 -0
- package/src/generated/simple_messagelib/types/ValidatePacketParams.ts +21 -0
- package/src/generated/simple_messagelib/types/Version.ts +26 -0
- package/src/generated/simple_messagelib/types/WithdrawFeesParams.ts +21 -0
- package/src/generated/simple_messagelib/types/index.ts +16 -0
- package/src/generated/uln/accounts/Confirmations.ts +171 -0
- package/src/generated/uln/accounts/ReceiveConfig.ts +169 -0
- package/src/generated/uln/accounts/SendConfig.ts +177 -0
- package/src/generated/uln/accounts/UlnSettings.ts +195 -0
- package/src/generated/uln/accounts/index.ts +16 -0
- package/src/generated/uln/errors/index.ts +761 -0
- package/src/generated/uln/events/AdminTransferredEvent.ts +23 -0
- package/src/generated/uln/events/ConfigSetEvent.ts +30 -0
- package/src/generated/uln/events/DefaultConfigSetEvent.ts +31 -0
- package/src/generated/uln/events/FeesPaidEvent.ts +28 -0
- package/src/generated/uln/events/LzTokenSetEvent.ts +23 -0
- package/src/generated/uln/events/PayloadVerifiedEvent.ts +31 -0
- package/src/generated/uln/events/RentWithdrawnEvent.ts +27 -0
- package/src/generated/uln/events/TreasuryFeeCapSetEvent.ts +21 -0
- package/src/generated/uln/events/TreasurySetEvent.ts +22 -0
- package/src/generated/uln/events/index.ts +7 -0
- package/src/generated/uln/index.ts +21 -0
- package/src/generated/uln/instructions/closeVerify.ts +148 -0
- package/src/generated/uln/instructions/commitVerification.ts +148 -0
- package/src/generated/uln/instructions/index.ts +16 -0
- package/src/generated/uln/instructions/initConfig.ts +183 -0
- package/src/generated/uln/instructions/initDefaultConfig.ts +195 -0
- package/src/generated/uln/instructions/initUln.ts +144 -0
- package/src/generated/uln/instructions/initVerify.ts +147 -0
- package/src/generated/uln/instructions/quote.ts +157 -0
- package/src/generated/uln/instructions/send.ts +220 -0
- package/src/generated/uln/instructions/sendWithLzToken.ts +255 -0
- package/src/generated/uln/instructions/setConfig.ts +205 -0
- package/src/generated/uln/instructions/setDefaultConfig.ts +184 -0
- package/src/generated/uln/instructions/setTreasury.ts +160 -0
- package/src/generated/uln/instructions/transferAdmin.ts +160 -0
- package/src/generated/uln/instructions/verify.ts +157 -0
- package/src/generated/uln/instructions/version.ts +59 -0
- package/src/generated/uln/instructions/withdrawRent.ts +172 -0
- package/src/generated/uln/types/CloseVerifyParams.ts +24 -0
- package/src/generated/uln/types/CommitVerificationParams.ts +25 -0
- package/src/generated/uln/types/Config.ts +75 -0
- package/src/generated/uln/types/ExecutorConfig.ts +26 -0
- package/src/generated/uln/types/InitConfigParams.ts +26 -0
- package/src/generated/uln/types/InitDefaultConfigParams.ts +31 -0
- package/src/generated/uln/types/InitUlnParams.ts +30 -0
- package/src/generated/uln/types/InitVerifyParams.ts +28 -0
- package/src/generated/uln/types/LzTokenTreasury.ts +26 -0
- package/src/generated/uln/types/MessagingFee.ts +24 -0
- package/src/generated/uln/types/Packet.ts +36 -0
- package/src/generated/uln/types/QuoteParams.ts +27 -0
- package/src/generated/uln/types/SendParams.ts +27 -0
- package/src/generated/uln/types/SendWithLzTokenParams.ts +34 -0
- package/src/generated/uln/types/SetConfigParams.ts +31 -0
- package/src/generated/uln/types/SetDefaultConfigParams.ts +31 -0
- package/src/generated/uln/types/SetTreasuryParams.ts +22 -0
- package/src/generated/uln/types/TransferAdminParams.ts +23 -0
- package/src/generated/uln/types/Treasury.ts +31 -0
- package/src/generated/uln/types/TreasuryFee.ts +28 -0
- package/src/generated/uln/types/UlnConfig.ts +34 -0
- package/src/generated/uln/types/VerifyParams.ts +26 -0
- package/src/generated/uln/types/Version.ts +26 -0
- package/src/generated/uln/types/WithdrawRentParams.ts +21 -0
- package/src/generated/uln/types/WorkerFee.ts +26 -0
- package/src/generated/uln/types/index.ts +25 -0
- package/src/generated/worker_interface/errors/index.ts +75 -0
- package/src/generated/worker_interface/index.ts +20 -0
- package/src/generated/worker_interface/instructions/index.ts +2 -0
- package/src/generated/worker_interface/instructions/quoteDvn.ts +145 -0
- package/src/generated/worker_interface/instructions/quoteExecutor.ts +148 -0
- package/src/generated/worker_interface/types/LzOption.ts +24 -0
- package/src/generated/worker_interface/types/QuoteDvnParams.ts +38 -0
- package/src/generated/worker_interface/types/QuoteExecutorParams.ts +34 -0
- package/src/generated/worker_interface/types/index.ts +3 -0
- package/src/index.ts +120 -0
- package/src/pda-deriver.ts +658 -0
- package/src/pricefeed.ts +208 -0
- package/src/recevie.ts +269 -0
- package/src/send-helper.ts +504 -0
- package/src/simple-message-lib.ts +303 -0
- package/src/types.ts +222 -0
- package/src/uln.ts +1045 -0
- package/src/utility.ts +592 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was GENERATED using the solita package.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
|
|
4
|
+
*
|
|
5
|
+
* See: https://github.com/metaplex-foundation/solita
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as beet from '@metaplex-foundation/beet'
|
|
9
|
+
import * as web3 from '@solana/web3.js'
|
|
10
|
+
import * as beetSolana from '@metaplex-foundation/beet-solana'
|
|
11
|
+
import { MessageLibType, messageLibTypeBeet } from '../types/MessageLibType'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Arguments used to create {@link MessageLibInfo}
|
|
15
|
+
* @category Accounts
|
|
16
|
+
* @category generated
|
|
17
|
+
*/
|
|
18
|
+
export type MessageLibInfoArgs = {
|
|
19
|
+
messageLibType: MessageLibType
|
|
20
|
+
bump: number
|
|
21
|
+
messageLibBump: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const messageLibInfoDiscriminator = [103, 102, 218, 28, 204, 135, 71, 14]
|
|
25
|
+
/**
|
|
26
|
+
* Holds the data for the {@link MessageLibInfo} Account and provides de/serialization
|
|
27
|
+
* functionality for that data
|
|
28
|
+
*
|
|
29
|
+
* @category Accounts
|
|
30
|
+
* @category generated
|
|
31
|
+
*/
|
|
32
|
+
export class MessageLibInfo implements MessageLibInfoArgs {
|
|
33
|
+
private constructor(
|
|
34
|
+
readonly messageLibType: MessageLibType,
|
|
35
|
+
readonly bump: number,
|
|
36
|
+
readonly messageLibBump: number
|
|
37
|
+
) {}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a {@link MessageLibInfo} instance from the provided args.
|
|
41
|
+
*/
|
|
42
|
+
static fromArgs(args: MessageLibInfoArgs) {
|
|
43
|
+
return new MessageLibInfo(
|
|
44
|
+
args.messageLibType,
|
|
45
|
+
args.bump,
|
|
46
|
+
args.messageLibBump
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Deserializes the {@link MessageLibInfo} from the data of the provided {@link web3.AccountInfo}.
|
|
52
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
53
|
+
*/
|
|
54
|
+
static fromAccountInfo(
|
|
55
|
+
accountInfo: web3.AccountInfo<Buffer>,
|
|
56
|
+
offset = 0
|
|
57
|
+
): [MessageLibInfo, number] {
|
|
58
|
+
return MessageLibInfo.deserialize(accountInfo.data, offset)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves the account info from the provided address and deserializes
|
|
63
|
+
* the {@link MessageLibInfo} from its data.
|
|
64
|
+
*
|
|
65
|
+
* @throws Error if no account info is found at the address or if deserialization fails
|
|
66
|
+
*/
|
|
67
|
+
static async fromAccountAddress(
|
|
68
|
+
connection: web3.Connection,
|
|
69
|
+
address: web3.PublicKey,
|
|
70
|
+
commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig
|
|
71
|
+
): Promise<MessageLibInfo> {
|
|
72
|
+
const accountInfo = await connection.getAccountInfo(
|
|
73
|
+
address,
|
|
74
|
+
commitmentOrConfig
|
|
75
|
+
)
|
|
76
|
+
if (accountInfo == null) {
|
|
77
|
+
throw new Error(`Unable to find MessageLibInfo account at ${address}`)
|
|
78
|
+
}
|
|
79
|
+
return MessageLibInfo.fromAccountInfo(accountInfo, 0)[0]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
84
|
+
* to fetch accounts matching filters that can be specified via that builder.
|
|
85
|
+
*
|
|
86
|
+
* @param programId - the program that owns the accounts we are filtering
|
|
87
|
+
*/
|
|
88
|
+
static gpaBuilder(
|
|
89
|
+
programId: web3.PublicKey = new web3.PublicKey(
|
|
90
|
+
'76y77prsiCMvXMjuoZ5VRrhG5qYBrUMYTE5WgHqgjEn6'
|
|
91
|
+
)
|
|
92
|
+
) {
|
|
93
|
+
return beetSolana.GpaBuilder.fromStruct(programId, messageLibInfoBeet)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Deserializes the {@link MessageLibInfo} from the provided data Buffer.
|
|
98
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
99
|
+
*/
|
|
100
|
+
static deserialize(buf: Buffer, offset = 0): [MessageLibInfo, number] {
|
|
101
|
+
return messageLibInfoBeet.deserialize(buf, offset)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Serializes the {@link MessageLibInfo} into a Buffer.
|
|
106
|
+
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
107
|
+
*/
|
|
108
|
+
serialize(): [Buffer, number] {
|
|
109
|
+
return messageLibInfoBeet.serialize({
|
|
110
|
+
accountDiscriminator: messageLibInfoDiscriminator,
|
|
111
|
+
...this,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
117
|
+
* {@link MessageLibInfo}
|
|
118
|
+
*/
|
|
119
|
+
static get byteSize() {
|
|
120
|
+
return messageLibInfoBeet.byteSize
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Fetches the minimum balance needed to exempt an account holding
|
|
125
|
+
* {@link MessageLibInfo} data from rent
|
|
126
|
+
*
|
|
127
|
+
* @param connection used to retrieve the rent exemption information
|
|
128
|
+
*/
|
|
129
|
+
static async getMinimumBalanceForRentExemption(
|
|
130
|
+
connection: web3.Connection,
|
|
131
|
+
commitment?: web3.Commitment
|
|
132
|
+
): Promise<number> {
|
|
133
|
+
return connection.getMinimumBalanceForRentExemption(
|
|
134
|
+
MessageLibInfo.byteSize,
|
|
135
|
+
commitment
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Determines if the provided {@link Buffer} has the correct byte size to
|
|
141
|
+
* hold {@link MessageLibInfo} data.
|
|
142
|
+
*/
|
|
143
|
+
static hasCorrectByteSize(buf: Buffer, offset = 0) {
|
|
144
|
+
return buf.byteLength - offset === MessageLibInfo.byteSize
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Returns a readable version of {@link MessageLibInfo} properties
|
|
149
|
+
* and can be used to convert to JSON and/or logging
|
|
150
|
+
*/
|
|
151
|
+
pretty() {
|
|
152
|
+
return {
|
|
153
|
+
messageLibType: 'MessageLibType.' + MessageLibType[this.messageLibType],
|
|
154
|
+
bump: this.bump,
|
|
155
|
+
messageLibBump: this.messageLibBump,
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @category Accounts
|
|
162
|
+
* @category generated
|
|
163
|
+
*/
|
|
164
|
+
export const messageLibInfoBeet = new beet.BeetStruct<
|
|
165
|
+
MessageLibInfo,
|
|
166
|
+
MessageLibInfoArgs & {
|
|
167
|
+
accountDiscriminator: number[] /* size: 8 */
|
|
168
|
+
}
|
|
169
|
+
>(
|
|
170
|
+
[
|
|
171
|
+
['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
|
|
172
|
+
['messageLibType', messageLibTypeBeet],
|
|
173
|
+
['bump', beet.u8],
|
|
174
|
+
['messageLibBump', beet.u8],
|
|
175
|
+
],
|
|
176
|
+
MessageLibInfo.fromArgs,
|
|
177
|
+
'MessageLibInfo'
|
|
178
|
+
)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was GENERATED using the solita package.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
|
|
4
|
+
*
|
|
5
|
+
* See: https://github.com/metaplex-foundation/solita
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as beet from '@metaplex-foundation/beet'
|
|
9
|
+
import * as web3 from '@solana/web3.js'
|
|
10
|
+
import * as beetSolana from '@metaplex-foundation/beet-solana'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Arguments used to create {@link Nonce}
|
|
14
|
+
* @category Accounts
|
|
15
|
+
* @category generated
|
|
16
|
+
*/
|
|
17
|
+
export type NonceArgs = {
|
|
18
|
+
bump: number
|
|
19
|
+
outboundNonce: beet.bignum
|
|
20
|
+
inboundNonce: beet.bignum
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const nonceDiscriminator = [143, 197, 147, 95, 106, 165, 50, 43]
|
|
24
|
+
/**
|
|
25
|
+
* Holds the data for the {@link Nonce} Account and provides de/serialization
|
|
26
|
+
* functionality for that data
|
|
27
|
+
*
|
|
28
|
+
* @category Accounts
|
|
29
|
+
* @category generated
|
|
30
|
+
*/
|
|
31
|
+
export class Nonce implements NonceArgs {
|
|
32
|
+
private constructor(
|
|
33
|
+
readonly bump: number,
|
|
34
|
+
readonly outboundNonce: beet.bignum,
|
|
35
|
+
readonly inboundNonce: beet.bignum
|
|
36
|
+
) {}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a {@link Nonce} instance from the provided args.
|
|
40
|
+
*/
|
|
41
|
+
static fromArgs(args: NonceArgs) {
|
|
42
|
+
return new Nonce(args.bump, args.outboundNonce, args.inboundNonce)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Deserializes the {@link Nonce} from the data of the provided {@link web3.AccountInfo}.
|
|
47
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
48
|
+
*/
|
|
49
|
+
static fromAccountInfo(
|
|
50
|
+
accountInfo: web3.AccountInfo<Buffer>,
|
|
51
|
+
offset = 0
|
|
52
|
+
): [Nonce, number] {
|
|
53
|
+
return Nonce.deserialize(accountInfo.data, offset)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves the account info from the provided address and deserializes
|
|
58
|
+
* the {@link Nonce} from its data.
|
|
59
|
+
*
|
|
60
|
+
* @throws Error if no account info is found at the address or if deserialization fails
|
|
61
|
+
*/
|
|
62
|
+
static async fromAccountAddress(
|
|
63
|
+
connection: web3.Connection,
|
|
64
|
+
address: web3.PublicKey,
|
|
65
|
+
commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig
|
|
66
|
+
): Promise<Nonce> {
|
|
67
|
+
const accountInfo = await connection.getAccountInfo(
|
|
68
|
+
address,
|
|
69
|
+
commitmentOrConfig
|
|
70
|
+
)
|
|
71
|
+
if (accountInfo == null) {
|
|
72
|
+
throw new Error(`Unable to find Nonce account at ${address}`)
|
|
73
|
+
}
|
|
74
|
+
return Nonce.fromAccountInfo(accountInfo, 0)[0]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
79
|
+
* to fetch accounts matching filters that can be specified via that builder.
|
|
80
|
+
*
|
|
81
|
+
* @param programId - the program that owns the accounts we are filtering
|
|
82
|
+
*/
|
|
83
|
+
static gpaBuilder(
|
|
84
|
+
programId: web3.PublicKey = new web3.PublicKey(
|
|
85
|
+
'76y77prsiCMvXMjuoZ5VRrhG5qYBrUMYTE5WgHqgjEn6'
|
|
86
|
+
)
|
|
87
|
+
) {
|
|
88
|
+
return beetSolana.GpaBuilder.fromStruct(programId, nonceBeet)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Deserializes the {@link Nonce} from the provided data Buffer.
|
|
93
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
94
|
+
*/
|
|
95
|
+
static deserialize(buf: Buffer, offset = 0): [Nonce, number] {
|
|
96
|
+
return nonceBeet.deserialize(buf, offset)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Serializes the {@link Nonce} into a Buffer.
|
|
101
|
+
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
102
|
+
*/
|
|
103
|
+
serialize(): [Buffer, number] {
|
|
104
|
+
return nonceBeet.serialize({
|
|
105
|
+
accountDiscriminator: nonceDiscriminator,
|
|
106
|
+
...this,
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
112
|
+
* {@link Nonce}
|
|
113
|
+
*/
|
|
114
|
+
static get byteSize() {
|
|
115
|
+
return nonceBeet.byteSize
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Fetches the minimum balance needed to exempt an account holding
|
|
120
|
+
* {@link Nonce} data from rent
|
|
121
|
+
*
|
|
122
|
+
* @param connection used to retrieve the rent exemption information
|
|
123
|
+
*/
|
|
124
|
+
static async getMinimumBalanceForRentExemption(
|
|
125
|
+
connection: web3.Connection,
|
|
126
|
+
commitment?: web3.Commitment
|
|
127
|
+
): Promise<number> {
|
|
128
|
+
return connection.getMinimumBalanceForRentExemption(
|
|
129
|
+
Nonce.byteSize,
|
|
130
|
+
commitment
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Determines if the provided {@link Buffer} has the correct byte size to
|
|
136
|
+
* hold {@link Nonce} data.
|
|
137
|
+
*/
|
|
138
|
+
static hasCorrectByteSize(buf: Buffer, offset = 0) {
|
|
139
|
+
return buf.byteLength - offset === Nonce.byteSize
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns a readable version of {@link Nonce} properties
|
|
144
|
+
* and can be used to convert to JSON and/or logging
|
|
145
|
+
*/
|
|
146
|
+
pretty() {
|
|
147
|
+
return {
|
|
148
|
+
bump: this.bump,
|
|
149
|
+
outboundNonce: (() => {
|
|
150
|
+
const x = <{ toNumber: () => number }>this.outboundNonce
|
|
151
|
+
if (typeof x.toNumber === 'function') {
|
|
152
|
+
try {
|
|
153
|
+
return x.toNumber()
|
|
154
|
+
} catch (_) {
|
|
155
|
+
return x
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return x
|
|
159
|
+
})(),
|
|
160
|
+
inboundNonce: (() => {
|
|
161
|
+
const x = <{ toNumber: () => number }>this.inboundNonce
|
|
162
|
+
if (typeof x.toNumber === 'function') {
|
|
163
|
+
try {
|
|
164
|
+
return x.toNumber()
|
|
165
|
+
} catch (_) {
|
|
166
|
+
return x
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return x
|
|
170
|
+
})(),
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @category Accounts
|
|
177
|
+
* @category generated
|
|
178
|
+
*/
|
|
179
|
+
export const nonceBeet = new beet.BeetStruct<
|
|
180
|
+
Nonce,
|
|
181
|
+
NonceArgs & {
|
|
182
|
+
accountDiscriminator: number[] /* size: 8 */
|
|
183
|
+
}
|
|
184
|
+
>(
|
|
185
|
+
[
|
|
186
|
+
['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
|
|
187
|
+
['bump', beet.u8],
|
|
188
|
+
['outboundNonce', beet.u64],
|
|
189
|
+
['inboundNonce', beet.u64],
|
|
190
|
+
],
|
|
191
|
+
Nonce.fromArgs,
|
|
192
|
+
'Nonce'
|
|
193
|
+
)
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was GENERATED using the solita package.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
|
|
4
|
+
*
|
|
5
|
+
* See: https://github.com/metaplex-foundation/solita
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as web3 from '@solana/web3.js'
|
|
9
|
+
import * as beetSolana from '@metaplex-foundation/beet-solana'
|
|
10
|
+
import * as beet from '@metaplex-foundation/beet'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Arguments used to create {@link OAppRegistry}
|
|
14
|
+
* @category Accounts
|
|
15
|
+
* @category generated
|
|
16
|
+
*/
|
|
17
|
+
export type OAppRegistryArgs = {
|
|
18
|
+
delegate: web3.PublicKey
|
|
19
|
+
bump: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const oAppRegistryDiscriminator = [6, 152, 199, 30, 217, 50, 69, 149]
|
|
23
|
+
/**
|
|
24
|
+
* Holds the data for the {@link OAppRegistry} Account and provides de/serialization
|
|
25
|
+
* functionality for that data
|
|
26
|
+
*
|
|
27
|
+
* @category Accounts
|
|
28
|
+
* @category generated
|
|
29
|
+
*/
|
|
30
|
+
export class OAppRegistry implements OAppRegistryArgs {
|
|
31
|
+
private constructor(
|
|
32
|
+
readonly delegate: web3.PublicKey,
|
|
33
|
+
readonly bump: number
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates a {@link OAppRegistry} instance from the provided args.
|
|
38
|
+
*/
|
|
39
|
+
static fromArgs(args: OAppRegistryArgs) {
|
|
40
|
+
return new OAppRegistry(args.delegate, args.bump)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Deserializes the {@link OAppRegistry} from the data of the provided {@link web3.AccountInfo}.
|
|
45
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
46
|
+
*/
|
|
47
|
+
static fromAccountInfo(
|
|
48
|
+
accountInfo: web3.AccountInfo<Buffer>,
|
|
49
|
+
offset = 0
|
|
50
|
+
): [OAppRegistry, number] {
|
|
51
|
+
return OAppRegistry.deserialize(accountInfo.data, offset)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves the account info from the provided address and deserializes
|
|
56
|
+
* the {@link OAppRegistry} from its data.
|
|
57
|
+
*
|
|
58
|
+
* @throws Error if no account info is found at the address or if deserialization fails
|
|
59
|
+
*/
|
|
60
|
+
static async fromAccountAddress(
|
|
61
|
+
connection: web3.Connection,
|
|
62
|
+
address: web3.PublicKey,
|
|
63
|
+
commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig
|
|
64
|
+
): Promise<OAppRegistry> {
|
|
65
|
+
const accountInfo = await connection.getAccountInfo(
|
|
66
|
+
address,
|
|
67
|
+
commitmentOrConfig
|
|
68
|
+
)
|
|
69
|
+
if (accountInfo == null) {
|
|
70
|
+
throw new Error(`Unable to find OAppRegistry account at ${address}`)
|
|
71
|
+
}
|
|
72
|
+
return OAppRegistry.fromAccountInfo(accountInfo, 0)[0]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
77
|
+
* to fetch accounts matching filters that can be specified via that builder.
|
|
78
|
+
*
|
|
79
|
+
* @param programId - the program that owns the accounts we are filtering
|
|
80
|
+
*/
|
|
81
|
+
static gpaBuilder(
|
|
82
|
+
programId: web3.PublicKey = new web3.PublicKey(
|
|
83
|
+
'76y77prsiCMvXMjuoZ5VRrhG5qYBrUMYTE5WgHqgjEn6'
|
|
84
|
+
)
|
|
85
|
+
) {
|
|
86
|
+
return beetSolana.GpaBuilder.fromStruct(programId, oAppRegistryBeet)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Deserializes the {@link OAppRegistry} from the provided data Buffer.
|
|
91
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
92
|
+
*/
|
|
93
|
+
static deserialize(buf: Buffer, offset = 0): [OAppRegistry, number] {
|
|
94
|
+
return oAppRegistryBeet.deserialize(buf, offset)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Serializes the {@link OAppRegistry} into a Buffer.
|
|
99
|
+
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
100
|
+
*/
|
|
101
|
+
serialize(): [Buffer, number] {
|
|
102
|
+
return oAppRegistryBeet.serialize({
|
|
103
|
+
accountDiscriminator: oAppRegistryDiscriminator,
|
|
104
|
+
...this,
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
110
|
+
* {@link OAppRegistry}
|
|
111
|
+
*/
|
|
112
|
+
static get byteSize() {
|
|
113
|
+
return oAppRegistryBeet.byteSize
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Fetches the minimum balance needed to exempt an account holding
|
|
118
|
+
* {@link OAppRegistry} data from rent
|
|
119
|
+
*
|
|
120
|
+
* @param connection used to retrieve the rent exemption information
|
|
121
|
+
*/
|
|
122
|
+
static async getMinimumBalanceForRentExemption(
|
|
123
|
+
connection: web3.Connection,
|
|
124
|
+
commitment?: web3.Commitment
|
|
125
|
+
): Promise<number> {
|
|
126
|
+
return connection.getMinimumBalanceForRentExemption(
|
|
127
|
+
OAppRegistry.byteSize,
|
|
128
|
+
commitment
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Determines if the provided {@link Buffer} has the correct byte size to
|
|
134
|
+
* hold {@link OAppRegistry} data.
|
|
135
|
+
*/
|
|
136
|
+
static hasCorrectByteSize(buf: Buffer, offset = 0) {
|
|
137
|
+
return buf.byteLength - offset === OAppRegistry.byteSize
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Returns a readable version of {@link OAppRegistry} properties
|
|
142
|
+
* and can be used to convert to JSON and/or logging
|
|
143
|
+
*/
|
|
144
|
+
pretty() {
|
|
145
|
+
return {
|
|
146
|
+
delegate: this.delegate.toBase58(),
|
|
147
|
+
bump: this.bump,
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @category Accounts
|
|
154
|
+
* @category generated
|
|
155
|
+
*/
|
|
156
|
+
export const oAppRegistryBeet = new beet.BeetStruct<
|
|
157
|
+
OAppRegistry,
|
|
158
|
+
OAppRegistryArgs & {
|
|
159
|
+
accountDiscriminator: number[] /* size: 8 */
|
|
160
|
+
}
|
|
161
|
+
>(
|
|
162
|
+
[
|
|
163
|
+
['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
|
|
164
|
+
['delegate', beetSolana.publicKey],
|
|
165
|
+
['bump', beet.u8],
|
|
166
|
+
],
|
|
167
|
+
OAppRegistry.fromArgs,
|
|
168
|
+
'OAppRegistry'
|
|
169
|
+
)
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was GENERATED using the solita package.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
|
|
4
|
+
*
|
|
5
|
+
* See: https://github.com/metaplex-foundation/solita
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as beet from '@metaplex-foundation/beet'
|
|
9
|
+
import * as web3 from '@solana/web3.js'
|
|
10
|
+
import * as beetSolana from '@metaplex-foundation/beet-solana'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Arguments used to create {@link PayloadHash}
|
|
14
|
+
* @category Accounts
|
|
15
|
+
* @category generated
|
|
16
|
+
*/
|
|
17
|
+
export type PayloadHashArgs = {
|
|
18
|
+
hash: number[] /* size: 32 */
|
|
19
|
+
bump: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const payloadHashDiscriminator = [96, 28, 106, 145, 103, 32, 186, 70]
|
|
23
|
+
/**
|
|
24
|
+
* Holds the data for the {@link PayloadHash} Account and provides de/serialization
|
|
25
|
+
* functionality for that data
|
|
26
|
+
*
|
|
27
|
+
* @category Accounts
|
|
28
|
+
* @category generated
|
|
29
|
+
*/
|
|
30
|
+
export class PayloadHash implements PayloadHashArgs {
|
|
31
|
+
private constructor(
|
|
32
|
+
readonly hash: number[] /* size: 32 */,
|
|
33
|
+
readonly bump: number
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates a {@link PayloadHash} instance from the provided args.
|
|
38
|
+
*/
|
|
39
|
+
static fromArgs(args: PayloadHashArgs) {
|
|
40
|
+
return new PayloadHash(args.hash, args.bump)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Deserializes the {@link PayloadHash} from the data of the provided {@link web3.AccountInfo}.
|
|
45
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
46
|
+
*/
|
|
47
|
+
static fromAccountInfo(
|
|
48
|
+
accountInfo: web3.AccountInfo<Buffer>,
|
|
49
|
+
offset = 0
|
|
50
|
+
): [PayloadHash, number] {
|
|
51
|
+
return PayloadHash.deserialize(accountInfo.data, offset)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves the account info from the provided address and deserializes
|
|
56
|
+
* the {@link PayloadHash} from its data.
|
|
57
|
+
*
|
|
58
|
+
* @throws Error if no account info is found at the address or if deserialization fails
|
|
59
|
+
*/
|
|
60
|
+
static async fromAccountAddress(
|
|
61
|
+
connection: web3.Connection,
|
|
62
|
+
address: web3.PublicKey,
|
|
63
|
+
commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig
|
|
64
|
+
): Promise<PayloadHash> {
|
|
65
|
+
const accountInfo = await connection.getAccountInfo(
|
|
66
|
+
address,
|
|
67
|
+
commitmentOrConfig
|
|
68
|
+
)
|
|
69
|
+
if (accountInfo == null) {
|
|
70
|
+
throw new Error(`Unable to find PayloadHash account at ${address}`)
|
|
71
|
+
}
|
|
72
|
+
return PayloadHash.fromAccountInfo(accountInfo, 0)[0]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
|
|
77
|
+
* to fetch accounts matching filters that can be specified via that builder.
|
|
78
|
+
*
|
|
79
|
+
* @param programId - the program that owns the accounts we are filtering
|
|
80
|
+
*/
|
|
81
|
+
static gpaBuilder(
|
|
82
|
+
programId: web3.PublicKey = new web3.PublicKey(
|
|
83
|
+
'76y77prsiCMvXMjuoZ5VRrhG5qYBrUMYTE5WgHqgjEn6'
|
|
84
|
+
)
|
|
85
|
+
) {
|
|
86
|
+
return beetSolana.GpaBuilder.fromStruct(programId, payloadHashBeet)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Deserializes the {@link PayloadHash} from the provided data Buffer.
|
|
91
|
+
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
|
|
92
|
+
*/
|
|
93
|
+
static deserialize(buf: Buffer, offset = 0): [PayloadHash, number] {
|
|
94
|
+
return payloadHashBeet.deserialize(buf, offset)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Serializes the {@link PayloadHash} into a Buffer.
|
|
99
|
+
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
|
|
100
|
+
*/
|
|
101
|
+
serialize(): [Buffer, number] {
|
|
102
|
+
return payloadHashBeet.serialize({
|
|
103
|
+
accountDiscriminator: payloadHashDiscriminator,
|
|
104
|
+
...this,
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Returns the byteSize of a {@link Buffer} holding the serialized data of
|
|
110
|
+
* {@link PayloadHash}
|
|
111
|
+
*/
|
|
112
|
+
static get byteSize() {
|
|
113
|
+
return payloadHashBeet.byteSize
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Fetches the minimum balance needed to exempt an account holding
|
|
118
|
+
* {@link PayloadHash} data from rent
|
|
119
|
+
*
|
|
120
|
+
* @param connection used to retrieve the rent exemption information
|
|
121
|
+
*/
|
|
122
|
+
static async getMinimumBalanceForRentExemption(
|
|
123
|
+
connection: web3.Connection,
|
|
124
|
+
commitment?: web3.Commitment
|
|
125
|
+
): Promise<number> {
|
|
126
|
+
return connection.getMinimumBalanceForRentExemption(
|
|
127
|
+
PayloadHash.byteSize,
|
|
128
|
+
commitment
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Determines if the provided {@link Buffer} has the correct byte size to
|
|
134
|
+
* hold {@link PayloadHash} data.
|
|
135
|
+
*/
|
|
136
|
+
static hasCorrectByteSize(buf: Buffer, offset = 0) {
|
|
137
|
+
return buf.byteLength - offset === PayloadHash.byteSize
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Returns a readable version of {@link PayloadHash} properties
|
|
142
|
+
* and can be used to convert to JSON and/or logging
|
|
143
|
+
*/
|
|
144
|
+
pretty() {
|
|
145
|
+
return {
|
|
146
|
+
hash: this.hash,
|
|
147
|
+
bump: this.bump,
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @category Accounts
|
|
154
|
+
* @category generated
|
|
155
|
+
*/
|
|
156
|
+
export const payloadHashBeet = new beet.BeetStruct<
|
|
157
|
+
PayloadHash,
|
|
158
|
+
PayloadHashArgs & {
|
|
159
|
+
accountDiscriminator: number[] /* size: 8 */
|
|
160
|
+
}
|
|
161
|
+
>(
|
|
162
|
+
[
|
|
163
|
+
['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
|
|
164
|
+
['hash', beet.uniformFixedSizeArray(beet.u8, 32)],
|
|
165
|
+
['bump', beet.u8],
|
|
166
|
+
],
|
|
167
|
+
PayloadHash.fromArgs,
|
|
168
|
+
'PayloadHash'
|
|
169
|
+
)
|