UNPKG

@zerochain/sdk

Version:

The Züs JS SDK is a JavaScript client library that provides a convenient interface for interacting with the Züs Network. It allows developers to perform various operations such as creating and managing allocations, uploading and downloading files, executi

22 lines (20 loc) 627 B
export const errorOut = (method: string, e: unknown): never => { console.error(`${method}: `, e) if (typeof e === 'string') throw new Error(e) else if (e instanceof Error) throw e else throw new Error(`${method}: Unknown error`) } export const truncateAddress = ( addressString = '', start = 5, flag = true, end = -4, showDots = true ): string => { if (addressString?.length <= start + 3 + Math.abs(end)) return addressString if (flag) { return `${addressString?.slice(0, start)}...${addressString?.slice(end)}` } else { return `${addressString?.slice(0, start)}${showDots ? '...' : ''}` } }