Skip to content

Commit

Permalink
Merge pull request #45 from multiversx/queries
Browse files Browse the repository at this point in the history
Queries: controller and resources
  • Loading branch information
andreibancioiu authored Mar 4, 2024
2 parents b9c6864 + 141cc69 commit adf3683
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions sdk-core/smart_contract_queries_controller.md
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];
```
19 changes: 19 additions & 0 deletions sdk-core/smart_contract_query.md
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];
```

0 comments on commit adf3683

Please sign in to comment.