eth

package
v0.0.0-...-0269a1e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Eth is the ID for state of an eth client in the connection state.
	EthID = "eth"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalForFungible

type ApprovalForFungible struct {
	ContractAddress string `json:"contract_address"`
	Owner           string `json:"owner"`
	Operator        string `json:"operator"`
}

type ApproveHash

type ApproveHash struct {
	ContractAddress string `json:"contract_address"`
	Hash            string `json:"hash"`
}

type ApproveTokenSpending

type ApproveTokenSpending struct {
	ContractAddress string `json:"contract_address"`
	Spender         string `json:"spender"`
	Amount          string `json:"amount"`
}

type Client

type Client struct {
}

Client exposes ethereum related functionality

func NewClient

func NewClient() *Client

NewClient creates a new Client ready for use

func (*Client) AddMultisigOwner

func (c *Client) AddMultisigOwner(ctx context.Context, conState jsonrpc.State, args MultisigOwner) (string, error)

AddMultisigOwner adds an owner to a multisig contract

func (*Client) Address

func (c *Client) Address(ctx context.Context, conState jsonrpc.State) (string, error)

Address of the loaded client

func (*Client) ApproveEthTftSpending

func (c *Client) ApproveEthTftSpending(ctx context.Context, conState jsonrpc.State, amount string) (string, error)

func (*Client) ApproveHash

func (c *Client) ApproveHash(ctx context.Context, conState jsonrpc.State, args ApproveHash) (string, error)

ApproveHash approves a transaction hash

func (*Client) ApproveTokenSpending

func (c *Client) ApproveTokenSpending(ctx context.Context, conState jsonrpc.State, args ApproveTokenSpending) (string, error)

ApproveTokenSpending approves spending from a token contract with a limit

func (*Client) Balance

func (c *Client) Balance(ctx context.Context, conState jsonrpc.State, address string) (string, error)

Balance of an address

func (*Client) BridgeToStellar

func (c *Client) BridgeToStellar(ctx context.Context, conState jsonrpc.State, args TftEthTransfer) (string, error)

func (*Client) CreateAndActivateStellarAccount

func (c *Client) CreateAndActivateStellarAccount(ctx context.Context, conState jsonrpc.State, network string) (string, error)

func (*Client) EthTftSpendingAllowance

func (c *Client) EthTftSpendingAllowance(ctx context.Context, conState jsonrpc.State) (string, error)

func (*Client) GetApprovalForAllFungible

func (c *Client) GetApprovalForAllFungible(ctx context.Context, conState jsonrpc.State, args ApprovalForFungible) (bool, error)

GetApprovalForAllFungible returns whether the given address is approved to spend all the given fungible tokens

func (*Client) GetApprovalForFungible

func (c *Client) GetApprovalForFungible(ctx context.Context, conState jsonrpc.State, args ApprovalForFungible) (bool, error)

GetApprovalForFungible returns whether the given address is approved to spend the given tokenId of the given fungible token

func (*Client) GetEthTftBalance

func (c *Client) GetEthTftBalance(ctx context.Context, conState jsonrpc.State) (string, error)

func (*Client) GetFungibleBalance

func (c *Client) GetFungibleBalance(ctx context.Context, conState jsonrpc.State, args GetFungibleBalance) (string, error)

GetFungibleBalance returns the balance of the given address for the given fungible token contract

func (*Client) GetHexSeed

func (c *Client) GetHexSeed(ctx context.Context, conState jsonrpc.State) (string, error)

func (*Client) GetMultisigOwners

func (c *Client) GetMultisigOwners(ctx context.Context, conState jsonrpc.State, contractAddress string) ([]string, error)

GetMultisigOwners fetches the owner addresses for a multisig contract

func (*Client) GetMultisigThreshold

func (c *Client) GetMultisigThreshold(ctx context.Context, conState jsonrpc.State, contractAddress string) (string, error)

GetMultisigThreshold fetches the treshold for a multisig contract

func (*Client) GetTokenBalance

func (c *Client) GetTokenBalance(ctx context.Context, conState jsonrpc.State, contractAddress string) (string, error)

GetTokenBalance fetches the balance for an erc20 compatible contract

func (*Client) Height

func (c *Client) Height(ctx context.Context, conState jsonrpc.State) (uint64, error)

Height of the chain for the connected rpc remote

func (*Client) InitiateMultisigEthTransfer

func (c *Client) InitiateMultisigEthTransfer(ctx context.Context, conState jsonrpc.State, args InitiateMultisigEthTransfer) (string, error)

InitiateMultisigEthTransfer initiates a multisig eth transfer operation

func (*Client) InitiateMultisigTokenTransfer

func (c *Client) InitiateMultisigTokenTransfer(ctx context.Context, conState jsonrpc.State, args InitiateMultisigTokenTransfer) (string, error)

InitiateMultisigTokenTransfer initiates a multisig eth transfer operation

func (*Client) IsApproved

func (c *Client) IsApproved(ctx context.Context, conState jsonrpc.State, args ApproveHash) (bool, error)

IsApproved approves a transaction hash

func (*Client) Load

func (c *Client) Load(ctx context.Context, conState jsonrpc.State, args Load) error

Load a client, connecting to the rpc endpoint at the given URL and loading a keypair from the given secret

func (*Client) OwnerOfFungible

func (c *Client) OwnerOfFungible(ctx context.Context, conState jsonrpc.State, args OwnerOfFungible) (string, error)

OwnerOfFungible returns the owner of the given fungible token

func (*Client) QuoteEthForTft

func (c *Client) QuoteEthForTft(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)

func (*Client) QuoteTftForEth

func (c *Client) QuoteTftForEth(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)

func (*Client) RemoveMultisigOwner

func (c *Client) RemoveMultisigOwner(ctx context.Context, conState jsonrpc.State, args MultisigOwner) (string, error)

RemoveMultisigOwner adds an owner to a multisig contract

func (*Client) SafeTransferFungible

func (c *Client) SafeTransferFungible(ctx context.Context, conState jsonrpc.State, args TransferFungible) (string, error)

SafeTransferFungible transfers a fungible token from the given address to the given target address

func (*Client) SetFungibleApproval

func (c *Client) SetFungibleApproval(ctx context.Context, conState jsonrpc.State, args SetFungibleApproval) (string, error)

SetFungibleApproval approves the given address to spend the given tokenId of the given fungible token

func (*Client) SetFungibleApprovalForAll

func (c *Client) SetFungibleApprovalForAll(ctx context.Context, conState jsonrpc.State, args SetFungibleApprovalForAll) (string, error)

SetFungibleApprovalForAll approves the given address to spend all the given fungible tokens

func (*Client) SwapEthForTft

func (c *Client) SwapEthForTft(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)

func (*Client) SwapTftForEth

func (c *Client) SwapTftForEth(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)

func (*Client) Transfer

func (c *Client) Transfer(ctx context.Context, conState jsonrpc.State, args Transfer) (string, error)

Transer an amount of Eth from the loaded account to the destination. The transaction ID is returned.

func (*Client) TransferEthTft

func (c *Client) TransferEthTft(ctx context.Context, conState jsonrpc.State, args TftEthTransfer) (string, error)

func (*Client) TransferFromTokens

func (c *Client) TransferFromTokens(ctx context.Context, conState jsonrpc.State, args TokenTransferFrom) (string, error)

TransferFromTokens transfer tokens from an account to another account (can be executed by anyone that is approved to spend)

func (*Client) TransferFungible

func (c *Client) TransferFungible(ctx context.Context, conState jsonrpc.State, args TransferFungible) (string, error)

TransferFungible transfers the given fungible token from the given address to the given target address

func (*Client) TransferTokens

func (c *Client) TransferTokens(ctx context.Context, conState jsonrpc.State, args TokenTransfer) (string, error)

TransferToken transfer an erc20 compatible token to a destination

type EthState

type EthState struct {
	Client *goethclient.Client
}

EthState managed by ethereum client

func State

func State(conState jsonrpc.State) *EthState

State from a connection. If no state is present, it is initialized

func (*EthState) Close

func (s *EthState) Close()

Close implements jsonrpc.Closer

type GetFungibleBalance

type GetFungibleBalance struct {
	ContractAddress string `json:"contract_address"`
	Target          string `json:"target"`
}

type GetTokenBalance

type GetTokenBalance struct {
	ContractAddress string `json:"contract_address"`
	Target          string `json:"target"`
}

type InitiateMultisigEthTransfer

type InitiateMultisigEthTransfer struct {
	ContractAddress string `json:"contract_address"`
	Destination     string `json:"destination"`
	Amount          string `json:"amount"`
}

type InitiateMultisigTokenTransfer

type InitiateMultisigTokenTransfer struct {
	ContractAddress string `json:"contract_address"`
	TokenAddress    string `json:"token_address"`
	Destination     string `json:"destination"`
	Amount          int64  `json:"amount"`
}

type Load

type Load struct {
	Url    string `json:"url"`
	Secret string `json:"secret"`
}

type MultisigOwner

type MultisigOwner struct {
	ContractAddress string `json:"contract_address"`
	Target          string `json:"target"`
	Threshold       int64  `json:"threshold"`
}

type OwnerOfFungible

type OwnerOfFungible struct {
	ContractAddress string `json:"contract_address"`
	TokenID         int64  `json:"token_id"`
}

type SetFungibleApproval

type SetFungibleApproval struct {
	ContractAddress string `json:"contract_address"`
	From            string `json:"from"`
	To              string `json:"to"`
	Amount          int64  `json:"amount"`
}

type SetFungibleApprovalForAll

type SetFungibleApprovalForAll struct {
	ContractAddress string `json:"contract_address"`
	From            string `json:"from"`
	To              string `json:"to"`
	Approved        bool   `json:"bool"`
}

type TftEthTransfer

type TftEthTransfer struct {
	Destination string `json:"destination"`
	Amount      string `json:"amount"`
}

type TokenTransfer

type TokenTransfer struct {
	ContractAddress string `json:"contract_address"`
	Destination     string `json:"destination"`
	Amount          string `json:"amount"`
}

type TokenTransferFrom

type TokenTransferFrom struct {
	ContractAddress string `json:"contract_address"`
	From            string `json:"from"`
	Destination     string `json:"destination"`
	Amount          string `json:"amount"`
}

type Transfer

type Transfer struct {
	Amount      string `json:"amount"`
	Destination string `json:"destination"`
}

type TransferFungible

type TransferFungible struct {
	ContractAddress string `json:"contract_address"`
	From            string `json:"from"`
	To              string `json:"to"`
	TokenID         int64  `json:"token_id"`
}

Jump to

Keyboard shortcuts

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