On Thursday, 17th December 2020, at 13:00 GMT, Trustology will be making a minor change to the Trust API that will slightly change how errors are handled for the balance of wallets.

What's Changing?

There will be a small change to the way balances are returned if there are any problems retrieving an active balance. Previously, a missing balance may have caused the API to return no data and an error message. This change allows for wallet data to be returned even if the balance is not available.

Why is it changing?

Trustology is working on enhancing our APIs to be more resilient. This will involve many changes but right now the change to the Trust API is around returning more data even during partial outages..

Although this change will only be apparent when a price feed fails it will constitute a breaking change as the response is different from previously.

What are the specific changes?

The specific changes are to the User SubWallets/Wallets - Balance query response on the value field.

query getAccounts($currency: String!) {
user {
firstName
lastName
email
subWallets {
items {
address
name
subWalletId
createdAt
updatedAt
walletType
... on BlockchainSubWallet {
balances {
items {
amount {
value // This now can return "NaN"
currency
timestamp
}}}}}
nextToken
}}}
  • The change consists of changing the response of balance amount on a bitcoin subWallet/Wallet when bitcoin balances are temporarily not available.

  • This could affect you if you previously had code handling for this case when bitcoin balances were temporarily unavailable.

  • It is important to note that this is an edge case, even though this could happen but it is a rare occurrence.

  • The changes have been deployed to our Sandbox environment.

Example of the change:

  • Previously if the bitcoin subWallet/Wallets balances were not available, the response would have been the following:

{
"data": {
"user": {
"email": "[email protected]",
"firstName": "Test",
"subWallets": {
"items": [
null,
]
}
}
},
"errors": [
{
"path": [
"user",
"subWallets",
"items",
1,
"total"
],
"data": null,
"errorType": "MappingTemplate",
"errorInfo": null,
"locations": [
{
"line": 12,
"column": 11,
"sourceName": null
}
],
"message": "Invocation of method 'parseDouble' in class java.lang.Double threw exception java.lang.NullPointerException at velocity[line 11, column 20]"
},
]
}
  • With the new change you are expected to have the following response when the bitcoin balances are temporarily available:

{
"data": {
"user": {
"email": "[email protected]",
"firstName": "Test",
"subWallets": {
"items": [
{
"name": "Bitcoin SubWallet",
"subWalletId": "1279578c-3c2c-4fee-9a25-7bade7c0435b/BTC/0",
"amount":{
"value":"NaN",
"currency":"BTC",
"timestamp": null,
"__typename":"Amount",
}
},
]
}
}
},
}

NB: The timestamp will be null if the "value" field is not available. If the "value" field is available the timestamp will be the time the amount was retrieved or the timestamp of the fx rate used to calculate the price.

Please let us know if you have any questions on the change and do not hesitate to contact us at [email protected].

Did this answer your question?