0

私はCoinBaseの初心者です。

getAccounts() メソッドを使用してすべてのアカウントを取得しています。

$this->client->getAccounts();

これは、タイプ object(Coinbase\Wallet\Resource\ResourceCollection) のオブジェクトを返しています。

object(Coinbase\Wallet\Resource\ResourceCollection)[37]
  private 'previousUri' => null
  private 'nextUri' => null
  private 'resources' => 
    array (size=1)
      0 => 
        object(Coinbase\Wallet\Resource\Account)[35]
          private 'name' => string 'BTC Wallet' (length=10)
          private 'primary' => boolean true
          private 'type' => string 'wallet' (length=6)
          private 'currency' => string 'BTC' (length=3)
          private 'balance' => 
            object(Coinbase\Wallet\Value\Money)[43]
              ...
          private 'nativeBalance' => 
            object(Coinbase\Wallet\Value\Money)[47]
              ...
          private 'createdAt' => 
            object(DateTime)[48]
              ...
          private 'updatedAt' => 
            object(DateTime)[49]
              ...
          private 'id' (Coinbase\Wallet\Resource\Resource) => string 'b12d3892-1228-5da1-a779-c5104bcbd749' (length=36)
          private 'resource' (Coinbase\Wallet\Resource\Resource) => string 'account' (length=7)
          private 'resourcePath' (Coinbase\Wallet\Resource\Resource) => string '/v2/accounts/b12d3892-1228-5da1-a779-c5104bcbd749' (length=49)
          private 'rawData' (Coinbase\Wallet\Resource\Resource) => 
            array (size=11)
              ...

(array) を使用して応答を変換すると、応答に無効な文字が含まれます。

   array (size=3)
  '�Coinbase\Wallet\Resource\ResourceCollection�previousUri' => null
  '�Coinbase\Wallet\Resource\ResourceCollection�nextUri' => null
  '�Coinbase\Wallet\Resource\ResourceCollection�resources' => 
    array (size=1)
      0 => 
        object(Coinbase\Wallet\Resource\Account)[35]
          private 'name' => string 'BTC Wallet' (length=10)
          private 'primary' => boolean true
          private 'type' => string 'wallet' (length=6)
          private 'currency' => string 'BTC' (length=3)
          private 'balance' => 
            object(Coinbase\Wallet\Value\Money)[43]
              ...
          private 'nativeBalance' => 
            object(Coinbase\Wallet\Value\Money)[47]
              ...
          private 'createdAt' => 
            object(DateTime)[48]
              ...
          private 'updatedAt' => 
            object(DateTime)[49]
              ...
          private 'id' (Coinbase\Wallet\Resource\Resource) => string 'b12d3892-1228-5da1-a779-c5104bcbd749' (length=36)
          private 'resource' (Coinbase\Wallet\Resource\Resource) => string 'account' (length=7)
          private 'resourcePath' (Coinbase\Wallet\Resource\Resource) => string '/v2/accounts/b12d3892-1228-5da1-a779-c5104bcbd749' (length=49)
          private 'rawData' (Coinbase\Wallet\Resource\Resource) => 
            array (size=11)
              ...

どんな助けでも大歓迎です。

アヌープ

4

2 に答える 2

0

以下のコードで修正できました。

 $accountResponse = $this->client->getAccounts();
  foreach ($accountResponse->all() as &$account) {
  $responseData[] = $account->getRawData();
 }
于 2016-06-29T12:19:38.947 に答える