Class: PaymasterRpc
Defined in: src/paymaster/rpc.ts:75
Implements
Constructors
Constructor
new PaymasterRpc(
options?):PaymasterRpc
Defined in: src/paymaster/rpc.ts:84
Parameters
options?
PaymasterOptions | PaymasterInterface | PaymasterRpc
Returns
PaymasterRpc
Properties
nodeUrl
nodeUrl:
string
Defined in: src/paymaster/rpc.ts:76
Implementation of
headers
headers:
object
Defined in: src/paymaster/rpc.ts:78
Implementation of
baseFetch
readonlybaseFetch: (input,init?) =>Promise<Response>
Defined in: src/paymaster/rpc.ts:80
Parameters
input
RequestInfo | URL
init?
RequestInit
Returns
Promise<Response>
Implementation of
requestId
requestId:
number
Defined in: src/paymaster/rpc.ts:82
Methods
fetch()
fetch(
method,params?,id?):Promise<Response>
Defined in: src/paymaster/rpc.ts:114
Parameters
method
string
params?
object
id?
string | number
Returns
Promise<Response>
errorHandler()
protectederrorHandler(method,params,rpcError?,otherError?):void
Defined in: src/paymaster/rpc.ts:128
Parameters
method
string
params
any
rpcError?
otherError?
any
Returns
void
fetchEndpoint()
protectedfetchEndpoint<T>(method,params?):Promise<Methods[T]["result"]>
Defined in: src/paymaster/rpc.ts:140
Type Parameters
T
T extends keyof ReadMethods | "paymaster_executeTransaction"
Parameters
method
T
params?
Methods[T]["params"]
Returns
Promise<Methods[T]["result"]>
isAvailable()
isAvailable():
Promise<boolean>
Defined in: src/paymaster/rpc.ts:156
Returns the status of the paymaster service
Returns
Promise<boolean>
If the paymaster service is correctly functioning, return true. Else, return false
Implementation of
PaymasterInterface.isAvailable
buildTransaction()
buildTransaction(
transaction,parameters):Promise<PreparedTransaction>
Defined in: src/paymaster/rpc.ts:160
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
Transaction to be executed by the paymaster
parameters
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
Implementation of
PaymasterInterface.buildTransaction
executeTransaction()
executeTransaction(
transaction,parameters):Promise<ExecuteResponse>
Defined in: src/paymaster/rpc.ts:238
Sends the signed typed data to the paymaster service for execution
Parameters
transaction
Typed data build by calling paymaster_buildTransaction signed by the user to be executed by the paymaster service
parameters
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
Implementation of
PaymasterInterface.executeTransaction
getSupportedTokens()
getSupportedTokens():
Promise<TokenData[]>
Defined in: src/paymaster/rpc.ts:282
Get a list of the tokens that the paymaster supports, together with their prices in STRK
Returns
Promise<TokenData[]>
An array of token data