Documentation ¶
Index ¶
- Constants
- Variables
- func CurrencyToString(units *big.Int, decimals int) string
- func GenerateKeypair() (*ecdsa.PrivateKey, error)
- func KeyFromSecret(secret string) (*ecdsa.PrivateKey, error)
- func TftUnitsToString(units *big.Int) string
- func WeiToString(wei *big.Int) string
- type Client
- func (c *Client) AddOwner(contractAddress, target string, treshold int64) (string, error)
- func (c *Client) AddressFromKey() common.Address
- func (c *Client) ApproveEthTftSpending(ctx context.Context, input string) (string, error)
- func (c *Client) ApproveHash(contractAddress, hash string) (string, error)
- func (c *Client) ApproveTokenSpending(ctx context.Context, contractAddress, spender string, amount string) (string, error)
- func (c *Client) BridgeToStellar(ctx context.Context, destination string, amount string) (string, error)
- func (c *Client) CreateAndActivateStellarAccount(ctx context.Context, network string) (string, error)
- func (c *Client) EthTftSpendingAllowance(ctx context.Context) (string, error)
- func (c *Client) GetApprovalForAllFungible(contractAddress, owner, operator string) (bool, error)
- func (c *Client) GetApprovalForFungible(contractAddress, owner, operator string) (bool, error)
- func (c *Client) GetBalance(addr string) (string, error)
- func (c *Client) GetCurrentHeight() (uint64, error)
- func (c *Client) GetEthTftBalance(ctx context.Context) (string, error)
- func (c *Client) GetFungibleBalance(contractAddress, target string) (*big.Int, error)
- func (c *Client) GetHexSeed() string
- func (c *Client) GetMultisigVersion(contractAddress string) (string, error)
- func (c *Client) GetOwners(contractAddress string) ([]string, error)
- func (c *Client) GetTftTokenContract() (*coreEntities.Token, error)
- func (c *Client) GetThreshold(contractAddress string) (*big.Int, error)
- func (c *Client) GetTokenBalance(contractAddress string) (string, error)
- func (c *Client) GetWethTokenContract() (*coreEntities.Token, error)
- func (c *Client) InitiateMultisigEthTransfer(safeContractAddress, destination string, amount string) (string, error)
- func (c *Client) InitiateMultisigTokenTransfer(safeContractAddress, tokenAddress, destination string, amount int64) (string, error)
- func (c *Client) IsApproved(contractAddress string, hash string) (bool, error)
- func (c *Client) IsOwner(contractAddress string, address string) (bool, error)
- func (c *Client) OwnerOfFungible(contractAddress string, token int64) (string, error)
- func (c *Client) QuoteEthForTft(ctx context.Context, amount string) (string, error)
- func (c *Client) QuoteTftForEth(ctx context.Context, amount string) (string, error)
- func (c *Client) RemoveOwner(contractAddress, target string, treshold int64) (string, error)
- func (c *Client) SafeTransferFungible(ctx context.Context, contractAddress, from, to string, tokenId int64) (string, error)
- func (c *Client) SetFungibleApproval(ctx context.Context, contractAddress, from, to string, amount int64) (string, error)
- func (c *Client) SetFungibleApprovalForAll(ctx context.Context, contractAddress, from, to string, approved bool) (string, error)
- func (c *Client) SwapEthForTft(ctx context.Context, amountIn string) (string, error)
- func (c *Client) SwapTftForEth(ctx context.Context, amountIn string) (string, error)
- func (c *Client) TransferEth(ctx context.Context, amount string, destination string) (string, error)
- func (c *Client) TransferEthTft(ctx context.Context, destination string, amount string) (string, error)
- func (c *Client) TransferFromTokens(ctx context.Context, contractAddress, from, to string, amount string) (string, error)
- func (c *Client) TransferFungible(ctx context.Context, contractAddress, from, to string, tokenId int64) (string, error)
- func (c *Client) TransferTokens(ctx context.Context, contractAddress common.Address, target string, ...) (string, error)
Constants ¶
View Source
const ( EthMainnetId = 1 EthGoerliId = 5 GasLimit = 210000 )
View Source
const ( SlippageAmount = 3000 GoerliChainId = 5 MainnetChainId = 1 )
View Source
const EthDecimals = 18
View Source
const TftDecimals = 7
Variables ¶
View Source
var ( GoerliWethContract = common.HexToAddress("0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6") MainnetWethContract = common.HexToAddress("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2") GoerliTft = coreEntities.NewToken(GoerliChainId, GoerliTestnetEthTftContractAddress, 7, "TFT", "TFT on Ethereum") GoerliWeth = coreEntities.NewToken(GoerliChainId, GoerliWethContract, 18, "WETH", "Wrapped Ether") MainnetTft = coreEntities.NewToken(MainnetChainId, MainnetEthTftContractAddress, 7, "TFT", "TFT on Ethereum") MainnetWeth = coreEntities.NewToken(MainnetChainId, MainnetWethContract, 18, "WETH", "Wrapped Ether") SwapRouter = common.HexToAddress(helper.ContractV3SwapRouterV1) )
View Source
var ( MainnetEthTftContractAddress = common.HexToAddress("0x395E925834996e558bdeC77CD648435d620AfB5b") GoerliTestnetEthTftContractAddress = common.HexToAddress("0xDa38782ce31Fc9861087320ABffBdee64Ed60515") )
Functions ¶
func GenerateKeypair ¶
func GenerateKeypair() (*ecdsa.PrivateKey, error)
func KeyFromSecret ¶
func KeyFromSecret(secret string) (*ecdsa.PrivateKey, error)
func TftUnitsToString ¶
func WeiToString ¶
Types ¶
type Client ¶
type Client struct { Secret string Url string Eth *ethclient.Client Key *ecdsa.PrivateKey Address common.Address }
func (*Client) AddressFromKey ¶
func (*Client) ApproveEthTftSpending ¶
func (*Client) ApproveHash ¶
func (*Client) ApproveTokenSpending ¶
func (*Client) BridgeToStellar ¶
func (*Client) CreateAndActivateStellarAccount ¶
func (*Client) EthTftSpendingAllowance ¶
func (*Client) GetApprovalForAllFungible ¶
GetApprovalForAllFungible returns the approval status of the given address for the given fungible token
func (*Client) GetApprovalForFungible ¶
GetApprovalForFungible returns the approval status of the given address for the given fungible token
func (*Client) GetCurrentHeight ¶
func (*Client) GetEthTftBalance ¶
func (*Client) GetFungibleBalance ¶
GetFungibleBalance returns the balance of the given address for the given fungible token contract
func (*Client) GetHexSeed ¶
func (*Client) GetMultisigVersion ¶
func (*Client) GetTftTokenContract ¶
func (c *Client) GetTftTokenContract() (*coreEntities.Token, error)
func (*Client) GetThreshold ¶
func (*Client) GetTokenBalance ¶
func (*Client) GetWethTokenContract ¶
func (c *Client) GetWethTokenContract() (*coreEntities.Token, error)
func (*Client) InitiateMultisigEthTransfer ¶
func (*Client) InitiateMultisigTokenTransfer ¶
func (*Client) IsApproved ¶
func (*Client) OwnerOfFungible ¶
ownerOfFungible returns the owner of the given fungible token
func (*Client) QuoteEthForTft ¶
func (*Client) QuoteTftForEth ¶
func (*Client) RemoveOwner ¶
func (*Client) SafeTransferFungible ¶
func (c *Client) SafeTransferFungible(ctx context.Context, contractAddress, from, to string, tokenId int64) (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, contractAddress, from, to string, amount int64) (string, error)
SetFungibleApproval approves the given address to spend the given amount of the given fungible token
func (*Client) SetFungibleApprovalForAll ¶
func (c *Client) SetFungibleApprovalForAll(ctx context.Context, contractAddress, from, to string, approved bool) (string, error)
SetFungibleApprovalForAll approves the given address to spend all the given fungible token
func (*Client) SwapEthForTft ¶
func (*Client) SwapTftForEth ¶
func (*Client) TransferEth ¶
func (*Client) TransferEthTft ¶
func (*Client) TransferFromTokens ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.