Request signature
The request method opens a Wallet Services confirmation screen for a signing request.
The method supports signing methods from the MetaMask JSON-RPC API. Configure the chains and default chain in your Embedded Wallets dashboard.
Parameters
| Argument | Description |
|---|---|
method | Signing method name as a string. |
requestParams | Parameters for the method as a Newtonsoft.Json.Linq JArray, in the required order. |
path? | Wallet Services path. The default is wallet/request; most integrations should omit this. |
tip
Subscribe to onSignResponse before making a request to receive its result.
void Start()
{
web3Auth = GetComponent<Web3Auth>();
web3Auth.setOptions(new Web3AuthOptions()
{
});
web3Auth.onSignResponse += onSignResponse;
}
private void onSignResponse(SignResponse signResponse)
{
// Functions to be called after receiving sign response
}
Usage
using Nethereum.Web3.Accounts;
using Newtonsoft.Json.Linq;
public void requestSignature()
{
var account = new Account(web3Auth.getPrivateKey());
JArray paramsArray = new JArray
{
"Hello World",
account.Address
};
web3Auth.request("personal_sign", paramsArray);
}
private void onSignResponse(SignResponse signResponse)
{
Debug.Log("Retrieved SignResponse: " + signResponse);
}