sign

open suspend override fun sign(clientApiKey: String?, mpcHost: String?, dkgData: String?, method: String?, params: String?, rpcUrl: String?, chainId: String?, metadata: String?): String

Signs a transaction or message using the MPC enclave.

This function sends a request to the MPC enclave to sign a transaction or message based on the provided parameters. It requires a valid client API key, DKG data, method, parameters, RPC URL, chain ID, and metadata.

Return

The signature string contained in a JSON object returned by the MPC enclave.

Parameters

clientApiKey

The API key for authenticating with the MPC service. Must not be null.

mpcHost

(Optional) The host address of the MPC service. Currently not used in the function's logic.

dkgData

The key shares. Must not be null.

method

The method to be called (e.g., "eth_sendTransaction"). Must not be null.

params

The parameters for the specified method, typically in JSON format. Must not be null.

rpcUrl

The URL of the RPC endpoint to interact with the blockchain. Must not be null.

chainId

The ID of the blockchain network (e.g., "1" for Ethereum Mainnet). Must not be null.

metadata

Additional metadata associated with the signing request. Must not be null.

Throws

if any of the following are null: clientApiKey, dkgData, method, params, rpcUrl, chainId, metadata.

if there is an error during the HTTP request to the enclave.