-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4fe121
commit fc1e8d3
Showing
1 changed file
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# ICRC-34: Batch Calling | ||
|
||
[![Status Badge](https://img.shields.io/badge/STATUS-DRAFT-ffcc00.svg)](https://github.com/orgs/dfinity/projects/31) | ||
[![Extension Badge](https://img.shields.io/badge/Extends-ICRC--25-ffcc222.svg)](./icrc_25_signer_interaction_standard.md) | ||
|
||
<!-- TOC --> | ||
* [ICRC-34: Batch Calling](#icrc-34-batch-call) | ||
* [Summary](#summary) | ||
* [Method](#method) | ||
* [Scope (according to the ICRC-25 standard)](#scope-according-to-the-icrc-25-standard) | ||
* [Example RPC Request ](#example-rpc-request-permission) | ||
* [Request](#request) | ||
* [Example RPC Request ](#example-rpc-request) | ||
* [Response](#response) | ||
* [Example RPC Response ](#example-rpc-response) | ||
* [Message Processing](#message-processing) | ||
* [Errors](#errors) | ||
|
||
## Summary | ||
|
||
JSON-RPC defines a [batch call](https://www.jsonrpc.org/specification#batch) as a JSON array of requests. All methods defined in this standard may also be invoked as part of a batch. | ||
|
||
If a signer receives a batch call, it must process each request sequentially in order of the id and reply with a batch response. Calls resulting in error responses do not prevent the processing of subsequent calls in the batch. | ||
|
||
## Method | ||
|
||
**Name:** `icrc34_batch_call` | ||
|
||
**Prerequisite:** Active session with granted permission scope `icrc33_call_canister` or `*`. | ||
* This scope may be restricted to specific target canister ids and/or sender principals. | ||
|
||
## Scope (according to the [ICRC-25 standard](./icrc_25_signer_interaction_standard.md)) | ||
|
||
**Scope:** `icrc34_batch_call` | ||
|
||
### Example RPC Request Permission | ||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"method": "icrc25_request_permissions", | ||
"params": { | ||
"version": "1", | ||
"scopes": [ | ||
{ | ||
"method": "icrc34_batch_call", | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## Request | ||
|
||
**`version` (`text`):** The version of the standard used. If the signer does not support the version of the request, it must send the `"VERSION_NOT_SUPPORTED"` error in response. | ||
|
||
### Example RPC Request | ||
|
||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"method": "icrc34_batch_call", | ||
"params": { | ||
"version": "1", | ||
"methods": [ | ||
{ | ||
"method": "greet", | ||
"arg": ["Hello"] | ||
}, | ||
{ | ||
"method": "hello", | ||
"arg": { "hello": "World"} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### Example RPC Response | ||
|
||
```json | ||
{ | ||
"id": 1, | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"version": "1", | ||
"methods:" { | ||
"greet": { | ||
"result": "Hello", | ||
}, | ||
"hello": { | ||
"result": "World", | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Message Processing | ||
|
||
TODO: Add message processing details | ||
|
||
## Errors | ||
|
||
See [ICRC-25](./icrc_25_signer_interaction_standard.md#errors-3) for a list of errors that can be returned by all methods. |