diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index 08e64ea6d35a727bd4c95177b13ea45af424a6b0..cd0c792c6a8764e4c4c8b677a8b87cbafc01fcac 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -326,13 +326,10 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser // Get transactions BMA.tx.sources({pubkey: data.pubkey}) .then(function(res){ - if (!data.sources) { - data.sources=[]; - } var sources = []; var sourcesIndexByKey = []; var balance = 0; - if (!!res.sources && res.sources.length > 0) { + if (res.sources) { _.forEach(res.sources, function(src) { var srcKey = src.type+':'+src.identifier+':'+src.noffset; src.consumed = false; @@ -442,23 +439,23 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser var balance = data.balance; _.forEach(data.tx.history, function(tx) { // process TX history - var uid = uids[tx.pubkey]; - tx.uid = (uid ? uid : null); + tx.uid = uids[tx.pubkey] || null; }); _.forEach(data.tx.pendings, function(tx) { // process TX pendings - var uid = uids[tx.pubkey]; - tx.uid = (uid ? uid : null); + tx.uid = uids[tx.pubkey] || null; var sources = []; var valid = true; - if (tx.issuer !== data.pubkey) { // do not check sources from received TX + if (tx.amount > 0) { // do not check sources from received TX valid = false; + // TODO get sources from the issuer ? } else { _.forEach(tx.inputs, function(input) { - var srcIndex = data.sourcesIndexByKey[input]; - if (srcIndex !== undefined) { + var inputKey = input.split(':').slice(2).join(':'); + var srcIndex = data.sourcesIndexByKey[inputKey]; + if (!angular.isUndefined(srcIndex)) { sources.push(data.sources[srcIndex]); } else { @@ -843,7 +840,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser locktime: 0, block_number: null }); - store(); // save the wallet + store(); // save pendings in local storage resolve(result); }).catch(function(err){reject(err);}); }); diff --git a/www/plugins/es/js/services/registry-services.js b/www/plugins/es/js/services/registry-services.js index 656e98760daa52b15e8159e8545ff76bac968f7e..154f37ea2c388b59eef0be428040992ad29b199f 100644 --- a/www/plugins/es/js/services/registry-services.js +++ b/www/plugins/es/js/services/registry-services.js @@ -8,7 +8,7 @@ angular.module('cesium.es.registry.services', ['ngResource', 'cesium.services', var categories = [], fields = { - commons: ["category", "title", "description", "issuer", "time", "address", "city", "thumbnail", "picturesCount", "type", "socials"], + commons: ["category", "title", "description", "issuer", "time", "address", "city", "thumbnail", "picturesCount", "type", "socials", "pubkey"], comment: { commons: ["issuer", "time", "message"], } diff --git a/www/plugins/es/templates/registry/view_record.html b/www/plugins/es/templates/registry/view_record.html index 78c090d32bc8a4a306d17c26e956bc198e22d612..3901696fe3e9dafc402e6e9b4699e65ec7c8cd26 100644 --- a/www/plugins/es/templates/registry/view_record.html +++ b/www/plugins/es/templates/registry/view_record.html @@ -149,13 +149,9 @@ </ion-content> <button class="button button-fab button-fab-bottom-right button-assertive icon ion-android-send visible-xs visible-sm" - ng-click="transfer(formData.issuer, formData.title)"> + ng-if="formData.pubkey" + ng-click="showTransferModal({pubkey: formData.pubkey, uid: formData.title})"> </button> - <button class="button button-fab button-fab-bottom-right button-assertive icon ion-ribbon-b visible-xs visible-sm" - ng-click="certifyIdentity()" - ng-if="hasSelf" - style="bottom:78px;"> - </button> </ion-view>