safe

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context, log logrus.FieldLogger, monitor string, conf *Config) (*client, error)

NewClient creates a new Safe API client

Types

type AddressInfo

type AddressInfo struct {
	Value   string  `json:"value"`
	Name    *string `json:"name"`
	LogoURI *string `json:"logoUri"`
}

type Client

type Client interface {
	// GetQueuedTransactions returns queued transactions for a safe
	GetQueuedTransactions(ctx context.Context, safeAddress string) (*QueuedTransactionsResponse, error)
	// GetTransaction returns details for a specific transaction
	GetTransaction(ctx context.Context, safeAddress, safeTxHash string) (*TransactionDetails, error)
	// GetSafe returns details for a specific safe
	GetSafe(ctx context.Context, safeAddress string) (*SafeResponse, error)
	// SetChainID sets the chain ID for the client
	SetChainID(chainID string)
}

Client exposes Safe API client

type Config

type Config struct {
	Enabled  bool   `yaml:"enabled" default:"true"`
	Endpoint string `yaml:"endpoint" default:"https://safe-client.safe.global"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Confirmation

type Confirmation struct {
	Signer      AddressInfo `json:"signer"`
	Signature   string      `json:"signature"`
	SubmittedAt int64       `json:"submittedAt"`
}

type DataDecoded

type DataDecoded struct {
	Method     string      `json:"method"`
	Parameters []Parameter `json:"parameters"`
}

type DetailedExecutionInfo

type DetailedExecutionInfo struct {
	Type                  string         `json:"type"`
	SubmittedAt           int64          `json:"submittedAt"`
	Nonce                 int            `json:"nonce"`
	SafeTxGas             string         `json:"safeTxGas"`
	BaseGas               string         `json:"baseGas"`
	GasPrice              string         `json:"gasPrice"`
	GasToken              string         `json:"gasToken"`
	RefundReceiver        AddressInfo    `json:"refundReceiver"`
	SafeTxHash            string         `json:"safeTxHash"`
	Executor              *AddressInfo   `json:"executor"`
	Signers               []AddressInfo  `json:"signers"`
	ConfirmationsRequired int            `json:"confirmationsRequired"`
	Confirmations         []Confirmation `json:"confirmations"`
	Rejectors             []AddressInfo  `json:"rejectors"`
	GasTokenInfo          *TokenInfo     `json:"gasTokenInfo"`
	Trusted               bool           `json:"trusted"`
	Proposer              AddressInfo    `json:"proposer"`
	ProposedByDelegate    *string        `json:"proposedByDelegate"`
}

type ExecutionInfo

type ExecutionInfo struct {
	Type                   string        `json:"type"`
	Nonce                  int           `json:"nonce"`
	ConfirmationsRequired  int           `json:"confirmationsRequired"`
	ConfirmationsSubmitted int           `json:"confirmationsSubmitted"`
	MissingSigners         []AddressInfo `json:"missingSigners,omitempty"`
}

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

func GetMetricsInstance

func GetMetricsInstance(namespace, monitorName string) *Metrics

func (Metrics) ObserveRequest

func (m Metrics) ObserveRequest(method, endpoint, path, chainID, safeAddress string)

func (Metrics) ObserveResponse

func (m Metrics) ObserveResponse(method, endpoint, path, code, chainID, safeAddress string, duration time.Duration)

type Parameter

type Parameter struct {
	Name         string      `json:"name"`
	Type         string      `json:"type"`
	Value        interface{} `json:"value"`
	ValueDecoded interface{} `json:"valueDecoded"`
}

type QueuedTransactionResult

type QueuedTransactionResult struct {
	Type         string       `json:"type"`
	Label        *string      `json:"label,omitempty"`
	Transaction  *Transaction `json:"transaction,omitempty"`
	ConflictType *string      `json:"conflictType,omitempty"`
}

type QueuedTransactionsResponse

type QueuedTransactionsResponse struct {
	Count    int                       `json:"count"`
	Next     *string                   `json:"next"`
	Previous *string                   `json:"previous"`
	Results  []QueuedTransactionResult `json:"results"`
}

type SafeAppInfo

type SafeAppInfo struct {
	Name    string `json:"name"`
	URL     string `json:"url"`
	LogoURI string `json:"logoUri"`
}

type SafeResponse added in v0.1.0

type SafeResponse struct {
	Address                    AddressInfo   `json:"address"`
	ChainID                    string        `json:"chainId"`
	Nonce                      int           `json:"nonce"`
	Threshold                  int           `json:"threshold"`
	Owners                     []AddressInfo `json:"owners"`
	Implementation             AddressInfo   `json:"implementation"`
	ImplementationVersionState string        `json:"implementationVersionState"`
	CollectiblesTag            *string       `json:"collectiblesTag"`
	TxQueuedTag                string        `json:"txQueuedTag"`
	TxHistoryTag               string        `json:"txHistoryTag"`
	MessagesTag                *string       `json:"messagesTag"`
	Modules                    *string       `json:"modules"`
	FallbackHandler            *AddressInfo  `json:"fallbackHandler"`
	Guard                      *AddressInfo  `json:"guard"`
	Version                    string        `json:"version"`
}

func (*SafeResponse) CheckSigners added in v0.1.1

func (s *SafeResponse) CheckSigners(signers []string) bool

type TokenInfo

type TokenInfo struct {
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
	LogoURI  string `json:"logoUri"`
}

type Transaction

type Transaction struct {
	ID            string          `json:"id"`
	Timestamp     int64           `json:"timestamp"`
	TxStatus      string          `json:"txStatus"`
	TxInfo        TransactionInfo `json:"txInfo"`
	ExecutionInfo ExecutionInfo   `json:"executionInfo"`
	SafeAppInfo   *SafeAppInfo    `json:"safeAppInfo"`
	TxHash        *string         `json:"txHash"`
}

type TransactionData

type TransactionData struct {
	HexData                   *string                 `json:"hexData"`
	DataDecoded               *DataDecoded            `json:"dataDecoded"`
	To                        AddressInfo             `json:"to"`
	Value                     string                  `json:"value"`
	Operation                 int                     `json:"operation"`
	TrustedDelegateCallTarget *string                 `json:"trustedDelegateCallTarget"`
	AddressInfoIndex          *map[string]AddressInfo `json:"addressInfoIndex"`
}

type TransactionDetails

type TransactionDetails struct {
	SafeAddress           string                `json:"safeAddress"`
	TxID                  string                `json:"txId"`
	ExecutedAt            *string               `json:"executedAt"`
	TxStatus              string                `json:"txStatus"`
	TxInfo                TransactionInfo       `json:"txInfo"`
	TxData                TransactionData       `json:"txData"`
	TxHash                *string               `json:"txHash"`
	DetailedExecutionInfo DetailedExecutionInfo `json:"detailedExecutionInfo"`
	SafeAppInfo           *SafeAppInfo          `json:"safeAppInfo"`
	Note                  *string               `json:"note"`
}

type TransactionInfo

type TransactionInfo struct {
	Type             string        `json:"type"`
	HumanDescription *string       `json:"humanDescription"`
	Sender           AddressInfo   `json:"sender"`
	Recipient        AddressInfo   `json:"recipient"`
	Direction        string        `json:"direction"`
	TransferInfo     *TransferInfo `json:"transferInfo,omitempty"`
}

type TransferInfo

type TransferInfo struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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