@yubing744/rooch-sdk
Version:
56 lines (55 loc) • 1.94 kB
TypeScript
import { IAccount, CallOption, ISessionKey } from './interface';
import { IClient } from '../client';
import { IAuthorizer } from '../auth';
import { AccountAddress, FunctionId, TypeTag, Arg, IPage } from '../types';
/**
* Rooch Account
* all write calls in here
*/
export declare class Account implements IAccount {
private readonly client;
private readonly address;
private readonly authorizer;
constructor(client: IClient, address: AccountAddress, authorizer: IAuthorizer);
private makeAuth;
private parseStateToSessionKey;
private parseScopes;
private getSequenceNumber;
/**
* Get account address
*/
getAddress(): string;
/**
* Run move function by current account
*
* @param funcId FunctionId the function like '0x3::empty::empty'
* @param tyArgs Generic parameter list
* @param args parameter list
* @param opts Call option
*/
runFunction(funcId: FunctionId, tyArgs: TypeTag[], args: Arg[], opts: CallOption): Promise<string>;
createSessionAccount(scope: Array<string>, maxInactiveInterval: number, opts?: CallOption): Promise<IAccount>;
registerSessionKey(authKey: AccountAddress, scopes: Array<string>, maxInactiveInterval: number, opts?: CallOption): Promise<void>;
/**
* Remove session key
*
* @param authKey
* @param opts
*/
removeSessionKey(authKey: AccountAddress, opts?: CallOption): Promise<string>;
/**
* Query account's sessionKey
*
* @param cursor The page cursor
* @param limit The page limit
*/
querySessionKeys(cursor: string | null, limit: number): Promise<IPage<ISessionKey, string>>;
/**
* Check session key whether expired
*
* @param authKey the auth key
*/
isSessionKeyExpired(authKey: AccountAddress): Promise<boolean>;
gasCoinBalance(): Promise<bigint>;
coinBalance(coinType: string): Promise<bigint>;
}