@protokol/nft-exchange-crypto
Version:
Transaction Builders For Exchange NFT Transaction Types
84 lines • 2.81 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NFTBidTransaction = void 0;
const crypto_1 = require("@arkecosystem/crypto");
const core_nft_crypto_1 = require("@protokol/core-nft-crypto");
const utils_1 = require("@protokol/utils");
const bytebuffer_1 = __importDefault(require("bytebuffer"));
const enums_1 = require("../enums");
class NFTBidTransaction extends core_nft_crypto_1.AbstractNFTTransaction {
static getAssetSchema() {
return {
type: "object",
required: ["nftBid"],
properties: {
nftBid: {
type: "object",
required: ["auctionId", "bidAmount"],
properties: {
auctionId: {
$ref: "transactionId",
},
bidAmount: {
bignumber: { minimum: 1 },
},
},
},
},
};
}
serialize() {
var _a;
const { data } = this;
utils_1.Asserts.assert.defined((_a = data.asset) === null || _a === void 0 ? void 0 : _a.nftBid);
const buffer = new bytebuffer_1.default(32 + 8, true);
buffer.append(data.asset.nftBid.auctionId, "hex");
buffer.writeUint64(data.asset.nftBid.bidAmount.toString());
return buffer;
}
deserialize(buf) {
const { data } = this;
const nftBid = {
auctionId: buf.readBytes(32).toString("hex"),
bidAmount: crypto_1.Utils.BigNumber.make(buf.readUint64().toString()),
};
data.asset = {
nftBid,
};
}
}
exports.NFTBidTransaction = NFTBidTransaction;
Object.defineProperty(NFTBidTransaction, "typeGroup", {
enumerable: true,
configurable: true,
writable: true,
value: enums_1.NFTExchangeTransactionsTypeGroup
});
Object.defineProperty(NFTBidTransaction, "type", {
enumerable: true,
configurable: true,
writable: true,
value: enums_1.NFTTransactionTypes.NFTBid
});
Object.defineProperty(NFTBidTransaction, "key", {
enumerable: true,
configurable: true,
writable: true,
value: "NFTBid"
});
Object.defineProperty(NFTBidTransaction, "version", {
enumerable: true,
configurable: true,
writable: true,
value: enums_1.NFTExchangeTransactionVersion
});
Object.defineProperty(NFTBidTransaction, "defaultStaticFee", {
enumerable: true,
configurable: true,
writable: true,
value: crypto_1.Utils.BigNumber.make(enums_1.NFTStaticFees.NFTBid)
});
//# sourceMappingURL=nft-bid.js.map