{"modulePath":"github.com/threefoldtech/web3_proxy/server","version":"v0.0.0-20230905100307-0269a1e6aecb","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package eth\n\n## Constants\n\n```go\nconst (\n\t// Eth is the ID for state of an eth client in the connection state.\n\tEthID = \"eth\"\n)\n```\n\n## Types\n\n```go\ntype ApprovalForFungible struct {\n\tContractAddress string `json:\"contract_address\"`\n\tOwner           string `json:\"owner\"`\n\tOperator        string `json:\"operator\"`\n}\n```\n\n```go\ntype ApproveHash struct {\n\tContractAddress string `json:\"contract_address\"`\n\tHash            string `json:\"hash\"`\n}\n```\n\n```go\ntype ApproveTokenSpending struct {\n\tContractAddress string `json:\"contract_address\"`\n\tSpender         string `json:\"spender\"`\n\tAmount          string `json:\"amount\"`\n}\n```\n\n```go\ntype Client struct {\n}\n```\nClient exposes ethereum related functionality\n\n```go\nfunc NewClient() *Client\n```\nNewClient creates a new Client ready for use\n\n```go\nfunc (c *Client) AddMultisigOwner(ctx context.Context, conState jsonrpc.State, args MultisigOwner) (string, error)\n```\nAddMultisigOwner adds an owner to a multisig contract\n\n```go\nfunc (c *Client) Address(ctx context.Context, conState jsonrpc.State) (string, error)\n```\nAddress of the loaded client\n\n```go\nfunc (c *Client) ApproveEthTftSpending(ctx context.Context, conState jsonrpc.State, amount string) (string, error)\n```\n\n```go\nfunc (c *Client) ApproveHash(ctx context.Context, conState jsonrpc.State, args ApproveHash) (string, error)\n```\nApproveHash approves a transaction hash\n\n```go\nfunc (c *Client) ApproveTokenSpending(ctx context.Context, conState jsonrpc.State, args ApproveTokenSpending) (string, error)\n```\nApproveTokenSpending approves spending from a token contract with a limit\n\n```go\nfunc (c *Client) Balance(ctx context.Context, conState jsonrpc.State, address string) (string, error)\n```\nBalance of an address\n\n```go\nfunc (c *Client) BridgeToStellar(ctx context.Context, conState jsonrpc.State, args TftEthTransfer) (string, error)\n```\n\n```go\nfunc (c *Client) CreateAndActivateStellarAccount(ctx context.Context, conState jsonrpc.State, network string) (string, error)\n```\n\n```go\nfunc (c *Client) EthTftSpendingAllowance(ctx context.Context, conState jsonrpc.State) (string, error)\n```\n\n```go\nfunc (c *Client) GetApprovalForAllFungible(ctx context.Context, conState jsonrpc.State, args ApprovalForFungible) (bool, error)\n```\nGetApprovalForAllFungible returns whether the given address is approved to spend all the given fungible tokens\n\n```go\nfunc (c *Client) GetApprovalForFungible(ctx context.Context, conState jsonrpc.State, args ApprovalForFungible) (bool, error)\n```\nGetApprovalForFungible returns whether the given address is approved to spend the given tokenId of the given fungible token\n\n```go\nfunc (c *Client) GetEthTftBalance(ctx context.Context, conState jsonrpc.State) (string, error)\n```\n\n```go\nfunc (c *Client) GetFungibleBalance(ctx context.Context, conState jsonrpc.State, args GetFungibleBalance) (string, error)\n```\nGetFungibleBalance returns the balance of the given address for the given fungible token contract\n\n```go\nfunc (c *Client) GetHexSeed(ctx context.Context, conState jsonrpc.State) (string, error)\n```\n\n```go\nfunc (c *Client) GetMultisigOwners(ctx context.Context, conState jsonrpc.State, contractAddress string) ([]string, error)\n```\nGetMultisigOwners fetches the owner addresses for a multisig contract\n\n```go\nfunc (c *Client) GetMultisigThreshold(ctx context.Context, conState jsonrpc.State, contractAddress string) (string, error)\n```\nGetMultisigThreshold fetches the treshold for a multisig contract\n\n```go\nfunc (c *Client) GetTokenBalance(ctx context.Context, conState jsonrpc.State, contractAddress string) (string, error)\n```\nGetTokenBalance fetches the balance for an erc20 compatible contract\n\n```go\nfunc (c *Client) Height(ctx context.Context, conState jsonrpc.State) (uint64, error)\n```\nHeight of the chain for the connected rpc remote\n\n```go\nfunc (c *Client) InitiateMultisigEthTransfer(ctx context.Context, conState jsonrpc.State, args InitiateMultisigEthTransfer) (string, error)\n```\nInitiateMultisigEthTransfer initiates a multisig eth transfer operation\n\n```go\nfunc (c *Client) InitiateMultisigTokenTransfer(ctx context.Context, conState jsonrpc.State, args InitiateMultisigTokenTransfer) (string, error)\n```\nInitiateMultisigTokenTransfer initiates a multisig eth transfer operation\n\n```go\nfunc (c *Client) IsApproved(ctx context.Context, conState jsonrpc.State, args ApproveHash) (bool, error)\n```\nIsApproved approves a transaction hash\n\n```go\nfunc (c *Client) Load(ctx context.Context, conState jsonrpc.State, args Load) error\n```\nLoad a client, connecting to the rpc endpoint at the given URL and loading a keypair from the given secret\n\n```go\nfunc (c *Client) OwnerOfFungible(ctx context.Context, conState jsonrpc.State, args OwnerOfFungible) (string, error)\n```\nOwnerOfFungible returns the owner of the given fungible token\n\n```go\nfunc (c *Client) QuoteEthForTft(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)\n```\n\n```go\nfunc (c *Client) QuoteTftForEth(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)\n```\n\n```go\nfunc (c *Client) RemoveMultisigOwner(ctx context.Context, conState jsonrpc.State, args MultisigOwner) (string, error)\n```\nRemoveMultisigOwner adds an owner to a multisig contract\n\n```go\nfunc (c *Client) SafeTransferFungible(ctx context.Context, conState jsonrpc.State, args TransferFungible) (string, error)\n```\nSafeTransferFungible transfers a fungible token from the given address to the given target address\n\n```go\nfunc (c *Client) SetFungibleApproval(ctx context.Context, conState jsonrpc.State, args SetFungibleApproval) (string, error)\n```\nSetFungibleApproval approves the given address to spend the given tokenId of the given fungible token\n\n```go\nfunc (c *Client) SetFungibleApprovalForAll(ctx context.Context, conState jsonrpc.State, args SetFungibleApprovalForAll) (string, error)\n```\nSetFungibleApprovalForAll approves the given address to spend all the given fungible tokens\n\n```go\nfunc (c *Client) SwapEthForTft(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)\n```\n\n```go\nfunc (c *Client) SwapTftForEth(ctx context.Context, conState jsonrpc.State, amountIn string) (string, error)\n```\n\n```go\nfunc (c *Client) Transfer(ctx context.Context, conState jsonrpc.State, args Transfer) (string, error)\n```\nTranser an amount of Eth from the loaded account to the destination. The transaction ID is returned.\n\n```go\nfunc (c *Client) TransferEthTft(ctx context.Context, conState jsonrpc.State, args TftEthTransfer) (string, error)\n```\n\n```go\nfunc (c *Client) TransferFromTokens(ctx context.Context, conState jsonrpc.State, args TokenTransferFrom) (string, error)\n```\nTransferFromTokens transfer tokens from an account to another account (can be executed by anyone that is approved to spend)\n\n```go\nfunc (c *Client) TransferFungible(ctx context.Context, conState jsonrpc.State, args TransferFungible) (string, error)\n```\nTransferFungible transfers the given fungible token from the given address to the given target address\n\n```go\nfunc (c *Client) TransferTokens(ctx context.Context, conState jsonrpc.State, args TokenTransfer) (string, error)\n```\nTransferToken transfer an erc20 compatible token to a destination\n\n```go\ntype EthState struct {\n\tClient *goethclient.Client\n}\n```\nEthState managed by ethereum client\n\n```go\nfunc State(conState jsonrpc.State) *EthState\n```\nState from a connection. If no state is present, it is initialized\n\n```go\nfunc (s *EthState) Close()\n```\nClose implements jsonrpc.Closer\n\n```go\ntype GetFungibleBalance struct {\n\tContractAddress string `json:\"contract_address\"`\n\tTarget          string `json:\"target\"`\n}\n```\n\n```go\ntype GetTokenBalance struct {\n\tContractAddress string `json:\"contract_address\"`\n\tTarget          string `json:\"target\"`\n}\n```\n\n```go\ntype InitiateMultisigEthTransfer struct {\n\tContractAddress string `json:\"contract_address\"`\n\tDestination     string `json:\"destination\"`\n\tAmount          string `json:\"amount\"`\n}\n```\n\n```go\ntype InitiateMultisigTokenTransfer struct {\n\tContractAddress string `json:\"contract_address\"`\n\tTokenAddress    string `json:\"token_address\"`\n\tDestination     string `json:\"destination\"`\n\tAmount          int64  `json:\"amount\"`\n}\n```\n\n```go\ntype Load struct {\n\tUrl    string `json:\"url\"`\n\tSecret string `json:\"secret\"`\n}\n```\n\n```go\ntype MultisigOwner struct {\n\tContractAddress string `json:\"contract_address\"`\n\tTarget          string `json:\"target\"`\n\tThreshold       int64  `json:\"threshold\"`\n}\n```\n\n```go\ntype OwnerOfFungible struct {\n\tContractAddress string `json:\"contract_address\"`\n\tTokenID         int64  `json:\"token_id\"`\n}\n```\n\n```go\ntype SetFungibleApproval struct {\n\tContractAddress string `json:\"contract_address\"`\n\tFrom            string `json:\"from\"`\n\tTo              string `json:\"to\"`\n\tAmount          int64  `json:\"amount\"`\n}\n```\n\n```go\ntype SetFungibleApprovalForAll struct {\n\tContractAddress string `json:\"contract_address\"`\n\tFrom            string `json:\"from\"`\n\tTo              string `json:\"to\"`\n\tApproved        bool   `json:\"bool\"`\n}\n```\n\n```go\ntype TftEthTransfer struct {\n\tDestination string `json:\"destination\"`\n\tAmount      string `json:\"amount\"`\n}\n```\n\n```go\ntype TokenTransfer struct {\n\tContractAddress string `json:\"contract_address\"`\n\tDestination     string `json:\"destination\"`\n\tAmount          string `json:\"amount\"`\n}\n```\n\n```go\ntype TokenTransferFrom struct {\n\tContractAddress string `json:\"contract_address\"`\n\tFrom            string `json:\"from\"`\n\tDestination     string `json:\"destination\"`\n\tAmount          string `json:\"amount\"`\n}\n```\n\n```go\ntype Transfer struct {\n\tAmount      string `json:\"amount\"`\n\tDestination string `json:\"destination\"`\n}\n```\n\n```go\ntype TransferFungible struct {\n\tContractAddress string `json:\"contract_address\"`\n\tFrom            string `json:\"from\"`\n\tTo              string `json:\"to\"`\n\tTokenID         int64  `json:\"token_id\"`\n}\n```\n\n","path":"github.com/threefoldtech/web3_proxy/server/pkg/eth","name":"eth","synopsis":"","isRedistributable":true}
