recieve xmr uses integarded addresses

pull/30/head
moneroexamples 7 years ago
parent 2ac14762f1
commit c741cdcda8

@ -94,6 +94,7 @@ target_link_libraries(${PROJECT_NAME}
mysqlpp
mysqlclient
easylogging
readline
${Boost_LIBRARIES}
pthread
unbound

@ -37,6 +37,9 @@ thinwalletCtrls.controller("LoginCtrl", function($scope, $location, AccountServi
$scope.mnemonic_language = 'english';
// just some dummy account, as not to fill login form every time.
$scope.mnemonic = "daft mouth scenic irate origin island irritate eternal ablaze template hotel boxes suitcase oilfield jury dash folding gymnast titans toolbox hiker archer hexagon hijack irate";
var decode_seed = function(mnemonic, language)
{

@ -26,34 +26,90 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
thinwalletCtrls.controller('ReceiveCoinsCtrl', function($scope, $rootScope, AccountService, EVENT_CODES) {
thinwalletCtrls.controller('ReceiveCoinsCtrl', function($scope, AccountService, EVENT_CODES) {
"use strict";
$scope.accountService = AccountService;
// $scope.accountService = AccountService;
$scope.params = {
address: $scope.address
// $scope.params = {
// address: $scope.address
// };
// // Generate random payment id
// $scope.payment_id = cnUtil.rand_32();
$scope.error = "";
var strpad = function(org_str, padString, length)
{ // from http://stackoverflow.com/a/10073737/248823
var str = org_str;
while (str.length < length)
str = padString + str;
return str;
};
// Generate random payment id
$scope.payment_id = cnUtil.rand_32();
//
//var payment_id8 = rand_8();
//var integarted_address = get_account_integrated_address(keys.public_addr, payment_id8);
var public_address = AccountService.getAddress();
$scope.payment_id8 = rand_8(); // random 8 byte payment id
$scope.payment_id8_rendered = $scope.payment_id8;
$scope.integarted_address = get_account_integrated_address(
public_address, $scope.payment_id8);
$scope.$watch("payment_id8", function (newValue, oldValue) {
if (oldValue !== newValue)
{
var payment_id8 = $scope.payment_id8;
$scope.$watch(
function(scope) {
return {
address: scope.address,
label: scope.label,
payment_id: scope.payment_id,
message: scope.message,
amount: scope.amount
};
},
function(data) {
$scope.params = data;
},
if (payment_id8.length <= 16 && /^[0-9a-fA-F]+$/.test(payment_id8)) {
// if payment id is shorter, but has correct number, just
// pad it to required length with zeros
payment_id8 = strpad(payment_id8, "0", 16);
}
// now double check if ok, when we padded it
if (payment_id8.length !== 16 || !(/^[0-9a-fA-F]{16}$/.test(payment_id8)))
{
$scope.integarted_address = "Not avaliable due to error"
$scope.error = "The payment ID you've entered is not valid";
return;
}
$scope.integarted_address = get_account_integrated_address(
public_address, payment_id8);
$scope.payment_id8_rendered = payment_id8;
$scope.error = "";
}
},
true
);
$scope.new_payment_id8 = function()
{
$scope.payment_id8 = rand_8();
}
//
//var payment_id8 = rand_8();
//var integarted_address = get_account_integrated_address(keys.public_addr, payment_id8);
// $scope.$watch(
// function(scope) {
// return {
// address: scope.address,
// label: scope.label,
// payment_id: scope.payment_id,
// message: scope.message,
// amount: scope.amount
// };
// },
// function(data) {
// $scope.params = data;
// },
// true
// );
});

@ -30,25 +30,52 @@
<div class="w-container middle-container receive">
<div class="middle-div receive">
<div class="w-form send-form receive">
<form id="email-form" name="email-form" data-name="Email Form" form-autofill-fix>
<label class="send-label" for="Receiver-address"> Integrated Address
</label>
<div class="move-text-div">
<div class="middle-text receive"> {{integrated_address}}
<div class="middle-text receive">
{{integarted_address}}
</div>
</div>
<label class="send-label" for="Receiver-address-3">Payment ID (Randomly generated)</label>
<div class="move-text-div">
<div class="middle-text receive">{{payment_id8}} </div>
<div class="w-col w-col-6 responsive-column">
<label class="send-label" for="payment_id8">
Payment ID (max 16 [0-9a-fA-F] characters)
</label>
<input class="w-input send-text-box" id="payment_id8" type="text" ng-model="payment_id8"
placeholder="e.g. 671a4f30238c5152"
name="payment_id8" data-name="payment_id8">
</div>
<input scroll-to-marker="qrcode" class="w-button send-btn" id="form-submit" type="submit"
value="Receive" data-wait="Generate new payment id">
</form>
<div class="w-col w-col-6 responsive-column">
<label class="send-label" for="payment_id8_rendered">
Final payment ID
</label>
<div class="move-text-div">
<div class="middle-text receive">
{{payment_id8_rendered}}
</div>
</div>
</div>
<div class="submit-div small-top-margin">
<a class="login-btn modals pointer" ng-click="new_payment_id8()">Generate new integrated address</a>
</div>
<div class="w-form-fail error-backing" style="display: block;" ng-show="!!error">
<p>{{error}}</p>
</div>
</div>
</div>
</div>
<!--
<div class="w-container middle-container receive">
<div class="middle-div receive">
<div class="w-form send-form receive">
@ -85,6 +112,7 @@
</div>
</div>
</div>
-->
<!--
<div class="qr-div" scroll-marker="qrcode">
@ -106,6 +134,7 @@
</div>
</div>
</div>
-->
</div>
-->
</div>

Loading…
Cancel
Save