Class: PaymasterRpc
Implements​
Constructors​
constructor​
• new PaymasterRpc(options?
): PaymasterRpc
Parameters​
Name | Type |
---|---|
options? | PaymasterOptions | PaymasterInterface | PaymasterRpc |
Returns​
Defined in​
Properties​
nodeUrl​
• nodeUrl: string
Implementation of​
Defined in​
headers​
• headers: object
Implementation of​
Defined in​
baseFetch​
• Readonly
baseFetch: (input
: RequestInfo
| URL
, init?
: RequestInit
) => Promise
<Response
>
Type declaration​
â–¸ (input
, init?
): Promise
<Response
>
Parameters​
Name | Type |
---|---|
input | RequestInfo | URL |
init? | RequestInit |
Returns​
Promise
<Response
>
Implementation of​
Defined in​
requestId​
• requestId: number
Defined in​
Methods​
fetch​
â–¸ fetch(method
, params?
, id?
): Promise
<Response
>
Parameters​
Name | Type | Default value |
---|---|---|
method | string | undefined |
params? | object | undefined |
id | string | number | 0 |
Returns​
Promise
<Response
>
Defined in​
errorHandler​
â–¸ errorHandler(method
, params
, rpcError?
, otherError?
): void
Parameters​
Name | Type |
---|---|
method | string |
params | any |
rpcError? | Error |
otherError? | any |
Returns​
void
Defined in​
fetchEndpoint​
â–¸ fetchEndpoint<T
>(method
, params?
): Promise
<Methods
[T
][``"result"``]>
Type parameters​
Name | Type |
---|---|
T | extends keyof ReadMethods | "paymaster_executeTransaction" |
Parameters​
Name | Type |
---|---|
method | T |
params? | Methods [T ][``"params"``] |
Returns​
Promise
<Methods
[T
][``"result"``]>
Defined in​
isAvailable​
â–¸ isAvailable(): Promise
<boolean
>
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
Defined in​
buildTransaction​
â–¸ buildTransaction(transaction
, parameters
): Promise
<PreparedTransaction
>
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​
Name | Type | Description |
---|---|---|
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
Implementation of​
PaymasterInterface.buildTransaction
Defined in​
executeTransaction​
â–¸ executeTransaction(transaction
, parameters
): Promise
<ExecuteResponse
>
Sends the signed typed data to the paymaster service for execution
Parameters​
Name | Type | Description |
---|---|---|
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
Implementation of​
PaymasterInterface.executeTransaction
Defined in​
getSupportedTokens​
â–¸ getSupportedTokens(): Promise
<TokenData
[]>
Get a list of the tokens that the paymaster supports, together with their prices in STRK
Returns​
Promise
<TokenData
[]>
An array of token data
Implementation of​
PaymasterInterface.getSupportedTokens