Skip to content

Broadcast Transaction Examples

t3ran13 edited this page Oct 6, 2020 · 5 revisions

##Transfer

$connector = new VizWSConnector();
$chainName = $connector->getPlatform();
/** @var CommandQueryData $tx */
$tx = Transaction::init($connector);
$tx->setParamByKey(
    '0:operations:0',
    [
        'transfer',
        [
            'from'   => 'guest123',
            'to'     => 't3ran13',
            'amount' => '3.141 VIZ',
            'memo'   => 'transfer example with @php-node-client'
        ]
    ]
);
//$tx->setParamByKey(
//    '0:operations:0',
//    [
//        'transfer',
//        [
//            'from'   => 'guest123',
//            'to'     => 't3ran13',
//            'amount' => '0.001 GBG',
//            'memo'   => 'test'
//        ]
//    ]
//);
Transaction::sign($chainName, $tx, ['active' => '5_active_private_key']);

$command = new BroadcastTransactionSynchronousCommand($connector);
$answer = $command->execute(
    $tx
);

echo PHP_EOL . '<pre>' . print_r($answer, true) . '<pre>'; die; //FIXME delete it

Clone this wiki locally