gateway

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenABI is the input ABI used to generate the binding from.
	MultiSendContractAddress = "0x96AF6B6c38636512075754066327d96F5cEDc81c"
	GWEIDecimal              = 9
	ETHDecimal               = 18
	ETHDerivationPath        = "m/44'/60'/0'/0/0"
)
View Source
const (
	BIPDecimal = 18.0
)

Variables

View Source
var (
	MaxUint256 = big.NewInt(0).Sub(big.NewInt(0).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1))
)

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	IsValidAddress(ctx context.Context, address string) bool
	NewWallet(ctx context.Context) (Wallet, error)
	FindWallet(ctx context.Context, privateKey string) (Wallet, error)
	GetBalance(ctx context.Context, address string) (map[string]float64, error)
	EstimateSendFee(ctx context.Context, w Wallet, coin string, amount float64, address string) (float64, error)
	Send(ctx context.Context, w Wallet, coin string, amount float64, address string) (string, error)
	EstimateMultiSendFee(ctx context.Context, w Wallet, coin string, addresses []string, amounts []float64) (float64, error)
	MultiSend(ctx context.Context, w Wallet, coin string, addresses []string, amounts []float64) (string, error)
	Subscribe(ctx context.Context, consumer EventConsumer) error
	IsTransactionComplete(ctx context.Context, hash string) bool
	Unsubscribe()
}

type CryptoHub

type CryptoHub struct {
	BlockChains map[string]Adapter
}

func NewCryptoHub

func NewCryptoHub(blockChains map[string]Adapter) *CryptoHub

func (*CryptoHub) EstimateMultiSendFee added in v0.0.3

func (ch *CryptoHub) EstimateMultiSendFee(ctx context.Context, baseCoin string, w Wallet, coin string, addresses []string, amounts []float64) (float64, error)

func (*CryptoHub) EstimateSendFee added in v0.0.3

func (ch *CryptoHub) EstimateSendFee(ctx context.Context, baseCoin string, w Wallet, coin string, amount float64, address string) (float64, error)

func (*CryptoHub) FindWallet added in v0.0.7

func (ch *CryptoHub) FindWallet(ctx context.Context, baseCoin string, privateKey string) (Wallet, error)

func (*CryptoHub) GetBalance

func (ch *CryptoHub) GetBalance(ctx context.Context, baseCoin string, address string) (map[string]float64, error)

func (*CryptoHub) IsTransactionComplete added in v0.0.21

func (ch *CryptoHub) IsTransactionComplete(ctx context.Context, baseCoin string, hash string) bool

func (*CryptoHub) IsValidAddress added in v0.0.13

func (ch *CryptoHub) IsValidAddress(ctx context.Context, baseCoin string, address string) bool

func (*CryptoHub) MultiSend

func (ch *CryptoHub) MultiSend(ctx context.Context, baseCoin string, w Wallet, coin string, addresses []string, amounts []float64) (string, error)

func (*CryptoHub) MustEstimateMultiSendFee added in v0.0.4

func (ch *CryptoHub) MustEstimateMultiSendFee(ctx context.Context, baseCoin string, w Wallet, coin string, addresses []string, amounts []float64) float64

func (*CryptoHub) MustEstimateSendFee added in v0.0.4

func (ch *CryptoHub) MustEstimateSendFee(ctx context.Context, baseCoin string, w Wallet, coin string, amount float64, address string) float64

func (*CryptoHub) MustFindWallet added in v0.0.7

func (ch *CryptoHub) MustFindWallet(ctx context.Context, baseCoin string, privateKey string) Wallet

func (*CryptoHub) MustGetBalance added in v0.0.4

func (ch *CryptoHub) MustGetBalance(ctx context.Context, baseCoin string, address string) map[string]float64

func (*CryptoHub) MustMultiSend added in v0.0.4

func (ch *CryptoHub) MustMultiSend(ctx context.Context, baseCoin string, w Wallet, coin string, addresses []string, amounts []float64) string

func (*CryptoHub) MustNewWallet added in v0.0.4

func (ch *CryptoHub) MustNewWallet(ctx context.Context, baseCoin string) Wallet

func (*CryptoHub) MustSend added in v0.0.4

func (ch *CryptoHub) MustSend(ctx context.Context, baseCoin string, w Wallet, coin string, amount float64, address string) string

func (*CryptoHub) NewWallet

func (ch *CryptoHub) NewWallet(ctx context.Context, baseCoin string) (Wallet, error)

func (*CryptoHub) Send

func (ch *CryptoHub) Send(ctx context.Context, baseCoin string, w Wallet, coin string, amount float64, address string) (string, error)

func (*CryptoHub) Subscribe added in v0.0.15

func (ch *CryptoHub) Subscribe(ctx context.Context, baseCoin string, consumer EventConsumer) error

func (*CryptoHub) SubscribeAll added in v0.0.15

func (ch *CryptoHub) SubscribeAll(ctx context.Context, consumer EventConsumer) error

func (*CryptoHub) Unsubscribe added in v0.0.15

func (ch *CryptoHub) Unsubscribe(_ context.Context, baseCoin string) error

func (*CryptoHub) UnsubscribeAll added in v0.0.15

func (ch *CryptoHub) UnsubscribeAll()

type EthereumAdapter added in v0.0.3

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

func NewEthereumAdapter added in v0.0.3

func NewEthereumAdapter(ethereumClient *ethclient.Client, gasPriceGwei float64) *EthereumAdapter

func (*EthereumAdapter) ApproveTokenMultisend added in v0.0.5

func (ea *EthereumAdapter) ApproveTokenMultisend(ctx context.Context, w Wallet, coin string) (string, error)

func (*EthereumAdapter) ConfigureTransactionContract added in v0.0.4

func (ea *EthereumAdapter) ConfigureTransactionContract(
	ctx context.Context,
	w Wallet,
	feePerc uint8,
	internalFeePerc uint8,
	rewardPerc uint8,
	affiliatesPerc []uint8,
	partnersPerc []uint8,
	partnersWallets []string,
) ([]string, error)

func (*EthereumAdapter) DeployMultiSendContract added in v0.0.4

func (ea *EthereumAdapter) DeployMultiSendContract(ctx context.Context, w Wallet) (string, string, error)

func (*EthereumAdapter) EstimateMultiSendFee added in v0.0.3

func (ea *EthereumAdapter) EstimateMultiSendFee(ctx context.Context, w Wallet, coin string, addresses []string, amounts []float64) (float64, error)

func (*EthereumAdapter) EstimateSendFee added in v0.0.3

func (ea *EthereumAdapter) EstimateSendFee(ctx context.Context, w Wallet, coin string, amount float64, address string) (float64, error)

func (*EthereumAdapter) FindWallet added in v0.0.7

func (ea *EthereumAdapter) FindWallet(_ context.Context, privateKey string) (Wallet, error)

func (*EthereumAdapter) GetBalance added in v0.0.3

func (ea *EthereumAdapter) GetBalance(ctx context.Context, address string) (map[string]float64, error)

func (*EthereumAdapter) IsTransactionComplete added in v0.0.21

func (ea *EthereumAdapter) IsTransactionComplete(ctx context.Context, hash string) bool

func (*EthereumAdapter) IsValidAddress added in v0.0.13

func (ea *EthereumAdapter) IsValidAddress(_ context.Context, address string) bool

func (*EthereumAdapter) MultiSend added in v0.0.3

func (ea *EthereumAdapter) MultiSend(ctx context.Context, w Wallet, coin string, addresses []string, amounts []float64) (string, error)

func (*EthereumAdapter) NewWallet added in v0.0.3

func (ea *EthereumAdapter) NewWallet(_ context.Context) (Wallet, error)

func (*EthereumAdapter) Send added in v0.0.3

func (ea *EthereumAdapter) Send(ctx context.Context, w Wallet, coin string, amount float64, address string) (string, error)

func (*EthereumAdapter) Subscribe added in v0.0.14

func (ea *EthereumAdapter) Subscribe(ctx context.Context, consumer EventConsumer) error

func (*EthereumAdapter) Unsubscribe added in v0.0.14

func (ea *EthereumAdapter) Unsubscribe()

type Event added in v0.0.14

type Event struct {
	SendEvent
	Hash    string      `json:"hash,omitempty"`
	From    string      `json:"from,omitempty"`
	Fee     float64     `json:"fee,omitempty"`
	FeeCoin string      `json:"feeCoin,omitempty"`
	Type    EventType   `json:"type,omitempty"`
	Items   []SendEvent `json:"items,omitempty"`
	Error   error       `json:"error,omitempty"`
}

type EventConsumer added in v0.0.14

type EventConsumer interface {
	Consume(event Event)
}

type EventConsumerFunc added in v0.0.14

type EventConsumerFunc func(event Event)

func (EventConsumerFunc) Consume added in v0.0.14

func (f EventConsumerFunc) Consume(event Event)

type EventType added in v0.0.14

type EventType string
const (
	TypeSend      EventType = "send"
	TypeMultisend EventType = "multisend"
)

type MinterAdapter

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

func NewMinterAdapter

func NewMinterAdapter(minterClient *api.Api, minterPollingClient *api.Api, pollingDuration time.Duration) *MinterAdapter

func (*MinterAdapter) AddBlockListener added in v0.0.17

func (ma *MinterAdapter) AddBlockListener(listener func(lastBlockHeight int, transactionsCount int))

func (*MinterAdapter) EstimateMultiSendFee added in v0.0.3

func (ma *MinterAdapter) EstimateMultiSendFee(ctx context.Context, w Wallet, coin string, addresses []string, amounts []float64) (float64, error)

func (*MinterAdapter) EstimateSendFee added in v0.0.3

func (ma *MinterAdapter) EstimateSendFee(ctx context.Context, w Wallet, coin string, amount float64, address string) (float64, error)

func (*MinterAdapter) FindWallet added in v0.0.7

func (ma *MinterAdapter) FindWallet(ctx context.Context, privateKey string) (Wallet, error)

func (*MinterAdapter) GetBalance

func (ma *MinterAdapter) GetBalance(ctx context.Context, address string) (map[string]float64, error)

func (*MinterAdapter) GetLastBlockHeight added in v0.0.16

func (ma *MinterAdapter) GetLastBlockHeight() int

func (*MinterAdapter) IsTransactionComplete added in v0.0.21

func (ma *MinterAdapter) IsTransactionComplete(_ context.Context, hash string) bool

func (*MinterAdapter) IsValidAddress added in v0.0.13

func (ma *MinterAdapter) IsValidAddress(_ context.Context, address string) bool

func (*MinterAdapter) MultiSend

func (ma *MinterAdapter) MultiSend(ctx context.Context, w Wallet, coin string, addresses []string, amounts []float64) (string, error)

func (*MinterAdapter) NewWallet

func (ma *MinterAdapter) NewWallet(ctx context.Context) (Wallet, error)

func (*MinterAdapter) SellAll

func (ma *MinterAdapter) SellAll(ctx context.Context, w Wallet, coin string) (string, error)

func (*MinterAdapter) Send

func (ma *MinterAdapter) Send(ctx context.Context, w Wallet, coin string, amount float64, address string) (string, error)

func (*MinterAdapter) SetLastBlockHeight added in v0.0.16

func (ma *MinterAdapter) SetLastBlockHeight(lastBlockHeight int)

func (*MinterAdapter) Subscribe added in v0.0.14

func (ma *MinterAdapter) Subscribe(_ context.Context, consumer EventConsumer) error

func (*MinterAdapter) Unsubscribe added in v0.0.14

func (ma *MinterAdapter) Unsubscribe()

type SendEvent added in v0.0.18

type SendEvent struct {
	Amount float64 `json:"amount,omitempty"`
	Coin   string  `json:"coin,omitempty"`
	To     string  `json:"to,omitempty"`
}

type Wallet

type Wallet struct {
	BaseCoin   string
	Address    string
	PrivateKey string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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