bindings

package
v0.7.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

License

This repository contains two separate license regimes:

  1. LGPL-3.0-or-later for all code in ./abigen (the forked go-ethereum abigen).
    See the full text in LICENSE under “GNU LESSER…”
  2. MIT for everything else in this repo.
    See the full text in LICENSE under “MIT License”.

CRE Generated Bindings (MVP)

This project utilizes a forked version of abigen (from go-ethereum) that lets you generate Go bindings for your smart contracts using a custom template.

Prerequisites

  1. Go Install Go 1.18 or later:
    brew install go          # macOS (Homebrew)
    sudo apt install golang  # Ubuntu/Debian
    
  2. Solidity compiler Install solc to compile or verify your contracts:
    npm install -g solc      # via npm
    brew install solidity    # macOS (Homebrew)
    

Usage

Programmatic API

import "github.com/smartcontractkit/cre-cli/cmd/generate-bindings/bindings"

func main() {
  err := bindings.GenerateBindings(
    "./pkg/bindings/build/MyContract_combined.json", // or "" if using abiPath
    "./pkg/bindings/MyContract.abi",                 // or "" for combined-json mode
    "bindings",                                       // Go package name
    "MyContract",                                     // typeName (single-ABI only)
    "./pkg/bindings/build/bindings.go",               // output file
  )
  if err != nil {
    log.Fatalf("generate bindings: %v", err)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBindings

func GenerateBindings(
	combinedJSONPath string,
	abiPath string,
	pkgName string,
	typeName string,
	outPath string,
) error

Types

This section is empty.

Directories

Path Synopsis
Package abigen generates Ethereum contract Go bindings.
Package abigen generates Ethereum contract Go bindings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL