View Source Circlex.Api.Accounts.Wallets (Circlex v0.1.6)

API Client to access Wallets service from the Circle API.

For instance, to get a list of wallets:

> Circlex.Api.Accounts.Wallets.list_wallets()
{
  :ok,
  [
    %Circlex.Struct.Wallet{
      addresses: [],
      balances: [%Circlex.Struct.Amount{amount: "150234.93", currency: "USD"}],
      description: "Master Wallet",
      entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
      type: "merchant",
      wallet_id: "1000216185"
    },
     %Circlex.Struct.Wallet{
      addresses: [],
      balances: [%Circlex.Struct.Amount{amount: "50.00", currency: "USD"}],
      description: "end_user_wallet",
      entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
      type: "merchant",
      wallet_id: "1000216186"
    }
  ]
}

To create a new wallet:

> Circlex.Api.Accounts.Wallets.create("Test Wallet")
{
  :ok,
  %Circlex.Struct.Wallet{
    balances: [],
    description: "Test Wallet",
    entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
    type: "end_user_wallet",
    wallet_id: "1000000500"
  }
}

Wallet Reference: https://developers.circle.com/reference/accounts-wallets-create

Link to this section Summary

Functions

Creates an end user wallet.

Retrieves a list of addresses associated with a wallet.

Retrieves a list of a user's wallets.

Link to this section Functions

Link to this function

create(description, opts \\ [])

View Source

Creates an end user wallet.

Reference: https://developers.circle.com/reference/accounts-wallets-create

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Accounts.Wallets.create("Test Wallet", host: host)
{
  :ok,
  %Circlex.Struct.Wallet{
    addresses: [],
    balances: [],
    description: "Test Wallet",
    entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
    type: "end_user_wallet",
    wallet_id: "1000000500"
  }
}
Link to this function

generate_address(wallet_id, currency, chain, opts \\ [])

View Source

Generate a blockchain address

Reference: https://developers.circle.com/reference/accounts-wallets-addresses-create

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Accounts.Wallets.generate_address("1000216185", "USD", "ETH", host: host)
{:ok,
  %Circlex.Struct.Address{
    address: "0x5d2e4a271103100c8dd463a3229e9fbb7e079f50",
    chain: "ETH",
    currency: "USD"
  }}
Link to this function

get_wallet(id, opts \\ [])

View Source

Get a wallet

Reference: https://developers.circle.com/reference/accounts-wallets-get-id

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Accounts.Wallets.get_wallet("1000216185", host: host)
{
  :ok,
  %Circlex.Struct.Wallet{
    balances: [%Circlex.Struct.Amount{amount: "150234.93", currency: "USD"}],
    description: "Master Wallet",
    entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
    type: "merchant",
    wallet_id: "1000216185",
    addresses: [],
  }
}
Link to this function

list_addresses(wallet_id, opts \\ [])

View Source

Retrieves a list of addresses associated with a wallet.

Reference: https://developers.circle.com/reference/accounts-wallets-addresses-get

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Accounts.Wallets.list_addresses("1000216185", host: host)
{
  :ok,
  [
    %{address: "0x522c4caaf435fdf1822c7b6a081858344623cf84", chain: "ETH", currency: "USD"},
    %{address: "mpLQ2waXiQW6aAtnp9XMWh52R42k3QVjtU", chain: "BTC", currency: "BTC"},
    %{address: "0x6a9de7df6a986a0398348efb0ecd91f341547b31", chain: "ETH", currency: "USD"}
  ]
}
Link to this function

list_wallets(opts \\ [])

View Source

Retrieves a list of a user's wallets.

Reference: https://developers.circle.com/reference/accounts-wallets-get

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Accounts.Wallets.list_wallets(host: host)
{
  :ok,
  [
    %Circlex.Struct.Wallet{
      addresses: [],
      balances: [%Circlex.Struct.Amount{amount: "150234.93", currency: "USD"}],
      description: "Master Wallet",
      entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
      type: "merchant",
      wallet_id: "1000216185"
    },
     %Circlex.Struct.Wallet{
      addresses: [],
      balances: [%Circlex.Struct.Amount{amount: "50.00", currency: "USD"}],
      description: "end_user_wallet",
      entity_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
      type: "merchant",
      wallet_id: "1000216186"
    }
  ]
}