Documentation ¶
Index ¶
- Constants
- Variables
- func DeployTestERC20(ctx context.Context, endpoint string) (common.Address, error)
- type ETHClient
- func (c *ETHClient) ChainID(ctx context.Context) (*big.Int, error)
- func (c *ETHClient) SendDAppAddress(ctx context.Context, signer Signer) (int, error)
- func (c *ETHClient) SendERC20Tokens(ctx context.Context, signer Signer, token common.Address, amount *big.Int, ...) (int, error)
- func (c *ETHClient) SendEther(ctx context.Context, signer Signer, txValue *big.Int, input []byte) (int, error)
- func (c *ETHClient) SendInput(ctx context.Context, signer Signer, input []byte) (int, error)
- type MnemonicSigner
- type Signer
Constants ¶
const DefaultGasLimit = 30_000_000
Default gas limit when sending transactions.
const FoundryMnemonic = "test test test test test test test test test test test junk"
Dev mnemonic used by Foundry/Anvil.
Variables ¶
var ( AddressCartesiDAppFactory common.Address AddressDAppAddressRelay common.Address AddressERC1155BatchPortal common.Address AddressERC1155SinglePortal common.Address AddressERC20Portal common.Address AddressERC721Portal common.Address AddressEtherPortal common.Address AddressInputBox common.Address AddressSunodoToken common.Address )
Functions ¶
Types ¶
type ETHClient ¶
type ETHClient struct { // Gas limit when building transactions. GasLimit uint64 // contains filtered or unexported fields }
Implements blockchain client for Ethereum using go-ethereum. This struct provides methods that are specific for the Cartesi Rollups.
func NewETHClient ¶
Create new ETH client.
func (*ETHClient) SendDAppAddress ¶
Send the DApp address to the DApp contract with the DAppAddressRelay contract. This function waits until the transaction is added to a block and return the input index.
func (*ETHClient) SendERC20Tokens ¶
func (c *ETHClient) SendERC20Tokens( ctx context.Context, signer Signer, token common.Address, amount *big.Int, input []byte, ) (int, error)
Send an ERC20 token to the ERC20 portal. This function also receives an optional input. This function increases the allowance of the sender before sending the token, if necessary. This function waits until the transaction is added to a block and return the input index.
func (*ETHClient) SendEther ¶
func (c *ETHClient) SendEther( ctx context.Context, signer Signer, txValue *big.Int, input []byte, ) (int, error)
Send Ether to the Ether portal. This function also receives an optional input. This function waits until the transaction is added to a block and return the input index.
type MnemonicSigner ¶
type MnemonicSigner struct {
// contains filtered or unexported fields
}
Create a signer by using a mnemonic.
func NewMnemonicSigner ¶
func NewMnemonicSigner(mnemonic string, accountIndex uint32, chainId *big.Int) ( s *MnemonicSigner, err error)
Create a new mnemonic signer.
func (*MnemonicSigner) Account ¶
func (s *MnemonicSigner) Account() common.Address
func (*MnemonicSigner) MakeTransactor ¶
func (s *MnemonicSigner) MakeTransactor() (*bind.TransactOpts, error)
func (*MnemonicSigner) SetAccount ¶
func (s *MnemonicSigner) SetAccount(accountIndex uint32) error