hypercerts-core
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "hypercerts-core", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Hypercerts Core component", | ||
@@ -5,0 +5,0 @@ "main": "hc-core.js", |
'use strict' | ||
var exports = module.exports = {} | ||
var Promise = require('promise') | ||
var Buffer = require('buffer/').Buffer | ||
var ipfsAPI = require('ipfs-api') | ||
var Ethereum = require('./ethereumAPI.js') | ||
var ipfs = ipfsAPI('/ip4/127.0.0.1/tcp/5001') | ||
// var Promise = require('promise') | ||
const Ethereum = require('./ethereumAPI.js') | ||
const ipfsAPI = require('ipfs-api') | ||
const ipfs = ipfsAPI('/ip4/127.0.0.1/tcp/5001') | ||
// For when https://github.com/ipfs/js-ipfs-api/pull/651 is patched | ||
/* | ||
if (typeof window.ipfs === 'undefined') { | ||
const ipfsAPI = require('ipfs-api') | ||
const ipfs = ipfsAPI('/ip4/127.0.0.1/tcp/5001') | ||
} else { | ||
const ipfs = window.ipfs | ||
} | ||
*/ | ||
exports.addItem = function (key, item) { | ||
@@ -65,3 +74,3 @@ console.log('Adding item') | ||
return new Promise(function (resolve, reject) { | ||
ipfs.files.add([claimsArrayBuffer], function (err, result) { | ||
ipfs.files.add(claimsArrayBuffer, function (err, result) { | ||
if (err) { | ||
@@ -68,0 +77,0 @@ reject('something went wrong adding the file') |
10198
409