meteor-nem-library
Version:
Meteor NIS1 Library
60 lines • 3.12 kB
JavaScript
;
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 NEM
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const MosaicDefinition_1 = require("../../models/mosaic/MosaicDefinition");
const MosaicId_1 = require("../../models/mosaic/MosaicId");
const MosaicLevy_1 = require("../../models/mosaic/MosaicLevy");
const MosaicTransferable_1 = require("../../models/mosaic/MosaicTransferable");
class BMosaicTransferable extends MosaicTransferable_1.MosaicTransferable {
/**
* constructor
* @param mosaicId
* @param properties
* @param quantity
* @param levy
*/
constructor(mosaicId, properties, quantity, levy) {
super(mosaicId, properties, quantity, levy);
}
/**
* Create a MosaicTransferable from object
* @param mosaicTransferable - MosaicTransferable object from outside source
* @returns {MosaicTransferable}
*/
static castToMosaicTransferable(mosaicTransferable) {
const mosaicId = new MosaicId_1.MosaicId(mosaicTransferable.mosaicId.namespaceId, mosaicTransferable.mosaicId.name);
const prop = new MosaicDefinition_1.MosaicProperties(mosaicTransferable.properties.divisibility, mosaicTransferable.properties.initialSupply, mosaicTransferable.properties.transferable, mosaicTransferable.properties.supplyMutable);
if (mosaicTransferable.levy) {
const levyMosaicId = new MosaicId_1.MosaicId(mosaicTransferable.levy.mosaicId.namespaceId, mosaicTransferable.levy.mosaicId.name);
const levy = new MosaicLevy_1.MosaicLevy(mosaicTransferable.levy.type, mosaicTransferable.levy.recipient, levyMosaicId, mosaicTransferable.levy.fee);
return new MosaicTransferable_1.MosaicTransferable(mosaicId, prop, mosaicTransferable.quantity, levy);
}
else {
return new MosaicTransferable_1.MosaicTransferable(mosaicId, prop, mosaicTransferable.quantity);
}
}
}
exports.BMosaicTransferable = BMosaicTransferable;
//# sourceMappingURL=bMosaicTransferable.js.map