Getting Started
SCM
git clone https://github.com/NeoPlace/neoplace-protocol.git
Current branch is: master
Prerequisites
Following development tools are required to run this project
* GIT
* IntelliJ IDEA / Visual Studio Code
* Node 8 with npm 5
* angular-cli
Hierarchy
app
app.component
app.module
... # entry point for angular app and configuration files
providers # useful class
model
...
package.json
README.md
How to use NeoPlace protocol
Web3 transaction class
Interact with the NeoPlace smart contract
//init web3 provider
constructor(private transactionWeb3: TransactionWeb3Service) {
this.transactionWeb3.initDesktop(); // for Desktop version
this.transactionWeb3.initMobile("[your ethereum private key]", "[rpcUrl]") // for Mobile version
}
Available methods:
this.transactionWeb3.buyItem
.send
.sendAdditionalFunds
.unlockFunds
.getPurchases
.getSales
.getTransaction
IPFS class
Available methods:
constructor(private ipfsService: IpfsService) {}
...
// add text data
this.ipfsService.addData("your text").then(resp => {
console.log("ipfs hash: ", resp.hash);
});
// add a file
this.ipfsService.addFile([your file]).then(reader => {
this.ipfsService.saveToIpfs(reader).then(resp => {
console.log("ipfs hash: ", resp.hash);
})
})
Architecture
How data is structured
Your item or service is stored in JSON format in IPFS :
{ "item": {
"id": "...";
"title": "...";
"subtitle": "...";
"category": "...";
"description": "...";
"tags": ["...", "...", "..."];
"gallery": ["<reference to another IPFS hash>", "...", "..."];
"status": "...";
"price": ...;
"currency": "...";
"brand": "...";
"condition": "...";
"userSeller": "..."
}
}