Sign Up
Skip to content

Sign Messages

Signing a message is an asynchronous Task. You can use await when calling WaaSWallet.SignMessage from within an async Task if you wish to obtain the SignMessageReturn object directly. Or, you can take the recommended approach which is to setup a handler function for the WaaSWallet.OnSignMessageComplete event and call the WaaSWallet.SignMessage method from anywhere (without await). For example:

public void OnSignMessageCompleteHandler(string signature) {
    // Do something
}
 
public void OnWalletCreatedHander(SequenceWallet wallet) {
    wallet.OnSignMessageComplete += OnSignMessageCompleteHandler;
}
_wallet.SignMessage(Chain.Polygon, "Message to sign");

If you're unfamiliar with working with events in Unity, check out this great Reddit post!