import { Models, Interfaces } from '@open-rights-exchange/chain-js'; import { EosChainState } from './eosChainState'; import { EosCreateAccountOptions, EosEntityName, EosGeneratedKeys, EosNewAccountType, EosPublicKeys, EosTransactionOptions } from './models/index'; import { EosTransaction } from './eosTransaction'; /** Helper class to compose a transction for creating a new chain account * Handles native, virtual, and createEscrow accounts * Generates new account keys if not provide * Supports reusing a recycled account and a wide range of other options */ export declare class EosCreateAccount implements Interfaces.CreateAccount { private _accountName; private _chainState; private _didRecycleAccount; private _transaction; private _accountType; private _options; /** Either publicKeys or multisigOptions will be converted and stored here */ private _authorizations; private _generatedKeys; constructor(chainState: EosChainState, options?: EosCreateAccountOptions); init(): Promise; /** Account name for the account to be created * May be automatically generated (or otherwise changed) by composeTransaction() */ get accountName(): EosEntityName; /** Account type to be created */ get accountType(): EosNewAccountType; /** Account will be recycled (accountName must be specified via composeTransaction() * This is set by composeTransaction() * ... if the account name provided has the 'unused' key as its active public key */ get didRecycleAccount(): boolean; /** The keys that were generated as part of the account creation process * IMPORTANT: Be sure to always read and store these keys after creating an account * This is the only way to retrieve the auto-generated private keys after an account is created */ get generatedKeys(): Partial; get isMultisig(): boolean; assertValidOptionsAndSetAuth(): void; /** Only available if NOT multisig */ get activeAndOwnerPublicKeys(): EosPublicKeys; /** Account creation options */ get options(): EosCreateAccountOptions; /** EOS requires the chain to execute a createAccount transaction * to create the account structure on-chain */ get supportsTransactionToCreateAccount(): boolean; /** The transaction with all actions needed to create the account * This should be signed and sent to the chain to create the account */ get transaction(): EosTransaction; /** Compose a transaction to send to the chain to create a new account */ composeTransaction(accountType: EosNewAccountType, transactionOptions?: EosTransactionOptions): Promise; /** Determine if desired account name is usable for a new account. * Generates a new account name if one isnt provided. * Checks if provided account is unused and can be recycled */ determineNewAccountName(accountName: EosEntityName): Promise<{ alreadyExists: boolean; newAccountName: Models.ChainEntityNameBrand; canRecycle: boolean; }>; /** Generates a random EOS compatible account name and checks chain to see if it is arleady in use. * If already in use, this function is called recursively until a unique name is generated */ generateAccountName(prefix: string, checkIfNameUsedOnChain?: boolean): Promise; /** Generates a random EOS account name account names MUST be base32 encoded in compliance with the EOS standard (usually 12 characters) account names can also contain only the following characters: a-z, 1-5, & '.' In regex: [a-z1-5\.]{12} account names are generated based on the current unix timestamp + some randomness, and cut to be 12 chars */ generateAccountNameString(prefix?: string): Promise; /** Checks create options - if publicKeys are missing, * autogenerate the public and private key pair and add them to options * If multisigOptions provided, just returns */ generateKeysIfNeeded(): Promise; doesAccountExist(accountName: EosEntityName): Promise; /** merge default options and incoming options */ private applyDefaultOptions; /** Generate new public and private key pair and stores them in class's generatedKeys * Allows existing publicKeys to be retained via overridePublicKeys * Also adds the new keys to the class's options.publicKeys */ private generateAccountKeys; /** Compose an updateAuth command to add a permission to the virtual 'master' account */ private composeCreateVirtualNestedActions; /** For a virual nested account, we add the new account's permission on the bottom of the linked list of permissions */ private composeNewVirualNestedAccountPermissionStructure; private assertValidOptionNewKeys; private assertValidOptionsResources; }