Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add marketplace service #810

Merged
merged 3 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ node_modules

# do not store vendor dir
vendor
tmp-systemservices
tmp-systemservices
node_modules
3 changes: 3 additions & 0 deletions systemservices/marketplace/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.DS_Store
.git
2 changes: 2 additions & 0 deletions systemservices/marketplace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.DS_Store
6 changes: 6 additions & 0 deletions systemservices/marketplace/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:10.11.0
WORKDIR /app
COPY ./package* ./
RUN npm install
COPY . .
CMD [ "npm", "start" ]
89 changes: 89 additions & 0 deletions systemservices/marketplace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Marketplace service

If you get error like `error while downloading manifest ipfs :: QmUoE4fsthoirJRWtqosNMQF79DYBWbgtGw37Sgg2eMdre RequestError: Error: ESOCKETTIMEDOUT` it's because ipfs gateway remove the file from its cache. We need to host an IPFS node to guarantee availability.

### Start service

```
./dev-cli service dev ./systemservices/marketplace
```

### List service

```
./dev-cli service execute marketplace --task listServices --json ./systemservices/marketplace/test-data/empty.json
```

### Get service

```
./dev-cli service execute marketplace --task getService --json ./systemservices/marketplace/test-data/getService.json
```

### Publish service version

```
./dev-cli service execute marketplace --task publishServiceVersion --json ./systemservices/marketplace/test-data/publishServiceVersion.json
```

### Send sign transaction

```
./dev-cli service execute marketplace --task sendSignedTransaction --json ./systemservices/marketplace/test-data/sendSignedTransaction.json
```

### Create service offer

```
./dev-cli service execute marketplace --task createServiceOffer --json ./systemservices/marketplace/test-data/createServiceOffer.json
```

### Purchase

```
./dev-cli service execute marketplace --task purchase --json ./systemservices/marketplace/test-data/purchase.json
```

### Is Authorized

#### with hash
```
./dev-cli service execute marketplace --task isAuthorized --json ./systemservices/marketplace/test-data/isAuthorized.json
```

#### with sid
```
./dev-cli service execute marketplace --task isAuthorized --json ./systemservices/marketplace/test-data/isAuthorized-sid.json
```


### Note:

To send the transaction returned by some commands, execute:

```
./dev-cli service execute ethwallet --task sign --json sign.json
```

With `sign.json` file like (you need to replace the data):
```json
{
"address": "0xcAB79fA69c68CB4C65fa5C6E05BC4dBa5FB57D11",
"passphrase": "1",
"transaction": {
"chainID": 3,
"data": "0x095ea7b300000000000000000000000094f4cb92fe9f547574aec617b1594b13abd47ad300000000000000000000000000000000000000000000003635c9adc5dea00000",
"gas": 1000000,
"gasPrice": "1000000000",
"nonce": 21,
"to": "0x5861B3DC52339d4f976B7fa5d80dB6cd6f477F1B",
"value": "0"
}
}
```

Then, publish transaction, copy past after `signedTransaction=` the tx outputted:

```
./dev-cli service execute marketplace --task sendSignedTransaction --data signedTransaction=
```
Loading