Interface
AuthenticatedAccount
On this page
- Properties
- addAuthDescriptor
- authenticator
- blockchainRid
- burn
- connection
- crosschainTransfer
- deleteAllAuthDescriptorsExceptMain
- deleteAuthDescriptor
- getAuthDescriptorById
- getAuthDescriptors
- getAuthDescriptorsBySigner
- getBalanceByAssetId
- getBalances
- getLastPendingCrosschainTransfer
- getMainAuthDescriptor
- getPendingCrosschainTransfers
- getRateLimit
- getTransferHistory
- getTransferHistoryEntry
- id
- isAuthDescriptorValid
- recallUnclaimedCrosschainTransfer
- recallUnclaimedTransfer
- resumeCrosschainTransfer
- revertCrosschainTransfer
- transfer
- Optional type
- updateMainAuthDescriptor
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)
- Account
- AuthenticatedAccount
Properties
addAuthDescriptor
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
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 },
>- authDescriptor: AuthDescriptorRegistration<SingleSig>
( authDescriptor: AuthDescriptorRegistration<SingleSig>, keyStore: KeyStore, ): Web3PromiEvent< { receipt: TransactionReceipt; session: Session }, { built: SignedTransaction; sent: Buffer }, >
authenticator
authenticator: AuthenticatorblockchainRid
blockchainRid: BufferInherited from Account.blockchainRid
burn
burn: (
assetId: BufferId,
amount: Amount,
) => Web3PromiEvent<
TransactionWithReceipt,
{ built: SignedTransaction; sent: Buffer },
>Burns the specified amount of the specified asset from this account
Type Declaration
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 },
>- assetId: BufferId
( assetId: BufferId, amount: Amount, ): Web3PromiEvent< TransactionWithReceipt, { built: SignedTransaction; sent: Buffer }, >
connection
connection: ConnectionInherited from Account.connection
crosschainTransfer
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
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: numbertimeout 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 },
>- targetChainRid: BufferId
( targetChainRid: BufferId, recipientId: BufferId, assetId: BufferId, amount: Amount, ttl?: number, ): Web3PromiEvent< TransferRef, { built: SignedTransaction; hop: HopData; init: TransactionReceipt }, >
deleteAllAuthDescriptorsExceptMain
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
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
Parameters
- authDescriptorId: BufferId
the id of the auth descriptor to delete
Returns Web3PromiEvent<
{ receipt: TransactionReceipt; session: Session },
{ built: SignedTransaction; sent: Buffer },
>- authDescriptorId: BufferId
( authDescriptorId: BufferId, ): Web3PromiEvent< { receipt: TransactionReceipt; session: Session }, { built: SignedTransaction; sent: Buffer }, >
getAuthDescriptorById
getAuthDescriptorById: (
authDescriptorId: BufferId,
) => Promise<AnyAuthDescriptor>Fetches an auth descriptor by its ID.
Type Declaration
Parameters
- authDescriptorId: BufferId
the id of the auth descriptor to fetch
Returns Promise<AnyAuthDescriptor>
- authDescriptorId: BufferId
(authDescriptorId: BufferId): Promise<AnyAuthDescriptor>
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
Inherited from Account.getAuthDescriptorById
getAuthDescriptors
getAuthDescriptors: () => Promise<AnyAuthDescriptor[]>Retrieves all auth descriptors associated with this account
Inherited from Account.getAuthDescriptors
getAuthDescriptorsBySigner
getAuthDescriptorsBySigner: (signer: BufferId) => Promise<AnyAuthDescriptor[]>Retrieves all auth descriptors on which the specified signer is also a signer.
Type Declaration
Parameters
- signer: BufferId
the signer whose auth descriptors to retrieve
Returns Promise<AnyAuthDescriptor[]>
- signer: BufferId
(signer: BufferId): Promise<AnyAuthDescriptor[]>
Inherited from Account.getAuthDescriptorsBySigner
getBalanceByAssetId
getBalanceByAssetId: (assetId: BufferId) => Promise<Balance | null>Retrieves the balance for a specific asset
Type Declaration
Inherited from Account.getBalanceByAssetId
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
Parameters
Optionallimit: numbermaximum page size
Optionalcursor: OptionalPageCursorwhere the page should start
Returns Promise<PaginatedEntity<Balance>>
(limit?: number, cursor?: OptionalPageCursor): Promise<PaginatedEntity<Balance>>
Inherited from Account.getBalances
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
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
- targetBlockchainRid: BufferId
( targetBlockchainRid: BufferId, recipientId: BufferId, assetId: BufferId, amount: bigint, ): Promise<PendingTransfer | null>
Inherited from Account.getLastPendingCrosschainTransfer
getMainAuthDescriptor
getMainAuthDescriptor: () => Promise<AnyAuthDescriptor>Retrieves the main auth descriptor of this account
Inherited from Account.getMainAuthDescriptor
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
Parameters
Optionallimit: OptionalLimitmaximum page size
Optionalcursor: OptionalPageCursorwhere the page should start
Returns Promise<PaginatedEntity<PendingTransfer>>
( limit?: OptionalLimit, cursor?: OptionalPageCursor, ): Promise<PaginatedEntity<PendingTransfer>>
Inherited from Account.getPendingCrosschainTransfers
getRateLimit
getRateLimit: () => Promise<RateLimit>Retrieves the current rate limit for this account. I.e., how many points this account currently has.
Inherited from Account.getRateLimit
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
Parameters
Optionallimit: numbermaximum page size
Optionalfilter: TransferHistoryFiltera filter to determine what type of transfer history entries to fetch
Optionalcursor: OptionalPageCursorwhere the page should start
Returns Promise<PaginatedEntity<TransferHistoryEntry>>
( limit?: number, filter?: TransferHistoryFilter, cursor?: OptionalPageCursor, ): Promise<PaginatedEntity<TransferHistoryEntry>>
Inherited from Account.getTransferHistory
getTransferHistoryEntry
getTransferHistoryEntry: (rowid: number) => Promise<TransferHistoryEntry | null>Retrieves a specific TransferHistoryEntry
Type Declaration
Parameters
- rowid: number
the rowid of the
TransferHistoryEntry
Returns Promise<TransferHistoryEntry | null>
the requested transfer history entry, or
nullif thatrowiddoes not exist.- rowid: number
(rowid: number): Promise<TransferHistoryEntry | null>
Inherited from Account.getTransferHistoryEntry
id
id: BufferisAuthDescriptorValid
isAuthDescriptorValid: (authDescriptorId: BufferId) => Promise<boolean>Determines whether the auth descriptor with the specified id is valid.
Type Declaration
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
- authDescriptorId: BufferId
(authDescriptorId: BufferId): Promise<boolean>
Inherited from Account.isAuthDescriptorValid
recallUnclaimedCrosschainTransfer
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
Parameters
- pendingTransfer: TransferRef
The transfer to recall
Returns Web3PromiEvent<void, { hop: HopData }>
- pendingTransfer: TransferRef
(pendingTransfer: TransferRef): Web3PromiEvent<void, { hop: HopData }>
recallUnclaimedTransfer
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
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 },
>- txRid: BufferId
( txRid: BufferId, opIndex: number, ): Web3PromiEvent< TransactionWithReceipt, { built: SignedTransaction; sent: Buffer }, >
resumeCrosschainTransfer
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
Parameters
- pendingTransfer: TransferRef
The transfer to resume
Returns Web3PromiEvent<void, { hop: HopData }>
- pendingTransfer: TransferRef
(pendingTransfer: TransferRef): Web3PromiEvent<void, { hop: HopData }>
revertCrosschainTransfer
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
Parameters
- pendingTransfer: TransferRef
The transfer to revert
Returns Web3PromiEvent<void, { hop: HopData }>
- pendingTransfer: TransferRef
(pendingTransfer: TransferRef): Web3PromiEvent<void, { hop: HopData }>
transfer
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
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 },
>- receiverId: BufferId
( receiverId: BufferId, assetId: BufferId, amount: Amount, ): Web3PromiEvent< TransactionWithReceipt, { built: SignedTransaction; sent: Buffer }, >
Optionaltype
type?: stringupdateMainAuthDescriptor
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
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 },
>- authDescriptor: AuthDescriptorRegistration<SingleSig>
( authDescriptor: AuthDescriptorRegistration<SingleSig>, keyStore: KeyStore, ): Web3PromiEvent< { receipt: TransactionReceipt; session: Session }, { built: SignedTransaction; 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.