fetchFromChain
fetchFromChain(
spaceUri):Promise<ISpaceDetailsAccountType|null>
Fetches space details from the blockchain based on a given space URI.
Parameters
Section titled “Parameters”• spaceUri: `space:cord:${string}`
The unique identifier (URI) of the space to be fetched.
Returns
Section titled “Returns”Promise<ISpaceDetailsAccountType | null>
A promise that resolves to the space details if found. The details include information such as the space URI, creator address, transaction capacity, and other relevant data.
Remarks
Section titled “Remarks”This function queries the CORD blockchain to retrieve details about a specific space, identified by the spaceUri.
It decodes the blockchain data into a more accessible format. If the space details are not found or cannot be decoded,
the function throws an error.
Throws
Section titled “Throws”- Thrown when no space is found with the provided URI.
Throws
Section titled “Throws”- Thrown when an error occurs during the fetching process.
Example
Section titled “Example”const spaceUri = 'space:example_uri';fetchFromChain(spaceUri) .then(spaceDetails => { console.log('Space Details:', spaceDetails); }) .catch(error => { if (error instanceof SDKErrors.ChainSpaceMissingError) { console.error('Space not found:', spaceUri); } else { console.error('Error fetching space from chain:', error); } });