diff --git a/README.adoc b/README.adoc index 8ee5e049..88a4e5c5 100644 --- a/README.adoc +++ b/README.adoc @@ -43,9 +43,8 @@ image::dshackle-intro.png[alt="",width=80%,align="center"] == Roadmap - [ ] External logging -- [ ] Access to ERC-20 tokens on asset level -- [ ] Subscription to bitcoind notification over gRPC (instead of ZeroMQ) - [ ] Prometheus monitoring +- [ ] Subscription to bitcoind notification over gRPC (instead of ZeroMQ) - [ ] BIP-32 Pubkey - [ ] Lightweight sidecar node connector - [ ] Configurable upstream roles @@ -226,7 +225,10 @@ grpcurl -import-path ./proto/ -proto blockchain.proto -d '{\"asset\": {\"chain\" ... ---- -See other enhanced methods in the link:docs/06-methods.adoc[Documentation for Enhanced Methods] +The balance subscription works with main coin (_ether_, _bticoin_), or with tokens like ERC-20 if configured additionally. +See link:docs/reference-configuration.adoc[Configuration Reference]. + +See other enhanced methods in the link:docs/06-methods.adoc[Documentation for Enhanced Methods]. == Documentation diff --git a/docs/06-methods.adoc b/docs/06-methods.adoc index 61736092..77672e53 100644 --- a/docs/06-methods.adoc +++ b/docs/06-methods.adoc @@ -52,10 +52,10 @@ Where: - `chain` target chain (see reference for ids) - `items` as a list of independent requests, which may be executed in different nodes in parallels or in different order, with: - * `method` - a JSON RPC standard name, ex: `eth_getBlockByHash` - * `payload` - list of parameters for the methods, encoded as JSON string, ex. `["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]` +* `method` - a JSON RPC standard name, ex: `eth_getBlockByHash` +* `payload` - list of parameters for the methods, encoded as JSON string, ex. `["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]` - `Selector` and `AvailabilityEnum` are described in reference, in short they allow to specify which nodes must be selected - to execute the reques (i.e. "execute only on an archive node") +to execute the reques (i.e. "execute only on an archive node") .NativeCallReplyItem [source,proto] @@ -71,7 +71,7 @@ message NativeCallReplyItem { Where: -- `payload` is JSON response for a particular call, encoded into a string (when `succeed` is true) +- `payload` is JSON response for a particular call (`result` field), encoded into a string (`succeed` is true) - or `error` if request failed (`succeed` is false) NOTE: Reply Items comes right after their execution on an upstream, therefore streaming response. @@ -106,7 +106,8 @@ Where: === SubscribeBalance or GetBalance -Subscribes to changes (`SubscribeBalance`) or get current (`GetBalance`) balance for a single address or a set of addresses. +Subscribes to changes (`SubscribeBalance`) or get current (`GetBalance`) balance for a single address, or a set of addresses. +By default, it supports only main protocol coin (i.e. `bitcoin`, `ether`), but can be configured to support ERC-20 on Ethereum (see link:reference-configuration.adoc[Reference Configuration]) .Request [source,proto] diff --git a/docs/reference-configuration.adoc b/docs/reference-configuration.adoc index 01fa3af5..1147a8e5 100644 --- a/docs/reference-configuration.adoc +++ b/docs/reference-configuration.adoc @@ -46,6 +46,18 @@ proxy: - id: kovan blockchain: kovan +tokens: + - id: dai + blockchain: ethereum + name: DAI + type: ERC-20 + address: 0x6B175474E89094C44Da98b954EedeAC495271d0F + - id: tether + blockchain: ethereum + name: Tether + type: ERC-20 + address: 0xdac17f958d2ee523a2206206994597c13d831ec7 + cluster: defaults: - chains: @@ -130,6 +142,11 @@ cluster: | | Setup HTTP proxy that emulates all standard JSON RPC requests. See <> section +| `tokens` +| +| Configure tokens for tracking balance. See <> section + + | `cache` | | Caching configuration. See <> section. @@ -242,6 +259,49 @@ a| Routing paths for Proxy. The proxy will handle requests as `https://${HOST}:$ |=== +[#tokens] +== Tokens config + +[source,yaml] +---- +tokens: + - id: dai + blockchain: ethereum + name: DAI + type: ERC-20 + address: 0x6B175474E89094C44Da98b954EedeAC495271d0F + - id: tether + blockchain: ethereum + name: Tether + type: ERC-20 + address: 0xdac17f958d2ee523a2206206994597c13d831ec7 +---- + +Tokens config enables tracking of a balance amount in the configured tokens. +After making the configuration above you can request balance (`GetBalance`), or subscribe to balance changes (`SubscribeBalance`), using link:06-methods.adoc[enhanced protocol] + +.Token config +[cols="2a,7"] +|=== +| Option | Description + +| `id` +| Internal id for reference (used in logging, etc) + +| `blockchain` +| An ethereum-based blockchain where the contract is deployed + +| `name` +| Name of the token, used for balance response as asset code (as converted to UPPERCASE) + +| `type` +| Type of token. Only `ERC-20` is supported at this moment + +| `address` +| Address of the deployed contract + +|=== + [#cache] == Cache config