set destination field

This commit is contained in:
Michele Balistreri 2020-04-01 13:50:22 +03:00
parent 4fd3162439
commit 1bb13358d5
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
1 changed files with 6 additions and 6 deletions

View File

@ -63,7 +63,7 @@ async function deployBucket(sender, factory, token, validityInDays) {
let methodCall = GiftBucketFactory.methods.create(token.toLowerCase(), expirationDate); let methodCall = GiftBucketFactory.methods.create(token.toLowerCase(), expirationDate);
try { try {
let receipt = await sendMethod(methodCall, sender, null); let receipt = await sendMethod(methodCall, sender, GiftBucketFactory.options.address);
return receipt.events.Created.returnValues.bucket; return receipt.events.Created.returnValues.bucket;
} catch(err) { } catch(err) {
console.error(err); console.error(err);
@ -73,19 +73,19 @@ async function deployBucket(sender, factory, token, validityInDays) {
async function createGift(sender, bucket, keycard) { async function createGift(sender, bucket, keycard) {
GiftBucket.options.address = bucket; GiftBucket.options.address = bucket;
let methodCall = GiftBucket.methods.createGift(keycard.keycard.toLowerCase(), keycard.amount, keycard.code); let methodCall = GiftBucket.methods.createGift(keycard.keycard, keycard.amount, keycard.code);
try { try {
let receipt = await sendMethod(methodCall, sender, null); await sendMethod(methodCall, sender, GiftBucket.options.address);
return receipt.events.Created.returnValues.bucket; return true;
} catch(err) { } catch(err) {
console.error(err); console.error(err);
return null; return false;
} }
} }
function processLine(line) { function processLine(line) {
let c = line.split(",").map((e) => e.trim()); let c = line.split(",").map((e) => e.toLowerCase().trim());
return {keycard: c[0], amount: parseInt(c[1]), code: c[2]}; return {keycard: c[0], amount: parseInt(c[1]), code: c[2]};
} }