HierarchiesClientReadOnly
@iota/hierarchies API documentation
Class: HierarchiesClientReadOnly
A client to interact with Hierarchies objects on the IOTA ledger.
This client is used for read-only operations, meaning it does not require an account or signing capabilities. For write operations, use HierarchiesClient.
Methods
packageId()
packageId():
string
Retrieves the package ID of the used hierarchies package.
Returns
A string representing the package ID.
Returns
string
iotaClient()
iotaClient():
IotaClient
Retrieves the underlying IOTA client used by this client.
Returns
The IotaClient instance.
Returns
IotaClient
isAttester()
isAttester(
federation_id,user_id):Promise<boolean>
Checks if a user has attestation accreditation.
Arguments
federation_id: The [ObjectID] of the federation.user_id: The [ObjectID] of the user.
Returns
A Result containing a boolean indicating if the user has attestation accreditation or an [Error].
TypeScript Usage
This method returns a Promise in TypeScript.
- On success, the promise resolves with a
boolean. - On failure, the promise rejects with an
Error.
try {
const isAttester = await client.isAttester(federationId, userId);
console.log("Is attester:", isAttester);
} catch (error) {
console.error("Failed to check attester status:", error);
}
Parameters
federation_id
string
user_id
string
Returns
Promise<boolean>
isAccreditor()
isAccreditor(
federation_id,user_id):Promise<boolean>
Checks if a user has accreditations to accredit.
Arguments
federation_id: The [ObjectID] of the federation.user_id: The [ObjectID] of the user.
Returns
A Result containing a boolean indicating if the user has accreditations to accredit or an [Error].
TypeScript Usage
This method returns a Promise in TypeScript.
- On success, the promise resolves with a
boolean. - On failure, the promise rejects with an
Error.
try {
const isAccreditor = await client.isAccreditor(federationId, userId);
console.log("Is accreditor:", isAccreditor);
} catch (error) {
console.error("Failed to check accreditor status:", error);
}
Parameters
federation_id
string
user_id
string
Returns
Promise<boolean>
getProperties()
getProperties(
federation_id):Promise<PropertyName[]>
Retrieves all property names registered in the federation.
Arguments
federation_id: The [ObjectID] of the federation.
Returns
A Result containing the list of property names or an [Error].
TypeScript Usage
This method returns a Promise in TypeScript.
- On success, the promise resolves with
WasmProperty[]. - On failure, the promise rejects with an
Error.
try {
const properties = await client.getProperties(federationId);
console.log("Properties:", properties);
} catch (error) {
console.error("Failed to get properties:", error);
}
Parameters
federation_id
string
Returns
Promise<PropertyName[]>
packageHistory()
packageHistory():
string[]
Retrieves the history of hierarchies package IDs.
Returns
An array of strings representing the package history.
Returns
string[]
isRootAuthority()
isRootAuthority(
federation_id,user_id):Promise<boolean>
Check if root authority is in the federation.
Arguments
federation_id: The [ObjectID] of the federation.user_id: The [ObjectID] of the user.
Returns
A Result containing a boolean indicating if the user is a root authority or an [Error].
Parameters
federation_id
string
user_id
string
Returns
Promise<boolean>
validateProperty()
validateProperty(
federation_id,user_id,property_name,property_value):Promise<boolean>
Validates a property for a specific user.
Arguments
federation_id: The [ObjectID] of the federation.user_id: The [ObjectID] of the user.property_name: The name of the property to validate.property_value: The value of the property to validate.
Returns
A Result containing a boolean indicating if the property is valid or an [Error].
TypeScript Usage
This method returns a Promise in TypeScript.
- On success, the promise resolves with a
boolean. - On failure, the promise rejects with an
Error.
try {
const isValid = await client.validateProperty(federationId, userId, propertyName, propertyValue);
console.log("Is property valid:", isValid);
} catch (error) {
console.error("Failed to validate property:", error);
}