docs: replace deprecated function NewTransactor in native-bindings page

This commit is contained in:
hsyodyssey 2024-03-27 19:44:30 +08:00
parent b98a0fcef0
commit 477106c494

View file

@ -223,12 +223,12 @@ func main() {
if err != nil { if err != nil {
log.Fatalf("Failed to connect to the Ethereum client: %v", err) log.Fatalf("Failed to connect to the Ethereum client: %v", err)
} }
auth, err := bind.NewTransactor(strings.NewReader(key), "<<strong_password>>") auth, err := bind.NewTransactorWithChainID(strings.NewReader(key), "<<strong_password>>", ChainId)
if err != nil { if err != nil {
log.Fatalf("Failed to create authorized transactor: %v", err) log.Fatalf("Failed to create authorized transactor: %v", err)
} }
// Deploy the contract passing the newly created `auth` and `conn` vars // Deploy the contract passing the newly created `auth` and `conn` vars
address, tx, instance, err := DeployStorage(auth, conn), new(big.Int), "Storage contract in Go!", 0, "Go!") address, tx, instance, err := DeployStorage(auth, conn)
if err != nil { if err != nil {
log.Fatalf("Failed to deploy new storage contract: %v", err) log.Fatalf("Failed to deploy new storage contract: %v", err)
} }