An object which allows the user to interact with an account by both querying and submitting signed transactions.

interface Session {
    account: AuthenticatedAccount;
    blockchainRid: Buffer;
    call: ((...operations) => Web3PromiEvent<TransactionWithReceipt, {
        built: Buffer;
        sent: Buffer;
    }>);
    callWithoutNop: ((...operations) => Web3PromiEvent<TransactionWithReceipt, {
        built: Buffer;
        sent: Buffer;
    }>);
    client: IClient;
    getAccountById: ((accountId) => Promise<null | Account>);
    getAccountsByAuthDescriptorId: ((id, limit?, cursor?) => Promise<PaginatedEntity<Account>>);
    getAccountsBySigner: ((signer, limit?, cursor?) => Promise<PaginatedEntity<Account>>);
    getAccountsByType: ((type, limit?, cursor?) => Promise<PaginatedEntity<Account>>);
    getAllAssets: ((limit?, cursor?) => Promise<PaginatedEntity<Asset>>);
    getAssetById: ((assetId) => Promise<null | Asset>);
    getAssetsByName: ((name, limit?, cursor?) => Promise<PaginatedEntity<Asset>>);
    getAssetsBySymbol: ((symbol, limit?, cursor?) => Promise<PaginatedEntity<Asset>>);
    getAssetsByType: ((type, limit?, cursor?) => Promise<PaginatedEntity<Asset>>);
    getAuthDescriptorValidator: ((useCache) => AuthDescriptorValidator);
    getBlockHeight: (() => Promise<number>);
    getConfig: (() => Promise<Config>);
    getEnabledRegistrationStrategies: (() => Promise<string[]>);
    getTransferDetails: ((txRid, opIndex) => Promise<TransferDetail[]>);
    getTransferDetailsByAsset: ((txRid, opIndex, assetId) => Promise<TransferDetail[]>);
    getVersion: (() => Promise<string>);
    sign: ((tx) => Promise<Buffer>);
    signAndSend: ((tx) => Promise<TransactionReceipt>);
    transactionBuilder: ((config?) => TransactionBuilder);
}

Hierarchy (view full)

Properties

blockchainRid: Buffer
call: ((...operations) => Web3PromiEvent<TransactionWithReceipt, {
    built: Buffer;
    sent: Buffer;
}>)

Builds and sends a transaction containing the specified operations. This method will also make sure to perform the appropriate authentication and signing of each operation, as well as inserting a nop operation at the end to make each transaction unique. If you don't want the tx to include a nop use callWithoutNop instead.

Type declaration

    • (...operations): Web3PromiEvent<TransactionWithReceipt, {
          built: Buffer;
          sent: Buffer;
      }>
    • Parameters

      • Rest ...operations: Operation[]

        the operations to include in the transaction

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

callWithoutNop: ((...operations) => Web3PromiEvent<TransactionWithReceipt, {
    built: Buffer;
    sent: Buffer;
}>)

Same as call but it does not include a nop at the end. Meaning that subsequent calls to this function with the same arguments is likely to be rejected.

Type declaration

    • (...operations): Web3PromiEvent<TransactionWithReceipt, {
          built: Buffer;
          sent: Buffer;
      }>
    • Parameters

      • Rest ...operations: Operation[]

        the operations to include in the transaction

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

client: IClient
getAccountById: ((accountId) => Promise<null | Account>)

Fetches the account with the specified id

Type declaration

    • (accountId): Promise<null | Account>
    • Parameters

      • accountId: BufferId

        the id of the account to fetch

      Returns Promise<null | Account>

Returns

the account with the specified id, or null if no account with that id exists

getAccountsByAuthDescriptorId: ((id, limit?, cursor?) => Promise<PaginatedEntity<Account>>)

Fetches all accounts with which the auth descriptor with the specified id is associated

Type declaration

getAccountsBySigner: ((signer, limit?, cursor?) => Promise<PaginatedEntity<Account>>)

Fetches all accounts with which the provided signer has at least one associated auth descriptor

Type declaration

getAccountsByType: ((type, limit?, cursor?) => Promise<PaginatedEntity<Account>>)

Returns all accounts of the specified type that is registered on the blockchain as a paginated entity

Type declaration

getAllAssets: ((limit?, cursor?) => Promise<PaginatedEntity<Asset>>)

Retrieves all assets that are registered on a blockchain as a paginated entity

Type declaration

getAssetById: ((assetId) => Promise<null | Asset>)

Retrieves asset information using its id

Type declaration

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

      • assetId: BufferId

        the id of the asset to fetch

      Returns Promise<null | Asset>

Returns

The asset details, or null if no asset with the specified id was found

getAssetsByName: ((name, limit?, cursor?) => Promise<PaginatedEntity<Asset>>)

Retrieves asset information using its name. As there can be multiple assets with the same name, the information is returned as a paginated entity.

Type declaration

getAssetsBySymbol: ((symbol, limit?, cursor?) => Promise<PaginatedEntity<Asset>>)

Retrieves asset information using its symbol. As there can be multiple assets with the same symbol, the information is returned as a paginated entity.

Type declaration

getAssetsByType: ((type, limit?, cursor?) => Promise<PaginatedEntity<Asset>>)

Retrieves all assets of a specific type, e.g., "ft4", as a paginated entity

Type declaration

getAuthDescriptorValidator: ((useCache) => AuthDescriptorValidator)

Gets a validator instance that can be used to validate if an auth descriptor is valid or not

Type declaration

getBlockHeight: (() => Promise<number>)

Returns the current block height of the underlying chain

Type declaration

    • (): Promise<number>
    • Returns Promise<number>

getConfig: (() => Promise<Config>)

Returns the ft config that is currently in effect

Type declaration

getEnabledRegistrationStrategies: (() => Promise<string[]>)

Returns a list containing the name of all of the enabled strategies

Type declaration

    • (): Promise<string[]>
    • Returns Promise<string[]>

getTransferDetails: ((txRid, opIndex) => Promise<TransferDetail[]>)

Retrieves the details of a transfer

Type declaration

    • (txRid, opIndex): Promise<TransferDetail[]>
    • Parameters

      • txRid: BufferId

        the id of the transaction in which the transfer was made

      • opIndex: number

        the index of the transfer operation within the transaction

      Returns Promise<TransferDetail[]>

Returns

Details about the transfer

getTransferDetailsByAsset: ((txRid, opIndex, assetId) => Promise<TransferDetail[]>)

Retrieves details of a transfer but only the details that was made with a specific asset

Type declaration

    • (txRid, opIndex, assetId): Promise<TransferDetail[]>
    • Parameters

      • txRid: BufferId

        the id of the transaction in which the transfer was made

      • opIndex: number

        the index of the transfer operation within the transaction

      • assetId: BufferId

        the asset id for which to return details

      Returns Promise<TransferDetail[]>

Returns

The transfer details

getVersion: (() => Promise<string>)

Returns the version of ft library installed on the blockchain with the format ..

Type declaration

    • (): Promise<string>
    • Returns Promise<string>

sign: ((tx) => Promise<Buffer>)

Signs a transaction using an available key

Type declaration

    • (tx): Promise<Buffer>
    • Parameters

      • tx: Buffer | RawGtx | GTX

        the transaction to sign

      Returns Promise<Buffer>

Returns

the original transaction with the appropriate signatures added

signAndSend: ((tx) => Promise<TransactionReceipt>)

Same as sign but it also submits the resulting transaction to the blockchain.

Type declaration

    • (tx): Promise<TransactionReceipt>
    • Parameters

      • tx: Buffer | RawGtx | GTX

        the transaction to sign and send

      Returns Promise<TransactionReceipt>

Returns

a receipt with the result of submitting the transaction

transactionBuilder: ((config?) => TransactionBuilder)

Returns a TransactionBuilder instance configured to use the same keys as enclosed in this Session instance.

Type declaration