Skip to content

R4R: service user guide #749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/service/cli/sendtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func GetCmdSvcRespond(cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "respond",
Short: "Respond a service method invocation",
Example: "iriscli service respond --chain-id=<chain-id> --from=<key name> --fee=0.004iris --req-chain-id=<call-chain-id> " +
Example: "iriscli service respond --chain-id=<chain-id> --from=<key name> --fee=0.004iris --request-chain-id=<call-chain-id> " +
"--request-id=<request-id> --response-data=<resp>",
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx := context.NewCLIContext().WithCodec(cdc).WithLogger(os.Stdout).
Expand Down
7 changes: 7 additions & 0 deletions docs/cli-client/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ iriscli service [command]
| [disable](disable.md) | Disable a available service binding |
| [enable](enable.md) | Enable an unavailable service binding |
| [refund-deposit](refund-deposit.md) | Refund all deposit from a service binding |
| [call](call.md) | Call a service method |
| [requests](requests.md) | Query service requests |
| [respond](respond.md) | Respond a service method invocation |
| [response](response.md) | Query a service response |
| [fees](fees.md) | Query return and incoming fee of a particular address |
| [refund-fees](refund-fees.md) | Refund all fees from service return fees |
| [withdraw-fees](withdraw-fees.md) | Withdraw all fees from service incoming fees |

## Flags

Expand Down
47 changes: 47 additions & 0 deletions docs/cli-client/service/call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# iriscli service call

## Description

Call a service method

## Usage

```
iriscli service call [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ------------------------------------------------------------ | -------- |
| --def-chain-id | | [string] the ID of the blockchain defined of the service | Yes |
| --service-name | | [string] service name | Yes |
| --method-id | | [int] the method id called | Yes |
| --bind-chain-id | | [string] the ID of the blockchain bond of the service | Yes |
| --provider | | [string] bech32 encoded account created the service binding | Yes |
| --service-fee | | [string] fee to pay for a service invocation | |
| --request-data | | [string] hex encoded request data of a service invocation | |
| -h, --help | | help for call | |

## Examples

### Initiate a service invocation request
```shell
iriscli service call --chain-id=test --from=node0 --fee=0.004iris --def-chain-id=test --service-name=test-service --method-id=1 --bind-chain-id=test --provider=faa1qm54q9ta97kwqaedz9wzd90cacdsp6mq54cwda --service-fee=1iris --request-data=434355
```

After that, you're done with initiating a service invocation request.

```txt
Committed at block 130 (tx hash: DB40CE593198FC1B112337C613934F4E325F0718770D40616473369090327994, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:8144 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 99 97 108 108] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 113 117 101 115 116 45 105 100] Value:[50 51 48 45 49 51 48 45 48] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[112 114 111 118 105 100 101 114] Value:[102 97 97 49 102 48 50 101 120 116 57 100 117 107 55 104 51 114 120 57 122 109 55 97 118 48 112 110 108 101 103 120 118 101 56 110 101 53 118 119 54 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 110 115 117 109 101 114] Value:[102 97 97 49 102 48 50 101 120 116 57 100 117 107 55 104 51 114 120 57 122 109 55 97 118 48 112 110 108 101 103 120 118 101 56 110 101 53 118 119 54 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 109 112 108 101 116 101 67 111 110 115 117 109 101 100 84 120 70 101 101 45 105 114 105 115 45 97 116 116 111] Value:[34 49 54 50 56 56 48 48 48 48 48 48 48 48 48 48 34] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
{
"tags": {
"action": "service-call",
"completeConsumedTxFee-iris-atto": "\"162880000000000\"",
"consumer": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"provider": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"request-id": "230-130-0"
}
}
```

44 changes: 44 additions & 0 deletions docs/cli-client/service/fees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# iriscli service fees

## Description

Query return and incoming fee of a particular address

## Usage

```
iriscli service fees [account address]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| -h, --help | | help for fees | |

## Examples

### Query service fees
```shell
iriscli service fees faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x
```

After that, you will get the service fees by specified address.

```json
{
"returned_fee": [
{
"denom": "iris-atto",
"amount": "10000000000000000"
}
],
"incoming_fee": [
{
"denom": "iris-atto",
"amount": "10000000000000000"
}
]
}
```

37 changes: 37 additions & 0 deletions docs/cli-client/service/refund-fees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# iriscli service refund-fees

## Description

Refund all fees from service return fees

## Usage

```
iriscli service refund-fees [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| -h, --help | | help for refund-fees | |

## Examples

### Refund fees from service return fees
```shell
iriscli service refund-fees --chain-id=test --from=node0 --fee=0.004iris
```

After that, you're done with refunding fees from service return fees.

```txt
Committed at block 450 (tx hash: B423D2D34710DEAA1D88AC376FEAD7935B28E63EEA9EACE6F7A7E654126CF877, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:3398 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 114 101 102 117 110 100 45 102 101 101 115] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 109 112 108 101 116 101 67 111 110 115 117 109 101 100 84 120 70 101 101 45 105 114 105 115 45 97 116 116 111] Value:[34 54 55 57 54 48 48 48 48 48 48 48 48 48 48 48 34] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
{
"tags": {
"action": "service-refund-fees",
"completeConsumedTxFee-iris-atto": "\"679600000000000\""
}
}
```

56 changes: 56 additions & 0 deletions docs/cli-client/service/requests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# iriscli service requests

## Description

Query service requests

## Usage

```
iriscli service requests [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| --def-chain-id | | [string] the ID of the blockchain defined of the service | Yes |
| --service-name | | [string] service name | Yes |
| --bind-chain-id | | [string] the ID of the blockchain bond of the service | Yes |
| --provider | | [string] bech32 encoded account created the service binding | Yes |
| -h, --help | | help for requests | |

## Examples

### Query service request list
```shell
iriscli service requests --def-chain-id=test --service-name=test-service --bind-chain-id=test --provider=faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x
```

After that, you will get the active request list of the specified provider.

```json
[
{
"def_chain_id": "chain-jsmJQQ",
"def_name": "test-service",
"bind_chain_id": "chain-jsmJQQ",
"req_chain_id": "chain-jsmJQQ",
"method_id": 1,
"provider": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"consumer": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"input": "Q0NV",
"service_fee": [
{
"denom": "iris-atto",
"amount": "10000000000000000"
}
],
"profiling": false,
"request_height": "456",
"request_intra_tx_counter": 0,
"expiration_height": "556"
}
]
```

43 changes: 43 additions & 0 deletions docs/cli-client/service/respond.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# iriscli service respond

## Description

Respond a service method invocation

## Usage

```
iriscli service respond [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| --request-chain-id | | [string] the ID of the blockchain that the service invocation initiated | Yes |
| --request-id | | [string] the ID of the service invocation | Yes |
| --response-data | | [string] hex encoded response data of a service invocation | |
| -h, --help | | help for respond | |

## Examples

### Respond to a service invocation
```shell
iriscli service respond --chain-id=test --from=node0 --fee=0.004iris --request-chain-id=test --request-id=230-130-0 --response-data=abcd
```

After that, you're done with responding to a service invocation.

```txt
Committed at block 130 (tx hash: DB40CE593198FC1B112337C613934F4E325F0718770D40616473369090327994, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:8144 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 99 97 108 108] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 113 117 101 115 116 45 105 100] Value:[50 51 48 45 49 51 48 45 48] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[112 114 111 118 105 100 101 114] Value:[102 97 97 49 102 48 50 101 120 116 57 100 117 107 55 104 51 114 120 57 122 109 55 97 118 48 112 110 108 101 103 120 118 101 56 110 101 53 118 119 54 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 110 115 117 109 101 114] Value:[102 97 97 49 102 48 50 101 120 116 57 100 117 107 55 104 51 114 120 57 122 109 55 97 118 48 112 110 108 101 103 120 118 101 56 110 101 53 118 119 54 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 109 112 108 101 116 101 67 111 110 115 117 109 101 100 84 120 70 101 101 45 105 114 105 115 45 97 116 116 111] Value:[34 49 54 50 56 56 48 48 48 48 48 48 48 48 48 48 34] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
{
"tags": {
"action": "service-call",
"completeConsumedTxFee-iris-atto": "\"162880000000000\"",
"consumer": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"provider": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"request-id": "230-130-0"
}
}
```

45 changes: 45 additions & 0 deletions docs/cli-client/service/response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# iriscli service response

## Description

Query a service response

## Usage

```
iriscli service response [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| --request-chain-id | | [string] the ID of the blockchain that the service invocation initiated | Yes |
| --request-id | | [string] the ID of the service invocation | Yes |
| -h, --help | | help for response | |

## Examples

### Query a service response
```shell
iriscli service response --request-chain-id=test --request-id=635-535-0
```

After that, you will get the response by specified parameters.

```json
{
"type": "iris-hub/service/SvcResponse",
"value": {
"req_chain_id": "test",
"request_height": "535",
"request_intra_tx_counter": 0,
"expiration_height": "635",
"provider": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"consumer": "faa1f02ext9duk7h3rx9zm7av0pnlegxve8ne5vw6x",
"output": "q80=",
"error_msg": null
}
}
```

37 changes: 37 additions & 0 deletions docs/cli-client/service/withdraw-fees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# iriscli service withdraw-fees

## Description

Withdraw all fees from service incoming fees

## Usage

```
iriscli service withdraw-fees [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| -h, --help | | help for withdraw-fees | |

## Examples

### Withdraw fees from service incoming fees
```shell
iriscli service withdraw-fees --chain-id=test --from=node0 --fee=0.004iris
```

After that, you're done with withdraw fees from service incoming fees.

```txt
Committed at block 306 (tx hash: 5A4C6E00F4F6BF795EB05D2D388CBA0E8A6E6CF17669314B1EE6A31729A22450, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:3398 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 119 105 116 104 100 114 97 119 45 102 101 101 115] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 109 112 108 101 116 101 67 111 110 115 117 109 101 100 84 120 70 101 101 45 105 114 105 115 45 97 116 116 111] Value:[34 54 55 57 54 48 48 48 48 48 48 48 48 48 48 48 34] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
{
"tags": {
"action": "service-withdraw-fees",
"completeConsumedTxFee-iris-atto": "\"679600000000000\""
}
}
```

10 changes: 9 additions & 1 deletion docs/zh/cli-client/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@ iriscli service [command]
| [bindings](bindings.md) | 查询服务绑定列表 |
| [update-binding](update-binding.md) | 更新一个存在的服务绑定 |
| [disable](disable.md) | 禁用一个可用的服务绑定 |
| [enable](enable.md) | 启用一个不可用的服务绑定 |
| [enable](enable.md) | 启用一个不可用的服务绑定
| [refund-deposit](refund-deposit.md) | 取回所有押金 |
| [call](call.md) | 调用服务方法 |
| [requests](requests.md) | 查询服务请求列表 |
| [respond](respond.md) | 响应服务调用 |
| [response](response.md) | 查询服务响应 |
| [fees](fees.md) | 查询指定地址的服务费退款和收入 |
| [refund-fees](refund-fees.md) | 从服务费退款中退还所有费用 |
| [withdraw-fees](withdraw-fees.md) | 从服务费收入中取回所有费用 |


## 标志

Expand Down
Loading