Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- require '../vendor/autoload.php';
- use Minter\MinterAPI;
- use Minter\SDK\MinterCoins\MinterSendCoinTx;
- use Minter\SDK\MinterTx;
- $nodeUrl = 'https://api.minter.one/';
- $wallet_w1 = 'адрес откуда';
- $privkey_w1 = 'приватник адреса откуда';
- $wallet_w2 = 'адрес куда слать';
- $coin = 'BIP';
- $api = new MinterAPI($nodeUrl);
- $response = $api->getBalance($wallet_w1);
- $balcoin = ($response->result->balance->$coin)/10**18;
- echo "Sender Balance (".$coin."): ".$balcoin."\n";
- echo "Receiver: ".$wallet_w2."\n";
- $nonce = $api->getNonce($wallet_w1);
- $tx = new MinterTx([
- 'nonce' => $nonce,
- 'chainId' => MinterTx::MAINNET_CHAIN_ID, // or MinterTx::TESTNET_CHAIN_ID
- 'gasPrice' => 1,
- 'gasCoin' => $coin,
- 'type' => MinterSendCoinTx::TYPE,
- 'data' => [
- 'coin' => $coin,
- 'to' => $wallet_w2,
- 'value' => $balcoin-0.01
- ],
- 'payload' => '',
- 'serviceData' => '',
- 'signatureType' => MinterTx::SIGNATURE_SINGLE_TYPE // or SIGNATURE_MULTI_TYPE
- ]);
- $txSigned = $tx->sign($privkey_w1);
- echo "TX signed: ".$txSigned."\n";
- $txResult = $api->send($txSigned);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement