Page MenuHomePhabricator

ERC-20 Token API
Open, HighPublic

Description

Goals:

  • Add token by address
  • Get token info: name (optional), symbol (optional), decimals, totalSupply
  • Query balance of an address
  • Add token balance, transfer and approval to account API

Event Timeline

iongchun created this task.Oct 17 2017, 6:13 PM
iongchun moved this task from Backlog to Working on the Ethereum Web Wallet board.

Add token: POST /api/token with {"address":"0x..."} (optional: "name", "symbol", "decimals")
Token info: GET /api/token/<address> returns {"address":"0x...", "name":"...", "symbol":"...", "decimals":..., "totalSupply":...}
Query balance: GET /api/token/<address>/balance/<address> returns {"address":"0x...", "balance":..., "balanceDecimal":...}

Account token API: transfer/transferFrom, approve, allowance

GET /api/account/<address>/token/<contract_address>/balance
POST /api/account/<address>/token/<contract_address>/transfer
POST /api/account/<address>/token/<contract_address>/approve
GET /api/account/<address>/token/<contract_address>/allowance/<spender_address>

GET /api/account/<owner_address>/token/<contract_address>/allowance/<spender_address>
redirects to:
GET /api/token/<contract_address>/allowance/<owner_address>/<spender_address>
returns:
{"contract_address":"0x...", "owner_address":"0x...", "spender_address:0x...", "allowance":...}

GET /api/account/<address>/token/<contract_address>/balance
redirects to:
GET /api/token/<contract_address>/balance/<address>

POST /api/account/{address}/token/{contractAddress}/transfer
with: {"to": "0x...", "amount":...}
results: 400, or 201 with header "Location": /api/tx/{hash}

POST /api/account/{address}/token/{contractAddress}/approve
with: {"spender": "0x...", "amount":..., "gasPrice"(optional):..., "gasLimit"(optional):...}
results: 400, or 201 with header "Location": /api/tx/{hash} and data: {"contract":"0x...", "owner":"0x...", "spender":"0x...", allowance:...}

update token transfer to support transferFrom:

POST /api/account/{address}/token/{contractAddress}/transfer
with: {"owner"(optional): "0x...", "to": "0x...", "amount":...}

iongchun moved this task from Working to Ready on the Ethereum Web Wallet board.Oct 21 2017, 10:49 AM

Add user to tokens:
System token: token with name, symbol, decimals in chain
User token: without ... in chain

iongchun moved this task from Ready to Working on the Ethereum Web Wallet board.Oct 25 2017, 9:35 PM