import Web3 from 'web3'; import { Subdomains, Options, Resolutions } from './types'; import Composer from './composer'; import { TransactionOptions } from './types/options'; export default class extends Composer implements Subdomains { private _resolutions; constructor(blockchainApi: Web3 | any, _resolutions: Resolutions, options?: Options); private _setSubnodeOwner; private _validateDomainAndLabel; private _validateAddress; /** * Checks if the given label subdomain is available under the given domain tree * * @throws SEARCH_DOMAINS_UNDER_AVAILABLE_TLDS if the given domain is not a domain under valid TLDs - KB009 * @throws INVALID_DOMAIN if the given domain is empty, is not alphanumeric or if has uppercase characters - KB010 * @throws INVALID_LABEL if the given label is empty, is not alphanumeric or if has uppercase characters - KB011 * @throws DOMAIN_NOT_EXISTS if the given domain does not exists - KB012 * * @param domain - Parent .rsk domain. ie: wallet.rsk * @param label - Subdomain to check if is available. ie: alice * * @returns * true if available, false if not */ available(domain: string, label: string): Promise; /** * Sets a subdomain owner. If the subdomain exists, sets the new owner, if not, creates the subdomain and sets the owner. * * @throws SEARCH_DOMAINS_UNDER_AVAILABLE_TLDS if the given domain is not a domain under valid TLDs - KB009 * @throws INVALID_DOMAIN if the given domain is empty, is not alphanumeric or if has uppercase characters - KB010 * @throws INVALID_LABEL if the given label is empty, is not alphanumeric or if has uppercase characters - KB011 * @throws DOMAIN_NOT_EXISTS if the given domain does not exists - KB012 * @throws NO_ACCOUNTS_TO_SIGN if the given blockchain api instance does not have associated accounts to sign the transaction - KB015 * @throws INVALID_ADDRESS if the given owner address is invalid - KB017 * @throws INVALID_CHECKSUM_ADDRESS if the given owner address has an invalid checksum - KB019 * * @param domain - Parent .rsk domain. ie: wallet.rsk * @param label - Subdomain to register. ie: alice * @param owner - The owner of the new subdomain * @param options - Custom configs to be used when submitting the transaction * * @returns Transaction hash */ setOwner(domain: string, label: string, owner: string, options?: TransactionOptions): Promise; /** * Creates a new subdomain under the given domain tree if it is available, and sets its resolution if addr is provided. * It could send one, two or three transactions based on the value of the sent parameters. * * @throws SEARCH_DOMAINS_UNDER_AVAILABLE_TLDS if the given domain is not a domain under valid TLDs - KB009 * @throws INVALID_DOMAIN if the given domain is empty, is not alphanumeric or if has uppercase characters - KB010 * @throws INVALID_LABEL if the given label is empty, is not alphanumeric or if has uppercase characters - KB011 * @throws DOMAIN_NOT_EXISTS if the given domain does not exists - KB012 * @throws SUBDOMAIN_NOT_AVAILABLE if the given domain is already owned - KB016 * @throws NO_ACCOUNTS_TO_SIGN if the given blockchain api instance does not have associated accounts to sign the transaction - KB015 * @throws INVALID_ADDRESS if the given owner or address resolution is invalid - KB017 * @throws INVALID_CHECKSUM_ADDRESS if the given owner address or resolution has an invalid checksum - KB019 * * @param domain - Parent .rsk domain. ie: wallet.rsk * @param label - Subdomain to register. ie: alice * @param owner - The owner of the new subdomain. If not provided, the address who executes the tx will be the owner * @param addr - The address to be set as resolution of the new subdomain * @param options - Custom configs to be used when submitting the transaction * * @returns Transaction hash of the latest transaction */ create(domain: string, label: string, owner?: string, addr?: string, options?: TransactionOptions): Promise; }