Skip to main content
Version: 11.x

Abstract Class: PaymasterInterface

Defined in: src/plugins/paymaster/interface.ts:11

Constructors​

Constructor​

new PaymasterInterface(): PaymasterInterface

Returns​

PaymasterInterface

Properties​

nodeUrl​

abstract nodeUrl: string

Defined in: src/plugins/paymaster/interface.ts:12


headers​

abstract headers: object

Defined in: src/plugins/paymaster/interface.ts:14


baseFetch​

abstract readonly baseFetch: (input, init?) => Promise<Response>

Defined in: src/plugins/paymaster/interface.ts:16

MDN Reference

Parameters​

input​

RequestInfo | URL

init?​

RequestInit

Returns​

Promise<Response>

Methods​

isAvailable()​

abstract isAvailable(): Promise<boolean>

Defined in: src/plugins/paymaster/interface.ts:23

Returns the status of the paymaster service

Returns​

Promise<boolean>

If the paymaster service is correctly functioning, return true. Else, return false


buildTransaction()​

abstract buildTransaction(transaction, parameters): Promise<PreparedTransaction>

Defined in: src/plugins/paymaster/interface.ts:33

Receives the transaction the user wants to execute. Returns the typed data along with the estimated gas cost and the maximum gas cost suggested to ensure execution

Parameters​

transaction​

UserTransaction

Transaction to be executed by the paymaster

parameters​

ExecutionParameters

Execution parameters to be used when executing the transaction

Returns​

Promise<PreparedTransaction>

The transaction data required for execution along with an estimation of the fee


executeTransaction()​

abstract executeTransaction(transaction, parameters): Promise<ExecuteResponse>

Defined in: src/plugins/paymaster/interface.ts:45

Sends the signed typed data to the paymaster service for execution

Parameters​

transaction​

ExecutableUserTransaction

Typed data build by calling paymaster_buildTransaction signed by the user to be executed by the paymaster service

parameters​

ExecutionParameters

Execution parameters to be used when executing the transaction

Returns​

Promise<ExecuteResponse>

The hash of the transaction broadcasted by the paymaster and the tracking ID corresponding to the user execute request


getSupportedTokens()​

abstract getSupportedTokens(): Promise<TokenData[]>

Defined in: src/plugins/paymaster/interface.ts:55

Get a list of the tokens that the paymaster supports, together with their prices in STRK

Returns​

Promise<TokenData[]>

An array of token data