Docs
chromia.com

Interface

Account

On this page

Represents a blockchain account which is read only. That is, using this object you can get information about an account, but you cannot submit authenticated operations with it.

For an account to which it is possible to write, see AuthenticatedAccount

interface Account {
    blockchainRid: Buffer;
    connection: Connection;
    getAuthDescriptorById: (
        authDescriptorId: BufferId,
    ) => Promise<AnyAuthDescriptor>;
    getAuthDescriptors: () => Promise<AnyAuthDescriptor[]>;
    getAuthDescriptorsBySigner: (
        signer: BufferId,
    ) => Promise<AnyAuthDescriptor[]>;
    getBalanceByAssetId: (assetId: BufferId) => Promise<Balance | null>;
    getBalances: (
        limit?: number,
        cursor?: OptionalPageCursor,
    ) => Promise<PaginatedEntity<Balance>>;
    getLastPendingCrosschainTransfer: (
        targetBlockchainRid: BufferId,
        recipientId: BufferId,
        assetId: BufferId,
        amount: bigint,
    ) => Promise<PendingTransfer | null>;
    getMainAuthDescriptor: () => Promise<AnyAuthDescriptor>;
    getPendingCrosschainTransfers: (
        limit?: OptionalLimit,
        cursor?: OptionalPageCursor,
    ) => Promise<PaginatedEntity<PendingTransfer>>;
    getRateLimit: () => Promise<RateLimit>;
    getTransferHistory: (
        limit?: number,
        filter?: TransferHistoryFilter,
        cursor?: OptionalPageCursor,
    ) => Promise<PaginatedEntity<TransferHistoryEntry>>;
    getTransferHistoryEntry: (
        rowid: number,
    ) => Promise<TransferHistoryEntry | null>;
    id: Buffer;
    isAuthDescriptorValid: (authDescriptorId: BufferId) => Promise<boolean>;
    type?: string;
}

Hierarchy (View Summary)

Properties

blockchainRid

blockchainRid: Buffer

connection

connection: Connection

getAuthDescriptorById

getAuthDescriptorById: (
    authDescriptorId: BufferId,
) => Promise<AnyAuthDescriptor>

Fetches an auth descriptor by its ID.

Type Declaration

Remarks

the auth descriptor in question needs to be associated with this account and if no auth descriptor is found, this method will throw an error

getAuthDescriptors

getAuthDescriptors: () => Promise<AnyAuthDescriptor[]>

Retrieves all auth descriptors associated with this account

getAuthDescriptorsBySigner

getAuthDescriptorsBySigner: (signer: BufferId) => Promise<AnyAuthDescriptor[]>

Retrieves all auth descriptors on which the specified signer is also a signer.

Type Declaration

getBalanceByAssetId

getBalanceByAssetId: (assetId: BufferId) => Promise<Balance | null>

Retrieves the balance for a specific asset

Type Declaration

    • (assetId: BufferId): Promise<Balance | null>
    • Parameters

      • assetId: BufferId

        the id of the asset to fetch balance for

      Returns Promise<Balance | null>

      the balance of the asset on this account, or null if this account does not have the asset

getBalances

getBalances: (
    limit?: number,
    cursor?: OptionalPageCursor,
) => Promise<PaginatedEntity<Balance>>

Retrieves all the balances of all assets that is available on the account and returns them as a paginated entity.

Type Declaration

getLastPendingCrosschainTransfer

getLastPendingCrosschainTransfer: (
    targetBlockchainRid: BufferId,
    recipientId: BufferId,
    assetId: BufferId,
    amount: bigint,
) => Promise<PendingTransfer | null>

Retrieves the most recent pending transfer which matches the specified arguments

Type Declaration

    • (
          targetBlockchainRid: BufferId,
          recipientId: BufferId,
          assetId: BufferId,
          amount: bigint,
      ): Promise<PendingTransfer | null>
    • Parameters

      • targetBlockchainRid: BufferId

        the rid of the blockchain that the transfer was targeting

      • recipientId: BufferId

        the id of the account that is going to receive the transfer

      • assetId: BufferId

        the id of the asset that is being transferred

      • amount: bigint

        how much of the asset that is being transferred

      Returns Promise<PendingTransfer | null>

      the latest pending transfer that matches the criteria. Or null if no such transfer is found

getMainAuthDescriptor

getMainAuthDescriptor: () => Promise<AnyAuthDescriptor>

Retrieves the main auth descriptor of this account

getPendingCrosschainTransfers

getPendingCrosschainTransfers: (
    limit?: OptionalLimit,
    cursor?: OptionalPageCursor,
) => Promise<PaginatedEntity<PendingTransfer>>

Retrieves all pending (i.e., started but not yet completed) cross chain transfers initiated by this account.

Type Declaration

getRateLimit

getRateLimit: () => Promise<RateLimit>

Retrieves the current rate limit for this account. I.e., how many points this account currently has.

getTransferHistory

getTransferHistory: (
    limit?: number,
    filter?: TransferHistoryFilter,
    cursor?: OptionalPageCursor,
) => Promise<PaginatedEntity<TransferHistoryEntry>>

Retrieves the full transfer history for this account as a paginated entity.

Type Declaration

getTransferHistoryEntry

getTransferHistoryEntry: (rowid: number) => Promise<TransferHistoryEntry | null>

Retrieves a specific TransferHistoryEntry

Type Declaration

    • (rowid: number): Promise<TransferHistoryEntry | null>
    • Parameters

      • rowid: number

        the rowid of the TransferHistoryEntry

      Returns Promise<TransferHistoryEntry | null>

      the requested transfer history entry, or null if that rowid does not exist.

id

id: Buffer

isAuthDescriptorValid

isAuthDescriptorValid: (authDescriptorId: BufferId) => Promise<boolean>

Determines whether the auth descriptor with the specified id is valid.

Type Declaration

    • (authDescriptorId: BufferId): Promise<boolean>
    • Parameters

      • authDescriptorId: BufferId

        the id of the auth descriptor to check

      Returns Promise<boolean>

      true or false depending on if the auth descriptor is valid or not

Optionaltype

type?: string