-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added convenience method Server::accountExists
- Loading branch information
1 parent
57794ef
commit d7c963b
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* Adds a new signer to an existing account | ||
*/ | ||
|
||
|
||
require '../vendor/autoload.php'; | ||
|
||
use \ZuluCrypto\StellarSdk\Keypair; | ||
use \ZuluCrypto\StellarSdk\Server; | ||
use \phpseclib\Math\BigInteger; | ||
|
||
|
||
$server = Server::testNet(); | ||
|
||
// Check if an account exists | ||
try { | ||
$exists = $server->accountExists('GCP6IHMHWRCF5TQ4ZP6TVIRNDZD56W42F42VHYWMVDGDAND75YGAHHBQ'); | ||
|
||
if ($exists) { | ||
print "Account exists!" . PHP_EOL; | ||
} | ||
else { | ||
print "Account does not exist." . PHP_EOL; | ||
} | ||
} | ||
// If there's an exception it could be a temporary error, like a connection issue | ||
// to Horizon, so we cannot tell for sure if the account exists or not | ||
catch (\Exception $e) { | ||
print "Error: " . $e->getMessage() . PHP_EOL; | ||
} |
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