Skip to content

Class: BoopClient

Defined in: packages/boop-sdk/lib/client.ts:35

Constructors

Constructor

new BoopClient(config?: Partial<BoopClientConfig>): BoopClient;

Defined in: packages/boop-sdk/lib/client.ts:39

Parameters

config?

Partial<BoopClientConfig>

Returns

BoopClient

Methods

createAccount()

createAccount(data: CreateAccountInput): Promise<CreateAccountOutput>;

Defined in: packages/boop-sdk/lib/client.ts:57

Create a new HappyAccount. If the account already exists, it will be returned.

Parameters

data

CreateAccountInput

Returns

Promise<CreateAccountOutput>


execute()

execute(data: ExecuteInput): Promise<ExecuteOutput>;

Defined in: packages/boop-sdk/lib/client.ts:108

Given a boop, submits it onchain to be executed, waits for and returns the result of execution.

Unless data.boop.account === data.boop.payer, the gas limit fields and fee fields can be omitted and will be filled by the submitter.

If the gas limits are provided, the submitter is free to perform or not perform simulation before submitting.

The submitter is nonce-aware and will buffer up to a certain amount of boop per nonce track, depending on its configuration. It will submit boop whenever their nonces becomes eligible.

Parameters

data

ExecuteInput

Returns

Promise<ExecuteOutput>


getNonce()

getNonce(data: GetNonceInput): Promise<GetNonceOutput>;

Defined in: packages/boop-sdk/lib/client.ts:65

Fetches an accounts nonce.

Parameters

data

GetNonceInput

Returns

Promise<GetNonceOutput>


getPending()

getPending(__namedParameters: GetPendingInput): Promise<GetPendingOutput>;

Defined in: packages/boop-sdk/lib/client.ts:176

Returns a list of pending (not yet included on chain) boops for the given account, identified by their hash and nonce.

Parameters

__namedParameters

GetPendingInput

Returns

Promise<GetPendingOutput>


getState()

getState(data: GetStateInput): Promise<GetStateOutput>;

Defined in: packages/boop-sdk/lib/client.ts:153

Returns the state of the Boop as known by the submitter.

Depending on the submitter's state retention policies, he might not be able to answer this query, even if he did see the Boop before. In this case he should answer with a status of GetState.UnknownBoop.

Parameters

data

GetStateInput

Returns

Promise<GetStateOutput>


simulate()

simulate(data: SimulateInput): Promise<SimulateOutput>;

Defined in: packages/boop-sdk/lib/client.ts:126

Given a boop possibly missing some gas limits or gas fee parameters, returns estimates for these limits and parameters, and the result of simulation.

Note that the boop is also allowed to be different in some way than the one for which the gas values will be used, e.g. for accounts that validate a signature, the validationData could be empty or include a dummy value.

If any gas limit is specified, it is passed along as-is during simulation and not filled in by the submitter.

Calling this endpoint does not create a state for the Boop on the submitter.

Parameters

data

SimulateInput

Returns

Promise<SimulateOutput>


submit()

submit(data: SubmitInput): Promise<SubmitOutput>;

Defined in: packages/boop-sdk/lib/client.ts:90

Given a boop, sends it to the submitter which will either accept it and return its hash, or fail with a rejection status.

The submitter is nonce-aware and will buffer up to a certain amount of boop per nonce track, depending on its configuration. It will submit boops whenever their nonces becomes eligible.

The submitter will then attempt to submit the transaction onchain. The state of the Boop can be queried with submitter_state.

If the gas limits are provided, the submitter is free to perform or not perform simulation before submitting.

If the submitter already has a pending Boop with the same nonce for this account, it will cancel the existing one on the condition that the new Boop passes validation. It can also impose additional restrictions, such as requesting a higher submitterFee for the replacement transaction.

Parameters

data

SubmitInput

Returns

Promise<SubmitOutput>


updateBoopFromSimulation()

updateBoopFromSimulation(boop: Boop, simulation: SimulateSuccess): Boop;

Defined in: packages/boop-sdk/lib/client.ts:134

Utility function to accept a successful simulation and return the boop with updated gas values.

Parameters

boop

Boop

simulation

SimulateSuccess

Returns

Boop


waitForReceipt()

waitForReceipt(data: WaitForReceiptInput): Promise<WaitForReceiptOutput>;

Defined in: packages/boop-sdk/lib/client.ts:166

Instructs the return the receipt of the boop whose hash is provided, waiting if needed.

It may also return earlier if a user-specified or submitter-mandated timeout is reached.

The submitter can return without a receipt if the Boop submission failed for other reasons.

Parameters

data

WaitForReceiptInput

Returns

Promise<WaitForReceiptOutput>