UNPKG

@make-software/csprclick-core-types

Version:

Typescript definitions for CSPR.click core packages

39 lines (38 loc) 1.29 kB
export class Account { constructor(provider, providerSupports, name, publicKey, connectedAt, token, custom, lastUsed) { this.provider = provider; this.providerSupports = providerSupports; this.name = name; this.publicKey = publicKey; this.connectedAt = connectedAt; this.token = token; this.custom = custom; this.lastUsed = lastUsed; } static fromAccountType(accountType) { return new Account(accountType.provider, accountType.providerSupports, accountType.name, accountType.public_key, // @ts-ignore accountType.connected_at || accountType.connectedAt, accountType.token, accountType.custom || {}, // @ts-ignore accountType.last_used || accountType.lastUsed); } toAccountType() { return { provider: this.provider, providerSupports: this.providerSupports, name: this.name, public_key: this.publicKey, connected_at: this.connectedAt, token: this.token, custom: this.custom, balance: '0', last_used: this.lastUsed }; } addToken(token) { this.token = token; } setCustomData(custom) { this.custom = custom; } }