Bit-Wasp / bitcoin-php

Bitcoin implementation in PHP
The Unlicense
1.05k stars 419 forks source link

Class 'BitWasp\Bitcoin\Address\AddressFactory' not found #907

Open masumetc opened 1 year ago

masumetc commented 1 year ago

Every time getting this error how can i solve ? `<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request; use BitWasp\Bitcoin\Crypto\Random\Random; use BitWasp\Bitcoin\Key\Factory\PrivateKeyFactory;

use BitWasp\Bitcoin\Address\AddressFactory; use BitWasp\Bitcoin\Address\PayToPubKeyHashAddress;

class CheckController extends Controller { public function check(){ $random = new Random();

    $privateKeyFactory = new PrivateKeyFactory();
    $privateKey = $privateKeyFactory->generateCompressed($random);
    $privateKeyWif = $privateKey->toWif();

    $addressFactory = new AddressFactory();
    $publicKey = $privateKey->getPublicKey();
    $address = new PayToPubKeyHashAddress($publicKey->getPubKeyHash());
    return $usdtAddress = $addressFactory->fromString($address->getAddress());
}

}`

viraladmin commented 1 year ago

I mean... I would bet... you can solve that error... by not using code that has been long since expired. Looks like something chatGPT made.

use BitWasp\Bitcoin\Address\AddressFactory;

Doesn't work as there is no AddressFactory that I can tell. Looks like all references to it were removed a long time ago now.