@payburner/keyburner-sidewinder-model
Version:
Models library for Keyburner Sidewinder
26 lines • 1.55 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const AccountUtils_1 = require("../utils/AccountUtils");
const assert = require("assert");
test('Test amount calculations', () => __awaiter(void 0, void 0, void 0, function* () {
const orig = 10.1;
const raw = AccountUtils_1.AccountUtils.calculateRaw("10.1", 6);
const unit = AccountUtils_1.AccountUtils.calculateUnit(raw, 6);
assert(orig.toFixed(6) === parseFloat(unit).toFixed(6));
}));
test('Test token account id calculations', () => {
const address = 'joe';
const symbol = 'xrp';
const serializedTokenAccountId = AccountUtils_1.AccountUtils.calculateTokenAccountId("bigboy", symbol, address);
assert(serializedTokenAccountId === 'sidewinder://v1/environment/bigboy/token/' + symbol + '/account/' + address);
});
//# sourceMappingURL=AccountUtils.test.js.map