Address#

class defichain.ocean.Address(ocean)#
getAccountHistory(address: str, height: int, txno: int) {}#

Get account history

Parameters:
  • address (str) – (required) address to get account history

  • height (int) – (required) block height of the account history

  • txno (int) – (required) order of txn

Returns:

(json string) {owner: str, txid: str, txn: int, type: str, amounts: str[], block: {height: int, hash: str, time: int}

Example:

>>> ocean.address.getAccountHistory("df1qwfpdfkvphwme3039pal4awq6cz66racsm8uek9", 2341564, 10)
listAccountHistory(address: str, size: int = 30, next: str | None = None) {}#

List account history

Parameters:
  • address (str) – (required) address to list account history

  • size (int) – (optional) size of account history

  • next (str) – (optional) next set of account history

Returns:

(json string) {owner: str, txid: str, txn: int, type: str, amounts: str[], block: {height: int, hash: str, time: int}

Example:

>>> ocean.address.listAccountHistory("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")
getBalance(address: str) {}#

Get current balance of an address

Parameters:

address (str) – (required) address bech32/legacy/b58 formatted address

Returns:

(json string) {data: float}

Example:

>>> ocean.address.getBalance("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")
getAggregation(address: str) {}#

Get current aggregated stats of an address

Parameters:

address (str) – (required) address bech32/legacy/b58 formatted address

Returns:

(json string) {id: str, hid: str, block: {hash: str, height: int, time: int, medianTime: int}, script: {type: str, hex: str}, statistic: {txCount: int, txInCount: int, txOutCount: int}, amount: {txIn: str, txOut: str, unspent: str}}

Example:

>>> ocean.address.getAggregation("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")
listToken(address: str, size: int = 30, next: str | None = None) {}#

List all tokens balance belonging to an address

Parameters:
  • address (str) – (required) address bech32/legacy/b58 formatted address

  • size (int) – (optional) size to query

  • next (str) – (optional) next token for next slice of AddressToken

Returns:

(json string) {id: str, amount: str, symbol: str, displaySymbol: str, symbolKey: str, name: str, isDAT: bool, isLPS: bool, isLoanToken: bool}

Example:

>>> ocean.address.listToken("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")
listVault(address: str, size: int = 30, next: str | None = None) {}#

List all vaults belonging to an address

Parameters:
  • address (str) – (required) address bech32/legacy/b58 formatted address

  • size (int) – (optional) size of vaults to query

  • next (str) – (optional) next set of vaults

Returns:

(json string) VaultActive or VaultLiquidated

Example:

>>> ocean.address.listVault("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")
listTransaction(address: str, size: int = 30, next: str | None = None) {}#

List all transaction activity belonging to an address

Parameters:
  • address (str) – (required) address bech32/legacy/b58 formatted address

  • size (int) – (optional) size to query

  • next (str) – (optional) next token for next slice of AddressActivity

Returns:

(json string) {id: str, hid: str, type: ‘vin’ | ‘vout’, typeHex: ‘00’ | ‘01’, txid: str, block: {hash: str, height: int, time: int, medianTime: int}, script: {type: str, hex: str}, vin: {txid: str, n: int}, vout: {txid: str, n: int}, value: str, tokenId: int}

Example:

>>> ocean.address.listTransaction("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")
listTransactionUnspent(address: str, size: int = 30, next: str | None = None) {}#

List all unspent belonging to an address

Parameters:
  • address (str) – (required) address bech32/legacy/b58 formatted address

  • size (int) – (optional) size to query

  • next (str) – (optional) next token for next slice of AddressUnspent

Returns:

(json string) {id: str, hid: str, sort: str, block: {hash: str, height: int, time: int, medianTime: int}, script: {type: str, hex: str}, vout: {txid: str, n: int, value: str, tokenId: int}}

Example:

>>> ocean.address.listTransactionUnspent("dEPoXJzwGia1aAbz6ZRB7FFSKSeWPn1v7A")