Options

An options object can be passed to an authorize wallet request to set some of the parameters of the authorization flow. In the example above, we've sent the empty configuration, since all the parameters are optional. Options you can configure are all optional and listed below:

{
  wallet_address?: string;
  redirect_url?: string;
  arbitrary_data?: Map<string, unknown>;
  screen_config?: ScreenConfig;
  message_to_sign?: string;
  store_indefinitely?: boolean;
}

wallet_address

The wallet address, which the user must log in with. If the user connects with another address, the request will be rejected.

If the value is not provided, the user can log in with any wallet address and continue processing the request.

Example value:

const options = {
    // ... rest of the options
    wallet_address: "0x4Ed918C7800F5dc34d2C774f6EA5fbd15f1a94a7"
}

redirect_url

If the value is not provided, the actionUrl generated by the SDK will be automatically built to redirect the user to our wallet connection screen, and this is the recommended approach.

Example value:

const options = {
    // ... rest of the options
    redirect_url: "https://your-frontend/wallet-connect/${id}"
}

arbitrary_data

Key-value mapping of any data you want to attach to the request. The data will simply be sent back to you upon the successful request completion. Depending on your use-case, you might want to add important info here, related to your existing application parameters.

If the value is not provided, the empty data is sent with the request and received back when the request is processed.

Example value:

const data = new Map<string, string>();
data['user-id'] = 'my internal user id';

const options = {
    // ... rest of the options
    arbitrary_data: data
}

screen_config

Configures the execution screen and sets the text labels your user will see when processing the request. By providing this value, you can communicate with the user more clearly what you're requesting from his side, and this will be shown to the users when you redirect them to the action URL generated by our SDK.

If the value is not provided, the default action messages will be shown when you redirect the user to our action execution screen.

const options = {
    // ... rest of the options
    screen_config: {
        before_action_message: "This message will be shown to your user before he executes the request.",
        after_action_message: "THis message will be shown to your user after he executes the action successfully."
    }
}

You can put anything textual in these parameters, links, thank you messages or whatever else might be useful for your case.

message_to_sign

You can provide your own message data to for user to sign in order to prove the ownership of the wallet. You should leave this empty if you want to authorize the user using our message signing process. We'll generate the message for you and check the signatures before letting you know the user is authorized.

store_indefinitely

Set this value to true if you want the request data to be destroyed once the request has been processed by the user.

If the value is not provided, the default value is false meaning you will always be able to fetch the request data and check the status, even after it was processed.

const options = {
    // ... rest of the options
    store_indefinitely: true
}

Last updated