Skip to content

Instantly share code, notes, and snippets.

@mgyong
Created October 21, 2021 05:22
Show Gist options
  • Select an option

  • Save mgyong/04158ff80aed8b764136ae8266673bef to your computer and use it in GitHub Desktop.

Select an option

Save mgyong/04158ff80aed8b764136ae8266673bef to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/mgyong/creatornfts/backend/pkg/eth/contract/api"
)
const (
CONTRACT_ADDRESS1 = "0x41E37083e0e3f0EaC5B446B41F8dD76b3f723C8B"
)
func main() {
//message := "ming here"
client, err := ethclient.Dial("https://goerli.infura.io/v3/88b681646aec41ebbb443c5d35f40f18")
if err != nil {
panic(err)
}
conn, err := api.NewApi(common.HexToAddress("CONTRACT_ADDRESS1"), client)
if err != nil {
panic(err)
}
/*
reply, err := conn.Greet(&bind.CallOpts{}, message)
if err != nil {
panic(err)
}
fmt.Println("reply: ", reply)
*/
reply1, err := conn.Hello(&bind.CallOpts{})
if err != nil {
panic(err)
}
fmt.Println("reply1: ", reply1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment