Withdraw from Aave to Solana
Pre-release — The Intents Connect API is currently in development. If you're interested in early access, get in touch with the team.
Below is an example flow withdrawing from Aave using a Solana wallet using the Intents Connect API.
You'll need to run an execution to get the estimated output amount, estimate costs for the destination chain action, and sign the intent (withdraw from Aave). As a result, you'll withdraw from Aave into your Solana wallet.
Make sure to understand Execution Lifecycle before you proceed with the implementation.
List supported tokens
Use List supported tokens to find the assetId values you will need. You'll need to use the Intents API for that.
const response = await fetch(`https://intents-connect-alpha-api.aurora.dev/api/v1/supported_tokens`);
const tokens = await response.json();Request an execution
Use Request an execution endpoint.
const response = await fetch(`https://intents-connect-alpha-api.aurora.dev/api/v1/executions/${solanaWalletAccount}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
// Generate your API key at https://studio.aurora.dev
'x-api-key': 'API_KEY',
},
body: JSON.stringify({
"dry": false,
"metadata": {
"intent": "aave_withdraw",
"title": "Withdraw from Aave"
},
"outOperation": true,
"quote": {
"amount": "197373",
"destinationAsset": "nep141:sol.omft.near",
"originAsset": "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near",
"slippageTolerance": 100
},
"steps": [
{
"functionSignature": "withdraw(address,uint256,address)",
"parameters": [
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"197373",
"0xFe6EF968D2F7B2e9CCCF92150d96c930C3CC4a4E"
],
"to": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5",
"value": "0"
},
{
"functionSignature": "transfer(address,uint256)",
"parameters": [
"{DEPOSIT_ADDRESS}",
"197373"
],
"to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"value": "0"
}
],
"type": "evm"
})
});
const execution = await response.json();Submit the digest
Use Submit digest to submit the signed message. This will allow executing batched transactions on the destination chain.
const response = await fetch(`https://intents-connect-alpha-api.aurora.dev/api/v1/executions/${solanaWalletAccount}/submit`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"executionId": "74e0cbfe-def3-47fb-8f1c-469778c6acbc",
"publicKey": "ed25519:BTKcXNp1wSzs9Mp2ejsPrHLr59z5UkEDJgqcWyXGhGc4",
"signature": "ed25519:466cjq2diW62zHhHik8hQQGLjLTg2drnZCEjBxDnUDZCoN4HmcXv4F4WTe2LqDgJk8Ccaq1rjusA47DeUWKegNy1"
})
});
const execution = await response.json();Monitor the status of the execution
Use Fetch executions using id of the execution
const response = await fetch(`https://intents-connect-alpha-api.aurora.dev/api/v1/executions/BTKcXNp1wSzs9Mp2ejsPrHLr59z5UkEDJgqcWyXGhGc4?id=74e0cbfe-def3-47fb-8f1c-469778c6acbc`);
const execution = await response.json();Last updated
