Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Member

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

No branches or pull requests

1 participant