dispatchUpdateTxCapacityToChain
dispatchUpdateTxCapacityToChain(
space
,creatorUri
,authorAccount
,new_capacity
,signCallback
):Promise
<object
>
Dispatches a Sub-ChainSpace creation transaction to the CORD blockchain.
Parameters
• space: space:cord:${string}
• creatorUri: did:cord:3${string}
The DID URI of the creator, used to authorize the transaction.
• authorAccount: CordKeyringPair
The blockchain account used for signing and submitting the transaction.
• new_capacity: number
• signCallback: SignExtrinsicCallback
The callback function for signing the transaction.
Returns
Promise
<object
>
A promise resolving to an object containing the ChainSpace URI and authorization ID.
uri
uri:
SpaceUri
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
const chainSpace: IChainSpace = { // ... initialization of chainSpace properties ...};const creatorUri: DidUri = 'did:cord:creator_uri';const authorAccount: CordKeyringPair = // ... initialization ...const signCallback: SignExtrinsicCallback = // ... implementation ...
try { const result = await dispatchSubspaceCreateToChain(chainSpace, creatorUri, authorAccount, signCallback); console.log('ChainSpace dispatched with URI:', result.uri);} catch (error) { console.error('Error dispatching ChainSpace:', error);}
Throws
- Thrown when there’s an error during the dispatch process.