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

Adds error handling to chainport requests #5059

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

patnir
Copy link
Contributor

@patnir patnir commented Jun 20, 2024

  1. Adds a new makeChainportRequest function that wraps the existing makeRequest function and adds error handling for chainport requests
  2. This function takes a generic type parameter T that represents the expected response type
  3. If the response is not successful, the function throws an error with the response status and message

For reference, this is their new error return type schema https://iflabs.slack.com/archives/C0677Q1AGDD/p1718793349123629

Testing Plan

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes

@patnir patnir requested a review from a team as a code owner June 20, 2024 18:59
@@ -63,11 +54,26 @@ export const fetchChainportBridgeTransaction = async (
const config = getConfig(networkId)
const url = `${config.endpoint}/ironfish/metadata?raw_amount=${amount.toString()}&asset_id=${
asset.web3_address
}&target_network_id=${network.chainport_network_id.toString()}&target_web3_address=${to}`
}&target_network_id=${
network.chainport_network_id.toString() + 'asdf'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the 'asdf' left over from testing?

1. Adds a new makeChainportRequest function that wraps the existing makeRequest function and adds error handling for chainport requests
2. This function takes a generic type parameter T that represents the expected response type
3. If the response is not successful, the function throws an error with the response status and message
@patnir patnir force-pushed the rahul/chainport-api-error-handling branch from 5a6567c to f19ada9 Compare June 20, 2024 22:55
@patnir patnir requested a review from hughy June 20, 2024 22:55
@patnir patnir merged commit eed7f0e into staging Jun 21, 2024
10 checks passed
@patnir patnir deleted the rahul/chainport-api-error-handling branch June 21, 2024 15:12
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