Client

Client

new Client()

Generate a class from the contract spec that where each contract method gets included with an identical name.

Each method returns an AssembledTransaction that can be used to modify, simulate, decode results, and possibly sign, & submit the transaction.

Source:

Methods

(async, static) from(options)

Generates a Client instance from the provided ClientOptions, which must include the contractId and rpcUrl.

Source:
Parameters:
Name Type Description
options

The ClientOptions object containing the necessary configuration, including the contractId and rpcUrl.

Throws:

If the provided options object does not contain both rpcUrl and contractId.

Type
TypeError
Returns:

A Promise that resolves to a Client instance.

(async, static) fromWasm(wasm, options)

Generates a Client instance from the provided ClientOptions and the contract's wasm binary.

Source:
Parameters:
Name Type Description
wasm

The contract's wasm binary as a Buffer.

options

The ClientOptions object containing the necessary configuration.

Throws:

If the contract spec cannot be obtained from the provided wasm binary.

Type
Error
Returns:

A Promise that resolves to a Client instance.

(async, static) fromWasmHash(wasmHash, options, format)

Generates a Client instance from the provided ClientOptions and the contract's wasm hash. The wasmHash can be provided in either hex or base64 format.

Source:
Parameters:
Name Type Default Description
wasmHash

The hash of the contract's wasm binary, in either hex or base64 format.

options

The ClientOptions object containing the necessary configuration, including the rpcUrl.

format hex

The format of the provided wasmHash, either "hex" or "base64". Defaults to "hex".

Throws:

If the provided options object does not contain an rpcUrl.

Type
TypeError
Returns:

A Promise that resolves to a Client instance.