GithubHelp home page GithubHelp logo

Comments (6)

erikdubbelboer avatar erikdubbelboer commented on September 28, 2024
$lock = "false";

Have you tried changing this to

$lock = false;

?

from easybitcoin-php.

nravanelli avatar nravanelli commented on September 28, 2024

@erikdubbelboer yep .... I get this instead;

Expected type array, got object

and here is the var_dump of the txid and vout I am using;

Array
(
    [txid] => 14acd0774013685a4cda17246298f21101884f6be7198db36fa5e3ee498fab37
    [vout] => 1
)

from easybitcoin-php.

erikdubbelboer avatar erikdubbelboer commented on September 28, 2024

Try this:

$tx = $bitcoin->masternode('outputs');
$txid = array_keys($tx);
$tx_array = [];
foreach($txid as $locktx) {
  $tx_array[] = [
    'txid' => $locktx,
    'vout' => (int)$tx[$locktx],
  ];
}
$lock = "false";
$lock_mn = $bitcoin->lockunspent($lock, $tx_array);

from easybitcoin-php.

nravanelli avatar nravanelli commented on September 28, 2024

some issue @erikdubbelboer ; I get this:

Expected type bool, got string

And my array changed slightly;

Array
(
    [0] => Array
        (
            [txid] => 14acd0774013685a4cda17246298f21101884f6be7198db36fa5e3ee498fab37
            [vout] => 1
        )

)

from easybitcoin-php.

nravanelli avatar nravanelli commented on September 28, 2024

Solved!!

$tx = $bitcoin->masternode('outputs');
$txid = array_keys($tx);
$tx_array = [];
foreach($txid as $locktx) {
  $tx_array[] = [
    'txid' => $locktx,
    'vout' => (int)$tx[$locktx],
  ];
}
$lock = false;
$lock_mn = $bitcoin->lockunspent($lock, $tx_array);

I was missing the [] after $tx_array in my first comment. I last too many hours on a simple mistake
thanks for the help @erikdubbelboer !

from easybitcoin-php.

erikdubbelboer avatar erikdubbelboer commented on September 28, 2024

lockunspent expects an array of objects, you were only giving it one object because you had your call inside your loop instead of out of it.

from easybitcoin-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.