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 query transfer status api #154

Merged
merged 11 commits into from
Sep 9, 2022
Merged

Conversation

npty
Copy link
Member

@npty npty commented Sep 6, 2022

Description

Closes #143

This PR introduces query status API for cross-chain transfer tx via deposit address or send token.

Possible returned statuses are:

  • asset_sent
  • deposit_confirmed
  • voted
  • batch_signed
  • ibc_sent
  • executed

Note: All statuses are represented as enum QueryTransferStatus

Changes

  • add AxelarTransferAPI to allow query transfer status for cross-chain transfer via deposit address or sendToken method.
  • rename axelarCachingServiceUrl to axelarGMPApiUrl

Usage

const { Environment } = require("@axelar-network/axelarjs-sdk");
const { AxelarTransferApi } = require("@axelar-network/axelarjs-sdk");

const api = new AxelarTransferApi({ environment: Environment.TESTNET })

// options is optional
const options = {
 depositAddress?: "",
 recipientAddress?: "",
}

// the first argument can be either evm tx hash or cosmos tx hash.
const response = await api.queryTransferStatus("6D1B1CD4B754280461BD7AD43B4838BBD8A467AA346B7584052025F83B5EB90F", options)

Example: success response

{
  success: true,
  data: {
    id: '6D1B1CD4B754280461BD7AD43B4838BBD8A467AA346B7584052025F83B5EB90F',
    status: 'executed',
    type: 'axelarnet_transfer',
    amount: 1,
    fee: 0.15,
    denom: 'uausdc',
    senderChain: 'axelarnet',
    senderAddress: 'axelar1d4v2fad26kze27s9przdc6zrcyxqsj20vas39m',
    recipientChain: 'ethereum',
    recipientAddress: 'axelar1xc8h95qg6lq7wlzq987v0xkxlpjwzlph928ylsdjggp9vaavjk0s5ll8zy',
    blockExplorerUrl: 'https://testnet.axelarscan.io/transfer/6D1B1CD4B754280461BD7AD43B4838BBD8A467AA346B7584052025F83B5EB90F',
    blockHeight: 3797679
  }
}

Example: failed response

{
  success: false,
  error: "No transfer found"
}

Tests

yarn test AxelarTransferAPI.spec.ts

image

@npty npty requested review from canhtrinh and pjenviri September 6, 2022 03:21
@npty npty self-assigned this Sep 6, 2022
@npty
Copy link
Member Author

npty commented Sep 6, 2022

cc: @jonator

@jonator
Copy link
Contributor

jonator commented Sep 6, 2022

This is greatly appreciated

Thanks.

@vladwulf vladwulf changed the base branch from main to 0.11.0 September 9, 2022 12:00
@vladwulf vladwulf merged commit 74c1c16 into 0.11.0 Sep 9, 2022
@vladwulf vladwulf deleted the feat/add-transfer-query branch September 9, 2022 12:03
canhtrinh added a commit that referenced this pull request Sep 13, 2022
* Implement query transfer status api (#154)
* refactor: rename axelarCachingServiceUrl to axelarGMPApiUrl
* feat: Add AxelarTransferAPI.ts
* feat: refactor query
* test: implement tests
* chore: update changelog
* feat: export AxelarTransferApi
* Fix/duplicate deposit address (#157)
* chore: deposit addresses from different source chains but with same destination chain run in parallel should be different
* chore: fix to fees
* chore: force bump minor

Co-authored-by: npty <[email protected]>
Co-authored-by: Automated Version Bump <[email protected]>
Co-authored-by: Canh Trinh <[email protected]>
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.

Add transfer status query API
4 participants