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, keyStore) => Web3PromiEvent<{
        receipt: TransactionReceipt;
        session: Session;
    }, {
        built: Buffer;
        sent: Buffer;
    }>);
    authenticator: Authenticator;
    blockchainRid: Buffer;
    burn: ((assetId, amount) => Web3PromiEvent<TransactionWithReceipt, {
        built: Buffer;
        sent: Buffer;
    }>);
    crosschainTransfer: ((targetChainRid, recipientId, assetId, amount) => Web3PromiEvent<TransferRef, {
        built: Buffer;
        hop: Buffer;
        init: TransactionReceipt;
    }>);
    deleteAllAuthDescriptorsExceptMain: (() => Web3PromiEvent<{
        receipt: TransactionReceipt;
        session: Session;
    }, {
        built: Buffer;
        sent: Buffer;
    }>);
    deleteAuthDescriptor: ((authDescriptorId) => Web3PromiEvent<{
        receipt: TransactionReceipt;
        session: Session;
    }, {
        built: Buffer;
        sent: Buffer;
    }>);
    getAuthDescriptorById: ((authDescriptorId) => Promise<AnyAuthDescriptor>);
    getAuthDescriptors: (() => Promise<AnyAuthDescriptor[]>);
    getAuthDescriptorsBySigner: ((signer) => Promise<AnyAuthDescriptor[]>);
    getBalanceByAssetId: ((assetId) => Promise<null | Balance>);
    getBalances: ((limit?, cursor?) => Promise<PaginatedEntity<Balance>>);
    getLastPendingCrosschainTransfer: ((targetBlockchainRid, recipientId, assetId, amount) => Promise<null | PendingTransfer>);
    getMainAuthDescriptor: (() => Promise<AnyAuthDescriptor>);
    getPendingCrosschainTransfers: ((limit?, cursor?) => Promise<PaginatedEntity<PendingTransfer>>);
    getRateLimit: (() => Promise<RateLimit>);
    getTransferHistory: ((limit?, filter?, cursor?) => Promise<PaginatedEntity<TransferHistoryEntry>>);
    getTransferHistoryEntry: ((rowid) => Promise<null | TransferHistoryEntry>);
    id: Buffer;
    isAuthDescriptorValid: ((authDescriptorId) => Promise<boolean>);
    recallUnclaimedCrosschainTransfer: ((pendingTransfer) => Web3PromiEvent<void, {
        hop: Buffer;
    }>);
    recallUnclaimedTransfer: ((txRid, opIndex) => Web3PromiEvent<TransactionWithReceipt, {
        built: Buffer;
        sent: Buffer;
    }>);
    resumeCrosschainTransfer: ((pendingTransfer) => Web3PromiEvent<void, {
        hop: Buffer;
    }>);
    revertCrosschainTransfer: ((pendingTransfer) => Web3PromiEvent<void, {
        hop: Buffer;
    }>);
    transfer: ((receiverId, assetId, amount) => Web3PromiEvent<TransactionWithReceipt, {
        built: Buffer;
        sent: Buffer;
    }>);
    updateMainAuthDescriptor: ((authDescriptor, keyStore) => Web3PromiEvent<{
        receipt: TransactionReceipt;
        session: Session;
    }, {
        built: Buffer;
        sent: Buffer;
    }>);
}

Hierarchy (view full)

Properties

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

Adds a new auth descriptor to the account

Type declaration

    • (authDescriptor, keyStore): Web3PromiEvent<{
          receipt: TransactionReceipt;
          session: Session;
      }, {
          built: Buffer;
          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: Buffer;
          sent: Buffer;
      }>

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

Burns the specified amount of the specified asset from this account

Type declaration

    • (assetId, amount): Web3PromiEvent<TransactionWithReceipt, {
          built: Buffer;
          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: Buffer;
          sent: Buffer;
      }>

crosschainTransfer: ((targetChainRid, recipientId, assetId, amount) => Web3PromiEvent<TransferRef, {
    built: Buffer;
    hop: Buffer;
    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, recipientId, assetId, amount): Web3PromiEvent<TransferRef, {
          built: Buffer;
          hop: Buffer;
          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.

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

deleteAllAuthDescriptorsExceptMain: (() => Web3PromiEvent<{
    receipt: TransactionReceipt;
    session: Session;
}, {
    built: Buffer;
    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.

Type declaration

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

deleteAuthDescriptor: ((authDescriptorId) => Web3PromiEvent<{
    receipt: TransactionReceipt;
    session: Session;
}, {
    built: Buffer;
    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): Web3PromiEvent<{
          receipt: TransactionReceipt;
          session: Session;
      }, {
          built: Buffer;
          sent: Buffer;
      }>
    • Parameters

      • authDescriptorId: BufferId

        the id of the auth descriptor to delete

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

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

Retrieves all auth descriptors associated with this account

Type declaration

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

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

Type declaration

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

Retrieves the balance for a specific asset

Type declaration

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

      • assetId: BufferId

        the id of the asset to fetch balance for

      Returns Promise<null | Balance>

Returns

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

getBalances: ((limit?, cursor?) => 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, recipientId, assetId, amount) => Promise<null | PendingTransfer>)

Retrieves the most recent pending transfer which matches the specified arguments

Type declaration

    • (targetBlockchainRid, recipientId, assetId, amount): Promise<null | PendingTransfer>
    • 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<null | PendingTransfer>

Returns

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

Type declaration

getPendingCrosschainTransfers: ((limit?, cursor?) => 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.

Type declaration

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

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

Type declaration

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

Retrieves a specific TransferHistoryEntry

Type declaration

Returns

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

id: Buffer
isAuthDescriptorValid: ((authDescriptorId) => Promise<boolean>)

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

Type declaration

    • (authDescriptorId): Promise<boolean>
    • Parameters

      • authDescriptorId: BufferId

        the id of the auth descriptor to check

      Returns Promise<boolean>

Returns

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

recallUnclaimedCrosschainTransfer: ((pendingTransfer) => Web3PromiEvent<void, {
    hop: Buffer;
}>)

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

    • (pendingTransfer): Web3PromiEvent<void, {
          hop: Buffer;
      }>
    • Parameters

      Returns Web3PromiEvent<void, {
          hop: Buffer;
      }>

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

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

Type declaration

    • (txRid, opIndex): Web3PromiEvent<TransactionWithReceipt, {
          built: Buffer;
          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: Buffer;
          sent: Buffer;
      }>

resumeCrosschainTransfer: ((pendingTransfer) => Web3PromiEvent<void, {
    hop: Buffer;
}>)

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

    • (pendingTransfer): Web3PromiEvent<void, {
          hop: Buffer;
      }>
    • Parameters

      Returns Web3PromiEvent<void, {
          hop: Buffer;
      }>

revertCrosschainTransfer: ((pendingTransfer) => Web3PromiEvent<void, {
    hop: Buffer;
}>)

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

    • (pendingTransfer): Web3PromiEvent<void, {
          hop: Buffer;
      }>
    • Parameters

      Returns Web3PromiEvent<void, {
          hop: Buffer;
      }>

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

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

Type declaration

    • (receiverId, assetId, amount): Web3PromiEvent<TransactionWithReceipt, {
          built: Buffer;
          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: Buffer;
          sent: Buffer;
      }>

updateMainAuthDescriptor: ((authDescriptor, keyStore) => Web3PromiEvent<{
    receipt: TransactionReceipt;
    session: Session;
}, {
    built: Buffer;
    sent: Buffer;
}>)

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

Type declaration

    • (authDescriptor, keyStore): Web3PromiEvent<{
          receipt: TransactionReceipt;
          session: Session;
      }, {
          built: Buffer;
          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: Buffer;
          sent: Buffer;
      }>

Remarks

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