mirror of https://github.com/status-im/web3.js.git
updated icap example
This commit is contained in:
parent
155c549e19
commit
c81b0c8b16
|
@ -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
|
@ -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
File diff suppressed because one or more lines are too long
|
@ -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>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<i>This page expects geth with JSON-RPC running at port 8545</i>
|
||||||
|
<div class="page-header">
|
||||||
<h1>ICAP transfer</h1>
|
<h1>ICAP transfer</h1>
|
||||||
<div>
|
|
||||||
<h4>namereg address</h4>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="col-lg-6">
|
||||||
<text>eg. 0x436474facc88948696b371052a1befb801f003ca or 'default')</text>
|
<div class="well">
|
||||||
</div>
|
<legend class="lead">namereg address</legend>
|
||||||
<div>
|
<small>eg. 0x436474facc88948696b371052a1befb801f003ca or 'default')</small>
|
||||||
<input type="text" id="namereg" onkeyup='onNameregKeyUp()' value="default"></input>
|
<div class="form-group">
|
||||||
|
<input class="form-control" type="text" id="namereg" onkeyup='onNameregKeyUp()' value="default"></input>
|
||||||
<text id="nameregValidation"></text>
|
<text id="nameregValidation"></text>
|
||||||
</div>
|
</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>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input type="text" id="exchange" onkeyup='onExchangeKeyUp()'></input>
|
|
||||||
<text id="exchangeValidation"></text>
|
<text id="exchangeValidation"></text>
|
||||||
</div>
|
</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>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input type="text" id="client" onkeyup='onClientKeyUp()'></input>
|
|
||||||
<text id="clientValidation"></text>
|
<text id="clientValidation"></text>
|
||||||
</div>
|
</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>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input type="text" id="value" onkeyup='onValueKeyUp()'></input>
|
|
||||||
<text id="valueValidation"></text>
|
<text id="valueValidation"></text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div> </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> </div>
|
|
||||||
<div>
|
<div>
|
||||||
<button id="transfer" type="button" onClick="transfer()">Transfer!</button>
|
<button class="btn btn-default" id="transfer" type="button" onClick="transfer()">Transfer!</button>
|
||||||
<text id="transferValidation"></text>
|
<text id="transferValidation"></text>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="well">
|
||||||
<div>
|
<div>
|
||||||
<h4>transfers</h4>
|
<legend class="lead">transfers</legend>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul id='transfers'></ul>
|
<ul id='transfers'></ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -219,5 +219,9 @@ Iban.prototype.address = function () {
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Iban.prototype.toString = function () {
|
||||||
|
return this._iban;
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = Iban;
|
module.exports = Iban;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue