UNPKG

@ton3/liteclient

Version:
25 lines (20 loc) 735 B
import { BlockchainClient } from '../blockchain' export class MulticastClient extends BlockchainClient { constructor (private readonly clients: BlockchainClient[]) { super(null) const exclude = [ 'constructor', 'shardIdent', 'globalVersion', 'extBlkRef', 'blkMasterInfo', 'blkPrevInfo', 'blkInfo' ] const props = Object.getOwnPropertyNames(BlockchainClient.prototype) .filter(prop => !exclude.includes(prop)) props.forEach((prop) => { this[prop] = (...args: any) => Promise.any(this.clients.map(client => client[prop](...args))).catch(err => console.log(err)) }) } }