postWeb3RpcByChain method

Future<RpcOut?> postWeb3RpcByChain(
  1. String chain,
  2. RpcIn rpcIn
)

Forwards a JSON-RPC call to the named chain and returns its answer unchanged.

Forwards a JSON-RPC call to the named chain and returns its answer unchanged. Only declared chains are reachable, and only to a caller with a validated principal — this is the deployment's upstream, not an open relay.

Parameters:

  • String chain (required): Chain is the registry id, from the URL.

  • RpcIn rpcIn (required):

Implementation

Future<RpcOut?> postWeb3RpcByChain(String chain, RpcIn rpcIn,) async {
  final response = await postWeb3RpcByChainWithHttpInfo(chain, rpcIn,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'RpcOut',) as RpcOut;

  }
  return null;
}