Package Exports
- @logosnetwork/logos-webwallet-sdk
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@logosnetwork/logos-webwallet-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
logos-webwallet-sdk
Creates Logos wallets without full nodes
Installation
npm i @logosnetwork/logos-webwallet-sdk
Usage
const LogosWallet = require('@logosnetwork/logos-webwallet-sdk')
const Wallet = LogosWallet.Wallet
let wallet = new Wallet({
password: 'password' // Make this strong
})
let account = wallet.createAccount({
index: 0
}).then((val) => {
account.createBlock('lgs_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpiij4txtdo', '1000000000000000000000000000000', true, wallet.rpc)
})
Class structure
full documentation coming soon
export class Wallet {
constructor(options?: WalletOptions)
public walletID: string
public currentAccountAddress: LogosAddress
public seed: Hexadecimal64Length
public rpc: RPCOptions
public mqtt: string
public readonly accounts: Account[]
public readonly account: Account
public readonly balance: string
public readonly pendingBlocks: Block[]
public setPassword(password: string): void
public createSeed(overwrite?: boolean): Hexadecimal64Length
public addAccount(account: Account): Account
public createAccount(options?: AccountOptions): Promise<Account>
public recalculateWalletBalancesFromChain(): void
public getBlock(hash: Hexadecimal64Length): Block | boolean
public confirmBlock(account: LogosAddress, hash: Hexadecimal64Length): void
public encrypt(): string
public load(encryptedWallet: string): Promise<WalletData>
private _decrypt(encryptedWallet: string): WalletData | boolean
private _generateAccountOptionsFromSeed(index: number): MinimialAccount
private _generateAccountOptionsFromPrivateKey(privateKey: Hexadecimal64Length): MinimialAccount
}
export class Account {
constructor(options?: AccountOptions);
public label: string
public synced: boolean
public readonly index: number
public readonly previous: Hexadecimal64Length
public readonly address: LogosAddress
public readonly publicKey: Hexadecimal64Length
public readonly privateKey: Hexadecimal64Length
public readonly balance: string
public readonly pendingBalance: string
public readonly representative: LogosAddress
public readonly chain: Block[]
public readonly recieveChain: Block[]
public readonly pendingChain: Block[]
public readonly blockCount: number
public readonly pendingBlockCount: number
public readonly recieveCount: number
public sync(options: RPCOptions): Promise<Account>
public updateBalancesFromChain(): void
public verifyChain(): boolean
public verifyRecieveChain(): boolean
public recentBlocks(count?: number, offset?: number): Block[]
public recentPendingBlocks(count?: number, offset?: number): Block[]
public recentReceiveBlocks(count?: number, offset?: number): Block[]
public getBlocksUpTo(hash: Hexadecimal64Length): Block[]
public getPendingBlocksUpTo(hash: Hexadecimal64Length): Block[]
public getReceiveBlocksUpTo(hash: Hexadecimal64Length): Block[]
public removePendingBlocks(): void
public removePendingBlock(hash: Hexadecimal64Length): boolean
public getBlock(hash: Hexadecimal64Length): Block
public createBlock(to: LogosAddress, amount?: string, remoteWork?: boolean, rpc?: RPCOptions): Promise<Block>
public getPendingBlock(hash: Hexadecimal64Length): boolean | Block
public confirmBlock(hash: Hexadecimal64Length, rpc: RPCOptions | boolean): void
public addReceiveBlock(block: MQTTBlockOptions): boolean | Block
}
export class Block {
constructor(options?: BlockOptions);
public signature: Hexadecimal64Length
public readonly hash: Hexadecimal64Length
public work: Hexadecimal16Length
public amount: string
public previous: Hexadecimal64Length
public transactionFee: string
public readonly representative: Hexadecimal64Length
public readonly destination: Hexadecimal64Length
public readonly account: Hexadecimal64Length
public createWork(testNet?: boolean): Hexadecimal16Length
public setRepresentative(account: LogosAddress): void
public setDestination(account: LogosAddress): void
public setAccount(account: LogosAddress): void
public sign(privateKey: Hexadecimal64Length): boolean
public verify(): boolean
public publish(options: RPCOptions): Promise<Hexadecimal64Length>
public toJSON(pretty?: boolean): BlockJSON
}
//#endregion
//#region Typedefs
type WalletOptions = {
password: string
seed?: Hexadecimal64Length
deterministicKeyIndex?: number
currentAccountAddress?: LogosAddress
accounts?: Map<LogosAddress, Account>
walletID?: string
version?: number
remoteWork?: boolean
rpc?: RPCOptions
};
type AccountOptions = {
label?: string
address?: LogosAddress
publicKey?: Hexadecimal64Length
privateKey?: Hexadecimal64Length
balance?: string | number
pendingBalance?: string | number
representative?: LogosAddress
chain?: Block[]
receiveChain?: Block[]
pendingChain?: Block[]
previous?: Hexadecimal64Length
version?: number
index?: number
};
type BlockOptions = {
hash?: Hexadecimal64Length
signature?: Hexadecimal64Length
work?: Hexadecimal16Length
amount?: string
previous?: Hexadecimal64Length
transactionFee?: string
representative?: LogosAddress
destination?: LogosAddress
account?: LogosAddress
};
type BlockJSON = string
type WalletData = {
seed?: Hexadecimal64Length
deterministicKeyIndex?: number
version?: number
walletID?: string | boolean
accounts?: MinimialAccount[]
}
type MinimialAccount = {
privateKey?: Hexadecimal64Length
publicKey?: Hexadecimal64Length
address?: LogosAddress
index?: number
label?: string
}
type MQTTBlockOptions = {
type: string
account: LogosAddress
previous: Hexadecimal64Length
representative: LogosAddress
amount: string
transaction_fee: string
link: Hexadecimal64Length
link_as_account: LogosAddress
signature: string
work: Hexadecimal16Length
timestamp: string
hash: Hexadecimal64Length
batchBlockHash: Hexadecimal64Length
}
type RPCOptions = {
host: string,
delegates: string[],
proxy?: string
}
type Hexadecimal64Length = string
type Hexadecimal16Length = string
type LogosAddress = string
Documentation
Coming Soon