Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateRandomSecret() ([32]byte, error)
- func NameHash(name string) (hash [32]byte, err error)
- func New() app.Component
- func Normalize(name string) (string, error)
- func PeriodMonthsToTimestamp(registerPeriodMonths uint32) big.Int
- func PrepareCallData_SetContentHashSpaceID(fullName string, contentHash string, spaceID string) ([][]byte, error)
- func RemoveTLD(str string) string
- type ContractsService
Constants ¶
View Source
const CName = "any-ns.contracts"
Variables ¶
View Source
var ( ErrNonceTooLow = errors.New("nonce too low") ErrNonceTooHigh = errors.New("nonce too high") )
Functions ¶
func GenerateRandomSecret ¶
func PeriodMonthsToTimestamp ¶ added in v0.1.9
Types ¶
type ContractsService ¶
type ContractsService interface {
CreateEthConnection() (*ethclient.Client, error)
// generic method to call any contract
CallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
GetBalanceOf(ctx context.Context, client *ethclient.Client, tokenAddress common.Address, address common.Address) (*big.Int, error)
IsContractDeployed(ctx context.Context, client *ethclient.Client, address common.Address) (bool, error)
// will return .owner of the contract
GetOwnerOfSmartContractWallet(ctx context.Context, client *ethclient.Client, address common.Address) (common.Address, error)
// ENS methods
GetOwnerForNamehash(ctx context.Context, client *ethclient.Client, namehash [32]byte) (common.Address, error)
GetAdditionalNameInfo(ctx context.Context, conn *ethclient.Client, currentOwner common.Address, fullName string) (ownerEthAddress string, ownerAnyAddress string, spaceId string, expiration *big.Int, err error)
MakeCommitment(nameFirstPart string, registrantAccount common.Address, secret [32]byte, controller *ac.AnytypeRegistrarControllerPrivate, fullName string, ownerAnyAddr string, spaceId string, isReverseRecordUpdate bool, registerPeriodMonths uint32) ([32]byte, error)
Commit(ctx context.Context, conn *ethclient.Client, opts *bind.TransactOpts, commitment [32]byte, controller *ac.AnytypeRegistrarControllerPrivate) (*types.Transaction, error)
Register(ctx context.Context, conn *ethclient.Client, authOpts *bind.TransactOpts, nameFirstPart string, registrantAccount common.Address, secret [32]byte, controller *ac.AnytypeRegistrarControllerPrivate, fullName string, ownerAnyAddr string, spaceId string, isReverseRecord bool, registerPeriodMonths uint32) (*types.Transaction, error)
RenewName(ctx context.Context, conn *ethclient.Client, opts *bind.TransactOpts, fullName string, durationSec uint64, controller *ac.AnytypeRegistrarControllerPrivate) (*types.Transaction, error)
GetNameByAddress(conn *ethclient.Client, address common.Address) (string, error)
// Aux methods
ConnectToRegistryContract(conn *ethclient.Client) (*ac.ENSRegistry, error)
ConnectToNamewrapperContract(conn *ethclient.Client) (*ac.AnytypeNameWrapper, error)
ConnectToResolver(conn *ethclient.Client) (*ac.AnytypeResolver, error)
ConnectToRegistrar(conn *ethclient.Client) (*ac.AnytypeRegistrarImplementation, error)
ConnectToPrivateController(conn *ethclient.Client) (*ac.AnytypeRegistrarControllerPrivate, error)
GenerateAuthOptsForAdmin(conn *ethclient.Client) (*bind.TransactOpts, error)
CalculateTxParams(conn *ethclient.Client, address common.Address) (*big.Int, uint64, error)
// Check if tx is even started to mine
WaitForTxToStartMining(ctx context.Context, conn *ethclient.Client, txHash common.Hash) error
WaitMined(ctx context.Context, client *ethclient.Client, tx *types.Transaction) (wasMined bool, err error)
TxByHash(ctx context.Context, client *ethclient.Client, txHash common.Hash) (*types.Transaction, error)
app.Component
}
TODO: refactor, split into several interfaces Low-level calls to contracts
Click to show internal directories.
Click to hide internal directories.