account: Account
balance: bigint
previous: string
- representative: Account
+ representative?: Account
link?: Uint8Array<ArrayBuffer>
signature?: string
work?: string
if (typeof previous !== 'string') {
throw new TypeError('Account frontier is unknown')
}
- if (!(representative instanceof Account)) {
- throw new TypeError('Account representative is unknown')
- }
this.account = account
this.balance = BigInt(balance)
this.previous = previous
- this.representative = representative
+ if (representative instanceof Account) {
+ this.representative = representative
+ }
if (typeof signature === 'string') {
this.signature = signature
}
get hash (): Uint8Array<ArrayBuffer> {
try {
if (this.link == null) {
- throw new Error('Block link is required')
+ throw new Error('Link is required')
+ }
+ if (this.representative == null) {
+ throw new Error('Representative is required')
}
const data = [
PREAMBLE,
toJSON (): { [key: string]: string } {
try {
if (this.link == null) {
- throw new Error('Block link is required')
+ throw new Error('Link is required')
+ }
+ if (this.representative == null) {
+ throw new Error('Representative is required')
}
return {
"type": "state",