safe

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChainIDToName = map[string]string{
	"1":        "eth",
	"11155111": "sep",
	"560048":   "hod",
}

ChainIDToName maps chain IDs to their Safe API chain names.

Functions

func NewClient

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

NewClient creates a new Safe Transaction Service API client.

Types

type Client

type Client interface {
	// GetQueuedTransactions returns queued transactions for a safe.
	GetQueuedTransactions(ctx context.Context, safeAddress string) (*MultisigTransactionsResponse, error)
	// GetTransaction returns details for a specific transaction.
	GetTransaction(ctx context.Context, safeTxHash string) (*MultisigTransaction, error)
	// GetSafe returns details for a specific safe.
	GetSafe(ctx context.Context, safeAddress string) (*SafeResponse, error)
	// SetChain sets the chain name for the client.
	SetChain(chain string)
}

Client exposes Safe Transaction Service API client.

type Config

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

Config holds configuration for the Safe API client.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the Safe configuration.

type Confirmation

type Confirmation struct {
	Owner          string `json:"owner"`
	SubmissionDate string `json:"submissionDate"`
	Signature      string `json:"signature"`
	SignatureType  string `json:"signatureType"`
}

Confirmation represents a transaction confirmation.

type DataDecoded

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

DataDecoded represents decoded transaction data.

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 MultisigTransaction added in v0.3.3

type MultisigTransaction struct {
	Safe                  string         `json:"safe"`
	To                    string         `json:"to"`
	Value                 string         `json:"value"`
	Data                  *string        `json:"data"`
	Operation             int            `json:"operation"`
	SafeTxHash            string         `json:"safeTxHash"`
	Nonce                 int            `json:"nonce"`
	SubmissionDate        string         `json:"submissionDate"`
	IsExecuted            bool           `json:"isExecuted"`
	ConfirmationsRequired int            `json:"confirmationsRequired"`
	Confirmations         []Confirmation `json:"confirmations"`
	DataDecoded           *DataDecoded   `json:"dataDecoded"`
	Proposer              string         `json:"proposer"`
	Origin                string         `json:"origin"`
	Trusted               bool           `json:"trusted"`
}

MultisigTransaction represents a multisig transaction from the Transaction Service API. Used for both list and detail endpoints.

type MultisigTransactionsResponse added in v0.3.3

type MultisigTransactionsResponse struct {
	Count            int                   `json:"count"`
	Next             *string               `json:"next"`
	Previous         *string               `json:"previous"`
	Results          []MultisigTransaction `json:"results"`
	CountUniqueNonce int                   `json:"countUniqueNonce"`
}

MultisigTransactionsResponse represents the response from /multisig-transactions/?executed=false.

type Parameter

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

Parameter represents a decoded parameter from transaction data.

type SafeResponse added in v0.1.0

type SafeResponse struct {
	Address         string   `json:"address"`
	Nonce           int64    `json:"nonce,string"`
	Threshold       int      `json:"threshold"`
	Owners          []string `json:"owners"`
	MasterCopy      string   `json:"masterCopy"`
	Modules         []string `json:"modules"`
	FallbackHandler string   `json:"fallbackHandler"`
	Guard           string   `json:"guard"`
	Version         *string  `json:"version"`
}

SafeResponse represents the response from /safes/{address}/.

func (*SafeResponse) CheckSigners added in v0.1.1

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

CheckSigners verifies that the provided signers match the Safe owners.

Jump to

Keyboard shortcuts

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