@wharfkit/antelope
Advanced tools
Comparing version 1.0.8-rc2 to 1.0.8
{ | ||
"name": "@wharfkit/antelope", | ||
"description": "Library for working with Antelope powered blockchains.", | ||
"version": "1.0.8-rc2", | ||
"version": "1.0.8", | ||
"homepage": "https://github.com/wharfkit/antelope", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause-No-Military-License", |
@@ -65,2 +65,22 @@ import {ABISerializableObject} from '../serializer/serializable' | ||
static formatUnits(units: Int64Type, precision: number) { | ||
const digits = Int64.from(units).toString().split('') | ||
let negative = false | ||
if (digits[0] === '-') { | ||
negative = true | ||
digits.shift() | ||
} | ||
while (digits.length <= precision) { | ||
digits.unshift('0') | ||
} | ||
if (precision > 0) { | ||
digits.splice(digits.length - precision, 0, '.') | ||
} | ||
let rv = digits.join('') | ||
if (negative) { | ||
rv = '-' + rv | ||
} | ||
return rv | ||
} | ||
constructor(units: Int64, symbol: Asset.Symbol) { | ||
@@ -85,20 +105,3 @@ this.units = units | ||
get quantity(): string { | ||
const digits = this.units.toString().split('') | ||
let negative = false | ||
if (digits[0] === '-') { | ||
negative = true | ||
digits.shift() | ||
} | ||
const p = this.symbol.precision | ||
while (digits.length <= p) { | ||
digits.unshift('0') | ||
} | ||
if (p > 0) { | ||
digits.splice(digits.length - p, 0, '.') | ||
} | ||
let rv = digits.join('') | ||
if (negative) { | ||
rv = '-' + rv | ||
} | ||
return rv | ||
return Asset.formatUnits(this.units, this.symbol.precision) | ||
} | ||
@@ -105,0 +108,0 @@ |
@@ -248,3 +248,7 @@ /** | ||
} | ||
throw new Error(`Unexpectedly encountered ${value} for non-optional`) | ||
throw new Error( | ||
`Unexpectedly encountered ${value} for non-optional (${ctx.codingPath | ||
.map((path) => path.field) | ||
.join('.')})` | ||
) | ||
} else if (type.isArray) { | ||
@@ -251,0 +255,0 @@ if (!Array.isArray(value)) { |
@@ -182,3 +182,7 @@ /** | ||
} | ||
throw new Error(`Found ${value} for non-optional type: ${type.typeName}`) | ||
throw new Error( | ||
`Found ${value} for non-optional type: ${type.typeName} (${ctx.codingPath | ||
.map((path) => path.field) | ||
.join('.')})` | ||
) | ||
} | ||
@@ -185,0 +189,0 @@ if (abiType && abiType.toABI) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2022080
34800
0