Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Implement RecoveryEndpoint class #9182

@ishantiw

Description

@ishantiw

Description

Implement RecoveryEndpoint class.

class RecoveryEndpoint extends BasePluginEndpoint {
	private _recoveryManager: SidechainRecoveryManager | MainchainRecoveryManager;
	
	load(recoveryManager) {
		this._recoveryManager = recoveryManager;
	}

	public addQueryKey(chainID, queryKey) {
		const sidechainClient = this._recoveryManager._sidechainClientMap.get(chainID);
		if (sidechainClient) {
			sidechainClient.enableStateRecovery();
			sidechainClient.addQueryKey(queryKey);
		}
	}

	public addChainForRecovery(chainID, connectionURL) {
		const sidechainClient = this._recoveryManager._sidechainClientMap.get(chainID);
		if (!sidechainClient) {
			this._recoveryManager.addSideChainClient(chainID, connectionURL);
		}
	}

      // Delete client for which recovery is no longer needed
      public deleteChainForRecovery(chainID) {}

       // Delete queryKey for which recovery is no longer needed
      public deleteQueryKey(chainID, queryKey) {}

      // User can get moduleName and subStorePrefix from getMetadata endpoint and key is what the user wants to track
      public createQueryKey(moduleName, subStorePrefix, key) {}: returns queryKey string

	public triggerStateRecovery(chainID, queryKey, txFee) {
		this._recoveryManager.triggerStateRecovery(chainID, queryKey);
            // update all the inclusion proofs if the transaction was included successfully
	}
	public triggerMessageRecovery(chainID, txFee): returns { txID, txJSON }
	public triggerInitStateRecovery(chainID, queryKey, txFee): returns { txID, txJSON }

	public triggerInitMessageRecovery(chainID, txFee): returns { txID, txJSON }


      // Enable signing of transaction
      public authorize(password)

      // It will send liveness termination command to mainchain
      public terminateChain(chainID)
}
  • Make sure all the endpoints return data in JSON format

Acceptance Criteria

  • Should have unit tests for all the endpoints

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions