aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-09-11 21:48:58 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-09-11 21:48:58 +0300
commit51916b06b3c534d55882f95a60f071329e41d909 (patch)
tree91dab0907f78c174ad5aa5d53f52dc1821a3f51b /src/js
parentdb9dac71b874782b37c47ab0029344affe1b7561 (diff)
downloadarching-kaos-web-ui-51916b06b3c534d55882f95a60f071329e41d909.tar.gz
arching-kaos-web-ui-51916b06b3c534d55882f95a60f071329e41d909.tar.bz2
arching-kaos-web-ui-51916b06b3c534d55882f95a60f071329e41d909.zip
Applying use of archingKaosFetchJSON
Diffstat (limited to 'src/js')
-rw-r--r--src/js/arching-kaos-stellar-network.js40
1 files changed, 16 insertions, 24 deletions
diff --git a/src/js/arching-kaos-stellar-network.js b/src/js/arching-kaos-stellar-network.js
index 99f19e0..9fb45b9 100644
--- a/src/js/arching-kaos-stellar-network.js
+++ b/src/js/arching-kaos-stellar-network.js
@@ -56,6 +56,21 @@ function getHoldersOfActiveAssetURL(){
activeSettings.stellarAssetsForScanning[activeSettings.stellarDefaultAsset].issuer+
'&limit=200';
}
+function renderStellarAddressesAndProceed(json){
+ var stats = document.querySelector('.stellar-network');
+ json._embedded.records.forEach(r=>{
+ var p = document.createElement("div");
+ p.className = "stellar-address";
+ p.innerText = r.account_id;
+ console.log(r);
+ p.id = r.account_id;
+ holders.push(r.account_id);
+ progressPlaceholder.max++;
+ checkAddressForConfigurationVariable(r.account_id);
+ stats.appendChild(p);
+ })
+ if (json._links.next) getHolders(json._links.next.href);
+}
/*
* Get addresses that trust the asset
* Limit is 200 addresses cause horizon API limitations.
@@ -83,30 +98,7 @@ function getHolders(a=0){
}
lastPage=url;
if (doIt) {
- fetch(url, {
- method:'GET',
- headers:{
- Accept: 'application/json'
- }
- }).then(response=>{
- if(response.ok){
- response.json().then(json=>{
- var stats = document.querySelector('.stellar-network');
- json._embedded.records.forEach(r=>{
- var p = document.createElement("div");
- p.className = "stellar-address";
- p.innerText = r.account_id;
- console.log(r);
- p.id = r.account_id;
- holders.push(r.account_id);
- progressPlaceholder.max++;
- checkAddressForConfigurationVariable(r.account_id);
- stats.appendChild(p);
- })
- if (json._links.next) getHolders(json._links.next.href);
- })
- }
- })
+ archingKaosFetchJSON(url, renderStellarAddressesAndProceed);
}
archingKaosLog("Searching holders... Done!");
}