aboutsummaryrefslogtreecommitdiff
path: root/src/js/url-generators.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-09-13 03:58:37 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-09-13 03:58:37 +0300
commit6d32a51649c246c86ff8c77bb123c6fa860f4e96 (patch)
treebc7f182d83d785f4d26ee195ef1e3bdfc4dec15b /src/js/url-generators.js
parent07836b00b52f922a889d0ea57144d505e8e92207 (diff)
downloadarching-kaos-web-ui-6d32a51649c246c86ff8c77bb123c6fa860f4e96.tar.gz
arching-kaos-web-ui-6d32a51649c246c86ff8c77bb123c6fa860f4e96.tar.bz2
arching-kaos-web-ui-6d32a51649c246c86ff8c77bb123c6fa860f4e96.zip
Further refactoring
Diffstat (limited to 'src/js/url-generators.js')
-rw-r--r--src/js/url-generators.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/js/url-generators.js b/src/js/url-generators.js
new file mode 100644
index 0000000..d92592d
--- /dev/null
+++ b/src/js/url-generators.js
@@ -0,0 +1,36 @@
+/*
+ * URL generators
+ *
+ * This file contains functions that generate URL
+ * based on the activeSettings.
+ *
+ * Apparently, we need `arching-kaos-web-ui-settings` to be loaded first
+ *
+ */
+
+function getIPNSURL(ipnsKey){
+ return activeSettings.ipfsGatewayAddress[activeSettings.ipfsSelectedGatewayAddress]+'ipns/'+ipnsKey;
+}
+
+function getIPFSURL(ipfsHash){
+ return activeSettings.ipfsGatewayAddress[activeSettings.ipfsSelectedGatewayAddress]+'ipfs/'+ipfsHash;
+}
+
+function getHoldersOfActiveAssetURL(){
+ return activeSettings.horizonAddresses[activeSettings.horizonSelectedAddress]+
+ 'accounts?asset='+
+ activeSettings.stellarAssetsForScanning[activeSettings.stellarDefaultAsset].code+
+ ':'+
+ activeSettings.stellarAssetsForScanning[activeSettings.stellarDefaultAsset].issuer+
+ '&limit=200';
+}
+
+function getTrustlinesURL(){
+ return activeSettings.horizonAddresses[activeSettings.horizonSelectedAddress]+
+ 'assets?asset_code='+
+ activeSettings.stellarAssetsForScanning[activeSettings.stellarDefaultAsset].code+
+ '&asset_issuer='+
+ activeSettings.stellarAssetsForScanning[activeSettings.stellarDefaultAsset].issuer;
+}
+
+// vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4