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

Implement RecoveryEndpoint class #9182

Open
Tracked by #6919
ishantiw opened this issue Dec 7, 2023 · 0 comments
Open
Tracked by #6919

Implement RecoveryEndpoint class #9182

ishantiw opened this issue Dec 7, 2023 · 0 comments

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Dec 7, 2023

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant