Compare commits

..

1 Commits

Author SHA1 Message Date
a7c497da6a Return IPFS hash in addContribution() response
Needed in kredits-web. Useful for clients to identify contributions
before knowing their assigned ID.
2019-09-10 12:18:35 +02:00
10 changed files with 41426 additions and 23 deletions

View File

@@ -1,4 +0,0 @@
template: |
## Changes
$CHANGES

8145
apps/contribution/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

8145
apps/contributor/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

8145
apps/proposal/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

8145
apps/token/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -58,7 +58,10 @@ class Contribution extends Record {
ipfsHashAttr.hashSize, ipfsHashAttr.hashSize,
]; ];
return this.functions.add(...contribution, callOptions); return this.functions.add(...contribution, callOptions).then(res => {
res.ipfsHash = this.ipfs.encodeHash(ipfsHashAttr);
return res;
});
}); });
} }

View File

@@ -28,7 +28,7 @@ class Contributor {
github_username, github_username,
gitea_username, gitea_username,
wiki_username, wiki_username,
zoom_display_name, accounts,
} = this; } = this;
let data = { let data = {
@@ -36,7 +36,7 @@ class Contributor {
'@type': 'Contributor', '@type': 'Contributor',
kind, kind,
name, name,
accounts: [], accounts: accounts || [],
}; };
if (url) { if (url) {
@@ -68,13 +68,6 @@ class Contributor {
}); });
} }
if (zoom_display_name) {
data.accounts.push({
'site': 'zoom.us',
'username': zoom_display_name,
});
}
// Write it pretty to ipfs // Write it pretty to ipfs
return JSON.stringify(data, null, 2); return JSON.stringify(data, null, 2);
} }
@@ -104,11 +97,10 @@ class Contributor {
accounts, accounts,
} = JSON.parse(serialized.toString('utf8')); } = JSON.parse(serialized.toString('utf8'));
let github_username, github_uid, gitea_username, wiki_username, zoom_display_name; let github_username, github_uid, gitea_username, wiki_username;
let github = accounts.find(a => a.site === 'github.com'); let github = accounts.find(a => a.site === 'github.com');
let gitea = accounts.find(a => a.site === 'gitea.kosmos.org'); let gitea = accounts.find(a => a.site === 'gitea.kosmos.org');
let wiki = accounts.find(a => a.site === 'wiki.kosmos.org'); let wiki = accounts.find(a => a.site === 'wiki.kosmos.org');
let zoom = accounts.find(a => a.site === 'zoom.us');
if (github) { if (github) {
(({ username: github_username, uid: github_uid} = github)); (({ username: github_username, uid: github_uid} = github));
@@ -119,9 +111,6 @@ class Contributor {
if (wiki) { if (wiki) {
(({ username: wiki_username } = wiki)); (({ username: wiki_username } = wiki));
} }
if (zoom) {
(({ username: zoom_display_name } = zoom));
}
return { return {
name, name,
@@ -132,7 +121,6 @@ class Contributor {
github_username, github_username,
gitea_username, gitea_username,
wiki_username, wiki_username,
zoom_display_name,
ipfsData: serialized, ipfsData: serialized,
}; };
} }

4
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "kredits-contracts", "name": "kredits-contracts",
"version": "5.5.0", "version": "5.4.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -6132,4 +6132,4 @@
} }
} }
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "kredits-contracts", "name": "kredits-contracts",
"version": "5.5.0", "version": "5.4.0",
"description": "Ethereum contracts and npm wrapper for Kredits", "description": "Ethereum contracts and npm wrapper for Kredits",
"main": "./lib/kredits.js", "main": "./lib/kredits.js",
"directories": { "directories": {

8836
yarn.lock Normal file

File diff suppressed because it is too large Load Diff