@test-org122/hypernet-core
Version:
Hypernet Core. Represents the SDK for running the Hypernet Protocol.
67 lines • 3.65 kB
TypeScript
import { IAccountsRepository } from "@interfaces/data";
import { AssetBalance, Balances, BigNumber, EthereumAddress, PublicIdentifier, ResultAsync } from "@interfaces/objects";
import { IVectorUtils, IBlockchainProvider, IBrowserNodeProvider, ILogUtils, IFullChannelState, IBlockchainUtils } from "@interfaces/utilities";
import { BalancesUnavailableError, BlockchainUnavailableError, CoreUninitializedError, RouterChannelUnknownError, VectorError } from "@interfaces/objects/errors";
declare class AssetInfo {
assetId: EthereumAddress;
name: string;
symbol: string;
decimals: number;
constructor(assetId: EthereumAddress, name: string, symbol: string, decimals: number);
}
/**
* Contains methods for getting Ethereum accounts, public identifiers,
* balances for accounts, and depositing & withdrawing assets.
*/
export declare class AccountsRepository implements IAccountsRepository {
protected blockchainProvider: IBlockchainProvider;
protected vectorUtils: IVectorUtils;
protected browserNodeProvider: IBrowserNodeProvider;
protected logUtils: ILogUtils;
protected blockchainUtils: IBlockchainUtils;
/**
* Retrieves an instances of the AccountsRepository.
*/
protected assetInfo: Map<EthereumAddress, AssetInfo>;
constructor(blockchainProvider: IBlockchainProvider, vectorUtils: IVectorUtils, browserNodeProvider: IBrowserNodeProvider, logUtils: ILogUtils, blockchainUtils: IBlockchainUtils);
/**
* Get the current public identifier for this instance.
*/
getPublicIdentifier(): ResultAsync<PublicIdentifier, VectorError | Error>;
/**
* Get the Ethereum accounts associated with this instance.
*/
getAccounts(): ResultAsync<string[], BlockchainUnavailableError>;
/**
* Get all balances associated with this instance.
*/
getBalances(): ResultAsync<Balances, BalancesUnavailableError | VectorError>;
/**
* Get balance for a particular asset for this instance
* @param assetAddress the (Ethereum) address of the token to get the balance of
*/
getBalanceByAsset(assetAddress: EthereumAddress): ResultAsync<AssetBalance, BalancesUnavailableError>;
/**
* Deposit funds into this instance of Hypernet Core
* @param assetAddress the (Ethereum) token address to deposit
* @param amount the amount of the token to deposit
*/
depositFunds(assetAddress: EthereumAddress, amount: BigNumber): ResultAsync<null, RouterChannelUnknownError | CoreUninitializedError | VectorError | Error | BlockchainUnavailableError>;
/**
* Withdraw funds from this instance of Hypernet Core to a specified (Ethereum) destination
* @param assetAddress the token address to withdraw
* @param amount the amount of the token to withdraw
* @param destinationAddress the destination (Ethereum) address to withdraw to
*/
withdrawFunds(assetAddress: string, amount: BigNumber, destinationAddress: string): ResultAsync<void, RouterChannelUnknownError | CoreUninitializedError | VectorError | Error>;
/**
* Mint the test token to the provided address
* @param amount the amount of the test token to mint
* @param to the (Ethereum) address to mint the test token to
*/
mintTestToken(amount: BigNumber, to: EthereumAddress): ResultAsync<void, BlockchainUnavailableError>;
protected _getAssetBalance(i: number, channelState: IFullChannelState): ResultAsync<AssetBalance, VectorError>;
protected _getAssetInfo(assetAddress: EthereumAddress): ResultAsync<AssetInfo, BlockchainUnavailableError>;
}
export {};
//# sourceMappingURL=AccountsRepository.d.ts.map