Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Update send-tx example #10

Open
xboston opened this issue Jun 26, 2019 · 1 comment
Open

Update send-tx example #10

xboston opened this issue Jun 26, 2019 · 1 comment

Comments

@xboston
Copy link
Owner

xboston commented Jun 26, 2019

case 'send-tx':
    if (($keys = $crypto->checkAddress($args['address'])) == false) {
        throw new \RuntimeException('address file not found', 1);
    }

    $nonce = $crypto->getNonce($args['address']);

    if ($crypto->net != 'main') {
        $data_len = \strlen($args['data']);
        if ($data_len > 0) {
            $args['fee'] = $data_len;
            $args['data'] = str2hex($args['data']);
        }
    } else {
        $args['data'] = '';
    }

    $sign_text = $crypto->makeSign($args['to'], \strval($args['value']), \strval($nonce), \strval($args['fee']), $args['data']);
    $sign = $crypto->sign($sign_text, $keys['private']);
    $res = $crypto->sendTx($args['to'], $args['value'], $args['fee'], $nonce, $args['data'], $keys['public'], $sign);

    echo \json_encode($res, JSON_PRETTY_PRINT);
@xboston xboston changed the title Update send-tx method Update send-tx example Jun 26, 2019
@xboston
Copy link
Owner Author

xboston commented Jul 18, 2019

Нужно с большим числом в поле data доработать

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant