Commit 89f44dd4 authored by Chuck LeDuc Díaz's avatar Chuck LeDuc Díaz
Browse files

Merge branch 'package' into 'master'

Release 0.1.1: compiled contract in the usual place

See merge request caelum-tech/caelum-identity!9
parents 652eb264 19a0edd5
Pipeline #66580878 passed with stage
in 2 minutes and 39 seconds
......@@ -9,6 +9,9 @@ lerna-debug.log*
# Vim
**/*.swp
# Vscode
.vscode
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "@caelum-tech/identity",
"version": "0.1.0",
"version": "0.1.1",
"description": "Caelum Identity library",
"main": "index.js",
"scripts": {
......@@ -10,7 +10,7 @@
"coverage:report": "nyc report --reporter=html",
"eslint": "./node_modules/eslint/bin/eslint.js .",
"lint": "npm run eslint; npm run solium",
"mocha": "mocha --timeout 30000 test/Identity.js",
"mocha": "mocha --timeout 30000 test",
"npm:publish": "npm publish --access public",
"solium": "solium --dir contracts",
"start": "./node_modules/@caelum-tech/parity/scripts/startParity.sh",
......@@ -33,7 +33,7 @@
},
"homepage": "https://gitlab.com/caelum-tech/caelum-identity#readme",
"dependencies": {
"@caelum-tech/parity": "^0.1.1",
"@caelum-tech/parity": "^0.1.2",
"ethers": "^4.0.27",
"keythereum": "^1.0.4"
},
......
......@@ -10,7 +10,7 @@ const fs = require('fs-extra')
* @returns {*} - Path where the compiled sources should be saved.
*/
function compilingPreperations () {
const buildPath = path.resolve(__dirname, '../src/contracts')
const buildPath = path.resolve(__dirname, '../build/contracts')
fs.removeSync(buildPath)
return buildPath
}
......
......@@ -14,7 +14,7 @@ const value = ethers.utils.formatBytes32String('Hello World')
describe('1.1. Identity', function () {
before(async () => {
parity = new Parity('http://localhost:8545')
parity = new Parity()
wallet = await parity.loadWallet('0x8ad0ba67f8088d1f990f878815173f1dafda0a55', '59Ta_ad6_]k<PWPp')
})
......@@ -24,13 +24,13 @@ describe('1.1. Identity', function () {
it('Should Build the Identity Contract', done => {
buildId()
let content = fs.readFileSync(path.resolve(__dirname, '../src/contracts', 'Identity.json'), 'utf8')
let content = fs.readFileSync(path.resolve(__dirname, '../build/contracts', 'Identity.json'), 'utf8')
expect(content).to.not.be.equal(null)
done()
})
it('Should Deploy the Identity Contract', (done) => {
IdentityContract = require('../src/contracts/Identity.json')
IdentityContract = require('../build/contracts/Identity.json')
parity.deployContract(wallet, IdentityContract, [wallet.address])
.then(async (testId) => {
identityAddr = testId.address
......@@ -46,7 +46,8 @@ describe('1.1. Identity', function () {
it('Should work as expected : setData and getData', (done) => {
identityContract.setData(key, value)
.then(async (tx) => {
await tx.wait()
const tx2 = await tx.wait()
console.log('setData manual after waiting: ', tx2)
return identityContract.getData(key)
})
.then((resValue) => {
......@@ -57,27 +58,30 @@ describe('1.1. Identity', function () {
it('Should act as a proxy', (done) => {
let newIdAddress
parity.deployContract(wallet, IdentityContract, [identityAddr])
parity.deployContract(wallet, IdentityContract, [wallet.address])
.then(async (newId) => {
newIdAddress = newId.address
newId = parity.getContract(newIdAddress, IdentityContract.abi, wallet)
let owner = await newId.owner()
expect(owner).to.be.equal(identityAddr)
expect(owner).to.be.equal(wallet.address)
let iface = new ethers.utils.Interface(IdentityContract.abi)
let encodedCall = iface.functions.setData.encode([ key, value ], 0, { from: wallet.address })
let tx = await identityContract.execute(OPERATION_CALL, newIdAddress, 0, encodedCall)
return tx.wait()
// let encodedCall = iface.functions.setData.encode([ key, value ], 0, { from: wallet.address })
let encodedCall = iface.functions.setData.encode([key, value])
// console.log("Encoded call: ", encodedCall)
let tx = await identityContract.execute(OPERATION_CALL, newId.address, 0, encodedCall)
tx = await tx.wait()
console.log('tx execute after waiting: ', tx)
return newId
})
.then(() => {
.then(async (newId) => {
console.log('** GetData 1')
console.log(newIdAddress)
let id2 = parity.getContract(newIdAddress, IdentityContract.abi, wallet)
return id2.getData(key)
})
.then((data) => {
let data1 = await identityContract.getData(key)
console.log(data1)
let data2 = await newId.getData(key)
console.log('** GetData 2')
console.log(data)
// console.log(ethers.utils.parseBytes32String(data))
console.log(data2)
done()
})
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment