types

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package types defines types used in admin operations for the Scroll paymaster service.

Package types provides common types and response structures for the Scroll paymaster service.

Package types provides common types and response structures for the Scroll paymaster service.

Index

Constants

View Source
const (
	// Success shows OK.
	Success = 0
	// InternalServerError shows a fatal error in the server
	InternalServerError = 500

	// ParseErrorCode indicates a JSON parsing error
	ParseErrorCode = -32700
	// InvalidRequestCode indicates an invalid JSON-RPC request
	InvalidRequestCode = -32600
	// MethodNotFoundCode indicates that the requested method does not exist
	MethodNotFoundCode = -32601
	// InvalidParamsCode indicates that the parameters provided to the method are invalid
	InvalidParamsCode = -32602

	// UnauthorizedErrorCode indicates that the user is not authorized to perform the action
	UnauthorizedErrorCode = -32000
	// InternalErrorCode indicates an internal server error
	InternalErrorCode = -32001
	// UnsupportedChainIDCode indicates that the chain ID is not supported by the paymaster
	UnsupportedChainIDCode = -32002
	// UnsupportedEntryPointCode indicates that the entry point is not supported by the paymaster
	UnsupportedEntryPointCode = -32003
	// PaymasterDataGenErrorCode indicates an error in generating paymaster data
	PaymasterDataGenErrorCode = -32004
	// UnsupportedTokenErrorCode indicates that the token is not supported by the paymaster
	UnsupportedTokenErrorCode = -32005
	// QuotaExceededErrorCode indicates that the quota for the paymaster has been exceeded
	QuotaExceededErrorCode = -32006

	// PolicyNotFoundCode indicates that the requested policy was not found
	PolicyNotFoundCode = -32100
	// PolicyAlreadyExistsCode indicates that the policy already exists
	PolicyAlreadyExistsCode = -32101
	// PolicyValidationErrorCode indicates that the policy data is invalid
	PolicyValidationErrorCode = -32102

	// JSONRPCVersion is the version of JSON-RPC used
	JSONRPCVersion = "2.0"
)

Variables

This section is empty.

Functions

func SendError

func SendError(c *gin.Context, id interface{}, code int, message string)

SendError sends a JSON-RPC error response

func SendRESTError added in v0.0.10

func SendRESTError(c *gin.Context, code int, message string)

SendRESTError sends a REST API error response

func SendRESTSuccess added in v0.0.10

func SendRESTSuccess(c *gin.Context, result interface{})

SendRESTSuccess sends a REST API success response

func SendSuccess

func SendSuccess(c *gin.Context, id interface{}, result interface{})

SendSuccess sends a JSON-RPC success response

Types

type AdminOperationResponse

type AdminOperationResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

AdminOperationResponse represents the response for admin operations

type GetPaymasterDataResultV7

type GetPaymasterDataResultV7 struct {
	Paymaster     common.Address `json:"paymaster"`
	PaymasterData string         `json:"paymasterData"`
}

GetPaymasterDataResultV7 is the result for pm_getPaymasterData (EntryPoint v0.7).

type GetPaymasterStubDataResultV7

type GetPaymasterStubDataResultV7 struct {
	Paymaster                     common.Address `json:"paymaster"`
	PaymasterData                 string         `json:"paymasterData"`
	PaymasterVerificationGasLimit string         `json:"paymasterVerificationGasLimit,omitempty"` // Optional for v0.7
	PaymasterPostOpGasLimit       string         `json:"paymasterPostOpGasLimit"`                 // Required for v0.7, because paymaster cannot trust the wallet side to provide it
	IsFinal                       bool           `json:"isFinal,omitempty"`
}

GetPaymasterStubDataResultV7 is the result for pm_getPaymasterStubData (EntryPoint v0.7).

type PaymasterJSONRPCRequest

type PaymasterJSONRPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"` // Method parameters, an array for ERC-7677.
	ID      interface{}     `json:"id,omitempty"`
	APIKey  string          `json:"apiKey"`
}

PaymasterJSONRPCRequest represents a JSON-RPC request specific to the paymaster service.

type PaymasterJSONRPCResponse

type PaymasterJSONRPCResponse struct {
	JSONRPC string      `json:"jsonrpc"`
	Result  interface{} `json:"result,omitempty"`
	Error   *RPCError   `json:"error,omitempty"` // Using the same RPCError struct
	ID      interface{} `json:"id"`
}

PaymasterJSONRPCResponse represents a JSON-RPC response specific to the paymaster service.

type PaymasterUserOperationV7

type PaymasterUserOperationV7 struct {
	Sender                        common.Address  `json:"sender"`
	Nonce                         hexutil.Big     `json:"nonce"`
	Factory                       *common.Address `json:"factory,omitempty"`
	FactoryData                   string          `json:"factoryData,omitempty"`
	CallData                      string          `json:"callData"`
	CallGasLimit                  hexutil.Big     `json:"callGasLimit"`
	VerificationGasLimit          hexutil.Big     `json:"verificationGasLimit"`
	PreVerificationGas            hexutil.Big     `json:"preVerificationGas"`
	MaxFeePerGas                  hexutil.Big     `json:"maxFeePerGas"`
	MaxPriorityFeePerGas          hexutil.Big     `json:"maxPriorityFeePerGas"`
	PaymasterVerificationGasLimit *hexutil.Big    `json:"paymasterVerificationGasLimit,omitempty"`
	PaymasterPostOpGasLimit       *hexutil.Big    `json:"paymasterPostOpGasLimit,omitempty"`
}

PaymasterUserOperationV7 defines the UserOperation structure sent to paymaster methods (unsigned), when the context implies an EntryPoint v0.7 interaction.

type PolicyResponse

type PolicyResponse struct {
	PolicyID   int64            `json:"policy_id"`
	PolicyName string           `json:"policy_name"`
	Limits     orm.PolicyLimits `json:"limits"`
	CreatedAt  string           `json:"created_at"`
	UpdatedAt  string           `json:"updated_at"`
}

PolicyResponse represents a policy in API responses

type RPCError

type RPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

RPCError represents a JSON-RPC error object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL