Skip to content

Commit

Permalink
more account migration, another test for tcr apply
Browse files Browse the repository at this point in the history
  • Loading branch information
jellegerbrandy committed Apr 6, 2018
1 parent 38a2778 commit bfb730a
Show file tree
Hide file tree
Showing 46 changed files with 116 additions and 10,366 deletions.
29 changes: 19 additions & 10 deletions dist/paratii.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var ParatiiCore = exports.ParatiiCore = function () {
(0, _createClass3.default)(ParatiiCore, [{
key: 'migrateAccount',
value: function migrateAccount(newAccount) {
var oldAccount, vids, i, vid, ptiBalance;
var oldAccount, vids, i, vid, didVideoApply, ptiBalance;
return _regenerator2.default.async(function migrateAccount$(_context) {
while (1) {
switch (_context.prev = _context.next) {
Expand All @@ -81,7 +81,7 @@ var ParatiiCore = exports.ParatiiCore = function () {

case 5:
if ((_context.t1 = _context.t0()).done) {
_context.next = 14;
_context.next = 18;
break;
}

Expand All @@ -92,24 +92,33 @@ var ParatiiCore = exports.ParatiiCore = function () {

case 10:
_context.next = 12;
return _regenerator2.default.awrap(this.paratii.eth.tcr.exit(vid.id));
return _regenerator2.default.awrap(this.config.paratii.eth.tcr.didVideoApply(vid.id));

case 12:
_context.next = 5;
break;
didVideoApply = _context.sent;

if (!didVideoApply) {
_context.next = 16;
break;
}

case 14:
_context.next = 16;
return _regenerator2.default.awrap(this.paratii.eth.balanceOf(oldAccount, 'PTI'));
return _regenerator2.default.awrap(this.paratii.eth.tcr.exit(vid.id));

case 16:
ptiBalance = _context.sent;
_context.next = 5;
break;

console.log(ptiBalance);
case 18:
_context.next = 20;
return _regenerator2.default.awrap(this.paratii.eth.transfer(newAccount, ptiBalance, 'PTI'));
return _regenerator2.default.awrap(this.paratii.eth.balanceOf(oldAccount, 'PTI'));

case 20:
ptiBalance = _context.sent;
_context.next = 23;
return _regenerator2.default.awrap(this.paratii.eth.transfer(newAccount, ptiBalance, 'PTI'));

case 23:
case 'end':
return _context.stop();
}
Expand Down
32 changes: 14 additions & 18 deletions dist/paratii.eth.tcr.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,40 +241,36 @@ var ParatiiEthTcr = exports.ParatiiEthTcr = function () {
case 19:
// console.log('tx: ', tx)
vId = void 0;
_context5.prev = 20;

vId = (0, _utils.getInfoFromLogs)(tx, '_Application', 'videoId', 1);
_context5.next = 28;
break;

case 24:
_context5.prev = 24;
_context5.t1 = _context5['catch'](20);

if (!_context5.t1) {
_context5.next = 28;
break;
try {
vId = (0, _utils.getInfoFromLogs)(tx, '_Application', 'videoId', 1);
} catch (e) {
// FIXME: thsi error should be thrown
if (e) {
console.log(tx);
// throw (e)
// return false
}
}

return _context5.abrupt('return', false);
// console.log('vId: ', vId)

case 28:
if (!vId) {
_context5.next = 32;
_context5.next = 25;
break;
}

return _context5.abrupt('return', true);

case 32:
case 25:
return _context5.abrupt('return', false);

case 33:
case 26:
case 'end':
return _context5.stop();
}
}
}, null, this, [[10, 16], [20, 24]]);
}, null, this, [[10, 16]]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/ParatiiIPFS.html
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/classes.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/htmldoc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@


<section class="readme-section">
<article><h1>paratii.js</h1><p><a href="https://circleci.com/gh/Paratii-Video/paratii-lib"><img src="https://circleci.com/gh/Paratii-Video/paratii-lib.svg?style=svg" alt="CircleCI"></a></p>
<article><h1>paratii.js</h1><p><a href="https://circleci.com/gh/Paratii-Video/paratii-js"><img src="https://circleci.com/gh/Paratii-Video/paratii-js.svg?style=svg" alt="CircleCI"></a></p>
<p><code>paratii.js</code> is the main entry point and abstraction layer to interact with the Paratii platform.</p>
<p>More information about the Paratii Project can be found on <a href="http://paratii.video/">paratii.video</a>, or in our <a href="https://github.com/Paratii-Video/paratii-player/wiki/Paratii-Blueprint">blueprint</a>. Join the discussion on <a href="https://gitter.im/Paratii-Video">gitter</a>.</p>
<h2>How to use it</h2><p>Here is a code snippet which will upload a video to Paratii and transcode it:</p>
Expand Down Expand Up @@ -156,7 +156,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.core.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
9 changes: 6 additions & 3 deletions docs/htmldoc/paratii.core.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,15 @@ <h1 class="page-title">Source: paratii.core.js</h1>
for (let i in vids) {
let vid = vids[i]
await this.vids.update(vid.id, {owner: newAccount})
await this.paratii.eth.tcr.exit(vid.id)
let didVideoApply = await this.config.paratii.eth.tcr.didVideoApply(vid.id)
if (didVideoApply) {
// removing video from statke
await this.paratii.eth.tcr.exit(vid.id)
}
}

// transfer all PTI to the new account
let ptiBalance = await this.paratii.eth.balanceOf(oldAccount, 'PTI')
console.log(ptiBalance)
await this.paratii.eth.transfer(newAccount, ptiBalance, 'PTI')
// FIXME: need to call tc.apply(vid.id) with newAccount as sender (how to do that?)
}
Expand Down Expand Up @@ -169,7 +172,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.core.users.html
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.core.users.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.core.vids.html
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.core.vids.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.db.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.db.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.db.users.html
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.db.users.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.db.vids.html
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.db.vids.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.events.html
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.events.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.html
Original file line number Diff line number Diff line change
Expand Up @@ -2651,7 +2651,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.tcr.html
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
6 changes: 4 additions & 2 deletions docs/htmldoc/paratii.eth.tcr.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ <h1 class="page-title">Source: paratii.eth.tcr.js</h1>
} catch (e) {
// FIXME: thsi error should be thrown
if (e) {
return false
console.log(tx)
// throw (e)
// return false
}
}

Expand Down Expand Up @@ -291,7 +293,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.users.html
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.users.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.vids.html
Original file line number Diff line number Diff line change
Expand Up @@ -2717,7 +2717,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.vids.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:36+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/htmldoc/paratii.eth.vouchers.html
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2018-04-06T14:20:37+02:00
on 2018-04-06T15:09:04+02:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
Loading

0 comments on commit bfb730a

Please sign in to comment.