MoonSigner
Summary
The @moonup/ethers
package is a utility package that provides a MoonSigner
class for signing messages, transactions, and typed data using the MoonSDK from the @moonup/moon-sdk
package. This signer implements the Signer
and TypedDataSigner
interfaces from the ethers
library.
Usage Examples
Here's a basic example of how to use the MoonSigner
class:
API Reference
MoonSigner
MoonSigner
A signer for signing messages, transactions, and typed data using the MoonSDK.
Constructor
config
(Object)SDK
(MoonSDK): An instance of the MoonSDK.address
(string): The Ethereum address of the account.chainId
(number): The ID of the Ethereum chain.
provider
(Provider): An optional provider.
Methods
_signTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, value: Record<string, any>)
: Signs a typed data object. This method is not implemented and throws an error.updateConfig(config: MoonSignerConfig)
: Updates the configuration options.connect(provider: Provider)
: Connects the signer to a provider.signTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, value: Record<string, string>)
: Signs a typed data object.getAddress()
: Returns the Ethereum address of the account.signMessage(message: BytesLike)
: Signs a message.broadcastTransaction(signedTransaction: string)
: Broadcasts a signed transaction.sendTransaction(transaction: TransactionRequest)
: Signs and broadcasts a transaction.transactionRequestToInputBody(tx: TransactionRequest)
: Converts aTransactionRequest
object to anInputBody
object.moonTransactionResponseToTransactions(tx: MoonTransaction)
: Converts aMoonTransaction
object to an array ofTransactionData
objects.signTransaction(transaction: TransactionRequest)
: Signs a transaction.getTypedDataDomain(name: string, version: string, chainId: number, verifyingContract: string)
: Returns aTypedDataDomain
object.getTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, message: Record<string, string>)
: Returns aTyped
object.
Example
Last updated