Let's get started
A complete example of using the api
With the following example you can see the operation of the api
HTML and JAVASCRIPT
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example Udrox</title>
<!-- Udrox wallet object -->
<script src="https://wallet.udrox.com/api/wallet_v1.js" type="application/javascript"></script>
<script type="text/javascript">
// We define the default processes for the basic functions of the walet in our app or website
// the onConnect function when your client connects correctly what does it do after this
walletudrox.onConnect = function(){
// Get variables information best use
var wallet = walletudrox.address; // string
var red = walletudrox.net; // string
var shortWallet = walletudrox.shortWallet; // string
var nsu = walletudrox.nsu; // string
document.getElementById('btnConect').style.display = "none";
document.getElementById('conectado').style.display = "block";
document.getElementById('conectado').innerHTML = nsu;
document.getElementById('red').innerHTML = red;
};
// transactional methods
walletudrox.onSendError = function(){
document.getElementById('botonSend').disabled = false;
alert("The operation could not be completed");
};
walletudrox.onBeforeSend = function(){
document.getElementById('botonSend').disabled = true;
};
walletudrox.onSend = function(hash){
document.getElementById('botonSend').disabled = false;
alert("Enviado "+hash);
// we process or store the hash; Please note, it is recommended not to release rewards directly here, send the hash to server language and verify it through our SAFEHASH system so you can be sure that the hash has not been corrupted.
};
walletudrox.acceptNets = ["UDROX"];
walletudrox.preferNet = "UDROX";
walletudrox.needConfirmations = 0;
walletudrox.notifyServer = "";
function transaction(){
walletudrox.transaction("0x0B77E2947375318fb0F6395A0C36855628685D0a","5","UDROX");
//walletudrox.transaction("0x0B77E2947375318fb0F6395A0C36855628685D0a","5","0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035");
}
function closeWallet(){
walletudrox.closeWallet();
}
function changeNet(){
walletudrox.changeNet();
}
function changeAccount(){
walletudrox.changeAccount();
}
// connect the wallet (Required)
function connectClient(){
walletudrox.oauth();
walletudrox.connect();
}
</script>
</head>
<body>
<button id="btnConect" onclick="connectClient();">CONNECT</button>
<div id="conectado" style="display: none;">ESTABLISHED CONNECTION</div>
<div >NET <b><span id="red" >NOT DEFINED</span></b></div>
<button onclick="changeAccount()">CHANGE ACCOUNT</button>
<button onclick="changeNet()">CHANGE NETWORK</button>
<button id="botonSend" onclick="transaction()">SEND</button>
<button onclick="closeWallet()">CLOSE</button>
</body>
</html>
Although with the example we can operate our api, we are going to show you details of how it works
Last updated