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

StoreOnChainWalletTransaction Getters Don't like up #118

Open
utxo-one opened this issue Jul 29, 2023 · 1 comment
Open

StoreOnChainWalletTransaction Getters Don't like up #118

utxo-one opened this issue Jul 29, 2023 · 1 comment

Comments

@utxo-one
Copy link
Contributor

Endpoint returns

object(BTCPayServer\Result\StoreOnChainWalletTransactionList)#661 (1) {
  ["data":"BTCPayServer\Result\AbstractResult":private]=>
  array(1) {
    [0]=>
    array(9) {
      ["transactionHash"]=>
      string(64) "f1689f524f0c0339e6e502f484345604908cbe07ddc1929233dc0cef0e7a42a4"
      ["comment"]=>
      string(0) ""
      ["labels"]=>
      array(0) {
      }
      ["amount"]=>
      string(4) "0.01"
      ["blockHash"]=>
      NULL
      ["blockHeight"]=>
      int(2469676)
      ["confirmations"]=>
      int(1)
      ["timestamp"]=>
      int(1690641768)
      ["status"]=>
      string(9) "Confirmed"
    }
  }
}

But getters are current set to:

<?php

declare(strict_types=1);

namespace BTCPayServer\Result;

class StoreOnChainWalletTransaction extends AbstractResult
{
    public function getDestinations(): StoreOnChainWalletTransactionDestinationList
    {
        $data = $this->getData();
        return new StoreOnChainWalletTransactionDestinationList($data['destinations']);
    }

    public function getFeeRate(): StoreOnChainWalletFeeRate
    {
        $data = $this->getData();
        return new StoreOnChainWalletFeeRate($data['feeRate']);
    }

    public function proceedWithPayjoin(): bool
    {
        $data = $this->getData();
        return $data['proceedWithPayjoin'];
    }

    public function proceedWithBroadcast(): bool
    {
        $data = $this->getData();
        return $data['proceedWithBroadcast'];
    }

    public function noChange(): bool
    {
        $data = $this->getData();
        return $data['noChange'];
    }

    public function rbf(): bool
    {
        $data = $this->getData();
        return $data['rbf'];
    }

    /**
     * @return array strings
     */
    public function selectedInputs(): array
    {
        $data = $this->getData();
        return $data['selectedInputs'];
    }
}

Where did these getters come from? or did we change the endpoint?

@ndeet
Copy link
Collaborator

ndeet commented Jul 31, 2023

Good catch 👍 seems we overlooked that one. Often the response is the same like the request and likely we did not double check it is the case for the transaction. Fixed by #119

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