-
Notifications
You must be signed in to change notification settings - Fork 11
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
add example: solana api example #62
Conversation
heyOnuoha
commented
May 16, 2024
•
edited
Loading
edited
- Examples: Refactor Solana API example to use both SDK + API: FIXES DX-55
- Example: EVM <> Solana - API: FIXES DX-40
The latest updates on your projects. Learn more about Vercel for Git ↗︎
7 Ignored Deployments
|
toChain: transferParams.toChain, | ||
toTokenAddress: transferParams.toTokenAddress!, | ||
toTokenSymbol: transferParams.toTokenSymbol!, | ||
contractCall: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is contractCall true here? when it's false above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, that's a typo, will fix
}; | ||
``` | ||
|
||
## Sending a Token Approval Request for ERC20 Tokens (Optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this "Optional"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an optional step in the transfer flow if the source token is not an ERC20 token.
contractCall: true, | ||
}); | ||
|
||
if (transferParams.fromChain !== "solana") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you checking if not solana? maybe add a comment why this is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm checking the source chain to know whether I'm executing a SOL transaction or an Ethereum transaction. I'll add a comment there
Next, we will check if the user has a Solana-supported wallet installed. If the user does not have a supported wallet installed, we will prompt them to install one. If all is good, we will proceed to sign and send the transaction over to the network. | ||
|
||
```typescript | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you actually executed these steps yourself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have
|
||
The `TransactionStatusParams` params contains the three properties, namely: `id`, `txHash` and `projectId` | ||
|
||
URL: [https://swap.prod.swing.xyz/v0/transfer/status](https://developers.swing.xyz/reference/api/cross-chain/6b61efd1b798a-transfer-status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing since you are fetching "/projects/{projectId}/transactions/{transactionId}"
but are linking to https://swap.prod.swing.xyz/v0/transfer/status
. that needs explanation or fixing or improving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out, will fix that