How to send batch requests using coinbase mobile SDK?

this is the official link:

and i have write single requst like this:


const [address] = await provider.request({
  method: "eth_requestAccounts",
  params: [],
});

it worked for me, next i send personal_sign request, it worked.

now i want send eth_requestAccounts and personal_sign in one requst?
how can i write this code?

official sample is “coming soon”.

Hi @nightking! Welcome to the community! Thank you for taking an interest in trying out Coinbase APIs. For the details regarding your inquiry, we will check on this for you with our team to see how we can best assist. We’ll get back to you once we have more information. Keep in touch!

Hi @nightking! Thank you for patiently waiting as we looked into your query. With regard to your concern on how to properly send a batched request, you may refer to the following code snippet:

const [results, account] = await initiateHandshake([
  { method: "eth_requestAccounts", params: {} },
  { 
    method: "personal_sign", 
    params: { 
      address: "", // leave empty since address is unknown
      message: "hello world"
    } 
  }
]);

Additionally, please note that the github link you’ve shared is about protocol spec, not about how to use the library. You may refer on the following links as reference for the Coinbase Wallet Mobile SDK library documentation:

We hope this is helpful, please let us know if you have any other questions. Have a great day!

1 Like