Documentation
¶
Index ¶
- Constants
- func AddInput(ctx context.Context, rpcUrl string, payload []byte, applicationAddress string) error
- func CheckAnvilAndInstall(ctx context.Context) (string, error)
- func DefaultTxOpts(ctx context.Context, client *ethclient.Client) (*bind.TransactOpts, error)
- func ExtractTarGz(archive []byte, destDir string) error
- func ExtractZip(archive []byte, destDir string) error
- func GetAnvilVersion(anvilExec string) (string, error)
- func GetInputAdded(ctx context.Context, rpcUrl string) ([]*contracts.InputBoxInputAdded, error)
- func HandleReleaseExecution(stdCtx context.Context, release HandleRelease) (string, error)
- func InstallAnvil(ctx context.Context) (string, error)
- func RunCommandOnce(stdCtx context.Context, cmd *exec.Cmd) ([]byte, error)
- func ShowAddresses(writer io.WriteCloser) error
- func WithFiles(content string) testcontainers.CustomizeRequestOption
- type AnvilConfig
- type AnvilRelease
- func (a *AnvilRelease) DownloadAsset(ctx context.Context, release *ReleaseAsset) (string, error)
- func (a *AnvilRelease) ExtractAsset(archive []byte, filename string, destDir string) error
- func (a AnvilRelease) FormatNameRelease(prefix, goos, goarch, _ string) string
- func (a *AnvilRelease) GetLatestReleaseCompatible(ctx context.Context) (*ReleaseAsset, error)
- func (a AnvilRelease) GetPrefix() string
- func (a *AnvilRelease) GetVersion(ctx context.Context) (string, error)
- func (a *AnvilRelease) ListRelease(ctx context.Context) ([]ReleaseAsset, error)
- func (a AnvilRelease) PlatformCompatible() (string, error)
- func (a *AnvilRelease) Prerequisites(ctx context.Context) error
- func (a AnvilRelease) SaveConfigOnDefaultLocation(config *AnvilConfig) error
- func (a AnvilRelease) TryLoadConfig() (*AnvilConfig, error)
- type AnvilWorker
- type ContractInfo
- type FoundryContainer
- func RunFoundry(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
- func SetupFoundryNightly(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
- func SetupFoundryStable(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
- func SetupFoundryV1(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
- type FoundryOption
- type FoundryOptions
- type HandleRelease
- type RPCRequest
- type ReleaseAsset
Constants ¶
const ( AnvilDefaultAddress = "127.0.0.1" AnvilDefaultPort = 8545 )
Default port for the Ethereum node.
const ApplicationAddress = "0x75135d8ADb7180640d29d822D9AD59E83E8695b2"
Application address in devnet. nonodo
const ApplicationContractName = "Application"
const GasLimit = 30_000_000
Gas limit when sending transactions.
const InputBoxAddress = "0xB6b39Fb3dD926A9e3FBc7A129540eEbeA3016a6c"
Input box address in devnet. v2.0.0-rc.17
const LATEST_TAG = "nightly"
const STABLE_TAG = "stable"
const SenderAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
Account that sends the transactions.
const SenderPrivateKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
Private key of the sender.
const TestMnemonic = "test test test test test test test test test test test junk"
Foundry test mnemonic.
const WINDOWS = "windows"
const X86_64 = "amd64"
Variables ¶
This section is empty.
Functions ¶
func AddInput ¶
AddInput sends an input to Ethereum using the devnet sender. This function should be used in the devnet environment.
func CheckAnvilAndInstall ¶
For while, we dont check if anvil is already installed. We always install anvil.
func DefaultTxOpts ¶
func ExtractTarGz ¶
Extract a tar.gz archive to a destination directory
func ExtractZip ¶
Extract a zip archive to a destination directory
func GetAnvilVersion ¶
func GetInputAdded ¶
GetInputAdded gets all input added events from the input box.
func HandleReleaseExecution ¶
func HandleReleaseExecution(stdCtx context.Context, release HandleRelease) (string, error)
Install release
func ShowAddresses ¶
func ShowAddresses(writer io.WriteCloser) error
Types ¶
type AnvilConfig ¶
type AnvilConfig struct { AssetAnvil ReleaseAsset `json:"asset_anvil"` LatestCheck string `json:"latest_check"` }
func LoadAnvilConfig ¶
func LoadAnvilConfig(path string) (*AnvilConfig, error)
func NewAnvilConfig ¶
func NewAnvilConfig(ra ReleaseAsset) *AnvilConfig
func (*AnvilConfig) SaveAnvilConfig ¶
func (a *AnvilConfig) SaveAnvilConfig(path string) error
type AnvilRelease ¶
type AnvilRelease struct { Namespace string Repository string ConfigFilename string Client *github.Client }
Anvil implementation from HandleRelease
func (*AnvilRelease) DownloadAsset ¶
func (a *AnvilRelease) DownloadAsset(ctx context.Context, release *ReleaseAsset) (string, error)
DownloadAsset implements HandleRelease.
func (*AnvilRelease) ExtractAsset ¶
func (a *AnvilRelease) ExtractAsset(archive []byte, filename string, destDir string) error
func (AnvilRelease) FormatNameRelease ¶
func (a AnvilRelease) FormatNameRelease(prefix, goos, goarch, _ string) string
FormatNameRelease implements HandleRelease.
func (*AnvilRelease) GetLatestReleaseCompatible ¶
func (a *AnvilRelease) GetLatestReleaseCompatible(ctx context.Context) (*ReleaseAsset, error)
GetLatestReleaseCompatible implements HandleRelease.
func (AnvilRelease) GetPrefix ¶ added in v0.0.2
func (a AnvilRelease) GetPrefix() string
func (*AnvilRelease) GetVersion ¶
func (a *AnvilRelease) GetVersion(ctx context.Context) (string, error)
GetVersion implements HandleRelease.
func (*AnvilRelease) ListRelease ¶
func (a *AnvilRelease) ListRelease(ctx context.Context) ([]ReleaseAsset, error)
ListRelease implements HandleRelease.
func (AnvilRelease) PlatformCompatible ¶
func (a AnvilRelease) PlatformCompatible() (string, error)
PlatformCompatible implements HandleRelease.
func (*AnvilRelease) Prerequisites ¶
func (a *AnvilRelease) Prerequisites(ctx context.Context) error
Prerequisites implements HandleRelease.
func (AnvilRelease) SaveConfigOnDefaultLocation ¶
func (a AnvilRelease) SaveConfigOnDefaultLocation(config *AnvilConfig) error
func (AnvilRelease) TryLoadConfig ¶
func (a AnvilRelease) TryLoadConfig() (*AnvilConfig, error)
type AnvilWorker ¶
type AnvilWorker struct { Address string Port int Verbose bool AnvilCmd string AnvilBlockTime time.Duration }
Start the anvil process in the host machine.
func (AnvilWorker) Start ¶
func (w AnvilWorker) Start(ctx context.Context, ready chan<- struct{}) error
func (AnvilWorker) String ¶
func (w AnvilWorker) String() string
type ContractInfo ¶
type ContractInfo struct { ContractName string `json:"contractName"` Address string `json:"address"` }
Define a struct to represent the structure of your JSON data
func GetContractInfo ¶
func GetContractInfo() ([]ContractInfo, error)
type FoundryContainer ¶
type FoundryContainer struct { testcontainers.Container // contains filtered or unexported fields }
func RunFoundry ¶
func RunFoundry(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
func SetupFoundryNightly ¶
func SetupFoundryNightly(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
func SetupFoundryStable ¶
func SetupFoundryStable(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
func SetupFoundryV1 ¶
func SetupFoundryV1(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*FoundryContainer, error)
type FoundryOption ¶
type FoundryOption func(*FoundryOptions) error
func WithStateContent ¶
func WithStateContent(content []byte) FoundryOption
func (FoundryOption) Customize ¶
func (f FoundryOption) Customize(req *testcontainers.GenericContainerRequest) error
Customize implements testcontainers.ContainerCustomizer.
type FoundryOptions ¶
type FoundryOptions struct {
// contains filtered or unexported fields
}
type HandleRelease ¶
type HandleRelease interface { // Name basead on version, arch, os with prefix FormatNameRelease(prefix, goos, goarch, version string) string // Check if the platform is compatible with the library and return the name of the release PlatformCompatible() (string, error) // List all releases from the repository ListRelease(ctx context.Context) ([]ReleaseAsset, error) // Get the latest release compatible with the platform GetLatestReleaseCompatible(ctx context.Context) (*ReleaseAsset, error) // Check prerequisites for the library Prerequisites(ctx context.Context) error // Download the asset from the release DownloadAsset(ctx context.Context, release *ReleaseAsset) (string, error) // Extract the asset from the archive ExtractAsset(archive []byte, filename string, destDir string) error GetVersion(ctx context.Context) (string, error) }
Interface for handle libraries on GitHub
func NewAnvilRelease ¶
func NewAnvilRelease() HandleRelease
type RPCRequest ¶
type ReleaseAsset ¶
type ReleaseAsset struct { Tag string `json:"tag"` AssetId int64 `json:"asset_id"` Filename string `json:"filename"` Url string `json:"url"` Path string `json:"path"` }
ReleaseAsset represents a release asset from GitHub
func GetAssetsFromLastReleaseGitHub ¶
func GetAssetsFromLastReleaseGitHub(ctx context.Context, client *github.Client, namespace, repository string, tag string) ([]ReleaseAsset, error)
Get assets of latest release or prerelease from GitHub
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
This program gets the devnet state from the devnet Docker image.
|
This program gets the devnet state from the devnet Docker image. |