Stellar Operations, Balances, and Account Objects

Query Stellar classic.

Operations

Operations are currently indexed by public key:

  • all operations can be queried through the standard format opnameByPublicKey. For example, paymentsByPublicKey.

  • operations that affect other accounts can also be queried opnameToPublicKey. For example, paymentsToPublicKey.

We advise playing with the GraphiQL endpoint to craft the queries that best fit your requirements.

For example, to index payments from an account:

query MyQuery {
  paymentsByPublicKey(publicKeyText: "PUBLIC_KEY") {
    nodes {
      accountByDestination {
        publickey
      }
      amount
      accountBySource {
        publickey
      }
      assetByAsset {
        code
        issuer
      }
      assetNative
      opId
      txInfoByTx {
        fee
        ledgerByLedger {
          closeTime
          sequence
        }
        txHash
        opCount
        memo
      }
      muxedaccountByDestinationMuxed {
        publickey
        id
      }
      muxedaccountBySourceMuxed {
        id
        publickey
      }
    }
  }
}

Note that source, destination, asset, and t-x info are references to other tables, and this is a standard way of retrieving the public keys. In general:

  • If assetNative is false, then assetByAsset enables you to read the code and the issuer.

  • If muxedaccountByDestinationMuxed is null, then accountByDestination holds the public key. And vice-versa for the operation source.

Balances

To query balances for an account:

query MyQuery {
  balanceByPublicKey(publicKeyText: "PUBLIC_KEY") {
    nodes {
      limit
      lpShare
      poolshareassetByLpShare {
        poolId
      }
      balance
      accountByAccount {
        publickey
      }
      assetByAsset {
        issuer
        code
      }
    }
  }
}

Note that if lpShare is true, then the balance is for the liquidity pool share of the pool poolID. Else, the asset is assetByAsset.

Account Objects

To query the account object for an account:

query MyQuery {
  accountObjectByPublicKey(publicKeyText: "PUBLIC_KEY") {
    nodes {
      accountByAccount {
        publickey
      }
      nativeBalance
      numSubEntries
    }
  }
}

Last updated

#17:

Change request updated