Appendix

/*
 *  Removes '0x' from hexadecimal numbers if they have it
 */
function HexFix(word) {
  if (typeof word === 'string') {
    var Word = word;
    if (word.startsWith('0x')) {
      Word = Word.slice(2);
    }
    return Word;
  }
  return '';
}
/*
 * Retrieves a Wallet
 * 
 * Blockchain: Blockchain where the wallet is registered
 * Address: Wallet Address
 */
function GetWallet(Blockchain, Address) {
  let data = {
    "Blockchain": HexFix(Blockchain),
    "Address": HexFix(Address),
    "Version": Version
  };

  return fetch(NAG_URL + 'Circular_GetWallet_', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(data)
  })
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    return response.json();
  })
  .catch((error) => {
    console.error('Error:', error);
  });
}

Last updated