Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateHexPrivateKey() (string, string, error)
- func GenerateJSONBQuery(prefix string, start int, data map[string]any) (string, []any)
- func GeneratePrivateKey() (*ecdsa.PrivateKey, error)
- func GetAddressFromContext(ctx context.Context) (string, bool)
- func ParseJSONBFilters(query url.Values, prefix string) map[string]any
- func RandomString(length int) string
- func StringWithCharset(length int, charset string) string
- type ArgType
- type Community
- type CommunityConfig
- type CommunityERC4337
- type CommunityIPFS
- type CommunityIndexer
- type CommunityNode
- type CommunityPlugin
- type CommunityProfile
- type CommunityScan
- type CommunityToken
- type ContextKey
- type EVMRequester
- type EVMType
- type Event
- type JSONRPCError
- type JsonRPCRequest
- type JsonRPCResponse
- type Log
- type LogStatus
- type Message
- type MessageResponse
- type Profile
- type PushDescription
- type PushMessage
- type PushToken
- type RPCHandlerFunc
- type Sponsor
- type Theme
- type Topic
- type Topics
- type UserOp
- type UserOpMessage
- type WSMessage
- type WSMessageCreator
- type WSMessageDataType
- type WSMessageLog
- type WSMessageType
- type WebhookMessager
Constants ¶
const ( // SignatureHeader is the header that contains the signature of the request SignatureHeader = "X-Signature" // AddressHeader is the header that contains the address of the sender AddressHeader = "X-Address" // AppVersionHeader is the header that contains the app version of the sender AppVersionHeader = "X-App-Version" )
const ImplementationStorageSlotKey = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"
const PushMessageAnonymousBody = "%s %s received"
const PushMessageAnonymousDescriptionBody = "%s"
const PushMessageAnonymousDescriptionTitle = "%s %s (%s) received"
success
const PushMessageAnonymousTitle = "%s"
const PushMessageBody = "%s %s received from %s"
const PushMessageSendingAnonymousBody = "Receiving %s %s..."
const PushMessageSendingAnonymousDescriptionBody = "%s"
const PushMessageSendingAnonymousDescriptionTitle = "Receiving %s %s (%s)..."
sending
const PushMessageSendingAnonymousTitle = "%s"
const PushMessageTitle = "%s - %s"
const Version = "0.0.0"
there is no need to change this value manually, it will be replaced by the build system
Variables ¶
var ( // Allowed function signatures FuncSigSingle = crypto.Keccak256([]byte("execute(address,uint256,bytes)"))[:4] FuncSigBatch = crypto.Keccak256([]byte("executeBatch(address[],uint256[],bytes[])"))[:4] FuncSigSafeExecFromModule = crypto.Keccak256([]byte("execTransactionFromModule(address,uint256,bytes,uint8)"))[:4] )
var SafeAbi = `` /* 19398-byte string literal not displayed */
Functions ¶
func GenerateHexPrivateKey ¶
generate a new private key
func GenerateJSONBQuery ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*ecdsa.PrivateKey, error)
generate a new private key
func GetAddressFromContext ¶
get address from context if exists
func RandomString ¶
func StringWithCharset ¶
Types ¶
type CommunityConfig ¶
type CommunityConfig struct { Community Community `json:"community"` Scan CommunityScan `json:"scan"` Indexer CommunityIndexer `json:"indexer"` IPFS CommunityIPFS `json:"ipfs"` Node CommunityNode `json:"node"` ERC4337 CommunityERC4337 `json:"erc4337"` Token CommunityToken `json:"token"` Profile CommunityProfile `json:"profile"` Plugins []CommunityPlugin `json:"plugins,omitempty"` Version int `json:"version"` }
type CommunityERC4337 ¶
type CommunityERC4337 struct { RPCURL string `json:"rpc_url"` PaymasterAddress string `json:"paymaster_address"` EntrypointAddress string `json:"entrypoint_address"` AccountFactoryAddress string `json:"account_factory_address"` PaymasterRPCURL string `json:"paymaster_rpc_url"` PaymasterType string `json:"paymaster_type"` }
type CommunityIPFS ¶
type CommunityIPFS struct {
URL string `json:"url"`
}
type CommunityIndexer ¶
type CommunityNode ¶
type CommunityPlugin ¶
type CommunityProfile ¶
type CommunityProfile struct {
Address string `json:"address"`
}
type CommunityScan ¶
type CommunityToken ¶
type ContextKey ¶
type ContextKey string
const ( ContextKeyAddress ContextKey = AddressHeader ContextKeySignature ContextKey = SignatureHeader )
type EVMRequester ¶
type EVMRequester interface { Context() context.Context Backend() bind.ContractBackend CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) BaseFee() (*big.Int, error) EstimateGasPrice() (*big.Int, error) EstimateGasLimit(msg ethereum.CallMsg) (uint64, error) NewTx(nonce uint64, from, to common.Address, data []byte, extraGas bool) (*types.Transaction, error) SendTransaction(tx *types.Transaction) error StorageAt(addr common.Address, slot common.Hash) ([]byte, error) ChainID() (*big.Int, error) Call(method string, result any, params json.RawMessage) error LatestBlock() (*big.Int, error) FilterLogs(q ethereum.FilterQuery) ([]types.Log, error) BlockTime(number *big.Int) (uint64, error) CallContract(call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) ListenForLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) error WaitForTx(tx *types.Transaction, timeout int) error Close() }
type Event ¶
type Event struct { Contract string `json:"contract"` EventSignature string `json:"event_signature"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Event) ConstructABIFromEventSignature ¶
ConstructABIFromEventSignature constructs an ABI from an event signature Example: Transfer(from address, to address, value uint256) Returns: {"name":"Transfer","type":"event","inputs":[{"name":"from","type":"address","indexed":false},{"name":"to","type":"address","indexed":false},{"name":"value","type":"uint256","indexed":false}]}
Example: Transfer(from indexed address, to indexed address, value uint256) Returns: {"name":"Transfer","type":"event","inputs":[{"name":"from","type":"address", "indexed": true},{"name":"to","type":"address", "indexed": true},{"name":"value","type":"uint256", "indexed": false}]}
func (*Event) GetTopic0FromEventSignature ¶
func (*Event) IsValidData ¶
IsValidData checks if the provided data contains exactly all the argument names returned by ParseEventSignature, plus the "topic" field, no more and no less.
func (*Event) ParseEventSignature ¶
Parse human readable event signature Example: Transfer(address from, address to, uint256 value) Returns: ("Transfer", ["from", "to", "value"], [{Name: "address", Indexed: false}, {Name: "address", Indexed: false}, {Name: "uint256", Indexed: false}])
Example: Transfer(address,address,uint256) Returns: ("Transfer", ["0", "1", "2"], [{Name: "address", Indexed: false}, {Name: "address", Indexed: false}, {Name: "uint256", Indexed: false}])
Example: Transfer(address indexed from, address indexed to, uint256 value) Returns: ("Transfer", ["from", "to", "value"], [{Name: "address", Indexed: true}, {Name: "address", Indexed: true}, {Name: "uint256", Indexed: false}])
Example: Transfer(address indexed, address indexed, uint256) Returns: ("Transfer", ["0", "1", "2"], [{Name: "address", Indexed: true}, {Name: "address", Indexed: true}, {Name: "uint256", Indexed: false}])
Example: Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value) Returns: ("Transfer", ["from", "to", "value"], [{Name: "address", Indexed: true}, {Name: "address", Indexed: true}, {Name: "uint256", Indexed: false}])
type JSONRPCError ¶
type JsonRPCRequest ¶
type JsonRPCRequest struct { Version string `json:"jsonrpc"` ID any `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params"` }
type JsonRPCResponse ¶
type JsonRPCResponse struct { Version string `json:"jsonrpc"` ID any `json:"id"` Result any `json:"result"` Error *JSONRPCError `json:"error,omitempty"` }
type Log ¶
type Log struct { Hash string `json:"hash"` TxHash string `json:"tx_hash"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Nonce int64 `json:"nonce"` Sender string `json:"sender"` To string `json:"to"` Value *big.Int `json:"value"` Data *json.RawMessage `json:"data"` ExtraData *json.RawMessage `json:"extra_data"` Status LogStatus `json:"status"` }
func (*Log) GenerateUniqueHash ¶
generate hash for transfer using a provided index, from, to and the tx hash
func (*Log) GetPoolTopic ¶
func (*Log) MatchesQuery ¶
func (*Log) ToWSMessage ¶
func (l *Log) ToWSMessage(t WSMessageType) *WSMessageLog
type Message ¶
type Message struct { ID string CreatedAt time.Time RetryCount int Message any Response *chan MessageResponse }
func NewTxMessage ¶
func (*Message) WaitForResponse ¶
type MessageResponse ¶
type PushDescription ¶
type PushDescription struct {
Description string `json:"description"`
}
type PushMessage ¶
func NewAnonymousPushMessage ¶
func NewAnonymousPushMessage(token []*PushToken, community, amount, symbol string, tx *Log) *PushMessage
func NewPushMessage ¶
func NewPushMessage(token []*PushToken, community, name, amount, symbol, username string) *PushMessage
func NewSilentPushMessage ¶
func NewSilentPushMessage(token []*PushToken, tx *Log) *PushMessage
type UserOp ¶
type UserOp struct { Sender common.Address `json:"sender" mapstructure:"sender" validate:"required"` Nonce *big.Int `json:"nonce" mapstructure:"nonce" validate:"required"` InitCode []byte `json:"initCode" mapstructure:"initCode" validate:"required"` CallData []byte `json:"callData" mapstructure:"callData" validate:"required"` CallGasLimit *big.Int `json:"callGasLimit" mapstructure:"callGasLimit" validate:"required"` VerificationGasLimit *big.Int `json:"verificationGasLimit" mapstructure:"verificationGasLimit" validate:"required"` PreVerificationGas *big.Int `json:"preVerificationGas" mapstructure:"preVerificationGas" validate:"required"` MaxFeePerGas *big.Int `json:"maxFeePerGas" mapstructure:"maxFeePerGas" validate:"required"` MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas" mapstructure:"maxPriorityFeePerGas" validate:"required"` PaymasterAndData []byte `json:"paymasterAndData" mapstructure:"paymasterAndData" validate:"required"` Signature []byte `json:"signature" mapstructure:"signature" validate:"required"` }
func (*UserOp) MarshalJSON ¶
MarshalJSON returns a JSON encoding of the UserOperation.
func (*UserOp) UnmarshalJSON ¶
UnmarshalJSON parses a JSON encoding of the UserOperation.
type UserOpMessage ¶
type WSMessage ¶
type WSMessage struct { PoolID string `json:"pool_id"` Type WSMessageType `json:"type"` ID string `json:"id"` }
type WSMessageCreator ¶
type WSMessageCreator interface { ToWSMessage(t WSMessageType) *WSMessageLog MatchesQuery(query string) bool }
type WSMessageDataType ¶
type WSMessageDataType string
const (
WSMessageDataTypeLog WSMessageDataType = "log"
)
type WSMessageLog ¶
type WSMessageLog struct { WSMessage DataType WSMessageDataType `json:"data_type"` Data Log `json:"data"` }
type WSMessageType ¶
type WSMessageType string
const ( WSMessageTypeNew WSMessageType = "new" WSMessageTypeUpdate WSMessageType = "update" WSMessageTypeRemove WSMessageType = "remove" )