@chromia/ft4 - v2.1.0
    Preparing search index...

    Interface AuthenticatedAccount

    Represents a blockchain account to which the user has at least one signing key that is valid for performing operations. This means that an object of this type can be used to get information about an account and submit authenticated operations.

    For a "read-only" account without keys, see Account

    interface AuthenticatedAccount {
        addAuthDescriptor: (
            authDescriptor: AuthDescriptorRegistration<SingleSig>,
            keyStore: KeyStore,
        ) => Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >;
        authenticator: Authenticator;
        blockchainRid: Buffer;
        burn: (
            assetId: BufferId,
            amount: Amount,
        ) => Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >;
        connection: Connection;
        crosschainTransfer: (
            targetChainRid: BufferId,
            recipientId: BufferId,
            assetId: BufferId,
            amount: Amount,
            ttl?: number,
        ) => Web3PromiEvent<
            TransferRef,
            { built: SignedTransaction; hop: HopData; init: TransactionReceipt },
        >;
        deleteAllAuthDescriptorsExceptMain: () => Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >;
        deleteAuthDescriptor: (
            authDescriptorId: BufferId,
        ) => Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >;
        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>;
        recallUnclaimedCrosschainTransfer: (
            pendingTransfer: TransferRef,
        ) => Web3PromiEvent<void, { hop: HopData }>;
        recallUnclaimedTransfer: (
            txRid: BufferId,
            opIndex: number,
        ) => Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >;
        resumeCrosschainTransfer: (
            pendingTransfer: TransferRef,
        ) => Web3PromiEvent<void, { hop: HopData }>;
        revertCrosschainTransfer: (
            pendingTransfer: TransferRef,
        ) => Web3PromiEvent<void, { hop: HopData }>;
        transfer: (
            receiverId: BufferId,
            assetId: BufferId,
            amount: Amount,
        ) => Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >;
        type?: string;
        updateMainAuthDescriptor: (
            authDescriptor: AuthDescriptorRegistration<SingleSig>,
            keyStore: KeyStore,
        ) => Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >;
    }

    Hierarchy (View Summary)

    Index

    Properties

    addAuthDescriptor: (
        authDescriptor: AuthDescriptorRegistration<SingleSig>,
        keyStore: KeyStore,
    ) => Web3PromiEvent<
        { receipt: TransactionReceipt; session: Session },
        { built: SignedTransaction; sent: Buffer },
    >

    Adds a new auth descriptor to the account

    Type Declaration

      • (
            authDescriptor: AuthDescriptorRegistration<SingleSig>,
            keyStore: KeyStore,
        ): Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >
      • Parameters

        • authDescriptor: AuthDescriptorRegistration<SingleSig>

          the auth descriptor information to use when registering the auth descriptor

        • keyStore: KeyStore

          keystore that should match the pubkey in the first argument. Will be used to sign the transaction

        Returns Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >

    authenticator: Authenticator
    blockchainRid: Buffer
    burn: (
        assetId: BufferId,
        amount: Amount,
    ) => Web3PromiEvent<
        TransactionWithReceipt,
        { built: SignedTransaction; sent: Buffer },
    >

    Burns the specified amount of the specified asset from this account

    Type Declaration

      • (
            assetId: BufferId,
            amount: Amount,
        ): Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >
      • Parameters

        • assetId: BufferId

          the id of the asset to burn

        • amount: Amount

          how much of the asset to burn

        Returns Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >

    connection: Connection
    crosschainTransfer: (
        targetChainRid: BufferId,
        recipientId: BufferId,
        assetId: BufferId,
        amount: Amount,
        ttl?: number,
    ) => Web3PromiEvent<
        TransferRef,
        { built: SignedTransaction; hop: HopData; init: TransactionReceipt },
    >

    Perform a cross-chain transfer.

    Will emit events when the init_transfer transaction is built, when init_transfer transaction is anchored, and on each hop (containing blockchain RID).

    Will resolve when complete_transfer transaction is confirmed.

    Type Declaration

      • (
            targetChainRid: BufferId,
            recipientId: BufferId,
            assetId: BufferId,
            amount: Amount,
            ttl?: number,
        ): Web3PromiEvent<
            TransferRef,
            { built: SignedTransaction; hop: HopData; init: TransactionReceipt },
        >
      • Parameters

        • targetChainRid: BufferId

          RID of the target blockchain.

        • recipientId: BufferId

          ID of the recipient.

        • assetId: BufferId

          ID of the asset to be transferred.

        • amount: Amount

          The amount to be transferred.

        • Optionalttl: number

          timeout of this transfer in milliseconds. If the transfer has not been completed within this timeout, it can be reverted. This argument is designed to be combined with one of the time functions, e.g., authentication.days.

        Returns Web3PromiEvent<
            TransferRef,
            { built: SignedTransaction; hop: HopData; init: TransactionReceipt },
        >

    deleteAllAuthDescriptorsExceptMain: () => Web3PromiEvent<
        { receipt: TransactionReceipt; session: Session },
        { built: SignedTransaction; sent: Buffer },
    >

    Deletes all auth descriptors on this account, except for the main one which cannot be deleted. Requires that the user has instantiated this structure with the keystore that holds the private key for the main auth descriptor.

    deleteAuthDescriptor: (
        authDescriptorId: BufferId,
    ) => Web3PromiEvent<
        { receipt: TransactionReceipt; session: Session },
        { built: SignedTransaction; sent: Buffer },
    >

    Deletes the auth descriptor with the the specified id. The auth descriptor in question does not necessarily need to be associated with this account, but the keys stored in this account will be used to sign the operation.

    Type Declaration

      • (
            authDescriptorId: BufferId,
        ): Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >
      • Parameters

        • authDescriptorId: BufferId

          the id of the auth descriptor to delete

        Returns Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >

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

    Fetches an auth descriptor by its ID.

    Type Declaration

    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: () => Promise<AnyAuthDescriptor[]>

    Retrieves all auth descriptors associated with this account

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

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

    Type Declaration

    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: (
        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: (
        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: () => Promise<AnyAuthDescriptor>

    Retrieves the main auth descriptor of this account

    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: () => Promise<RateLimit>

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

    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: (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: Buffer
    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

    recallUnclaimedCrosschainTransfer: (
        pendingTransfer: TransferRef,
    ) => Web3PromiEvent<void, { hop: HopData }>

    Recalls a cross-chain account creation transfer which was not claimed before timeout.

    Will emit event on each hop (containing blockchain RID).

    Will resolve when revert_transfer transaction is confirmed.

    Type Declaration

    recallUnclaimedTransfer: (
        txRid: BufferId,
        opIndex: number,
    ) => Web3PromiEvent<
        TransactionWithReceipt,
        { built: SignedTransaction; sent: Buffer },
    >

    Returns a transfer that was properly delivered to its destination, but not claimed in time, to this account.

    Type Declaration

      • (
            txRid: BufferId,
            opIndex: number,
        ): Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >
      • Parameters

        • txRid: BufferId

          the id of the transaction in which the transfer was made

        • opIndex: number

          the index of the operation within the transaction

        Returns Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >

    resumeCrosschainTransfer: (
        pendingTransfer: TransferRef,
    ) => Web3PromiEvent<void, { hop: HopData }>

    Resume a cross-chain transfer which was initiated but did not complete properly.

    Will emit event on each hop (containing blockchain RID).

    Will resolve when complete_transfer transaction is confirmed.

    Type Declaration

    revertCrosschainTransfer: (
        pendingTransfer: TransferRef,
    ) => Web3PromiEvent<void, { hop: HopData }>

    Revert a cross-chain transfer which was initiated but did not complete properly.

    Will emit event on each hop (containing blockchain RID).

    Will resolve when revert_transfer transaction is confirmed.

    Type Declaration

    transfer: (
        receiverId: BufferId,
        assetId: BufferId,
        amount: Amount,
    ) => Web3PromiEvent<
        TransactionWithReceipt,
        { built: SignedTransaction; sent: Buffer },
    >

    Transfers the specified amount of the specified asset from this account to the specified receiver.

    Type Declaration

      • (
            receiverId: BufferId,
            assetId: BufferId,
            amount: Amount,
        ): Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >
      • Parameters

        • receiverId: BufferId

          who should receive the assets

        • assetId: BufferId

          what asset should be sent

        • amount: Amount

          how much of that asset should be sent

        Returns Web3PromiEvent<
            TransactionWithReceipt,
            { built: SignedTransaction; sent: Buffer },
        >

    type?: string
    updateMainAuthDescriptor: (
        authDescriptor: AuthDescriptorRegistration<SingleSig>,
        keyStore: KeyStore,
    ) => Web3PromiEvent<
        { receipt: TransactionReceipt; session: Session },
        { built: SignedTransaction; sent: Buffer },
    >

    Replaces the previous main auth descriptor with a new one which will be created with the provided information.

    Type Declaration

      • (
            authDescriptor: AuthDescriptorRegistration<SingleSig>,
            keyStore: KeyStore,
        ): Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >
      • Parameters

        • authDescriptor: AuthDescriptorRegistration<SingleSig>

          the auth descriptor information to use for the new auth descriptor

        • keyStore: KeyStore

          keystore that should match the pubkey in the first argument. Will be used to sign the transaction

        Returns Web3PromiEvent<
            { receipt: TransactionReceipt; session: Session },
            { built: SignedTransaction; sent: Buffer },
        >

    This function will throw an error if this AuthenticatedAccount instance does not have access to the private key of the current main auth descriptor.