zeroex

package module
v0.0.0-...-b5ef136 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECSignature

type ECSignature struct {
	V byte
	R common.Hash
	S common.Hash
}

ECSignature contains the parameters of an elliptic curve signature

func (ECSignature) Bytes

func (ecSignature ECSignature) Bytes() []byte

Bytes generates 0x EthSign Signature (append the signature type byte) data

type KeyedSigner

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

KeyedSigner is a signer that produces an `eth_sign`-compatible signature locally using a private key

func (*KeyedSigner) EthSign

func (s *KeyedSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)

EthSign mimicks the signing of `eth_sign` locally its supplied private key

func (*KeyedSigner) GetSignerAddress

func (s *KeyedSigner) GetSignerAddress() common.Address

GetSignerAddress returns the signerAddress corresponding to Signer's private key

type KeystoreSigner

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

KeystoreSigner is a signer that produces an `eth_sign`-compatible signature locally using a private key

func (*KeystoreSigner) EthSign

func (l *KeystoreSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)

type Order

type Order struct {
	ChainID               *big.Int       `json:"chainId"`
	ExchangeAddress       common.Address `json:"exchangeAddress"`
	MakerAddress          common.Address `json:"makerAddress"`
	MakerAssetData        []byte         `json:"makerAssetData"`
	MakerFeeAssetData     []byte         `json:"makerFeeAssetData"`
	MakerAssetAmount      *big.Int       `json:"makerAssetAmount"`
	MakerFee              *big.Int       `json:"makerFee"`
	TakerAddress          common.Address `json:"takerAddress"`
	TakerAssetData        []byte         `json:"takerAssetData"`
	TakerFeeAssetData     []byte         `json:"takerFeeAssetData"`
	TakerAssetAmount      *big.Int       `json:"takerAssetAmount"`
	TakerFee              *big.Int       `json:"takerFee"`
	SenderAddress         common.Address `json:"senderAddress"`
	FeeRecipientAddress   common.Address `json:"feeRecipientAddress"`
	ExpirationTimeSeconds *big.Int       `json:"expirationTimeSeconds"`
	Salt                  *big.Int       `json:"salt"`
	// contains filtered or unexported fields
}

Order represents an unsigned 0x order

func (*Order) ComputeOrderHash

func (o *Order) ComputeOrderHash() (common.Hash, error)

ComputeOrderHash computes a 0x order hash

type SignatureType

type SignatureType uint8

SignatureType represents the type of 0x signature encountered

const (
	IllegalSignature SignatureType = iota
	InvalidSignature
	EIP712Signature
	EthSignSignature
	WalletSignature
	ValidatorSignature
	PreSignedSignature
	EIP1271WalletSignature
	NSignatureTypesSignature
)

SignatureType values

type SignedOrder

type SignedOrder struct {
	Order
	Signature []byte `json:"signature"`
}

SignedOrder represents a signed 0x order

func SignOrder

func SignOrder(signer Signer, order *Order) (*SignedOrder, error)

SignOrder signs the 0x order with the supplied Signer.

func (SignedOrder) MarshalJSON

func (s SignedOrder) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the SignedOrder type

func (*SignedOrder) UnmarshalJSON

func (s *SignedOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaller for the SignedOrder type

type SignedOrderJSON

type SignedOrderJSON struct {
	ChainID               int64  `json:"chainId"`
	ExchangeAddress       string `json:"exchangeAddress"`
	MakerAddress          string `json:"makerAddress"`
	MakerAssetData        string `json:"makerAssetData"`
	MakerFeeAssetData     string `json:"makerFeeAssetData"`
	MakerAssetAmount      string `json:"makerAssetAmount"`
	MakerFee              string `json:"makerFee"`
	TakerAddress          string `json:"takerAddress"`
	TakerAssetData        string `json:"takerAssetData"`
	TakerFeeAssetData     string `json:"takerFeeAssetData"`
	TakerAssetAmount      string `json:"takerAssetAmount"`
	TakerFee              string `json:"takerFee"`
	SenderAddress         string `json:"senderAddress"`
	FeeRecipientAddress   string `json:"feeRecipientAddress"`
	ExpirationTimeSeconds string `json:"expirationTimeSeconds"`
	Salt                  string `json:"salt"`
	Signature             string `json:"signature"`
}

SignedOrderJSON is an unmodified JSON representation of a SignedOrder

type Signer

type Signer interface {
	EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)
}

Signer defines the methods needed to act as a elliptic curve signer

func NewKeystoreSigner

func NewKeystoreSigner(keystore *keystore.KeyStore) Signer

NewKeystoreSigner instantiates a new KeystoreSigner

func NewSigner

func NewSigner(privateKey *ecdsa.PrivateKey) Signer

NewSigner instantiates a new Signer

Jump to

Keyboard shortcuts

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