Skip to main content

@midnight-ntwrk/midnight-js-contracts v0.2.5 • API


Midnight.js API Reference v0.2.5 / @midnight-ntwrk/midnight-js-contracts / submitReplaceAuthorityTx

Function: submitReplaceAuthorityTx()

submitReplaceAuthorityTx<PSS, PSK>(providers, privateStateKey, contractAddress): (newAuthority) => Promise<FinalizedTxData>

Constructs and submits a transaction that replaces the maintenance authority stored on the blockchain for this contract. After the transaction is finalized, the current signing key stored in the given private state provider is overwritten with the given new authority key.

Type parameters

PSS extends PrivateStateSchema

PSK extends string

Parameters

providers: MidnightProviders<string, PrivateStateSchema>

The providers to use to manage the transaction lifecycle.

privateStateKey: PSK

THe key at which the contract being update has its state stored.

contractAddress: string

The address of the contract for which the maintenance authority should be updated.

TODO: There are at least three options we should support in the future:

  1. Replace authority and maintain key (current).
  2. Replace authority and do not maintain key.
  3. Add additional authorities and maintain original key.

Returns

Function

Parameters

newAuthority: string

The signing key of the new contract maintenance authority.

Returns

Promise<FinalizedTxData>