dotbit
Version:
A complete .bit SDK and utilities in TypeScript
99 lines (98 loc) • 3.41 kB
TypeScript
import { RecordsEditor } from './builders/RecordsEditor';
import { RemoteTxBuilder } from './builders/RemoteTxBuilder';
import { AccountStatus, PaymentMethodIDs, DWebProtocol } from './const';
import { BitIndexer } from './fetchers/BitIndexer';
import { AccountInfo, BitAccountRecord, BitAccountRecordAddress, BitAccountRecordExtended, KeyInfo } from './fetchers/BitIndexer.type';
import { SubAccountListParams, SubAccountMintParams } from './fetchers/SubAccountAPI';
import { BitSigner } from './signers/BitSigner';
export interface BitAccountOptions {
account: string;
bitIndexer?: BitIndexer;
bitBuilder?: RemoteTxBuilder;
signer?: BitSigner;
}
export interface SubAccountParams {
account: string;
keyInfo?: KeyInfo;
mintForAccount?: string;
registerYears: number;
}
export interface RoleKeyInfo extends KeyInfo {
algorithm_id: number;
}
export interface RegisterParam {
keyInfo?: KeyInfo;
registerYears: number;
paymentMethodID: PaymentMethodIDs;
inviterAccount?: string;
channelAccount?: string;
}
export interface RenewParam {
paymentMethodID: PaymentMethodIDs;
renewYears: number;
}
export interface RenewRes extends RenewParam {
keyInfo: KeyInfo;
account: string;
orderId: string;
txHash: string;
}
export interface RegisterRes extends RegisterParam {
account: string;
orderId: string;
txHash: string;
}
export declare class BitAccount {
#private;
account: string;
bitIndexer: BitIndexer;
bitBuilder: RemoteTxBuilder;
signer: BitSigner;
constructor(options: BitAccountOptions);
protected _info: AccountInfo;
protected _records: BitAccountRecordExtended[];
status: AccountStatus;
protected requireSigner(): void;
protected requireBitBuilder(): void;
setReverseRecord(): void;
subAccounts(params?: Omit<SubAccountListParams, 'account'>): Promise<import("./fetchers/SubAccountAPI").SubAccountListRes>;
checkSubAccounts(subAccounts: SubAccountMintParams[]): Promise<{
result: import("./fetchers/SubAccountAPI").SubAccountWithStatus[];
}>;
mintSubAccounts(params: SubAccountParams[]): Promise<{
hash?: string | undefined;
hash_list: string[];
}>;
mintSubAccount(params: SubAccountParams): Promise<{
hash?: string | undefined;
hash_list: string[];
}>;
changeOwner(keyInfo: KeyInfo): Promise<{
hash: string;
}>;
changeManager(keyInfo: KeyInfo): Promise<{
hash: string;
}>;
updateRecords(records: BitAccountRecord[]): Promise<{
hash: string;
}>;
editRecords(): Promise<RecordsEditor>;
info(): Promise<AccountInfo>;
owner(): Promise<RoleKeyInfo>;
manager(): Promise<RoleKeyInfo>;
records(key?: string): Promise<BitAccountRecordExtended[]>;
addresses(chain?: string): Promise<BitAccountRecordAddress[]>;
addrs(chain?: string): Promise<BitAccountRecordAddress[]>;
dwebs(protocol?: DWebProtocol): Promise<BitAccountRecordExtended[]>;
dweb(): Promise<BitAccountRecordExtended | undefined>;
profiles(subtype?: string): Promise<BitAccountRecordExtended[]>;
avatar(): Promise<{
linkage: Array<{
type: string;
content: string;
}>;
url: string;
} | null>;
register(param: RegisterParam): Promise<RegisterRes>;
renew(param: RenewParam): Promise<RenewRes>;
}