How to use the bitcore-lib-cash.PublicKey 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 simpleledger / slpjs / examples / 11-get-txns-from-xpub-grpc.ts View on Github external
(async () => {
    for (let i = 0; i < lastFoundActiveAddressIndex + addressGapScanDepth; i++) {
        // get address
        const orderPublickey = hdPublickey.deriveChild(accountDerivation + i.toFixed());
        // @ts-ignore
        const pubkey = new bitcore.PublicKey(orderPublickey.publicKey);
        // @ts-ignore
        const address = bitcore.Address.fromPublicKey(pubkey, bitcore.Networks.mainnet).toString();
        console.log(address);
        //const cashAddr = Utils.toCashAddress(address);
        //console.log(cashAddr);
        const res = await gprc.getAddressTransactions({address});
        if (res.getConfirmedTransactionsList().length > 0) {
            lastFoundActiveAddressIndex = i;
            transactionHistory.push(...res.getConfirmedTransactionsList());
            console.log("Has transactions!");
        }
        console.log(transactionHistory.length);
    }
})();
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;