common

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractPermitData

type ContractPermitData struct {
	FromToken              string
	Spender                string
	Name                   string
	Version                string
	PublicAddress          string
	ChainId                int
	Nonce                  int64
	Deadline               int64
	Amount                 *big.Int
	IsDomainWithoutVersion bool
}

type ContractPermitDataDaiLike

type ContractPermitDataDaiLike struct {
	FromToken              string
	Spender                string
	Name                   string
	Version                string
	Holder                 string
	ChainId                int
	Nonce                  int64
	Expiry                 int64
	Allowed                bool
	IsDomainWithoutVersion bool
}

type HttpExecutor

type HttpExecutor interface {
	ExecuteRequest(ctx context.Context, payload RequestPayload, v interface{}) error
}

type RequestPayload

type RequestPayload struct {
	Method string
	Params interface{}
	U      string
	Body   []byte
}

type TransactionBuilder

type TransactionBuilder interface {
	SetData(d []byte) TransactionBuilder
	SetNonce(uint64) TransactionBuilder
	SetGasPrice(*big.Int) TransactionBuilder
	SetGas(uint64) TransactionBuilder
	SetValue(*big.Int) TransactionBuilder
	SetTo(*gethCommon.Address) TransactionBuilder
	SetGasTipCap(*big.Int) TransactionBuilder
	SetGasFeeCap(*big.Int) TransactionBuilder

	BuildLegacyTx(context.Context) (*types.Transaction, error)
	BuildDynamicTx(context.Context) (*types.Transaction, error)
	Build(context.Context) (*types.Transaction, error)
}

type TransactionBuilderFactory

type TransactionBuilderFactory interface {
	New() TransactionBuilder
}

type Wallet

type Wallet interface {
	Call(ctx context.Context, contractAddress gethCommon.Address, callData []byte) ([]byte, error)

	Nonce(ctx context.Context) (uint64, error)
	Address() gethCommon.Address
	Balance(ctx context.Context) (*big.Int, error)

	GetGasTipCap(ctx context.Context) (*big.Int, error)
	GetGasPrice(ctx context.Context) (*big.Int, error)

	Sign(tx *types.Transaction) (*types.Transaction, error)
	SignBytes(data []byte) ([]byte, error)
	BroadcastTransaction(ctx context.Context, tx *types.Transaction) error
	TransactionReceipt(ctx context.Context, txHash gethCommon.Hash) (*types.Receipt, error)

	GetContractDetailsForPermit(ctx context.Context, token gethCommon.Address, spender gethCommon.Address, amount *big.Int, deadline int64) (*ContractPermitData, error)
	GetContractDetailsForPermitDaiLike(ctx context.Context, token gethCommon.Address, spender gethCommon.Address, deadline int64) (*ContractPermitDataDaiLike, error)
	TokenPermit(cd ContractPermitData) (string, error)
	TokenPermitDaiLike(cd ContractPermitDataDaiLike) (string, error)

	IsEIP1559Applicable() bool
	ChainId() int64
}

Jump to

Keyboard shortcuts

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