@neo-one/server-plugin-wallet
Version:
NEO•ONE Server wallet plugin.
80 lines (79 loc) • 3 kB
TypeScript
import { NetworkType as ClientNetworkType } from '@neo-one/client-common';
import { LocalWallet } from '@neo-one/client-core';
import { DescribeTable, PluginManager } from '@neo-one/server-plugin';
import { Observable } from 'rxjs';
import { ReadWalletClient, WalletClient } from './types';
import { Wallet, WalletResourceType } from './WalletResourceType';
interface InitialOptions {
readonly privateKey: string;
readonly password?: string;
}
interface WalletResourceOptions {
readonly client: WalletClient;
readonly readClient: ReadWalletClient;
readonly pluginManager: PluginManager;
readonly resourceType: WalletResourceType;
readonly name: string;
readonly baseName: string;
readonly networkName: string;
readonly address: string;
readonly dataPath: string;
readonly walletPath: string;
readonly clientNetworkType: ClientNetworkType;
readonly initial?: InitialOptions;
}
interface NewWalletResourceOptions {
readonly client: WalletClient;
readonly pluginManager: PluginManager;
readonly resourceType: WalletResourceType;
readonly name: string;
readonly privateKey?: string;
readonly password?: string;
readonly dataPath: string;
}
interface ExistingWalletResourceOptions {
readonly client: WalletClient;
readonly pluginManager: PluginManager;
readonly resourceType: WalletResourceType;
readonly name: string;
readonly dataPath: string;
}
export declare class WalletResource {
static createNew({ client, pluginManager, resourceType, name, privateKey: privateKeyIn, password, dataPath, }: NewWalletResourceOptions): Promise<WalletResource>;
static createExisting({ client, pluginManager, resourceType, name, dataPath, }: ExistingWalletResourceOptions): Promise<WalletResource>;
private static getWalletPath;
readonly resource$: Observable<Wallet>;
private readonly client;
private mutableReadClient;
private readonly resourceType;
private readonly name;
private readonly baseName;
private readonly networkName;
private readonly address;
private readonly dataPath;
private readonly walletPath;
private readonly clientNetworkType;
private mutableInitial;
private mutableNeoBalance;
private mutableGasBalance;
private mutableBalance;
private readonly network$;
constructor({ client, readClient, pluginManager, resourceType, name, baseName, networkName, address, dataPath, walletPath, clientNetworkType, initial, }: WalletResourceOptions);
create(): Promise<void>;
delete(): Promise<void>;
readonly walletID: {
readonly network: ClientNetworkType;
readonly address: string;
};
readonly wallet: LocalWallet;
readonly unlocked: boolean;
unlock({ password }: {
readonly password: string;
}): Promise<void>;
lock(): Promise<void>;
readonly wif: string | undefined;
getDebug(): DescribeTable;
private toResource;
private update;
}
export {};