Skip to content

Add account_balances RPC method to unsafe RPC interface on nodes #1624

@enlight

Description

@enlight

The account_balances RPC method should accept a list of contract addresses (on the DAppChain) as input. eth and loom should be accepted as aliases for the built-in contracts, eth will be resolved to ethcoin, and loom to coin.

The RPC method should:

  1. Retrieve all the account mappings from the address mapper contract.
  2. For each account mapping query how many tokens the DAppChain account has for each of the specified contracts.
  3. Return a plain JSON response containing all the balances in this format:
    "accounts": {
      "eth:0xdeadbeef": {
        "eth": "1000000000",
        "loom": "20000",
        "eth:0xwhatever": "0"
      },
      "eth:0xdeadfeeb": {
        "eth": "0",
        "loom": "10000000",
        "eth:0xwhatever": "100"
      }
    }
    Aside from eth and loom the contract addresses in the response should be the foreign address, this means the input contract addresses will need to be mapped to a foreign address via the contract mappings stored in the gateway contract.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions