import { Account } from '.'
import { Block } from '../block'
-import { BURN_PUBLIC_KEY } from '../constants'
import { Rpc } from '../rpc'
import { AccountInfoRequest } from '../rpc/account_info'
import { BlockInfoRequest } from '../rpc/block_info'
if (typeof confirmedFrontierBlock[confirmedFrontierSubtype] !== 'function') {
throw new TypeError('Unknown subtype of confirmed frontier block', { cause: confirmedFrontierSubtype })
}
- confirmedFrontierBlock[confirmedFrontierSubtype](confirmedFrontierContents.link === BURN_PUBLIC_KEY ? confirmedFrontierContents.representative : confirmedFrontierContents.link, 0).signature = confirmedFrontierContents.signature
+ if (confirmedFrontierSubtype === 'epoch') {
+ confirmedFrontierBlock.epoch(accountInfo.account_version)
+ } else if (confirmedFrontierSubtype === 'change') {
+ confirmedFrontierBlock.change(confirmedFrontierContents.representative)
+ } else {
+ confirmedFrontierBlock[confirmedFrontierSubtype](confirmedFrontierContents.link, 0)
+ }
+ confirmedFrontierBlock.signature = confirmedFrontierContents.signature
account.confirmed_frontier_block = confirmedFrontierBlock
const reqFrontierBlockInfo: BlockInfoRequest = {
if (typeof frontierBlock[frontierSubtype] !== 'function') {
throw new TypeError('Unknown subtype of frontier block', { cause: frontierSubtype })
}
- frontierBlock[frontierSubtype](frontierContents.link === BURN_PUBLIC_KEY ? frontierContents.representative : frontierContents.link, 0).signature = frontierContents.signature
+ if (frontierSubtype === 'epoch') {
+ frontierBlock.epoch(accountInfo.account_version)
+ } else if (confirmedFrontierSubtype === 'change') {
+ frontierBlock.change(frontierContents.representative)
+ } else {
+ frontierBlock[frontierSubtype](frontierContents.link, 0)
+ }
+ frontierBlock.signature = frontierContents.signature
account.frontier_block = frontierBlock
}
if (typeof frontierBlock[subtype] !== 'function') {
throw new TypeError('Unknown frontier block subtype', { cause: subtype })
}
- const arg = subtype === 'epoch' ? account_version : subtype === 'change' ? representative : link
- frontierBlock[subtype](arg, 0).signature = signature
+ if (subtype === 'epoch') {
+ frontierBlock.epoch(account_version)
+ } else if (subtype === 'change') {
+ frontierBlock.change(representative)
+ } else {
+ frontierBlock[subtype](link, 0)
+ }
+ frontierBlock.signature = signature
account.frontier_block = frontierBlock
}
}