Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pay with forceFee doesn't work #84

Open
jmn8718 opened this issue Dec 6, 2017 · 1 comment
Open

Pay with forceFee doesn't work #84

jmn8718 opened this issue Dec 6, 2017 · 1 comment

Comments

@jmn8718
Copy link

jmn8718 commented Dec 6, 2017

Im trying to perfom a pay action forcing the fee to the value i want, i follow the examples of the repo but i can not make it work, this is my code

const payment = {};
payment[destinationAddress] = btcToSatoshi(amount);
const options = {
	forceFee: btcToSatoshi(fee),
	checkFee: false,
}
_wallet.pay(payment, null, false, true, blocktrail.Wallet.FEE_STRATEGY_FORCE_FEE, null, options)

but i get the following error

{ Error: An internal error was encountered
at Function.Request.handleFailure (/app/node_modules/blocktrail-sdk/lib/request.js:210:17)
at /app/node_modules/blocktrail-sdk/lib/request.js:184:29
at Request.callback (/app/node_modules/superagent/lib/node/index.js:746:30)
at Request.<anonymous> (/app/node_modules/superagent/lib/node/index.js:135:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (/app/node_modules/superagent/lib/node/index.js:938:12)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
at process._tickDomainCallback (internal/process/next_tick.js:218:9) code: 500, statusCode: 500 }

any help?

@timigod
Copy link

timigod commented Jan 2, 2018

@jmn8718 it's forcefee not forceFee but I'm still getting the same error (though I did it correctly)

This is my own code

const executeTransfer = (identifier, passphrase, address, amount, userId, fee) => {
  return sails.blocktrailClient.initWallet(identifier, passphrase)
    .then((wallet) => {
      const options = {
        forcefee: fee
      }
      let payment = {}
      payment[address] = amount
      return wallet.pay(payment, null, false, true, blocktrail.Wallet.FEE_STRATEGY_FORCE_FEE, null, options)
        .then((txhash) => {
          return buildTransaction(amount, address, userId, txhash) // ignore this
            .then((transaction) => {
              return transaction
            })
        })
        .catch((error) => {
          return error
        })
    })
}

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

No branches or pull requests

2 participants