Documentation
¶
Overview ¶
Package evm provides EVM-specific client services for the remote-signer.
Index ¶
- Constants
- Variables
- type AllowedKeyInfo
- type ApproveRequest
- type ApproveResponse
- type CreateHDWalletRequest
- type CreateKeystoreParams
- type CreateRuleRequest
- type CreateSignerRequest
- type DeriveAddressRequest
- type DeriveAddressResponse
- type GuardAPI
- type GuardService
- type HDWalletAPI
- type HDWalletResponse
- type HDWalletService
- func (s *HDWalletService) Create(ctx context.Context, req *CreateHDWalletRequest) (*HDWalletResponse, error)
- func (s *HDWalletService) DeriveAddress(ctx context.Context, primaryAddr string, req *DeriveAddressRequest) (*DeriveAddressResponse, error)
- func (s *HDWalletService) GetSigner(ctx context.Context, primaryAddr string, chainID string, index uint32) (*RemoteSigner, error)
- func (s *HDWalletService) GetSigners(ctx context.Context, primaryAddr string, chainID string, start, count uint32) ([]*RemoteSigner, error)
- func (s *HDWalletService) Import(ctx context.Context, req *CreateHDWalletRequest) (*HDWalletResponse, error)
- func (s *HDWalletService) List(ctx context.Context) (*ListHDWalletsResponse, error)
- func (s *HDWalletService) ListDerived(ctx context.Context, primaryAddr string) (*ListDerivedAddressesResponse, error)
- type HashPayload
- type ListDerivedAddressesResponse
- type ListHDWalletsResponse
- type ListRequestsFilter
- type ListRequestsResponse
- type ListRulesFilter
- type ListRulesResponse
- type ListSignersFilter
- type ListSignersResponse
- type LockSignerResponse
- type MessagePayload
- type PreviewRuleRequest
- type PreviewRuleResponse
- type RawMessagePayload
- type RemoteSigner
- func (s *RemoteSigner) Close() error
- func (s *RemoteSigner) GetAddress() common.Address
- func (s *RemoteSigner) PersonalSign(data string) ([]byte, error)
- func (s *RemoteSigner) PersonalSignWithContext(ctx context.Context, data string) ([]byte, error)
- func (s *RemoteSigner) SignEIP191Message(message string) ([]byte, error)
- func (s *RemoteSigner) SignEIP191MessageWithContext(ctx context.Context, message string) ([]byte, error)
- func (s *RemoteSigner) SignHash(hashedData common.Hash) ([]byte, error)
- func (s *RemoteSigner) SignHashWithContext(ctx context.Context, hashedData common.Hash) ([]byte, error)
- func (s *RemoteSigner) SignRawMessage(raw []byte) ([]byte, error)
- func (s *RemoteSigner) SignRawMessageWithContext(ctx context.Context, raw []byte) ([]byte, error)
- func (s *RemoteSigner) SignTransactionWithChainID(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (s *RemoteSigner) SignTransactionWithChainIDAndContext(ctx context.Context, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (s *RemoteSigner) SignTypedData(typedData eip712.TypedData) ([]byte, error)
- func (s *RemoteSigner) SignTypedDataWithContext(ctx context.Context, typedData eip712.TypedData) ([]byte, error)
- type RemoteSignerAPI
- type RequestAPI
- type RequestService
- func (s *RequestService) Approve(ctx context.Context, requestID string, req *ApproveRequest) (*ApproveResponse, error)
- func (s *RequestService) Get(ctx context.Context, requestID string) (*RequestStatus, error)
- func (s *RequestService) List(ctx context.Context, filter *ListRequestsFilter) (*ListRequestsResponse, error)
- func (s *RequestService) PreviewRule(ctx context.Context, requestID string, req *PreviewRuleRequest) (*PreviewRuleResponse, error)
- type RequestStatus
- type Rule
- type RuleAPI
- type RuleConfig
- type RuleService
- func (s *RuleService) Create(ctx context.Context, req *CreateRuleRequest) (*Rule, error)
- func (s *RuleService) Delete(ctx context.Context, ruleID string) error
- func (s *RuleService) Get(ctx context.Context, ruleID string) (*Rule, error)
- func (s *RuleService) List(ctx context.Context, filter *ListRulesFilter) (*ListRulesResponse, error)
- func (s *RuleService) Toggle(ctx context.Context, ruleID string, enabled bool) (*Rule, error)
- func (s *RuleService) Update(ctx context.Context, ruleID string, req *UpdateRuleRequest) (*Rule, error)
- type Service
- type SignAPI
- type SignError
- type SignRequest
- type SignResponse
- type SignService
- type Signer
- type SignerAPI
- type SignerInfo
- type SignerService
- func (s *SignerService) Create(ctx context.Context, req *CreateSignerRequest) (*Signer, error)
- func (s *SignerService) List(ctx context.Context, filter *ListSignersFilter) (*ListSignersResponse, error)
- func (s *SignerService) Lock(ctx context.Context, address string) (*LockSignerResponse, error)
- func (s *SignerService) Unlock(ctx context.Context, address string, req *UnlockSignerRequest) (*UnlockSignerResponse, error)
- type Transaction
- type TransactionPayload
- type TypedData
- type TypedDataDomain
- type TypedDataField
- type TypedDataPayload
- type UnlockSignerRequest
- type UnlockSignerResponse
- type UpdateRuleRequest
Constants ¶
const ( SignTypeHash = "hash" SignTypeRawMessage = "raw_message" SignTypeEIP191 = "eip191" SignTypePersonal = "personal" SignTypeTypedData = "typed_data" SignTypeTransaction = "transaction" )
Sign types supported by the remote-signer.
const ( StatusPending = "pending" StatusAuthorizing = "authorizing" StatusSigning = "signing" StatusCompleted = "completed" StatusRejected = "rejected" StatusFailed = "failed" )
Request status values.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrSignerNotFound = errors.New("signer not found") ErrInvalidPayload = errors.New("invalid payload") ErrRateLimited = errors.New("rate limited") ErrPendingApproval = errors.New("pending manual approval") ErrRejected = errors.New("request rejected") ErrBlocked = errors.New("request blocked by rule") ErrTimeout = errors.New("timeout waiting for approval") )
Common errors returned by EVM services.
Functions ¶
This section is empty.
Types ¶
type AllowedKeyInfo ¶
type AllowedKeyInfo struct {
ID string `json:"id"`
Name string `json:"name"`
AccessType string `json:"access_type"` // "unrestricted" or "explicit"
}
AllowedKeyInfo represents an API key that has access to a signer (admin view only).
type ApproveRequest ¶
type ApproveRequest struct {
Approved bool `json:"approved"`
RuleType string `json:"rule_type,omitempty"`
RuleMode string `json:"rule_mode,omitempty"`
RuleName string `json:"rule_name,omitempty"`
MaxValue string `json:"max_value,omitempty"`
}
ApproveRequest represents a request to approve a signing request.
type ApproveResponse ¶
type ApproveResponse struct {
RequestID string `json:"request_id"`
Status string `json:"status"`
Signature string `json:"signature,omitempty"`
SignedData string `json:"signed_data,omitempty"`
Message string `json:"message,omitempty"`
GeneratedRule *Rule `json:"generated_rule,omitempty"`
}
ApproveResponse represents the response from an approval request.
type CreateHDWalletRequest ¶
type CreateHDWalletRequest struct {
Action string `json:"action"`
Password string `json:"password"`
Mnemonic string `json:"mnemonic,omitempty"`
EntropyBits int `json:"entropy_bits,omitempty"`
}
CreateHDWalletRequest represents the request to create or import an HD wallet.
type CreateKeystoreParams ¶
type CreateKeystoreParams struct {
Password string `json:"password"`
}
CreateKeystoreParams contains parameters for creating a keystore signer.
type CreateRuleRequest ¶
type CreateRuleRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
Config map[string]interface{} `json:"config"`
Enabled bool `json:"enabled"`
}
CreateRuleRequest represents a request to create a new rule.
type CreateSignerRequest ¶
type CreateSignerRequest struct {
Type string `json:"type"`
Keystore *CreateKeystoreParams `json:"keystore,omitempty"`
}
CreateSignerRequest represents a request to create a new signer.
type DeriveAddressRequest ¶
type DeriveAddressRequest struct {
Index *uint32 `json:"index,omitempty"`
Start *uint32 `json:"start,omitempty"`
Count *uint32 `json:"count,omitempty"`
}
DeriveAddressRequest represents the request to derive address(es).
type DeriveAddressResponse ¶
type DeriveAddressResponse struct {
Derived []SignerInfo `json:"derived"`
}
DeriveAddressResponse represents the response from deriving addresses.
type GuardService ¶
type GuardService struct {
// contains filtered or unexported fields
}
GuardService handles the approval guard.
type HDWalletAPI ¶
type HDWalletAPI interface {
Create(ctx context.Context, req *CreateHDWalletRequest) (*HDWalletResponse, error)
Import(ctx context.Context, req *CreateHDWalletRequest) (*HDWalletResponse, error)
List(ctx context.Context) (*ListHDWalletsResponse, error)
DeriveAddress(ctx context.Context, primaryAddr string, req *DeriveAddressRequest) (*DeriveAddressResponse, error)
ListDerived(ctx context.Context, primaryAddr string) (*ListDerivedAddressesResponse, error)
GetSigner(ctx context.Context, primaryAddr string, chainID string, index uint32) (*RemoteSigner, error)
GetSigners(ctx context.Context, primaryAddr string, chainID string, start, count uint32) ([]*RemoteSigner, error)
}
HDWalletAPI defines the HD wallet management operations interface.
type HDWalletResponse ¶
type HDWalletResponse struct {
PrimaryAddress string `json:"primary_address"`
BasePath string `json:"base_path"`
DerivedCount int `json:"derived_count"`
Derived []SignerInfo `json:"derived,omitempty"`
Locked bool `json:"locked"` // true when wallet exists on disk but is not unlocked
}
HDWalletResponse represents an HD wallet in API responses.
type HDWalletService ¶
type HDWalletService struct {
// contains filtered or unexported fields
}
HDWalletService handles HD wallet management operations.
func (*HDWalletService) Create ¶
func (s *HDWalletService) Create(ctx context.Context, req *CreateHDWalletRequest) (*HDWalletResponse, error)
Create creates a new HD wallet.
func (*HDWalletService) DeriveAddress ¶
func (s *HDWalletService) DeriveAddress(ctx context.Context, primaryAddr string, req *DeriveAddressRequest) (*DeriveAddressResponse, error)
DeriveAddress derives a single address from an HD wallet.
func (*HDWalletService) GetSigner ¶
func (s *HDWalletService) GetSigner(ctx context.Context, primaryAddr string, chainID string, index uint32) (*RemoteSigner, error)
GetSigner derives (if needed) the address at the given index and returns a *RemoteSigner.
func (*HDWalletService) GetSigners ¶
func (s *HDWalletService) GetSigners(ctx context.Context, primaryAddr string, chainID string, start, count uint32) ([]*RemoteSigner, error)
GetSigners derives a batch of addresses and returns []*RemoteSigner.
func (*HDWalletService) Import ¶
func (s *HDWalletService) Import(ctx context.Context, req *CreateHDWalletRequest) (*HDWalletResponse, error)
Import imports an HD wallet from a mnemonic.
func (*HDWalletService) List ¶
func (s *HDWalletService) List(ctx context.Context) (*ListHDWalletsResponse, error)
List lists all HD wallets.
func (*HDWalletService) ListDerived ¶
func (s *HDWalletService) ListDerived(ctx context.Context, primaryAddr string) (*ListDerivedAddressesResponse, error)
ListDerived lists all derived addresses for an HD wallet.
type HashPayload ¶
type HashPayload struct {
Hash string `json:"hash"`
}
HashPayload represents the payload for hash signing.
type ListDerivedAddressesResponse ¶
type ListDerivedAddressesResponse struct {
Derived []SignerInfo `json:"derived"`
}
ListDerivedAddressesResponse represents the response from listing derived addresses.
type ListHDWalletsResponse ¶
type ListHDWalletsResponse struct {
Wallets []HDWalletResponse `json:"wallets"`
}
ListHDWalletsResponse represents the response from listing HD wallets.
type ListRequestsFilter ¶
type ListRequestsFilter struct {
Status string
SignerAddress string
ChainID string
Limit int
Cursor *string
CursorID *string
}
ListRequestsFilter contains filter options for listing requests.
type ListRequestsResponse ¶
type ListRequestsResponse struct {
Requests []RequestStatus `json:"requests"`
Total int `json:"total"`
NextCursor *string `json:"next_cursor,omitempty"`
NextCursorID *string `json:"next_cursor_id,omitempty"`
HasMore bool `json:"has_more"`
}
ListRequestsResponse represents the response from listing requests.
type ListRulesFilter ¶
type ListRulesFilter struct {
ChainType string
SignerAddress string
APIKeyID string
Type string
Mode string
Enabled *bool
Limit int
Offset int
}
ListRulesFilter contains filter options for listing rules.
type ListRulesResponse ¶
ListRulesResponse represents the response from listing rules.
type ListSignersFilter ¶
ListSignersFilter contains filter options for listing signers.
type ListSignersResponse ¶
type ListSignersResponse struct {
Signers []Signer `json:"signers"`
Total int `json:"total"`
HasMore bool `json:"has_more"`
}
ListSignersResponse represents the response from listing signers.
type LockSignerResponse ¶
type LockSignerResponse = Signer
LockSignerResponse represents the response after locking a signer.
type MessagePayload ¶
type MessagePayload struct {
Message string `json:"message"`
}
MessagePayload represents the payload for EIP-191/personal signing.
type PreviewRuleRequest ¶
type PreviewRuleRequest struct {
RuleType string `json:"rule_type"`
RuleMode string `json:"rule_mode"`
RuleName string `json:"rule_name,omitempty"`
MaxValue string `json:"max_value,omitempty"`
}
PreviewRuleRequest represents a request to preview a rule for approval.
type PreviewRuleResponse ¶
type PreviewRuleResponse struct {
Rule Rule `json:"rule"`
}
PreviewRuleResponse represents a rule preview for an approval.
type RawMessagePayload ¶
type RawMessagePayload struct {
RawMessage []byte `json:"raw_message"`
}
RawMessagePayload represents the payload for raw message signing.
type RemoteSigner ¶
type RemoteSigner struct {
// contains filtered or unexported fields
}
RemoteSigner implements ethsig signer interfaces by making remote calls to the signing service.
func NewRemoteSigner ¶
func NewRemoteSigner(sign *SignService, address common.Address, chainID string) *RemoteSigner
NewRemoteSigner creates a new RemoteSigner that uses the given SignService.
func (*RemoteSigner) Close ¶
func (s *RemoteSigner) Close() error
Close is a no-op for RemoteSigner.
func (*RemoteSigner) GetAddress ¶
func (s *RemoteSigner) GetAddress() common.Address
GetAddress returns the signer's address.
func (*RemoteSigner) PersonalSign ¶
func (s *RemoteSigner) PersonalSign(data string) ([]byte, error)
PersonalSign signs data using personal_sign (EIP-191 0x45).
func (*RemoteSigner) PersonalSignWithContext ¶
PersonalSignWithContext signs data using personal_sign with context.
func (*RemoteSigner) SignEIP191Message ¶
func (s *RemoteSigner) SignEIP191Message(message string) ([]byte, error)
SignEIP191Message signs an EIP-191 formatted message.
func (*RemoteSigner) SignEIP191MessageWithContext ¶
func (s *RemoteSigner) SignEIP191MessageWithContext(ctx context.Context, message string) ([]byte, error)
SignEIP191MessageWithContext signs an EIP-191 formatted message with context.
func (*RemoteSigner) SignHash ¶
func (s *RemoteSigner) SignHash(hashedData common.Hash) ([]byte, error)
SignHash signs pre-hashed data (32 bytes).
func (*RemoteSigner) SignHashWithContext ¶
func (s *RemoteSigner) SignHashWithContext(ctx context.Context, hashedData common.Hash) ([]byte, error)
SignHashWithContext signs pre-hashed data with context.
func (*RemoteSigner) SignRawMessage ¶
func (s *RemoteSigner) SignRawMessage(raw []byte) ([]byte, error)
SignRawMessage signs raw message bytes.
func (*RemoteSigner) SignRawMessageWithContext ¶
SignRawMessageWithContext signs raw message bytes with context.
func (*RemoteSigner) SignTransactionWithChainID ¶
func (s *RemoteSigner) SignTransactionWithChainID(tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
SignTransactionWithChainID signs an Ethereum transaction with explicit chain ID.
func (*RemoteSigner) SignTransactionWithChainIDAndContext ¶
func (s *RemoteSigner) SignTransactionWithChainIDAndContext(ctx context.Context, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
SignTransactionWithChainIDAndContext signs an Ethereum transaction with context.
func (*RemoteSigner) SignTypedData ¶
func (s *RemoteSigner) SignTypedData(typedData eip712.TypedData) ([]byte, error)
SignTypedData signs EIP-712 typed data.
func (*RemoteSigner) SignTypedDataWithContext ¶
func (s *RemoteSigner) SignTypedDataWithContext(ctx context.Context, typedData eip712.TypedData) ([]byte, error)
SignTypedDataWithContext signs EIP-712 typed data with context.
type RemoteSignerAPI ¶
type RemoteSignerAPI interface {
NewRemoteSigner(sign *SignService, address common.Address, chainID string) *RemoteSigner
}
RemoteSignerAPI defines the interface for creating remote signers.
type RequestAPI ¶
type RequestAPI interface {
Get(ctx context.Context, requestID string) (*RequestStatus, error)
List(ctx context.Context, filter *ListRequestsFilter) (*ListRequestsResponse, error)
Approve(ctx context.Context, requestID string, req *ApproveRequest) (*ApproveResponse, error)
PreviewRule(ctx context.Context, requestID string, req *PreviewRuleRequest) (*PreviewRuleResponse, error)
}
RequestAPI defines the request management operations interface.
type RequestService ¶
type RequestService struct {
// contains filtered or unexported fields
}
RequestService handles signing request operations.
func (*RequestService) Approve ¶
func (s *RequestService) Approve(ctx context.Context, requestID string, req *ApproveRequest) (*ApproveResponse, error)
Approve approves or rejects a pending signing request.
func (*RequestService) Get ¶
func (s *RequestService) Get(ctx context.Context, requestID string) (*RequestStatus, error)
Get gets the status of a signing request.
func (*RequestService) List ¶
func (s *RequestService) List(ctx context.Context, filter *ListRequestsFilter) (*ListRequestsResponse, error)
List lists signing requests with optional filters using cursor-based pagination.
func (*RequestService) PreviewRule ¶
func (s *RequestService) PreviewRule(ctx context.Context, requestID string, req *PreviewRuleRequest) (*PreviewRuleResponse, error)
PreviewRule previews the rule that would be generated for a pending request.
type RequestStatus ¶
type RequestStatus struct {
ID string `json:"id"`
APIKeyID string `json:"api_key_id"`
ChainType string `json:"chain_type"`
ChainID string `json:"chain_id"`
SignerAddress string `json:"signer_address"`
SignType string `json:"sign_type"`
Status string `json:"status"`
Payload json.RawMessage `json:"payload,omitempty"`
Signature string `json:"signature,omitempty"`
SignedData string `json:"signed_data,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
RuleMatchedID *string `json:"rule_matched_id,omitempty"`
RuleMatchedName *string `json:"rule_matched_name,omitempty"`
ApprovedBy *string `json:"approved_by,omitempty"`
ApprovedAt *time.Time `json:"approved_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
RequestStatus represents the status of a sign request.
type Rule ¶
type Rule struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
Source string `json:"source"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
Config RuleConfig `json:"config,omitempty"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
MatchCount uint64 `json:"match_count"`
LastMatchedAt *time.Time `json:"last_matched_at,omitempty"`
}
Rule represents an authorization rule.
type RuleAPI ¶
type RuleAPI interface {
List(ctx context.Context, filter *ListRulesFilter) (*ListRulesResponse, error)
Get(ctx context.Context, ruleID string) (*Rule, error)
Create(ctx context.Context, req *CreateRuleRequest) (*Rule, error)
Update(ctx context.Context, ruleID string, req *UpdateRuleRequest) (*Rule, error)
Delete(ctx context.Context, ruleID string) error
Toggle(ctx context.Context, ruleID string, enabled bool) (*Rule, error)
}
RuleAPI defines the rule CRUD operations interface.
type RuleConfig ¶
type RuleConfig json.RawMessage
RuleConfig represents the configuration for a rule.
func (RuleConfig) MarshalJSON ¶
func (r RuleConfig) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*RuleConfig) UnmarshalJSON ¶
func (r *RuleConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RuleService ¶
type RuleService struct {
// contains filtered or unexported fields
}
RuleService handles rule CRUD operations.
func (*RuleService) Create ¶
func (s *RuleService) Create(ctx context.Context, req *CreateRuleRequest) (*Rule, error)
Create creates a new authorization rule.
func (*RuleService) Delete ¶
func (s *RuleService) Delete(ctx context.Context, ruleID string) error
Delete deletes a rule by ID.
func (*RuleService) List ¶
func (s *RuleService) List(ctx context.Context, filter *ListRulesFilter) (*ListRulesResponse, error)
List lists authorization rules with optional filters.
func (*RuleService) Update ¶
func (s *RuleService) Update(ctx context.Context, ruleID string, req *UpdateRuleRequest) (*Rule, error)
Update updates an existing authorization rule.
type Service ¶
type Service struct {
Sign *SignService
Requests *RequestService
Rules *RuleService
Signers *SignerService
HDWallets *HDWalletService
Guard *GuardService
}
Service groups all EVM-related sub-services.
func NewService ¶
NewService creates a new EVM service group.
type SignAPI ¶
type SignAPI interface {
Execute(ctx context.Context, req *SignRequest) (*SignResponse, error)
ExecuteAsync(ctx context.Context, req *SignRequest) (*SignResponse, error)
}
SignAPI defines the signing operations interface.
type SignRequest ¶
type SignRequest struct {
ChainID string `json:"chain_id"`
SignerAddress string `json:"signer_address"`
SignType string `json:"sign_type"`
Payload json.RawMessage `json:"payload"`
}
SignRequest represents a signing request to the remote-signer service.
type SignResponse ¶
type SignResponse struct {
RequestID string `json:"request_id"`
Status string `json:"status"`
Signature string `json:"signature,omitempty"`
SignedData string `json:"signed_data,omitempty"`
Message string `json:"message,omitempty"`
RuleMatched string `json:"rule_matched_id,omitempty"`
}
SignResponse represents the response from a signing request.
type SignService ¶
type SignService struct {
// PollInterval is the interval between status checks when waiting for approval.
PollInterval time.Duration
// PollTimeout is the maximum time to wait for approval.
PollTimeout time.Duration
// contains filtered or unexported fields
}
SignService handles signing operations.
func (*SignService) Execute ¶
func (s *SignService) Execute(ctx context.Context, req *SignRequest) (*SignResponse, error)
Execute submits a signing request and waits for the result. If the request requires manual approval, this method will poll until completed or timeout.
func (*SignService) ExecuteAsync ¶
func (s *SignService) ExecuteAsync(ctx context.Context, req *SignRequest) (*SignResponse, error)
ExecuteAsync submits a signing request and returns immediately. If the request requires approval, returns the pending status with a SignError.
func (*SignService) SetPolling ¶
func (s *SignService) SetPolling(interval, timeout time.Duration)
SetPolling configures polling parameters.
type Signer ¶
type Signer struct {
Address string `json:"address"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
Locked bool `json:"locked"`
AllowedKeys []AllowedKeyInfo `json:"allowed_keys,omitempty"`
}
Signer represents a signer configuration.
type SignerAPI ¶
type SignerAPI interface {
List(ctx context.Context, filter *ListSignersFilter) (*ListSignersResponse, error)
Create(ctx context.Context, req *CreateSignerRequest) (*Signer, error)
Unlock(ctx context.Context, address string, req *UnlockSignerRequest) (*UnlockSignerResponse, error)
Lock(ctx context.Context, address string) (*LockSignerResponse, error)
}
SignerAPI defines the signer management operations interface.
type SignerInfo ¶
type SignerInfo struct {
Address string `json:"address"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
Locked bool `json:"locked"`
}
SignerInfo represents a signer in API responses (used by HD wallets).
type SignerService ¶
type SignerService struct {
// contains filtered or unexported fields
}
SignerService handles signer management operations.
func (*SignerService) Create ¶
func (s *SignerService) Create(ctx context.Context, req *CreateSignerRequest) (*Signer, error)
Create creates a new signer (admin only).
func (*SignerService) List ¶
func (s *SignerService) List(ctx context.Context, filter *ListSignersFilter) (*ListSignersResponse, error)
List lists available signers with optional filters.
func (*SignerService) Lock ¶
func (s *SignerService) Lock(ctx context.Context, address string) (*LockSignerResponse, error)
Lock locks an unlocked signer (admin only).
func (*SignerService) Unlock ¶
func (s *SignerService) Unlock(ctx context.Context, address string, req *UnlockSignerRequest) (*UnlockSignerResponse, error)
Unlock unlocks a locked signer (admin only).
type Transaction ¶
type Transaction struct {
To *string `json:"to,omitempty"`
Value string `json:"value"`
Data string `json:"data,omitempty"`
Nonce *uint64 `json:"nonce,omitempty"`
Gas uint64 `json:"gas"`
GasPrice string `json:"gasPrice,omitempty"`
GasTipCap string `json:"gasTipCap,omitempty"`
GasFeeCap string `json:"gasFeeCap,omitempty"`
TxType string `json:"txType"`
}
Transaction represents an Ethereum transaction for signing.
type TransactionPayload ¶
type TransactionPayload struct {
Transaction *Transaction `json:"transaction"`
}
TransactionPayload represents the payload for transaction signing.
type TypedData ¶
type TypedData struct {
Types map[string][]TypedDataField `json:"types"`
PrimaryType string `json:"primaryType"`
Domain TypedDataDomain `json:"domain"`
Message map[string]interface{} `json:"message"`
}
TypedData represents EIP-712 typed data structure.
type TypedDataDomain ¶
type TypedDataDomain struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
ChainId string `json:"chainId,omitempty"`
VerifyingContract string `json:"verifyingContract,omitempty"`
Salt string `json:"salt,omitempty"`
}
TypedDataDomain represents the EIP-712 domain separator.
type TypedDataField ¶
TypedDataField represents a field in EIP-712 types.
type TypedDataPayload ¶
type TypedDataPayload struct {
TypedData *TypedData `json:"typed_data"`
}
TypedDataPayload represents the payload for EIP-712 typed data signing.
type UnlockSignerRequest ¶
type UnlockSignerRequest struct {
Password string `json:"password"`
}
UnlockSignerRequest represents a request to unlock a locked signer.
type UnlockSignerResponse ¶
type UnlockSignerResponse = Signer
UnlockSignerResponse represents the response after unlocking a signer.