@near-js/accounts
Version:
Classes encapsulating account-specific functionality
43 lines (40 loc) • 1.87 kB
text/typescript
import { PublicKey } from '@near-js/crypto';
import { C as Connection } from './connection-BbhZTxD7.cjs';
import { Account } from './account.cjs';
import '@near-js/signers';
import '@near-js/providers';
import '@near-js/types';
import '@near-js/transactions';
import '@near-js/tokens';
/**
* Account creator provides an interface for implementations to actually create accounts
*/
declare abstract class AccountCreator {
abstract createAccount(newAccountId: string, publicKey: PublicKey): Promise<void>;
}
declare class LocalAccountCreator extends AccountCreator {
readonly masterAccount: Account;
readonly initialBalance: bigint;
constructor(masterAccount: Account, initialBalance: bigint);
/**
* Creates an account using a masterAccount, meaning the new account is created from an existing account
* @param newAccountId The name of the NEAR account to be created
* @param publicKey The public key from the masterAccount used to create this account
* @returns {Promise<void>}
*/
createAccount(newAccountId: string, publicKey: PublicKey): Promise<void>;
}
declare class UrlAccountCreator extends AccountCreator {
readonly connection: Connection;
readonly helperUrl: string;
constructor(connection: Connection, helperUrl: string);
/**
* Creates an account using a helperUrl
* This is [hosted here](https://helper.nearprotocol.com) or set up locally with the [near-contract-helper](https://github.com/nearprotocol/near-contract-helper) repository
* @param newAccountId The name of the NEAR account to be created
* @param publicKey The public key from the masterAccount used to create this account
* @returns {Promise<void>}
*/
createAccount(newAccountId: string, publicKey: PublicKey): Promise<void>;
}
export { AccountCreator, LocalAccountCreator, UrlAccountCreator };