Paymaster utilities
Paymaster utilities
The paymaster utilities library contains essential utilities for using paymasters on zkSync Era.
Contract interfaces
IPaymasterFlow
Constant ABI definition for the Paymaster Flow Interface.
IPaymasterFlow := abi.JSON(strings.NewReader(paymasterflow.IPaymasterFlowMetaData.ABI));
Functions
GetApprovalBasedPaymasterInput
Returns encoded input for an approval-based paymaster.
Inputs
Parameter | Type | Description |
---|---|---|
paymasterInput | ApprovalBasedPaymasterInput | The input data to the paymaster. |
func GetApprovalBasedPaymasterInput(paymasterInput types.ApprovalBasedPaymasterInput) ([]byte, error) {
return paymasterFlowAbi.Pack("approvalBased",
paymasterInput.Token,
paymasterInput.MinimalAllowance,
paymasterInput.InnerInput)
}
GetGeneralPaymasterInput
Returns encoded input for a general-based paymaster.
Inputs
Parameter | Type | Description |
---|---|---|
paymasterInput | GeneralPaymasterInput | The input data to the paymaster. |
func GetGeneralPaymasterInput(paymasterInput types.GeneralPaymasterInput) ([]byte, error) {
return paymasterFlowAbi.Pack("general", paymasterInput)
}
GetPaymasterParams
Returns a correctly-formed paymasterParams
object for common paymaster flows.
Inputs
Parameter | Type | Description |
---|---|---|
paymasterAddress | Address | The non-zero paymaster address. |
paymasterInput | PaymasterInput | The input data to the paymaster. |
func GetPaymasterParams(paymasterAddress common.Address, paymasterInput types.PaymasterInput) (*types.PaymasterParams, error)
Find out more about the PaymasterInput
type. Check out the example how to use paymaster.