Sending USDC to a Solana address fails validation

Sending tokens to Solana via the SIWC API generally works ok. However, if sending USDC specifically a validation error is returned:

Please enter a valid email or ethereum address

This does not occur with other tokens. Manually doing a send (via the UI) works fine.

Hi @yamen! Thank you for sharing this with us. Please allow us some time while we look into this validation error. Keep in touch.

Hey @yamen! Can you please share the request that you are making and the Screenshot of the code?

@Loop_11 A screenshot of the code portion is here:

The account.uuid is looked up using listAccounts and filtered for the appropriate currency. I can confirm there is only one USDC wallet in this case.

The above code will work with payloads such as:

{
        amount: "10000000",
        currency: "BONK",
        to: "<solana wallet>",
        type: "send",
        to_financial_institution: false
}

But will fail with:

{
        amount: "100",
        currency: "USDC",
        to: "<solana wallet>",
        type: "send",
        to_financial_institution: false
}

Saying the destination needs to be an Ethereum address or email.

Trying to provide a more idiomatic example, here’s library code which does the withdrawal:

async function doWithdrawal(currency: string, amount: string, address: string) {
  const accounts = await client.apiClient.rest
    .coinbaseRequest({
      baseURL: 'https://api.coinbase.com/',
      url: `/v2/accounts`,
      method: 'get'
    })
    .catch((e) => e.response);

  const account = accounts.data.data.find((account) => account.currency.name.toUpperCase() === currency);

  console.log(account);

  const withdrawal = await client.apiClient.rest
    .coinbaseRequest({
      baseURL: 'https://api.coinbase.com/',
      url: `/v2/accounts/${account.id}/transactions`,
      method: 'post',
      data: {
        type: 'send',
        to: address,
        currency: currency,
        amount: amount
      }
    })
    .catch((e) => e.response);

  console.log(withdrawal.data);
}

Note client.apiClient.rest.coinbaseRequest is just a simple wrapper around axios which will handle security / headers.

Calling with:

await doWithdrawal('BONK', '100', '<address>');
await doWithdrawal('USDC', '1', '<address>');

They both successfully find an account, here’s the USDC one:

{
  id: '<id>',
  name: 'USDC Wallet',
  primary: true,
  type: 'wallet',
  balance: { amount: '<balance>', currency: 'USDC' },
  created_at: '2023-12-07T19:36:12Z',
  updated_at: '2023-12-26T19:56:19Z',
  resource: 'account',
  resource_path: '/v2/accounts/<id>',
  currency: {
    asset_id: '2b92315d-eab7-5bef-84fa-089a131333f5',
    code: 'USDC',
    color: '#2775CA',
    exponent: 6,
    name: 'USDC',
    slug: 'usdc',
    type: 'crypto',
    rewards: { apy: '0.051', formatted_apy: '5.10%', label: '5.10% APY' }
  },
  allow_deposits: true,
  allow_withdrawals: true
}

And here’s the USDC error:

{
  errors: [
    {
      id: 'validation_error',
      message: 'Please enter a valid email or ethereum address',
      field: 'base'
    }
  ]
}