class BasicRequestClient

A basic request client contract that implements the IOracleClient interface.

Properties

data0

Represents the initial state of a field in a data structure.

{State<Field>}
Signature
data0: State<import("o1js/dist/node/lib/provable/field.js").Field>;

oracleAddress

Represents an Oracle Address.

{State<PublicKey>}
Signature
oracleAddress: State<PublicKey>;

tokenAddress

Represents the token address stored in the state.

{State<PublicKey>}
Signature
tokenAddress: State<PublicKey>;

Methods

init()

Initializes the instance.

This method initializes the instance by calling the 'init' method of the super class, and setting the value of 'this.data0' to 'Field(0)'.

Signature
init(): void;

onFulfillRequest(data0)

Callback method for fulfilling an Oracle request.

Parameters
Name Type Description

data0

Field

The data to fulfill the request with.

Returns

Promise<void>

{Bool} A boolean indicating success (always true in this implementation, potentially requiring verification).

Signature
onFulfillRequest(data0: Field): Promise<void>;

sendErc677RequestTo(req0, req1, req2, req3)

Sends an ERC677 request to the Oracle contract.

Parameters
Name Type Description

req0

Field

The first field of the request.

req1

Field

The second field of the request.

req2

Field

The third field of the request.

req3

Field

The fourth field of the request.

{Bool} - Returns true if the request was successfully sent to the Oracle contract.

Returns

Promise<void>

Signature
sendErc677RequestTo(req0: Field, req1: Field, req2: Field, req3: Field): Promise<void>;

sendOracleRequest(req0, req1, req2, req3)

Sends an Oracle request to the stored Oracle contract.

Parameters
Name Type Description

req0

Field

The first field of the request data.

req1

Field

The second field of the request data.

req2

Field

The third field of the request data.

req3

Field

The fourth field of the request data.

Returns

Promise<void>

{Bool} - A boolean indicating success (determined by the Oracle contract).

Signature
sendOracleRequest(req0: Field, req1: Field, req2: Field, req3: Field): Promise<void>;

sendOracleRequestWithAddr(oracleAddress, req0, req1, req2, req3)

Sends an Oracle request to the stored Oracle contract.

Parameters
Name Type Description

oracleAddress

PublicKey

The new Oracle contract address to set.

req0

Field

The first field of the request data.

req1

Field

The second field of the request data.

req2

Field

The third field of the request data.

req3

Field

The fourth field of the request data.

Returns

Promise<void>

{Bool} - A boolean indicating success (determined by the Oracle contract).

Signature
sendOracleRequestWithAddr(oracleAddress: PublicKey, req0: Field, req1: Field, req2: Field, req3: Field): Promise<void>;

setErc677Token(tokenAddress)

Updates the stored ERC-677 token address associated with this client.

Parameters
Name Type Description

tokenAddress

PublicKey

The new PublicKey of the ERC-677 token. {Bool} - True to indicate successful execution.

Returns

Promise<void>

Signature
setErc677Token(tokenAddress: PublicKey): Promise<void>;

setOracleContract(oracleAddress)

Sets the stored Oracle contract address.

Parameters
Name Type Description

oracleAddress

PublicKey

The new Oracle contract address to set.

Returns

Promise<void>

{Bool} - A boolean indicating success (always true in this implementation).

Signature
setOracleContract(oracleAddress: PublicKey): Promise<void>;
© OpenNautilus 2024-