fix: pub key / cert check

And selection of address.
fix: check for cert
This commit is contained in:
Thomas Zarebczan 2019-09-23 09:07:43 -04:00 committed by Sean Yesmunt
parent 34b91fca23
commit 3b2776395b
3 changed files with 11 additions and 11 deletions

6
dist/bundle.es.js vendored
View file

@ -1372,13 +1372,13 @@ function doClaimYoutubeChannels() {
dispatch({ dispatch({
type: lbryRedux.ACTIONS.USER_YOUTUBE_IMPORT_STARTED type: lbryRedux.ACTIONS.USER_YOUTUBE_IMPORT_STARTED
}); });
lbryRedux.Lbry.address_list().then(addressList => addressList.find(el => el.used_times === 0)).then(address => Lbryio.call('yt', 'transfer', { lbryRedux.Lbry.address_list().then(addressList => addressList.sort((a, b) => a.used_times - b.used_times)[0]).then(address => Lbryio.call('yt', 'transfer', {
address: address.address, address: address.address,
public_key: address.public_key public_key: address.pubkey
}).then(response => { }).then(response => {
if (response && response.success) { if (response && response.success) {
Promise.all(response.map(channelMeta => { Promise.all(response.map(channelMeta => {
if (channelMeta && channelMeta.channel && channelMeta.channel.transferable) { if (channelMeta && channelMeta.channel && channelMeta.channel.channel_certificate) {
return lbryRedux.Lbry.channel_import({ return lbryRedux.Lbry.channel_import({
channel_data: channelMeta.channel.channel_certificate channel_data: channelMeta.channel.channel_certificate
}); });

10
dist/bundle.js vendored
View file

@ -2827,17 +2827,17 @@ function doClaimYoutubeChannels() {
type: lbry_redux__WEBPACK_IMPORTED_MODULE_0__["ACTIONS"].USER_YOUTUBE_IMPORT_STARTED type: lbry_redux__WEBPACK_IMPORTED_MODULE_0__["ACTIONS"].USER_YOUTUBE_IMPORT_STARTED
}); });
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].address_list().then(function (addressList) { lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].address_list().then(function (addressList) {
return addressList.find(function (el) { return addressList.sort(function (a, b) {
return el.used_times === 0; return a.used_times - b.used_times;
}); })[0];
}).then(function (address) { }).then(function (address) {
return lbryio__WEBPACK_IMPORTED_MODULE_4__["default"].call('yt', 'transfer', { return lbryio__WEBPACK_IMPORTED_MODULE_4__["default"].call('yt', 'transfer', {
address: address.address, address: address.address,
public_key: address.public_key public_key: address.pubkey
}).then(function (response) { }).then(function (response) {
if (response && response.success) { if (response && response.success) {
Promise.all(response.map(function (channelMeta) { Promise.all(response.map(function (channelMeta) {
if (channelMeta && channelMeta.channel && channelMeta.channel.transferable) { if (channelMeta && channelMeta.channel && channelMeta.channel.channel_certificate) {
return lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].channel_import({ return lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].channel_import({
channel_data: channelMeta.channel.channel_certificate channel_data: channelMeta.channel.channel_certificate
}); });

View file

@ -389,16 +389,16 @@ export function doClaimYoutubeChannels() {
type: ACTIONS.USER_YOUTUBE_IMPORT_STARTED, type: ACTIONS.USER_YOUTUBE_IMPORT_STARTED,
}); });
Lbry.address_list() Lbry.address_list()
.then(addressList => addressList.find(el => el.used_times === 0)) .then(addressList => addressList.sort((a, b) => a.used_times - b.used_times)[0])
.then(address => .then(address =>
Lbryio.call('yt', 'transfer', { Lbryio.call('yt', 'transfer', {
address: address.address, address: address.address,
public_key: address.public_key, public_key: address.pubkey,
}).then(response => { }).then(response => {
if (response && response.success) { if (response && response.success) {
Promise.all( Promise.all(
response.map(channelMeta => { response.map(channelMeta => {
if (channelMeta && channelMeta.channel && channelMeta.channel.transferable) { if (channelMeta && channelMeta.channel && channelMeta.channel.channel_certificate) {
return Lbry.channel_import({ return Lbry.channel_import({
channel_data: channelMeta.channel.channel_certificate, channel_data: channelMeta.channel.channel_certificate,
}); });