Get Outstanding Lowers For Account
Get all available lowers and the data to complete them. This accepts either an Ethereum recipient address or AvN sender address.
The first part of the lower transaction is triggered using this. Once this trigger transaction is completed, it takes 24 hours before the data required to complete step-2 of the lower transaction is available. After 24 hours, you can query for the claimData. You'll need the claimData
to submit the Ethereum transaction.
Once you have the claimData
, you can carryout the Ethereum transaction. You cannot use the this api to carryout Ethereum transactions.
api.query.getOutstandingLowersForAccount(<params>)
The merkle path was previously required as part of the claimData
to complete a Lower transaction on Ethereum. But with the decoupling of lowers from summaries that happened on version 3.5.1 of the Aventus parachain onwards, there is no need for a merkle path generation in order to claim a lower. The proofs now generated on-chain provide the user with all the info they need in order to claim a lower.
Expected Results
lowerId
- The assigned ID of your lower request.token
- The Ethereum contract address of the token being lowered.from
: The public key of the sending Aventus account.to
: The address on Ethereum specified to receive the lowered token amount.amount
: The amount of the token lowered.claimData
: A string of the lower data required to complete step 2 of the lower process (claim the tokens).name
: The name of the transaction type.
You can get the AVN_GATEWAY_URL here.
Using The Recipient Ethereum Addresss
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "gateway url of your chosen network";
const options = {
suri: "suri of your account",
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
const avnSdk = new AvnApi(AVN_GATEWAY_URL, options);
// The below Ethereum address is just an example
const RECIPIENT_ETHEREUM_ADDRESS = "0x0aa4a0f15864e2c1c3aa17d505faa0f997b4bdf9";
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
const result = await api.query.getOutstandingLowersForAccount(
RECIPIENT_ETHEREUM_ADDRESS
);
console.log(result);
}
(async () => {
await main();
})();
[
{
lowerId: 30,
token: '0x0d88ed6e74bbfd96b831231638b66c05571e824f',
from: '0x5e3791f8f33eaf8b2b28aac472bd7782e175413afcad5b939d3773fe8b9c4677',
to: '0x0aa4a0f15864e2c1c3aa17d505faa0f997b4bdf9',
amount: '500000000000000',
name: 'TokenManager.LowerReadyToClaim',
claimData: '0x97d9b397189e8b771ffac3cb04cf26c780a93431000000000000000000000000000000000000000000000000000000000000000c6c9a8c64d0681bf2bb474babd345115ee4139ecb0000001ebc43863d59213a094d55a924ac83de17213f2d113514d08e71961d8cca3403f53f54c2742f7284d0a7eaa06c24cc27563313af9a8899df4a8a877694c1499e26000931d97e6f693135e3cf544a2403bb580104b1f1f01ed8c061fc7e2c9f42ccb45f42a7d4b56b30d134f84ce4d312a863cc11483f80313dcc24fd47ddfd7d56b701d54f69d424659927cbc744e43102e2d2b1d224389e4a35ed900a943aabb45d6373f98c9d31a1c4afbb160a3c24a1b4407d75314d48abf811b5cf033e1f0280dc00',
}
]
REQUEST
POST <https://AVN_GATEWAY_URL/query>
HEADERS
Content-Type: application/json Authorization': bearer <awtToken>
REQUEST PARAMS
- accountId [required] - a string representing the sender's Ethereum address.
JSON-RPC Example
curl https://AVN_GATEWAY_URL/query \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"getOutstandingLowersForAccount", "params":{"accountId":"0x1a2b3c...a2b3"}, "id":1}'
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"lowerId": 30,
"token": "0x0d88ed6e74bbfd96b831231638b66c05571e824f",
"from": "0x5e3791f8f33eaf8b2b28aac472bd7782e175413afcad5b939d3773fe8b9c4677",
"to": "0x0aa4a0f15864e2c1c3aa17d505faa0f997b4bdf9",
"amount": "500000000000000",
"name": "TokenManager.LowerReadyToClaim",
"claimData": "0x97d9b397189e8b771ffac3cb04cf26c780a93431000000000000000000000000000000000000000000000000000000000000000c6c9a8c64d0681bf2bb474babd345115ee4139ecb0000001ebc43863d59213a094d55a924ac83de17213f2d113514d08e71961d8cca3403f53f54c2742f7284d0a7eaa06c24cc27563313af9a8899df4a8a877694c1499e26000931d97e6f693135e3cf544a2403bb580104b1f1f01ed8c061fc7e2c9f42ccb45f42a7d4b56b30d134f84ce4d312a863cc11483f80313dcc24fd47ddfd7d56b701d54f69d424659927cbc744e43102e2d2b1d224389e4a35ed900a943aabb45d6373f98c9d31a1c4afbb160a3c24a1b4407d75314d48abf811b5cf033e1f0280dc00"
}
]
}
Using The Sender's Public Key
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "<node_url>";
const options = {
suri: "<account_suri>",
};
const API = new AVN_API(AVN_GATEWAY_URL, options);
// the below public key is just an example
const SENDER_PUBLIC_KEY =
"0x5e3791f8f33eaf8b2b28aac472bd7782e175413afcad5b939d3773fe8b9c4677";
async function main() {
await api.init();
// Replace "acct" with the Aventus address or public key
const result = await api.query.getOutstandingLowersForAccount(
SENDER_PUBLIC_KEY
);
console.log(result);
}
(async () => {
await main();
})();
[
{
lowerId: 30,
token: '0x0d88ed6e74bbfd96b831231638b66c05571e824f',
from: '0x5e3791f8f33eaf8b2b28aac472bd7782e175413afcad5b939d3773fe8b9c4677',
to: '0x0aa4a0f15864e2c1c3aa17d505faa0f997b4bdf9',
amount: '500000000000000',
name: 'TokenManager.LowerReadyToClaim',
claimData: '0x97d9b397189e8b771ffac3cb04cf26c780a93431000000000000000000000000000000000000000000000000000000000000000c6c9a8c64d0681bf2bb474babd345115ee4139ecb0000001ebc43863d59213a094d55a924ac83de17213f2d113514d08e71961d8cca3403f53f54c2742f7284d0a7eaa06c24cc27563313af9a8899df4a8a877694c1499e26000931d97e6f693135e3cf544a2403bb580104b1f1f01ed8c061fc7e2c9f42ccb45f42a7d4b56b30d134f84ce4d312a863cc11483f80313dcc24fd47ddfd7d56b701d54f69d424659927cbc744e43102e2d2b1d224389e4a35ed900a943aabb45d6373f98c9d31a1c4afbb160a3c24a1b4407d75314d48abf811b5cf033e1f0280dc00',
}
]
REQUEST
POST <https://AVN_GATEWAY_URL/query>
HEADERS
Content-Type: application/json Authorization': bearer <awtToken>
REQUEST PARAMS
- accountId [required] - a string representing the public key of the account to check.
JSON-RPC Example
curl https://AVN_GATEWAY_URL/query \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"getOutstandingLowersForAccount", "params":{"accountId":"0x5e3791f8f33eaf8b2b28aac472bd7782e175413afcad5b939d3773fe8b9c4677"}, "id":1}'
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"lowerId": 30,
"token": "0x0d88ed6e74bbfd96b831231638b66c05571e824f",
"from": "0x5e3791f8f33eaf8b2b28aac472bd7782e175413afcad5b939d3773fe8b9c4677",
"to": "0x0aa4a0f15864e2c1c3aa17d505faa0f997b4bdf9",
"amount": "500000000000000",
"name": "TokenManager.LowerReadyToClaim",
"claimData": "0x97d9b397189e8b771ffac3cb04cf26c780a93431000000000000000000000000000000000000000000000000000000000000000c6c9a8c64d0681bf2bb474babd345115ee4139ecb0000001ebc43863d59213a094d55a924ac83de17213f2d113514d08e71961d8cca3403f53f54c2742f7284d0a7eaa06c24cc27563313af9a8899df4a8a877694c1499e26000931d97e6f693135e3cf544a2403bb580104b1f1f01ed8c061fc7e2c9f42ccb45f42a7d4b56b30d134f84ce4d312a863cc11483f80313dcc24fd47ddfd7d56b701d54f69d424659927cbc744e43102e2d2b1d224389e4a35ed900a943aabb45d6373f98c9d31a1c4afbb160a3c24a1b4407d75314d48abf811b5cf033e1f0280dc00"
}
]
}