blocktrail / blocktrail-sdk-php

BlockTrail's Developer Friendly PHP SDK for the BlockTrail API
MIT License
44 stars 49 forks source link

Fees estimation #101

Open EshanMaini opened 6 years ago

EshanMaini commented 6 years ago

Hii i am using this method to send BTC $wallet->pay(array($address => $value), null, false, true);

i want to get the transaction fees estimate before sending the transaction. is there any method available to do this?

n0n0n0n0 commented 6 years ago

did you solve it?

AlexKirsanoff commented 6 years ago

My solution:

$feeStrategy = \Blocktrail\SDK\Wallet::FEE_STRATEGY_LOW_PRIORITY; // your fee type

$address; // your address $satoshi; // your amount in satoshi

$fee = $wallet->coinSelection( \Blocktrail\SDK\Wallet::normalizeOutputsStruct([$address => $satoshi]), false, false, $feeStrategy )['fee'];