connect add contributor form to ethereum
This commit is contained in:
@@ -38,6 +38,7 @@ export default Ember.Service.extend({
|
||||
return this.get('kreditsContractInstance');
|
||||
}
|
||||
|
||||
console.log(config.ethereumChain);
|
||||
let contract = kreditsContracts(this.get('web3'), config.ethereumChain)['Kredits'];
|
||||
|
||||
this.set('kreditsContractInstance', contract);
|
||||
@@ -130,6 +131,24 @@ export default Ember.Service.extend({
|
||||
});
|
||||
},
|
||||
|
||||
addContributor(address, name, ipfsHash, isCore, id) {
|
||||
Ember.Logger.debug('[kredits] add contributor', name, address);
|
||||
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||
this.get('kreditsContract').addContributor(address, name, ipfsHash, isCore, id, (err, data) => {
|
||||
if (err) { reject(err); }
|
||||
Ember.Logger.debug('[kredits] add contributor response', data);
|
||||
let contributor = Contributor.create({
|
||||
address: address,
|
||||
github_username: name,
|
||||
github_uid: id,
|
||||
ipfsHash: ipfsHash,
|
||||
kredits: 0
|
||||
});
|
||||
resolve(contributor);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
logKreditsContract: function() {
|
||||
Ember.Logger.debug('[kredits] kreditsContract', this.get('kreditsContract'));
|
||||
}.on('init')
|
||||
|
||||
Reference in New Issue
Block a user