Skip to content

Commit

Permalink
Improve manual relay (#250)
Browse files Browse the repository at this point in the history
* chore: setting up calc for generating command ID

chore: code cleanup

* chore: update manual relay to destination chain

* chore: code cleanup

* chore: code cleanup

* chore: adding comments

* chore: adding event query

* chore: adding query methods for confirmation height and event

* chore: code cleanup

* chore: code refactor

* chore: typo in changelog

* chore: refactor code and update tests

* chore: fixing command ID calculation

chore: fixing issue where event initially not found

chore: adding retry on retrieving batch data

chore: adding retries

chore: code cleanup

* chore: code cleanup

* chore: code cleanup

* chore: code cleanup for manualRelay through signing

* chore: adding logs for debug mode

* chore: update command ID and update tests
  • Loading branch information
canhtrinh authored Mar 2, 2023
1 parent 027e714 commit cf7bd4d
Show file tree
Hide file tree
Showing 16 changed files with 1,095 additions and 217 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed `estimateGasFee` function in how it handles the `minGasPrice` parameter, which should compare the min to the destination chain gas price, whereas it was comparing to the source chain price originally.
- AxelarRecoveryAPI
- introduced wss subscription service (subscribeToTx) to invoke subscribe to specific transactions for updates
- AxelarGMPRecoveryAPI
- fixes to manualRelayToDestinationChain to first check if transaction is already confirmed but not broadcasted, and broadcast the transaction (as identified by command ID) if so

## [0.12.4] - 2023-FEBRUARY-1

Expand Down
7 changes: 6 additions & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface EnvironmentConfigs {
axelarRpcUrl: string;
axelarLcdUrl: string;
axelarGMPApiUrl: string;
axelarscanBaseApiUrl: string;
depositServiceUrl: string;
recoveryApiUrl: string;
axelarCrosschainApiUrl: string;
Expand All @@ -17,6 +18,7 @@ const localConfigs: EnvironmentConfigs = {
axelarRpcUrl: "https://axelar-testnet-rpc.axelar-dev.workers.dev",
axelarLcdUrl: "https://axelar-testnet-lcd.axelar-dev.workers.dev",
axelarGMPApiUrl: "https://testnet.api.gmp.axelarscan.io",
axelarscanBaseApiUrl: "",
depositServiceUrl: "https://deposit-service-devnet-release.devnet.axelar.dev",
recoveryApiUrl: "https://axelar-signing-relayer-testnet.axelar.dev",
axelarCrosschainApiUrl: "https://testnet.api.axelarscan.io/cross-chain",
Expand All @@ -28,6 +30,7 @@ const devnetConfigs: EnvironmentConfigs = {
axelarRpcUrl: "",
axelarLcdUrl: "",
axelarGMPApiUrl: "https://devnet.api.gmp.axelarscan.io",
axelarscanBaseApiUrl: "",
depositServiceUrl: "https://deposit-service-devnet-release.devnet.axelar.dev",
recoveryApiUrl: "",
axelarCrosschainApiUrl: "",
Expand All @@ -37,9 +40,10 @@ const devnetConfigs: EnvironmentConfigs = {
const testnetConfigs: EnvironmentConfigs = {
resourceUrl: "https://nest-server-testnet.axelar.dev",
axelarRpcUrl: "https://rpc-axelar-testnet.imperator.co:443", // "https://testnet.rpc.axelar.dev/chain/axelar",
axelarLcdUrl: "https://rpc-axelar-testnet.imperator.co",
axelarLcdUrl: "https://lcd-axelar-testnet.imperator.co",
depositServiceUrl: "https://deposit-service.testnet.axelar.dev",
axelarGMPApiUrl: "https://testnet.api.gmp.axelarscan.io",
axelarscanBaseApiUrl: "https://testnet.api.axelarscan.io",
recoveryApiUrl: "https://axelar-signing-relayer-testnet.axelar.dev",
axelarCrosschainApiUrl: "https://testnet.api.axelarscan.io/cross-chain",
axelarscanUrl: "https://testnet.axelarscan.io",
Expand All @@ -50,6 +54,7 @@ const mainnetConfigs: EnvironmentConfigs = {
axelarRpcUrl: "https://mainnet.rpc.axelar.dev/chain/axelar",
axelarLcdUrl: "https://lcd-axelar.imperator.co",
axelarGMPApiUrl: "https://api.gmp.axelarscan.io",
axelarscanBaseApiUrl: "https://api.axelarscan.io",
depositServiceUrl: "https://deposit-service.mainnet.axelar.dev",
recoveryApiUrl: "https://axelar-signing-relayer-mainnet.axelar.dev",
axelarCrosschainApiUrl: "https://api.axelarscan.io/cross-chain",
Expand Down
17 changes: 17 additions & 0 deletions src/libs/AxelarQueryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ export class AxelarQueryAPI {
});
}

public async getEVMEvent(sourceChainId: string, srcTxHash: string, srcEventId: number) {
await throwIfInvalidChainIds([sourceChainId], this.environment);
await this.initQueryClientIfNeeded();
return this.axelarQueryClient.evm
.Event({
chain: sourceChainId,
eventId: `${srcTxHash}-${srcEventId}`,
})
.catch((e) => undefined);
}

public async getConfirmationHeight(chain: string) {
await throwIfInvalidChainIds([chain], this.environment);
await this.initQueryClientIfNeeded();
return this.axelarQueryClient.evm.ConfirmationHeight({ chain });
}

/**
* Gest the transfer fee for a given transaction
* example testnet query: "https://axelartest-lcd.quickapi.com/axelar/nexus/v1beta1/transfer_fee?source_chain=ethereum&destination_chain=terra&amount=100000000uusd"
Expand Down
Loading

0 comments on commit cf7bd4d

Please sign in to comment.