-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathpayment-transaction.php
More file actions
33 lines (21 loc) · 843 Bytes
/
payment-transaction.php
File metadata and controls
33 lines (21 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Builds a payment transaction
*/
require '../vendor/autoload.php';
use \ZuluCrypto\StellarSdk\Keypair;
use \ZuluCrypto\StellarSdk\Server;
$server = Server::testNet();
// GAJCCCRIRXAYEU2ATNQAFYH4E2HKLN2LCKM2VPXCTJKIBVTRSOLEGCJZ
$sourceKeypair = Keypair::newFromSeed('SDJCZISO5M5XAUV6Y7MZJNN3JZ5BWPXDHV4GXP3MYNACVDNQRQSERXBC');
// GCP6IHMHWRCF5TQ4ZP6TVIRNDZD56W42F42VHYWMVDGDAND75YGAHHBQ
$destinationKeypair = Keypair::newFromSeed('SCEDMZ7DUEOUGRQWEXHXEXISQ2NAWI5IDXRHYWT2FHTYLIQOSUK5FX2E');
$txEnvelope = $server->buildTransaction($sourceKeypair)
->addLumenPayment($destinationKeypair, 10)
->getTransactionEnvelope();
$txEnvelope->sign($sourceKeypair);
$b64Tx = base64_encode($txEnvelope->toXdr());
print "Submitting transaction: " . PHP_EOL;
print $b64Tx;
print PHP_EOL;
$server->submitB64Transaction($b64Tx);