Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
obany committed Feb 17, 2020
1 parent ffd6ed3 commit e70ce72
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 40 deletions.
40 changes: 22 additions & 18 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15323,26 +15323,30 @@ async function attachToTangle(provider, depth, mwm, seed, addressIndex, tag, pay
const message = asciiToTrytes(ascii);
console.log(`Message Trytes Length: ${message.length}`);

const iota = composeAPI({
provider
});

const address = generateAddress(seed, addressIndex);
try {
const iota = composeAPI({
provider
});

console.log("Preparing transfer");
const trytes = await iota.prepareTransfers('9'.repeat(81), [
{
address,
value: 0,
message,
tag
}
]);
const address = generateAddress(seed, addressIndex);

console.log("Sending trytes");
const bundles = await iota.sendTrytes(trytes, depth, mwm);
console.log("Preparing transfer");
const trytes = await iota.prepareTransfers('9'.repeat(81), [
{
address,
value: 0,
message,
tag
}
]);

return bundles[0].hash;
console.log("Sending trytes");
const bundles = await iota.sendTrytes(trytes, depth, mwm);
return bundles[0].hash;
} catch (err) {
console.log(`Sending trytes failed`);
console.log(err.message);
}
}

module.exports = {
Expand Down Expand Up @@ -31946,7 +31950,7 @@ async function run() {
} catch (error) {
core.setFailed(error.message);
console.log(`Failed`);
console.log(error.message);
console.log(error);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gh-tangle-release",
"version": "0.5.3",
"version": "0.5.4",
"description": "Create a release and adds metadata to the IOTA Tangle",
"main": "dist/index.js",
"scripts": {
Expand Down
44 changes: 24 additions & 20 deletions src/iota.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,30 @@ async function attachToTangle(provider, depth, mwm, seed, addressIndex, tag, pay
const message = asciiToTrytes(ascii);
console.log(`Message Trytes Length: ${message.length}`);

const iota = composeAPI({
provider
});

const address = generateAddress(seed, addressIndex);

console.log("Preparing transfer");
const trytes = await iota.prepareTransfers('9'.repeat(81), [
{
address,
value: 0,
message,
tag
}
]);

console.log("Sending trytes");
const bundles = await iota.sendTrytes(trytes, depth, mwm);

return bundles[0].hash;
try {
const iota = composeAPI({
provider
});

const address = generateAddress(seed, addressIndex);

console.log("Preparing transfer");
const trytes = await iota.prepareTransfers('9'.repeat(81), [
{
address,
value: 0,
message,
tag
}
]);

console.log("Sending trytes");
const bundles = await iota.sendTrytes(trytes, depth, mwm);
return bundles[0].hash;
} catch (err) {
console.log(`Sending trytes failed`);
console.log(err.message);
}
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion src/tangle-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function run() {
} catch (error) {
core.setFailed(error.message);
console.log(`Failed`);
console.log(error.message);
console.log(error);
}
}

Expand Down

0 comments on commit e70ce72

Please sign in to comment.