Created
November 25, 2020 05:13
-
-
Save askaaqib/cbed46cccfbebcbf8e31cb3e2ae3780f to your computer and use it in GitHub Desktop.
Stream Payments - Stellar PHP API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
require "../vendor/autoload.php"; | |
use ZuluCrypto\StellarSdk\Server; | |
$server = Server::testNet(); | |
$account = $server->getAccount('GCCZACJX7DHEWGK5WJ2ONRGAJN2RBGGCX3OO4NF66JMJ4MNACKED577A'); | |
echo "<pre>"; | |
print "Waiting for new payments to " . $account->getId() . PHP_EOL; | |
$account->streamPayments('now', function(\ZuluCrypto\StellarSdk\Model\Payment $payment) { | |
printf('[%s] Amount: %s From %s' . PHP_EOL, | |
$payment->getType(), | |
$payment->getAmount(), | |
$payment->getSourceAccountId() | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment