bindings

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 9 Imported by: 0

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