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

feat:add-tx-recovery #363

Merged
merged 69 commits into from
Jun 11, 2024
Merged

feat:add-tx-recovery #363

merged 69 commits into from
Jun 11, 2024

Conversation

npty
Copy link
Member

@npty npty commented May 20, 2024

Description

AXE-2924
AXE-4087

This PR has migrated the manualRelayToDestChain function from the old sdk to axelarjs. It's completely rewrote for readability and maintainability purpose, but it should work the same. The response format is compatible with the old version as well.

This PR also fixed our failed tests in that haven't been fixed for long time.

Usage

The function signature is changed (in a better way) due to our isomorphic pattern.

import { manualRelayToDestChain } from '@axelarjs/transaction-recovery';

// params structure
const params = {
  environment: "testnet" | "mainnet",
  txHash: "0x..",
  options?: {
       escapeAfterConfirm?: boolean | undefined;
       txLogIndex?: number | undefined;
       messageId?: string | undefined;
  }
}

// Basic Usage
const response = await manualRelayToDestChain({
  txHash,
  environment
});

The response's type is ManualRelayToDestChainResponse as below:

export type RecoveryTxType =
  | "axelar.confirm_gateway_tx"
  | "axelar.sign_commands"
  | "axelar.route_message"
  | "evm.gateway_approve";

export type RecoveryTx = {
  transactionHash: string;
};

export type ManualRelayToDestChainResponse = {
  success: boolean;
  type: RouteDir;
  logs: string[];
  error?: string | undefined;
  confirmTx?: RecoveryTx | undefined;
  signCommandTx?: RecoveryTx | undefined;
  routeMessageTx?: RecoveryTx | undefined;
  gatewayApproveTx?: RecoveryTx | undefined;
};

Migration Guide for Axelarscan

  1. Install new package: npm install @axelarjs/transaction-recovery
  2. Replace the old import with the following code:
import { manualRelayToDestChain, } from '@axelarjs/transaction-recovery';
  1. Update the function call as follows:
const options = { 
  escapeAfterConfirm,
  messageId,
  txLogIndex: logIndex;
}
const response = await manualRelayToDestChain(ENVIRONMENT, transactionHash, options);

Copy link

vercel bot commented May 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
axelar-maestro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 7:24am
axelar-registry ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 7:24am
axelar-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 7:24am

Copy link

changeset-bot bot commented May 20, 2024

🦋 Changeset detected

Latest commit: 4719824

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@axelarjs/transaction-recovery Minor
@axelarjs/api Minor
@axelarjs/cosmos Patch
@axelarjs/core Patch
@axelarjs/maestro Patch
@axelarjs/deposit-address Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@npty npty merged commit 234f925 into main Jun 11, 2024
5 checks passed
@npty npty deleted the feat/add-tx-recovery branch June 11, 2024 12:23
SGiaccobasso added a commit that referenced this pull request Jun 27, 2024
* feat:add-tx-recovery (#363)

* chore: init manualRelayToDestChain

* chore: pending work and disable husky

* feat: add `AxelarRecoveryApiClient`

* chore: add axelar recovery api urls

* chore: add createAxelarBroadcastClient

* feat: implement confirm step

* feat: implement sign tx flow

* feat: improve sign tx

* feat: implement route message

* chore: add signEvmTx to axelar-recovery client

* chore: implement signGatewayApprove tx

* chore: refactor error for each recovery step

* chore: fix build error

* chore: add retry

* chore: add built path to gitignore

* chore: returns early if fail to proceed

* docs(changeset): add tx recovery

* docs(changeset): Add a tx recovery feature

* feat: implement escapeAfterConfirm

* chore: make options optional

* chore: add tests

* chore: moving files and folders

* chore: check for tx status first

* chore: remove unnecessary check

* chore: fix checking finalized block issue

* chore: fix error msg

* chore: refactor recovery methods

* chore: add test for axelar confirm tx

* chore: add tests for axelarConfirmTx

* chore: remove unused import

* chore: add more assertion axelarConfirmTx

* chore: add tests for axelar sign tx

* chore: add evm gateway approve test

* chore: fix sign commands

* chore: remove execute tx signing from backend

* chore: remove unused import

* chore: remove the signEvmTx command from axelar-recovery api

* chore: move getWalletClient to common folder

* chore: use wallet client to sendRawTransaction

* chore: implement response mapping

* chore: fix build error

* chore: implement recovery tests

* chore: update isomorphic test

* chore: fix tests

* chore: fix tests

* chore: add messageId and txLogIndex to params

* chore: remove txEventIndex

* chore: fix import

* chore: skip manual test

* chore: fix test expect

* chore: uncomment husky

* chore: remove outdated changeset

* chore: add changeset

* chore: typo

* feat: add lcd urls to core package

* feat: add stargate connect function with fallback to other rpc urls

* chore: fix tests

* chore: update changeset

* chore: fix error in deposit address

* chore: fix wrong type

* chore: extract helper function 'shouldAbortRecovery'

* chore: separate actions and types for axelar txs

* chore: add more reasons to retry batch commands

* chore: added more tests and fix error

* chore: remove sign tx from evm to ibc

* chore: move batch commands query in sign commands inside try block

* chore: move batch commands query to the try block

* chore: remove undefined

* chore: apply changesets (#378)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: add query transaction status (#379)

* feat: implement queryTransactionStatus

* chore: update express_executed type

* chore: add tests

* docs(changeset): chore: add queryTransactionStatus to transaction-recovery package

* chore: update function doc

* feat: redesign (#377)

* feat: update colors

* feat: update colors

* feat: add clash grotesk font and set it as primary font

* feat: update font weights

* feat: update font weights ui package

* feat: animated bg

* feat: animated bg in ui package

* feat: mobile and light mode improvements

* feat: mobile and light mode improvements ui package

* fix: video bg on mobile

* fix: chain selector position on mobile

* fix: remove unused page and use tabs in deployments table

* fix: tabs position to match other pages

* fix: get deployments query

* fix: show theme selector in sidebar

* fix: text colors token page

---------

Co-authored-by: Santiago Giaccobasso <santigiacco@192.168.1.4>
Co-authored-by: Santiago Giaccobasso <santigiacco@192.168.0.104>
Co-authored-by: Santiago Giaccobasso <santigiacco@Santiagos-MacBook-Pro.local>

* chore: apply changesets (#381)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: fix type error (#383)

* chore: add dev guideline (#384)

* chore: apply changesets (#385)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: npty <78221556+npty@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Santiago Giaccobasso <santigiacco@192.168.1.4>
Co-authored-by: Santiago Giaccobasso <santigiacco@192.168.0.104>
Co-authored-by: Santiago Giaccobasso <santigiacco@Santiagos-MacBook-Pro.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants