How to use the bitcore-lib-cash.Address function in bitcore-lib-cash

To help you get started, we’ve selected a few bitcore-lib-cash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github monicanagent / cypherpoker.js / src / server / utils / newHDWallet.js View on Github external
function getAddress(walletObj, network=null, cashAddress=false) {
   if (network == null) {
      network = bitcoin.networks.mainnet;
   }
   if (cashAddress == true) {
      var publicKey = bitcoreCash.PublicKey(walletObj.publicKey);
      var address = new bitcoreCash.Address(publicKey, network);
      return (address.toString());
   } else {
      return (bitcoin.payments.p2pkh({pubkey:walletObj.publicKey, network:network}).address);
   }
}
github monicanagent / cypherpoker.js / src / server / libs / adapters / BitcoinCashNative.js View on Github external
getAddress(walletObj, network="main", cashAddress=false) {
      network = network.toLowerCase();
      if (cashAddress == true) {
         var publicKey = bitcoreCash.PublicKey(walletObj.publicKey);
         switch (network) {
            case "main":
               var address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "mainnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "livenet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "test":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "test3":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "testnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "regtest":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.regtest);
               break;
github monicanagent / cypherpoker.js / src / server / libs / adapters / BitcoinCashNative.js View on Github external
getAddress(walletObj, network="main", cashAddress=false) {
      network = network.toLowerCase();
      if (cashAddress == true) {
         var publicKey = bitcoreCash.PublicKey(walletObj.publicKey);
         switch (network) {
            case "main":
               var address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "mainnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "livenet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "test":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "test3":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "testnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
github monicanagent / cypherpoker.js / src / server / libs / adapters / BitcoinCashNative.js View on Github external
address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "livenet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "test":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "test3":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "testnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "regtest":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.regtest);
               break;
            default:
               throw (new Error("Unrecognized network \""+network+"\"."));
               break;
         }
         return (address.toString());
      } else {
         if ((network == "main") || (network == "mainnet") || (network == "livenet")) {
            return (this.server.bitcoincash.payments.p2pkh({pubkey:walletObj.publicKey}).address);
         } else {
            var subNet = this.server.bitcoincash.networks.testnet;
            return (this.server.bitcoincash.payments.p2pkh({pubkey:walletObj.publicKey, network:subNet}).address);
         }
      }
   }
github monicanagent / cypherpoker.js / src / server / libs / adapters / BitcoinCashNative.js View on Github external
var address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "mainnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "livenet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.livenet);
               break;
            case "test":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "test3":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "testnet":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.testnet);
               break;
            case "regtest":
               address = new bitcoreCash.Address(publicKey, bitcoreCash.Networks.regtest);
               break;
            default:
               throw (new Error("Unrecognized network \""+network+"\"."));
               break;
         }
         return (address.toString());
      } else {
         if ((network == "main") || (network == "mainnet") || (network == "livenet")) {
            return (this.server.bitcoincash.payments.p2pkh({pubkey:walletObj.publicKey}).address);
         } else {
            var subNet = this.server.bitcoincash.networks.testnet;
            return (this.server.bitcoincash.payments.p2pkh({pubkey:walletObj.publicKey, network:subNet}).address);
         }
github BCNetio / BlockStackWallet / app / Providers / Wallets.js View on Github external
export const addrToBCHFormat = address => {
  const bchAdr = new bch.Address(address);
  const format = bch.Address.CashAddrFormat;
  return bchAdr.toString(format);
};