Adjust for latest naming conventions
expept the renaming of ipfsHash to hashDigest all are already reflected in the contracts
This commit is contained in:
@@ -9,7 +9,7 @@ export default Component.extend({
|
|||||||
|
|
||||||
// Default attributes used by reset
|
// Default attributes used by reset
|
||||||
attributes: {
|
attributes: {
|
||||||
address: null,
|
account: null,
|
||||||
name: null,
|
name: null,
|
||||||
kind: 'person',
|
kind: 'person',
|
||||||
url: null,
|
url: null,
|
||||||
@@ -24,9 +24,9 @@ export default Component.extend({
|
|||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
isValidAddress: computed('kredits.ethProvider', 'address', function() {
|
isValidAccount: computed('kredits.ethProvider', 'account', function() {
|
||||||
// TODO: add proper address validation
|
// TODO: add proper address validation
|
||||||
return this.get('address') !== '';
|
return this.get('account') !== '';
|
||||||
}),
|
}),
|
||||||
isValidName: isPresent('name'),
|
isValidName: isPresent('name'),
|
||||||
isValidURL: isPresent('url'),
|
isValidURL: isPresent('url'),
|
||||||
@@ -34,7 +34,7 @@ export default Component.extend({
|
|||||||
isValidGithubUsername: isPresent('github_username'),
|
isValidGithubUsername: isPresent('github_username'),
|
||||||
isValidWikiUsername: isPresent('wiki_username'),
|
isValidWikiUsername: isPresent('wiki_username'),
|
||||||
isValid: and(
|
isValid: and(
|
||||||
'isValidAddress',
|
'isValidAccount',
|
||||||
'isValidName',
|
'isValidName',
|
||||||
'isValidGithubUID'
|
'isValidGithubUID'
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{input name="address"
|
{{input name="account"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
|
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
|
||||||
value=address
|
value=account
|
||||||
class=(if isValidAddress 'valid' '')}}
|
class=(if isValidAccount 'valid' '')}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<select required onchange={{action (mut kind) value="target.value"}}>
|
<select required onchange={{action (mut kind) value="target.value"}}>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<tr class="metadata {{if contributor.isCurrentUser 'current-user'}} {{if contributor.showMetadata 'visible'}}">
|
<tr class="metadata {{if contributor.isCurrentUser 'current-user'}} {{if contributor.showMetadata 'visible'}}">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://testnet.etherscan.io/address/{{contributor.address}}">Inspect Ethereum transactions</a></li>
|
<li><a href="https://testnet.etherscan.io/address/{{contributor.account}}">Inspect Ethereum transactions</a></li>
|
||||||
{{#if contributor.ipfsHash}}
|
{{#if contributor.ipfsHash}}
|
||||||
<li><a href="https://ipfs.io/ipfs/{{contributor.ipfsHash}}">Inspect IPFS profile</a></li>
|
<li><a href="https://ipfs.io/ipfs/{{contributor.ipfsHash}}">Inspect IPFS profile</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@@ -26,11 +26,8 @@ export default class Contributor extends Base {
|
|||||||
|
|
||||||
return this.functions.getContributorById(id)
|
return this.functions.getContributorById(id)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
// TODO: remove as soon as the contract provides the id
|
// TODO: remove when naming updated on the contract
|
||||||
data.id = id;
|
data.hashDigest = data.ipfsHash;
|
||||||
// TODO: rename address to account
|
|
||||||
data.address = data.account;
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
// Fetch IPFS data if available
|
// Fetch IPFS data if available
|
||||||
@@ -48,7 +45,7 @@ export default class Contributor extends Base {
|
|||||||
.then((ipfsHashAttr) => {
|
.then((ipfsHashAttr) => {
|
||||||
let contributor = [
|
let contributor = [
|
||||||
contributorAttr.address,
|
contributorAttr.address,
|
||||||
ipfsHashAttr.ipfsHash,
|
ipfsHashAttr.hashDigest,
|
||||||
ipfsHashAttr.hashFunction,
|
ipfsHashAttr.hashFunction,
|
||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
contributorAttr.isCore,
|
contributorAttr.isCore,
|
||||||
|
|||||||
@@ -24,13 +24,10 @@ export default class Operator extends Base {
|
|||||||
getById(id) {
|
getById(id) {
|
||||||
id = ethers.utils.bigNumberify(id);
|
id = ethers.utils.bigNumberify(id);
|
||||||
|
|
||||||
return this.functions.proposals(id)
|
return this.functions.getProposal(id)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
// TODO: remove as soon as the contract provides the id
|
// TODO: remove when naming updated on the contract
|
||||||
data.id = id;
|
data.hashDigest = data.ipfsHash;
|
||||||
// TODO: rename creatorAddress to creator
|
|
||||||
data.creatorAddress = data.creator;
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
// Fetch IPFS data if available
|
// Fetch IPFS data if available
|
||||||
@@ -49,7 +46,7 @@ export default class Operator extends Base {
|
|||||||
let proposal = [
|
let proposal = [
|
||||||
proposalAttr.contributorId,
|
proposalAttr.contributorId,
|
||||||
proposalAttr.amount,
|
proposalAttr.amount,
|
||||||
ipfsHashAttr.ipfsHash,
|
ipfsHashAttr.hashDigest,
|
||||||
ipfsHashAttr.hashFunction,
|
ipfsHashAttr.hashFunction,
|
||||||
ipfsHashAttr.hashSize,
|
ipfsHashAttr.hashSize,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export default class IPFS {
|
|||||||
if (!data.hashSize || data.hashSize === 0) {
|
if (!data.hashSize || data.hashSize === 0) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
// merge ipfsHash (encoded from hashDigest, hashSize, hashFunction)
|
||||||
|
data.ipfsHash = this.encodeHash(data);
|
||||||
|
|
||||||
return this.cat(data)
|
return this.cat(data)
|
||||||
.then(deserialize)
|
.then(deserialize)
|
||||||
.then((attributes) => {
|
.then((attributes) => {
|
||||||
@@ -39,15 +42,15 @@ export default class IPFS {
|
|||||||
decodeHash(ipfsHash) {
|
decodeHash(ipfsHash) {
|
||||||
let multihash = multihashes.decode(multihashes.fromB58String(ipfsHash));
|
let multihash = multihashes.decode(multihashes.fromB58String(ipfsHash));
|
||||||
return {
|
return {
|
||||||
ipfsHash: '0x' + multihashes.toHexString(multihash.digest),
|
hashDigest: '0x' + multihashes.toHexString(multihash.digest),
|
||||||
hashSize: multihash.length,
|
hashSize: multihash.length,
|
||||||
hashFunction: multihash.code,
|
hashFunction: multihash.code,
|
||||||
sourceHash: ipfsHash
|
ipfsHash: ipfsHash
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
encodeHash(hashData) {
|
encodeHash(hashData) {
|
||||||
let digest = this._ipfsAPI.Buffer.from(hashData.ipfsHash.slice(2), 'hex');
|
let digest = this._ipfsAPI.Buffer.from(hashData.hashDigest.slice(2), 'hex');
|
||||||
return multihashes.encode(digest, hashData.hashFunction, hashData.hashSize);
|
return multihashes.encode(digest, hashData.hashFunction, hashData.hashSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import bignumber from 'kredits-web/utils/cps/bignumber';
|
|||||||
export default EmberObject.extend({
|
export default EmberObject.extend({
|
||||||
// Contract
|
// Contract
|
||||||
id: bignumber('idRaw', 'toString'),
|
id: bignumber('idRaw', 'toString'),
|
||||||
// TODO: Should we rename it to account like in the contract?
|
account: null,
|
||||||
address: null,
|
|
||||||
balance: bignumber('balanceRaw', 'toNumber'),
|
balance: bignumber('balanceRaw', 'toNumber'),
|
||||||
isCore: false,
|
isCore: false,
|
||||||
ipfsHash: null,
|
ipfsHash: null,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{{#if kredits.currentUserIsCore }}
|
{{#if kredits.currentUserIsCore }}
|
||||||
(core)
|
(core)
|
||||||
{{/if}}
|
{{/if}}
|
||||||
Account: {{kredits.currentUser.address}}
|
Account: {{kredits.currentUser.account}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
Reference in New Issue
Block a user