Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving All User Wallets through Coinbase iOS SDK

I've recently been experimenting with the Coinbase iOS SDK and I've been having issues retrieving a user's Ethereum, Litecoin and Bitcoin Cash balances and historic transactions. Currently, I've only managed to do this with Bitcoin, USD and EUR, which seems to be consistent with the behaviour of the demo app supplied by Coinbase.

I have configured an application on the Coinbase API Access page using OAuth2 and the generated client ID and secret are being used within the app.

The issue seems to stem from the fact that I modified the Coinbase iOS SDK to allow me to pass the account parameter as ‘all’. This, I had hoped, would allow me to view details of all user accounts (ETH, BTC, LTC etc.) however, I only get BTC, USD and EUR when calling ‘getAccountsList’ on the Coinbase object.

NSString *accessToken = [response objectForKey:@"access_token"];
Coinbase *client = [Coinbase coinbaseWithOAuthAccessToken:accessToken];

[client getAccountsList:^(NSArray *accounts, CoinbasePagingHelper *paging, NSError *error) {
    for (CoinbaseAccount *account in accounts) {
        // Only BTC, USD and EUR are in the accounts array at this point. 
    }
}];

This is surprising as the permissions request page correctly asks the user for all wallets, as you can see in the screenshot below:

enter image description here

I suspect a solution to this would be to use API keys, as you are able to specify exactly which accounts to grant access to. I plan to distribute the app however, so this technique should not be used.

enter image description here

Here is an example of the URL I am sending:

https://www.coinbase.com/oauth/authorize?response_type=code&client_id=CLIENT_ID_GOES_HERE&account=all&scope=balance%20transactions%20user&redirect_uri=com.example-name.example-app.coinbase-oauth%3A%2F%2Fcoinbase-oauth

Does anyone know how I can request access to all of a users accounts using OAuth and be able to retrieve details for each? Is the scope I defined incorrect in some way? The only alternative I can think of would be to request access one by one to each wallet and store individual access tokens. This wouldn't be a great user experience however.

Thanks!

like image 608
A. Walker Avatar asked Jan 06 '18 01:01

A. Walker


People also ask

What is Coinbase wallet SDK?

Coinbase Wallet SDK (formerly WalletLink) is an open source SDK which allows you to connect your dapps to millions of Coinbase Wallet users, including their assets and NFTs.

Does Coinbase have an API?

Coinbase API is a method for us to trade cryptocurrencies on Coinbase automatically via code.

Is Coinbase API free?

Price: It is offered free. However, every API key or application is limited to 10,000 requests per hour. Special features: The Coinbase API supports multiple payment capabilities, which allow users to make payments through banks, credit cards, or other online methods.


1 Answers

Add the parameter

account=all

to the oAuth endpoint: https://coinbase.com/oauth/authorize?account=all&response_type=code.‌​..

Here are the details: https://developers.coinbase.com/docs/wallet/coinbase-connect/permissions

Coinbase Connect applications can request different access to user’s wallets. This access is defined by account parameter on OAuth2 authorization URL. Available options are:`

  • select - (default) Allow user to pick the wallet associated with the application
  • new - Application will create a new wallet (named after the application)
  • all - Application will get access to all of user’s wallets
like image 197
EvilJordan Avatar answered Oct 29 '22 19:10

EvilJordan