-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexampleFetchAllGalaTxns.js
40 lines (31 loc) · 1.14 KB
/
exampleFetchAllGalaTxns.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const axios = require('axios');
async function main() {
try {
let bookmark, finalRes, response;
do {
let data = JSON.stringify({
"user": "eth|493DA86081A7Fa84c59eF7590C5e5ceAfe0A3205",
"limit": 100,
"bookmark": bookmark
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api-galaswap.gala.com/galachain/api/asset/token-contract/FetchTokenSwapsOfferedByUser',
headers: {
'X-Wallet-Address': 'eth|493DA86081A7Fa84c59eF7590C5e5ceAfe0A3205',
'Content-Type': 'application/json'
},
data: data,
};
response = (await axios.request(config))
finalRes = { ...finalRes, ...response.data.Data }
bookmark = response.data.Data.nextPageBookMark
} while (response?.data.Data.nextPageBookMark);
console.log(finalRes)
return finalRes;
} catch (error) {
console.error(error)
}
}
main()