Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateRandomSecret() ([32]byte, error)
- func NameHash(name string) (hash [32]byte, err error)
- func New() app.Component
- func NormalizeAnyName(name string, useEnsip15 bool) (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 Block
- type CommitParams
- type ContractsService
- type MakeCommitmentParams
- type RegisterParams
- type RenewParams
Constants ¶
View Source
const CName = "any-ns.contracts"
View Source
const MAX_NAME_LENGTH = 100
Variables ¶
View Source
var ( ErrNonceTooLow = errors.New("nonce too low") ErrNonceTooHigh = errors.New("nonce too high") // ErrNotAContract is returned by GetScwOwner when there is no code at the address: // it is either an EOA or a smart contract wallet that is not deployed yet ErrNotAContract = errors.New("address is not a smart contract") )
Functions ¶
func GenerateRandomSecret ¶
func NormalizeAnyName ¶ added in v0.3.0
func PeriodMonthsToTimestamp ¶ added in v0.1.9
Types ¶
type Block ¶ added in v0.7.0
type Block struct {
Number int64
Hash common.Hash
// the block timestamp (unix seconds)
Time uint64
}
Block identifies a block of the chain
type CommitParams ¶ added in v0.2.3
type CommitParams struct {
Opts *bind.TransactOpts
Commitment [32]byte
Controller *ac.AnytypeRegistrarControllerPrivate
}
type ContractsService ¶
type ContractsService interface {
CreateEthConnection() (*ethclient.Client, error)
// generic method to call any contract
CallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
// AA methods:
IsContractDeployed(ctx context.Context, address common.Address) (bool, error)
// will return .owner of the contract (at the block, a zero hash: the latest one)
GetScwOwner(ctx context.Context, address common.Address, block common.Hash) (common.Address, error)
// ENS methods.
// block pins a read to one block by its hash (EIP-1898; a zero hash: the latest block).
// all the reads of one cache refresh use the same block, so that they see one chain state
// (one fork too, even behind a load balancer) and can be ordered by it
LatestBlock(ctx context.Context) (*Block, error)
// FinalizedBlock is the newest block that can not be reorged away (the "finalized" tag, or
// "safe" if the provider does not know it)
FinalizedBlock(ctx context.Context) (*Block, error)
GetOwnerForNamehash(ctx context.Context, namehash [32]byte, block common.Hash) (common.Address, error)
GetNameExpires(ctx context.Context, fullName string, block common.Hash) (*big.Int, error)
GetAdditionalNameInfo(ctx context.Context, currentOwner common.Address, fullName string, block common.Hash) (ownerEthAddress string, ownerAnyAddress string, spaceID string, err error)
Commit(ctx context.Context, params *CommitParams) (*types.Transaction, error)
Register(ctx context.Context, params *RegisterParams) (*types.Transaction, error)
Renew(ctx context.Context, params *RenewParams) (*types.Transaction, error)
// Aux methods
MakeCommitment(params *MakeCommitmentParams) ([32]byte, error)
GetNameByAddress(address common.Address) (string, error)
GetBalanceOf(ctx context.Context, tokenAddress common.Address, address common.Address) (*big.Int, error)
ConnectToRegistryContract() (*ac.ENSRegistry, error)
ConnectToNamewrapperContract() (*ac.AnytypeNameWrapper, error)
ConnectToResolver() (*ac.AnytypeResolver, error)
ConnectToRegistrar() (*ac.AnytypeRegistrarImplementation, error)
ConnectToPrivateController() (*ac.AnytypeRegistrarControllerPrivate, error)
GenerateAuthOptsForAdmin() (*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, txHash common.Hash) error
WaitMined(ctx context.Context, tx *types.Transaction) (wasMined bool, err error)
TxByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, error)
app.Component
}
TODO: refactor, split into several interfaces Low-level calls to contracts
type MakeCommitmentParams ¶ added in v0.2.3
type RegisterParams ¶ added in v0.2.3
type RenewParams ¶ added in v0.2.3
type RenewParams struct {
TxOpts *bind.TransactOpts
FullName string
DurationSec uint64
Controller *ac.AnytypeRegistrarControllerPrivate
}
Click to show internal directories.
Click to hide internal directories.