Skip to content

Class: BoopClient

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

Constructors

Constructor

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

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

Parameters

config?

Partial<BoopClientConfig>

Returns

BoopClient

Methods

computeBoopHash()

computeBoopHash(chainId: number, boop: {
  account: `0x${string}`;
  callData: `0x${string}`;
  dest: `0x${string}`;
  executeGasLimit?: number;
  extraData: `0x${string}`;
  gasLimit?: number;
  maxFeePerGas?: bigint;
  nonceTrack: bigint;
  nonceValue: bigint;
  payer: `0x${string}`;
  submitterFee?: bigint;
  validateGasLimit?: number;
  validatePaymentGasLimit?: number;
  validatorData: `0x${string}`;
  value: bigint;
}): `0x${string}`;

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

Computes a boop hash, which is compute over a Boop and the chain ID.

Parameters

chainId

number

boop
account

`0x${string}`

callData

`0x${string}`

dest

`0x${string}`

executeGasLimit?

number

extraData

`0x${string}`

gasLimit?

number

maxFeePerGas?

bigint

nonceTrack

bigint

nonceValue

bigint

payer

`0x${string}`

submitterFee?

bigint

validateGasLimit?

number

validatePaymentGasLimit?

number

validatorData

`0x${string}`

value

bigint

Returns

`0x${string}`


createAccount()

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

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

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

Parameters

data

CreateAccountInput

Returns

Promise<CreateAccountOutput>


decode()

decode(boop: `0x${string}`): Boop;

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

Decodes a Hex encoded Boop.

Parameters

boop

`0x${string}`

Returns

Boop


encode()

encode(boop: {
  account: `0x${string}`;
  callData: `0x${string}`;
  dest: `0x${string}`;
  executeGasLimit?: number;
  extraData: `0x${string}`;
  gasLimit?: number;
  maxFeePerGas?: bigint;
  nonceTrack: bigint;
  nonceValue: bigint;
  payer: `0x${string}`;
  submitterFee?: bigint;
  validateGasLimit?: number;
  validatePaymentGasLimit?: number;
  validatorData: `0x${string}`;
  value: bigint;
}): `0x${string}`;

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

Encodes a Boop into the encoded Hex form for onchain submission.

Parameters

boop
account

`0x${string}`

callData

`0x${string}`

dest

`0x${string}`

executeGasLimit?

number

extraData

`0x${string}`

gasLimit?

number

maxFeePerGas?

bigint

nonceTrack

bigint

nonceValue

bigint

payer

`0x${string}`

submitterFee?

bigint

validateGasLimit?

number

validatePaymentGasLimit?

number

validatorData

`0x${string}`

value

bigint

Returns

`0x${string}`


execute()

execute(data: {
  boop: {
     account: `0x${string}`;
     callData: `0x${string}`;
     dest: `0x${string}`;
     executeGasLimit?: number;
     extraData: `0x${string}`;
     gasLimit?: number;
     maxFeePerGas?: bigint;
     nonceTrack: bigint;
     nonceValue: bigint;
     payer: `0x${string}`;
     submitterFee?: bigint;
     validateGasLimit?: number;
     validatePaymentGasLimit?: number;
     validatorData: `0x${string}`;
     value: bigint;
  };
  entryPoint?: `0x${string}`;
  timeout?: number;
}): Promise<ExecuteOutput>;

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

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
boop

{ account: `0x${string}`; callData: `0x${string}`; dest: `0x${string}`; executeGasLimit?: number; extraData: `0x${string}`; gasLimit?: number; maxFeePerGas?: bigint; nonceTrack: bigint; nonceValue: bigint; payer: `0x${string}`; submitterFee?: bigint; validateGasLimit?: number; validatePaymentGasLimit?: number; validatorData: `0x${string}`; value: bigint; }

boop.account

`0x${string}`

boop.callData

`0x${string}`

boop.dest

`0x${string}`

boop.executeGasLimit?

number

boop.extraData

`0x${string}`

boop.gasLimit?

number

boop.maxFeePerGas?

bigint

boop.nonceTrack

bigint

boop.nonceValue

bigint

boop.payer

`0x${string}`

boop.submitterFee?

bigint

boop.validateGasLimit?

number

boop.validatePaymentGasLimit?

number

boop.validatorData

`0x${string}`

boop.value

bigint

entryPoint?

`0x${string}`

timeout?

number

Returns

Promise<ExecuteOutput>


getNonce()

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

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

Fetches an accounts nonce.

Parameters

data

GetNonceInput

Returns

Promise<GetNonceOutput>


getPending()

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

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

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:161

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:134

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: {
  boop: {
     account: `0x${string}`;
     callData: `0x${string}`;
     dest: `0x${string}`;
     executeGasLimit?: number;
     extraData: `0x${string}`;
     gasLimit?: number;
     maxFeePerGas?: bigint;
     nonceTrack: bigint;
     nonceValue: bigint;
     payer: `0x${string}`;
     submitterFee?: bigint;
     validateGasLimit?: number;
     validatePaymentGasLimit?: number;
     validatorData: `0x${string}`;
     value: bigint;
  };
  entryPoint?: `0x${string}`;
}): Promise<SubmitOutput>;

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

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
boop

{ account: `0x${string}`; callData: `0x${string}`; dest: `0x${string}`; executeGasLimit?: number; extraData: `0x${string}`; gasLimit?: number; maxFeePerGas?: bigint; nonceTrack: bigint; nonceValue: bigint; payer: `0x${string}`; submitterFee?: bigint; validateGasLimit?: number; validatePaymentGasLimit?: number; validatorData: `0x${string}`; value: bigint; }

boop.account

`0x${string}`

boop.callData

`0x${string}`

boop.dest

`0x${string}`

boop.executeGasLimit?

number

boop.extraData

`0x${string}`

boop.gasLimit?

number

boop.maxFeePerGas?

bigint

boop.nonceTrack

bigint

boop.nonceValue

bigint

boop.payer

`0x${string}`

boop.submitterFee?

bigint

boop.validateGasLimit?

number

boop.validatePaymentGasLimit?

number

boop.validatorData

`0x${string}`

boop.value

bigint

entryPoint?

`0x${string}`

Returns

Promise<SubmitOutput>


updateBoopFromSimulation()

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

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

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:174

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>