updated icap example

This commit is contained in:
debris 2015-08-07 10:31:04 +02:00
parent 155c549e19
commit c81b0c8b16
7 changed files with 81 additions and 68 deletions

4
dist/web3-light.js vendored
View File

@ -4702,6 +4702,10 @@ Iban.prototype.address = function () {
return ''; return '';
}; };
Iban.prototype.toString = function () {
return this._iban;
};
module.exports = Iban; module.exports = Iban;

File diff suppressed because one or more lines are too long

4
dist/web3.js vendored
View File

@ -4702,6 +4702,10 @@ Iban.prototype.address = function () {
return ''; return '';
}; };
Iban.prototype.toString = function () {
return this._iban;
};
module.exports = Iban; module.exports = Iban;

4
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

6
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,9 @@
<html> <html>
<head> <head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../dist/web3.js"></script> <script type="text/javascript" src="../dist/web3.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -40,7 +43,7 @@
function validateNamereg() { function validateNamereg() {
var address = document.getElementById('namereg').value; var address = document.getElementById('namereg').value;
var ok = /^(0x)?[0-9a-f]{40}$/.test(address) || address === 'default'; <!--var ok = /^(0x)?[0-9a-f]{40}$/.test(address) || address === 'default';-->
if (ok) { if (ok) {
namereg = address === 'default' ? web3.eth.namereg : Namereg.at(address); namereg = address === 'default' ? web3.eth.namereg : Namereg.at(address);
document.getElementById('nameregValidation').innerText = 'ok!'; document.getElementById('nameregValidation').innerText = 'ok!';
@ -104,7 +107,7 @@
}; };
function validateIBAN() { function validateIBAN() {
if (!web3.isIBAN(iban)) { if (!iban.isValid()) {
return document.getElementById('ibanValidation').innerText = ' - IBAN number is incorrect'; return document.getElementById('ibanValidation').innerText = ' - IBAN number is incorrect';
} }
document.getElementById('ibanValidation').innerText = ' - IBAN number correct'; document.getElementById('ibanValidation').innerText = ' - IBAN number correct';
@ -113,8 +116,11 @@
function updateIBAN(ok) { function updateIBAN(ok) {
var exchangeId = document.getElementById('exchange').value; var exchangeId = document.getElementById('exchange').value;
var clientId = document.getElementById('client').value; var clientId = document.getElementById('client').value;
iban = 'XE' + '00' + 'ETH' + exchangeId + clientId; iban = web3.eth.iban.createIndirect({
document.getElementById('iban').innerText = iban; institution: exchangeId,
identifier: clientId
});
document.getElementById('iban').innerText = iban.toString();
validateIBAN(); validateIBAN();
}; };
@ -136,68 +142,63 @@
</script> </script>
</head> </head>
<body> <body>
<h1>ICAP transfer</h1> <div class="col-lg-12">
<div> <i>This page expects geth with JSON-RPC running at port 8545</i>
<h4>namereg address</h4> <div class="page-header">
</div> <h1>ICAP transfer</h1>
<div> </div>
<text>eg. 0x436474facc88948696b371052a1befb801f003ca or 'default')</text> <div class="col-lg-6">
</div> <div class="well">
<div> <legend class="lead">namereg address</legend>
<input type="text" id="namereg" onkeyup='onNameregKeyUp()' value="default"></input> <small>eg. 0x436474facc88948696b371052a1befb801f003ca or 'default')</small>
<text id="nameregValidation"></text> <div class="form-group">
</div> <input class="form-control" type="text" id="namereg" onkeyup='onNameregKeyUp()' value="default"></input>
<text id="nameregValidation"></text>
</div>
<div> <legend class="lead">exchange identifier</legend>
<h4>exchange identifier</h4> <small>eg. WYWY</small>
</div> <div class="form-group">
<div> <input class="form-control" type="text" id="exchange" onkeyup='onExchangeKeyUp()'></input>
<text>eg. WYWY</text> <text id="exchangeValidation"></text>
</div> </div>
<div>
<input type="text" id="exchange" onkeyup='onExchangeKeyUp()'></input>
<text id="exchangeValidation"></text>
</div>
<div> <legend class="lead">client identifier</legend>
<h4>client identifier</h4> <small>eg. GAVOFYORK</small>
</div> <div class="form-group">
<div> <input class="form-control" type="text" id="client" onkeyup='onClientKeyUp()'></input>
<text>eg. GAVOFYORK</text> <text id="clientValidation"></text>
</div> </div>
<div>
<input type="text" id="client" onkeyup='onClientKeyUp()'></input>
<text id="clientValidation"></text>
</div>
<div> <legend class="lead">value</legend>
<h4>value</h4> <small>eg. 100</small>
</div> <div class="form-group">
<div> <input class="form-control" type="text" id="value" onkeyup='onValueKeyUp()'></input>
<text>eg. 100</text> <text id="valueValidation"></text>
</div> </div>
<div>
<input type="text" id="value" onkeyup='onValueKeyUp()'></input>
<text id="valueValidation"></text>
</div>
<div>&nbsp;</div> <legend class="lead">IBAN: </legend>
<div> <div class="form-group">
<text>IBAN: </text>
<text id="iban"></text> <text id="iban"></text>
<text id="ibanValidation"></text> <text id="ibanValidation"></text>
</div> </div>
<div>&nbsp;</div> <div>
<div> <button class="btn btn-default" id="transfer" type="button" onClick="transfer()">Transfer!</button>
<button id="transfer" type="button" onClick="transfer()">Transfer!</button> <text id="transferValidation"></text>
<text id="transferValidation"></text> </div>
</div> </div>
</div>
<div> <div class="col-lg-6">
<h4>transfers</h4> <div class="well">
</div> <div>
<div> <legend class="lead">transfers</legend>
<ul id='transfers'></ul> </div>
<div>
<ul id='transfers'></ul>
</div>
</div>
</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -219,5 +219,9 @@ Iban.prototype.address = function () {
return ''; return '';
}; };
Iban.prototype.toString = function () {
return this._iban;
};
module.exports = Iban; module.exports = Iban;