Documentation ¶
Index ¶
- Constants
- Variables
- func ComputePage(first *int, last *int, after *string, before *string, total int) (offset int, limit int, err error)
- func ConfigureLog(level slog.Leveler)
- func ConvertStatusStringToCompletionStatus(status string) model.CompletionStatus
- func DecodeCursor(base64Cursor string, total int) (int, error)
- func EncodeCursor(offset int) string
- func ExtractSigAndData(raw string) (common.Address, apitypes.TypedData, []byte, error)
- func ExtractTarGz(archive []byte, destDir string) error
- func ExtractZip(archive []byte, destDir string) error
- func HandleReleaseExecution(stdCtx context.Context, release HandleRelease) (string, error)
- func HashEIP712Message(data apitypes.TypedData) ([]byte, error)
- func IsPortInUse(port int) bool
- func NewCartesiDomain(chainId *math.HexOrDecimal256) apitypes.TypedDataDomain
- func RunCommandOnce(stdCtx context.Context, cmd *exec.Cmd) ([]byte, error)
- func SignMessage(hash []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
- type AnvilConfig
- type AnvilRelease
- type DbFactory
- type HandleRelease
- type PageResult
- type ReleaseAsset
- type SigAndData
Constants ¶
const ( HARDHAT = 31337 PURPOSE_INDEX = 44 COIN_TYPE_INDEX = 60 )
const DefaultPaginationLimit = 1000
const LATEST_TAG = "nightly"
const TimeoutInSeconds = 10
const WINDOWS = "windows"
const X86_64 = "amd64"
Variables ¶
var ErrInvalidCursor = errors.New("invalid pagination cursor")
var ErrInvalidLimit = errors.New("limit cannot be negative")
var ErrMixedPagination = errors.New(
"cannot mix forward pagination (first, after) with backward pagination (last, before)")
Functions ¶
func ComputePage ¶
func ComputePage( first *int, last *int, after *string, before *string, total int, ) (offset int, limit int, err error)
Compute the pagination parameters given the GraphQL connection parameters.
func ConfigureLog ¶
func ConvertStatusStringToCompletionStatus ¶
func ConvertStatusStringToCompletionStatus(status string) model.CompletionStatus
Status on schema could be: 'NONE', 'ACCEPTED', 'REJECTED', 'EXCEPTION', 'MACHINE_HALTED', 'CYCLE_LIMIT_EXCEEDED', 'TIME_LIMIT_EXCEEDED', 'PAYLOAD_LENGTH_LIMIT_EXCEEDED'
func DecodeCursor ¶
Decode the integer offset from a base64 string.
func EncodeCursor ¶
Encode the integer offset into a base64 string.
func ExtractSigAndData ¶
func ExtractTarGz ¶
Extract a tar.gz archive to a destination directory
func ExtractZip ¶
Extract a zip archive to a destination directory
func HandleReleaseExecution ¶
func HandleReleaseExecution(stdCtx context.Context, release HandleRelease) (string, error)
Install release
func HashEIP712Message ¶
Implement the hashing function based on EIP-712 requirements
func IsPortInUse ¶
func NewCartesiDomain ¶
func NewCartesiDomain(chainId *math.HexOrDecimal256) apitypes.TypedDataDomain
func SignMessage ¶
func SignMessage(hash []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
Sign the hash with the private key
Types ¶
type AnvilConfig ¶
type AnvilConfig struct { AssetAnvil ReleaseAsset `json:"asset_anvil"` LatestCheck string `json:"latest_check"` }
type AnvilRelease ¶
type AnvilRelease struct { Namespace string Repository string ConfigFilename string Client *github.Client }
Anvil implementation from HandleRelease
type DbFactory ¶
func NewDbFactory ¶
func NewDbFactory() *DbFactory
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 }
Interface for handle libraries on GitHub
type PageResult ¶
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