Documentation ¶
Index ¶
- Constants
- Variables
- func Body(w http.ResponseWriter, body any, meta any) error
- func BodyMultiple(w http.ResponseWriter, body any, meta any) error
- func ChecksumAddress(addr string) string
- func Decrypt(encryptedValue string, key string) (string, error)
- func Encrypt(secretValue string, key string) (string, error)
- func Filter[T any](slice []T, f func(T) bool) []T
- func GenerateKey() ([]byte, error)
- func GetContextAddress(ctx context.Context) (string, bool)
- func HexToBigInt(hex string) *big.Int
- func HexToPrivateKey(privateKeyHex string) (*ecdsa.PrivateKey, error)
- func IsSameHexAddress(a, b string) bool
- func JSONRPCBody(w http.ResponseWriter, id any, body any, meta any, err error) error
- func JSONRPCMultiBody(w http.ResponseWriter, ids []any, bodies []any, meta any, errs []error) error
- func ParseDestinationFromCallData(calldata []byte) (common.Address, error)
- func ParseERC20Transfer(calldata []byte, evm engine.EVMRequester) (common.Address, common.Address, common.Address, *big.Int, error)
- func Remove[T any](slice []T, index int) []T
- func ShortenName(s string, length int) string
- func StreamedBody(w http.ResponseWriter, body string) error
- type AddressResponse
- type ImageFormat
- type Nonce
- type Pagination
- type Response
- type ResponseType
- type SizedImages
Constants ¶
const CardManagerABI = `` /* 2731-byte string literal not displayed */
Variables ¶
var ( ErrInvalidCalldata = errors.New("invalid calldata") ErrNotTransfer = errors.New("not a transfer") )
Functions ¶
func BodyMultiple ¶
func BodyMultiple(w http.ResponseWriter, body any, meta any) error
func ChecksumAddress ¶
func Decrypt ¶
Decrypt takes an encrypted value and a key, decrypts the value using AES-CFB, and returns the decrypted value as a string.
Parameters:
- encryptedValue: The hex-encoded string of the encrypted value
- key: The decryption key as a hex-encoded string
Returns:
- The decrypted string
- An error if decryption fails
func Encrypt ¶
Encrypt takes a secret value and a key, encrypts the value using AES-CFB, and returns the encrypted value as a hex-encoded string.
Parameters:
- secretValue: The string to be encrypted
- key: The encryption key as a hex-encoded string
Returns:
- A hex-encoded string of the encrypted value
- An error if encryption fails
func GenerateKey ¶
func GetContextAddress ¶
GetContextAddress returns the indexer.ContextKeyAddress from the context
func HexToBigInt ¶
func HexToPrivateKey ¶
func HexToPrivateKey(privateKeyHex string) (*ecdsa.PrivateKey, error)
func IsSameHexAddress ¶
func JSONRPCBody ¶
func JSONRPCMultiBody ¶
func ParseERC20Transfer ¶
func ParseERC20Transfer(calldata []byte, evm engine.EVMRequester) (common.Address, common.Address, common.Address, *big.Int, error)
ParseERC20Transfer parses the calldata of an ERC20 transfer from a smart contract Execute function
func ShortenName ¶
func StreamedBody ¶
func StreamedBody(w http.ResponseWriter, body string) error
Types ¶
type AddressResponse ¶
type AddressResponse struct {
Address string `json:"address"`
}
type ImageFormat ¶
type ImageFormat string
const ( JPG ImageFormat = "jpg" JPEG ImageFormat = "jpeg" PNG ImageFormat = "png" GIF ImageFormat = "gif" WEBP ImageFormat = "webp" )
type Nonce ¶
func NewNonce ¶
GenerateNonce generates a nonce which is a unique number that can only be used once. This nonce is a uint256 composed of a uint64 and a uint192. The uin192 contains an epoch timestamp in the last 10 digits
func ParseNonce ¶
ParseNonce parses a nonce from a big.Int containing a uint256 with the first 64 bits being the key and the last 192 bits being the seq.
type Pagination ¶
type Response ¶
type Response struct { // The response type // in: body ResponseType ResponseType `json:"response_type"` Object any `json:"object,omitempty"` Array any `json:"array,omitempty"` Meta any `json:"meta,omitempty"` }
Response is the default response object swagger:response defaultResponse
type ResponseType ¶
type ResponseType string
const ( ResponseTypeObject ResponseType = "object" ResponseTypeArray ResponseType = "array" ResponseTypeSecure ResponseType = "secure" )
type SizedImages ¶
func ParseImage ¶
func ParseImage(file multipart.File) (*SizedImages, error)