Skip to content

Commit

Permalink
build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed May 3, 2019
1 parent cc210e9 commit 65b4522
Showing 1 changed file with 12 additions and 46 deletions.
58 changes: 12 additions & 46 deletions lib/TokenType1.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,15 @@ var TokenType1 = /** @class */ (function () {
}
TokenType1.prototype.create = function (createConfig) {
return __awaiter(this, void 0, void 0, function () {
var tmpBITBOX_1, getRawTransactions, slpValidator, bitboxNetwork, fundingAddress, fundingWif_1, tokenReceiverAddress, batonReceiverAddress, bchChangeReceiverAddress, balances, decimals, name_1, symbol, documentUri, documentHash, initialTokenQty, genesisTxid, error_1;
var _this = this;
var tmpBITBOX, bitboxNetwork, fundingAddress, fundingWif_1, tokenReceiverAddress, batonReceiverAddress, bchChangeReceiverAddress, balances, decimals, name_1, symbol, documentUri, documentHash, initialTokenQty, genesisTxid, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 4]);
// validate address formats
this.validateAddressFormat(createConfig);
tmpBITBOX_1 = this.returnBITBOXInstance(createConfig.fundingAddress);
getRawTransactions = function (txids) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tmpBITBOX_1.RawTransactions.getRawTransaction(txids)];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); };
slpValidator = new slpjs.LocalValidator(tmpBITBOX_1, getRawTransactions);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX_1, slpValidator);
tmpBITBOX = this.returnBITBOXInstance(createConfig.fundingAddress);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX);
fundingAddress = addy.toSLPAddress(createConfig.fundingAddress);
fundingWif_1 = createConfig.fundingWif;
tokenReceiverAddress = addy.toSLPAddress(createConfig.tokenReceiverAddress);
Expand Down Expand Up @@ -103,23 +95,15 @@ var TokenType1 = /** @class */ (function () {
};
TokenType1.prototype.mint = function (mintConfig) {
return __awaiter(this, void 0, void 0, function () {
var tmpBITBOX_2, getRawTransactions, slpValidator, bitboxNetwork, fundingAddress, fundingWif_2, tokenReceiverAddress, batonReceiverAddress, bchChangeReceiverAddress, tokenId, additionalTokenQty, balances, tokenInfo, tokenDecimals, mintQty, inputUtxos, mintTxid, error_2;
var _this = this;
var tmpBITBOX, bitboxNetwork, fundingAddress, fundingWif_2, tokenReceiverAddress, batonReceiverAddress, bchChangeReceiverAddress, tokenId, additionalTokenQty, balances, tokenInfo, tokenDecimals, mintQty, inputUtxos, mintTxid, error_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
// validate address formats
this.validateAddressFormat(mintConfig);
tmpBITBOX_2 = this.returnBITBOXInstance(mintConfig.fundingAddress);
getRawTransactions = function (txids) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tmpBITBOX_2.RawTransactions.getRawTransaction(txids)];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); };
slpValidator = new slpjs.LocalValidator(tmpBITBOX_2, getRawTransactions);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX_2, slpValidator);
tmpBITBOX = this.returnBITBOXInstance(mintConfig.fundingAddress);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX);
fundingAddress = addy.toSLPAddress(mintConfig.fundingAddress);
fundingWif_2 = mintConfig.fundingWif;
tokenReceiverAddress = addy.toSLPAddress(mintConfig.tokenReceiverAddress);
Expand Down Expand Up @@ -156,23 +140,15 @@ var TokenType1 = /** @class */ (function () {
};
TokenType1.prototype.send = function (sendConfig) {
return __awaiter(this, void 0, void 0, function () {
var tmpBITBOX_3, getRawTransactions, slpValidator, bitboxNetwork, fundingAddress, fundingWif_3, tokenReceiverAddress, bchChangeReceiverAddress, tokenId, amount_1, tokenInfo, tokenDecimals_1, balances, inputUtxos, sendTxid, error_3;
var _this = this;
var tmpBITBOX, bitboxNetwork, fundingAddress, fundingWif_3, tokenReceiverAddress, bchChangeReceiverAddress, tokenId, amount_1, tokenInfo, tokenDecimals_1, balances, inputUtxos, sendTxid, error_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
// validate address formats
this.validateAddressFormat(sendConfig);
tmpBITBOX_3 = this.returnBITBOXInstance(sendConfig.fundingAddress);
getRawTransactions = function (txids) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tmpBITBOX_3.RawTransactions.getRawTransaction(txids)];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); };
slpValidator = new slpjs.LocalValidator(tmpBITBOX_3, getRawTransactions);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX_3, slpValidator);
tmpBITBOX = this.returnBITBOXInstance(sendConfig.fundingAddress);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX);
fundingAddress = addy.toSLPAddress(sendConfig.fundingAddress);
fundingWif_3 = sendConfig.fundingWif;
tokenReceiverAddress = sendConfig.tokenReceiverAddress;
Expand Down Expand Up @@ -202,8 +178,6 @@ var TokenType1 = /** @class */ (function () {
inputUtxos = inputUtxos.concat(balances.nonSlpUtxos);
// 6) Set the proper private key for each Utxo
inputUtxos.forEach(function (txo) { return (txo.wif = fundingWif_3); });
console.log("AMOUNT", amount_1.length);
console.log("tokenReceiverAddress", tokenReceiverAddress.length);
return [4 /*yield*/, bitboxNetwork.simpleTokenSend(tokenId, amount_1, inputUtxos, tokenReceiverAddress, bchChangeReceiverAddress)];
case 3:
sendTxid = _a.sent();
Expand All @@ -218,23 +192,15 @@ var TokenType1 = /** @class */ (function () {
};
TokenType1.prototype.burn = function (burnConfig) {
return __awaiter(this, void 0, void 0, function () {
var tmpBITBOX_4, getRawTransactions, slpValidator, bitboxNetwork, fundingAddress, bchChangeReceiverAddress, tokenInfo, tokenDecimals, balances, amount, inputUtxos, burnTxid, error_4;
var _this = this;
var tmpBITBOX, bitboxNetwork, fundingAddress, bchChangeReceiverAddress, tokenInfo, tokenDecimals, balances, amount, inputUtxos, burnTxid, error_4;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
// validate address formats
this.validateAddressFormat(burnConfig);
tmpBITBOX_4 = this.returnBITBOXInstance(burnConfig.fundingAddress);
getRawTransactions = function (txids) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, tmpBITBOX_4.RawTransactions.getRawTransaction(txids)];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); };
slpValidator = new slpjs.LocalValidator(tmpBITBOX_4, getRawTransactions);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX_4, slpValidator);
tmpBITBOX = this.returnBITBOXInstance(burnConfig.fundingAddress);
bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX);
fundingAddress = addy.toSLPAddress(burnConfig.fundingAddress);
bchChangeReceiverAddress = addy.toSLPAddress(burnConfig.bchChangeReceiverAddress);
return [4 /*yield*/, bitboxNetwork.getTokenInformation(burnConfig.tokenId)];
Expand Down

0 comments on commit 65b4522

Please sign in to comment.