dispatchSubspaceCreateToChain
dispatchSubspaceCreateToChain(
chainSpace,authorAccount,count,parent):Promise<object>
Dispatches a Sub-ChainSpace creation transaction to the CORD blockchain.
Parameters
Section titled “Parameters”• chainSpace: IChainSpaceAccountType
The ChainSpace object containing necessary information for creating the ChainSpace on the blockchain.
• authorAccount: CordKeyringPair
The blockchain account used for signing and submitting the transaction.
• count: number
The count of transactions permitted to be performed on the chain for the subspace.
• parent: `space:cord:${string}`
The chainspace under which the sub-space will be created.
Returns
Section titled “Returns”Promise<object>
A promise resolving to an object containing the ChainSpace URI and authorization ID.
authorization
Section titled “authorization”authorization:
AuthorizationUri
uri:
SpaceUri
Remarks
Section titled “Remarks”Responsible for creating a new ChainSpace on the blockchain. It first checks if the ChainSpace with the given URI already exists to avoid duplicates. If not, it constructs and submits a transaction to create the ChainSpace. The transaction requires authorization from the creator and is signed by the specified author account.
Example
Section titled “Example”const chainSpace: IChainSpace = { // ... initialization of chainSpace properties ...};const authorAccount: CordKeyringPair = // ... initialization ...
try { const result = await dispatchSubspaceCreateToChain(chainSpace, creatorUri, authorAccount); console.log('ChainSpace dispatched with URI:', result.uri);} catch (error) { console.error('Error dispatching ChainSpace:', error);}Throws
Section titled “Throws”- Thrown when there’s an error during the dispatch process.