Files
zeekay 579f53c3cc chore: remove local replace directives and update dependencies
- Update github.com/luxfi/netrunner v1.15.3 → v1.15.4
- Update github.com/luxfi/node v1.22.77 → v1.22.80
- Remove local replace directive for netrunner
- Use published package versions for reproducible builds
2026-01-03 07:09:01 -08:00

44 lines
922 B
Go

// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package contract
import "github.com/luxfi/crypto"
// GetContractOwner gets owner for https://docs.openzeppelin.com/contracts/2.x/api/ownership#Ownable-owner contracts
func GetContractOwner(
rpcURL string,
contractAddress crypto.Address,
) (crypto.Address, error) {
out, err := CallToMethod(
rpcURL,
contractAddress,
"owner()->(address)",
)
if err != nil {
return crypto.Address{}, err
}
return GetSmartContractCallResult[crypto.Address]("owner", out)
}
func TransferOwnership(
rpcURL string,
contractAddress crypto.Address,
ownerPrivateKey string,
newOwner crypto.Address,
) error {
_, _, err := TxToMethod(
rpcURL,
false,
crypto.Address{},
ownerPrivateKey,
contractAddress,
nil,
"transfer ownership",
nil,
"transferOwnership(address)",
newOwner,
)
return err
}