-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from multiversx/queries
Queries: controller and resources
- Loading branch information
Showing
2 changed files
with
42 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,23 @@ | ||
## SmartContractQueriesController | ||
|
||
``` | ||
class SmartContractQueriesController: | ||
// The constructor is not captured by the specs; it's up to the implementing library to define it. | ||
// Generally speaking, the constructor can be parametrized with an `Abi` or `Codec` instance (implementation detail), necessary to decode contract return data. | ||
// Additionally, it can either be parametrized with a network provider, or some other facility to run contract queries against the network. | ||
// If `Abi` or `Codec` is available, this function encodes the input arguments accordingly. | ||
create_query({ | ||
contract: string; | ||
caller?: string; | ||
value?: Amount; | ||
function: string; | ||
arguments: List[any]; | ||
}): SmartContractQuery; | ||
// Runs the query against the network and returns the raw (encoded) response. | ||
run_query(query: SmartContractQuery): SmartContractQueryResponse; | ||
// Decodes the raw (encoded) response and returns the parsed result. | ||
parse_query_response(response: SmartContractQueryResponse): List[any]; | ||
``` |
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,19 @@ | ||
## SmartContractQuery | ||
|
||
``` | ||
dto SmartContractQuery: | ||
contract: string; | ||
caller?: string; | ||
value?: Amount; | ||
function: string; | ||
arguments: List[bytes]; | ||
``` | ||
|
||
## SmartContractQueryResponse | ||
|
||
``` | ||
dto SmartContractQueryResponse: | ||
return_code: string; | ||
return_message: string; | ||
return_data_parts: List[bytes]; | ||
``` |