diff --git a/README.md b/README.md index 6b78ffe..97242ca 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ This repository is the home of `akashjs`, a library designed to facilitate inter | [@cosmjs/stargate](https://github.com/cosmos/cosmjs/tree/main/packages/stargate) | A client library for the Cosmos SDK 0.40+ (Stargate). | | [@cosmjs/proto-signing](https://github.com/cosmos/cosmjs/tree/main/packages/proto-signing) | A library for signing and broadcasting transactions using the Cosmos SDK. | +### Documentation + +Documentation for the library is available [here](https://akash-network.github.io/akashjs). + ## Compatibility Compatible with modern browsers, nodejs 14+ and Webpack 5 diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e2ac661 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/assets/hierarchy.js b/docs/assets/hierarchy.js new file mode 100644 index 0000000..7f60c3b --- /dev/null +++ b/docs/assets/hierarchy.js @@ -0,0 +1 @@ +window.hierarchyData = "eJyVj70KwjAUhd/lzKmipY1k9wmELtIhJJEGbxO4N04l7y6hi+DU6cD54eNs4JyLwDz1oGcFDi8KrsScBGaD7scmya4BBg9Pk6XobcvvzJmh8I7Jw1yuN4UPEwwcWZEg5//2aSkrQe0NGBTxXZt3u1EV9KB/eAdgx0gKbonkOaR2vB/nWusXRthZcQ==" \ No newline at end of file diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css new file mode 100644 index 0000000..d3d6af4 --- /dev/null +++ b/docs/assets/highlight.css @@ -0,0 +1,127 @@ +:root { + --light-hl-0: #795E26; + --dark-hl-0: #DCDCAA; + --light-hl-1: #000000; + --dark-hl-1: #D4D4D4; + --light-hl-2: #A31515; + --dark-hl-2: #CE9178; + --light-hl-3: #800000; + --dark-hl-3: #808080; + --light-hl-4: #800000; + --dark-hl-4: #569CD6; + --light-hl-5: #000000FF; + --dark-hl-5: #D4D4D4; + --light-hl-6: #E50000; + --dark-hl-6: #9CDCFE; + --light-hl-7: #0000FF; + --dark-hl-7: #CE9178; + --light-hl-8: #AF00DB; + --dark-hl-8: #C586C0; + --light-hl-9: #001080; + --dark-hl-9: #9CDCFE; + --light-hl-10: #0070C1; + --dark-hl-10: #4FC1FF; + --light-hl-11: #0000FF; + --dark-hl-11: #569CD6; + --light-hl-12: #098658; + --dark-hl-12: #B5CEA8; + --light-hl-13: #008000; + --dark-hl-13: #6A9955; + --light-hl-14: #267F99; + --dark-hl-14: #4EC9B0; + --light-code-background: #FFFFFF; + --dark-code-background: #1E1E1E; +} + +@media (prefers-color-scheme: light) { :root { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); + --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --code-background: var(--light-code-background); +} } + +@media (prefers-color-scheme: dark) { :root { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); + --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --code-background: var(--dark-code-background); +} } + +:root[data-theme='light'] { + --hl-0: var(--light-hl-0); + --hl-1: var(--light-hl-1); + --hl-2: var(--light-hl-2); + --hl-3: var(--light-hl-3); + --hl-4: var(--light-hl-4); + --hl-5: var(--light-hl-5); + --hl-6: var(--light-hl-6); + --hl-7: var(--light-hl-7); + --hl-8: var(--light-hl-8); + --hl-9: var(--light-hl-9); + --hl-10: var(--light-hl-10); + --hl-11: var(--light-hl-11); + --hl-12: var(--light-hl-12); + --hl-13: var(--light-hl-13); + --hl-14: var(--light-hl-14); + --code-background: var(--light-code-background); +} + +:root[data-theme='dark'] { + --hl-0: var(--dark-hl-0); + --hl-1: var(--dark-hl-1); + --hl-2: var(--dark-hl-2); + --hl-3: var(--dark-hl-3); + --hl-4: var(--dark-hl-4); + --hl-5: var(--dark-hl-5); + --hl-6: var(--dark-hl-6); + --hl-7: var(--dark-hl-7); + --hl-8: var(--dark-hl-8); + --hl-9: var(--dark-hl-9); + --hl-10: var(--dark-hl-10); + --hl-11: var(--dark-hl-11); + --hl-12: var(--dark-hl-12); + --hl-13: var(--dark-hl-13); + --hl-14: var(--dark-hl-14); + --code-background: var(--dark-code-background); +} + +.hl-0 { color: var(--hl-0); } +.hl-1 { color: var(--hl-1); } +.hl-2 { color: var(--hl-2); } +.hl-3 { color: var(--hl-3); } +.hl-4 { color: var(--hl-4); } +.hl-5 { color: var(--hl-5); } +.hl-6 { color: var(--hl-6); } +.hl-7 { color: var(--hl-7); } +.hl-8 { color: var(--hl-8); } +.hl-9 { color: var(--hl-9); } +.hl-10 { color: var(--hl-10); } +.hl-11 { color: var(--hl-11); } +.hl-12 { color: var(--hl-12); } +.hl-13 { color: var(--hl-13); } +.hl-14 { color: var(--hl-14); } +pre, code { background: var(--code-background); } diff --git a/docs/assets/icons.js b/docs/assets/icons.js new file mode 100644 index 0000000..58882d7 --- /dev/null +++ b/docs/assets/icons.js @@ -0,0 +1,18 @@ +(function() { + addIcons(); + function addIcons() { + if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons); + const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg")); + svg.innerHTML = `MMNEPVFCICPMFPCPTTAAATR`; + svg.style.display = "none"; + if (location.protocol === "file:") updateUseElements(); + } + + function updateUseElements() { + document.querySelectorAll("use").forEach(el => { + if (el.getAttribute("href").includes("#icon-")) { + el.setAttribute("href", el.getAttribute("href").replace(/.*#/, "#")); + } + }); + } +})() \ No newline at end of file diff --git a/docs/assets/icons.svg b/docs/assets/icons.svg new file mode 100644 index 0000000..50ad579 --- /dev/null +++ b/docs/assets/icons.svg @@ -0,0 +1 @@ +MMNEPVFCICPMFPCPTTAAATR \ No newline at end of file diff --git a/docs/assets/main.js b/docs/assets/main.js new file mode 100644 index 0000000..4f59cd9 --- /dev/null +++ b/docs/assets/main.js @@ -0,0 +1,60 @@ +"use strict"; +window.translations={"copy":"Copy","copied":"Copied!","normally_hidden":"This member is normally hidden due to your filter settings.","hierarchy_expand":"Expand","hierarchy_collapse":"Collapse"}; +"use strict";(()=>{var De=Object.create;var le=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var je=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ne(e))!Be.call(t,i)&&i!==n&&le(t,i,{get:()=>e[i],enumerable:!(r=Fe(e,i))||r.enumerable});return t};var $e=(t,e,n)=>(n=t!=null?De(Ve(t)):{},je(e||!t||!t.__esModule?le(n,"default",{value:t,enumerable:!0}):n,t));var pe=qe((de,he)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,c],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[c+1]*i[d+1],c+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var c=s.node.edges["*"];else{var c=new t.TokenSet;s.node.edges["*"]=c}s.str.length==1&&(c.final=!0),i.push({node:c,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),m=s.str.charAt(1),p;m in s.node.edges?p=s.node.edges[m]:(p=new t.TokenSet,s.node.edges[m]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof de=="object"?he.exports=n():e.lunr=n()}(this,function(){return t})})()});window.translations||={copy:"Copy",copied:"Copied!",normally_hidden:"This member is normally hidden due to your filter settings.",hierarchy_expand:"Expand",hierarchy_collapse:"Collapse"};var ce=[];function G(t,e){ce.push({selector:e,constructor:t})}var J=class{alwaysVisibleMember=null;constructor(){this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){ce.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!ze(e)){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r,document.querySelector(".col-sidebar").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(!n)return;let r=n.offsetParent==null,i=n;for(;i!==document.body;)i instanceof HTMLDetailsElement&&(i.open=!0),i=i.parentElement;if(n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let s=document.createElement("p");s.classList.add("warning"),s.textContent=window.translations.normally_hidden,n.prepend(s)}r&&e.scrollIntoView()}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent=window.translations.copied,e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent=window.translations.copy},100)},1e3)})})}};function ze(t){let e=t.getBoundingClientRect(),n=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(e.bottom<0||e.top-n>=0)}var ue=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var ge=$e(pe(),1);async function H(t){let e=Uint8Array.from(atob(t),s=>s.charCodeAt(0)),r=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate")),i=await new Response(r).text();return JSON.parse(i)}async function fe(t,e){if(!window.searchData)return;let n=await H(window.searchData);t.data=n,t.index=ge.Index.load(n.index),e.classList.remove("loading"),e.classList.add("ready")}function ve(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:document.documentElement.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{fe(e,t)}),fe(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");i.addEventListener("mouseup",()=>{re(t)}),r.addEventListener("focus",()=>t.classList.add("has-focus")),We(t,i,r,e)}function We(t,e,n,r){n.addEventListener("input",ue(()=>{Ue(t,e,n,r)},200)),n.addEventListener("keydown",i=>{i.key=="Enter"?Je(e,t):i.key=="ArrowUp"?(me(e,n,-1),i.preventDefault()):i.key==="ArrowDown"&&(me(e,n,1),i.preventDefault())}),document.body.addEventListener("keypress",i=>{i.altKey||i.ctrlKey||i.metaKey||!n.matches(":focus")&&i.key==="/"&&(i.preventDefault(),n.focus())}),document.body.addEventListener("keyup",i=>{t.classList.contains("has-focus")&&(i.key==="Escape"||!e.matches(":focus-within")&&!n.matches(":focus"))&&(n.blur(),re(t))})}function re(t){t.classList.remove("has-focus")}function Ue(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ye(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` + ${ye(l.parent,i)}.${d}`);let m=document.createElement("li");m.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=c+d,m.append(p),p.addEventListener("focus",()=>{e.querySelector(".current")?.classList.remove("current"),m.classList.add("current")}),e.appendChild(m)}}function me(t,e,n){let r=t.querySelector(".current");if(!r)r=t.querySelector(n==1?"li:first-child":"li:last-child"),r&&r.classList.add("current");else{let i=r;if(n===1)do i=i.nextElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);else do i=i.previousElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);i?(r.classList.remove("current"),i.classList.add("current")):n===-1&&(r.classList.remove("current"),e.focus())}}function Je(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),re(e)}}function ye(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ne(t.substring(s,o)),`${ne(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(ne(t.substring(s))),i.join("")}var Ge={"&":"&","<":"<",">":">","'":"'",'"':"""};function ne(t){return t.replace(/[&<>"'"]/g,e=>Ge[e])}var I=class{el;app;constructor(e){this.el=e.el,this.app=e.app}};var A="mousedown",Ee="mousemove",B="mouseup",X={x:0,y:0},xe=!1,ie=!1,Xe=!1,D=!1,Le=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(Le?"is-mobile":"not-mobile");Le&&"ontouchstart"in document.documentElement&&(Xe=!0,A="touchstart",Ee="touchmove",B="touchend");document.addEventListener(A,t=>{ie=!0,D=!1;let e=A=="touchstart"?t.targetTouches[0]:t;X.y=e.pageY||0,X.x=e.pageX||0});document.addEventListener(Ee,t=>{if(ie&&!D){let e=A=="touchstart"?t.targetTouches[0]:t,n=X.x-(e.pageX||0),r=X.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ie=!1});document.addEventListener("click",t=>{xe&&(t.preventDefault(),t.stopImmediatePropagation(),xe=!1)});var Y=class extends I{active;className;constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(A,n=>this.onDocumentPointerDown(n)),document.addEventListener(B,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var se;try{se=localStorage}catch{se={getItem(){return null},setItem(){}}}var C=se;var be=document.head.appendChild(document.createElement("style"));be.dataset.for="filters";var Z=class extends I{key;value;constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),be.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=C.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){C.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var oe=new Map,ae=class{open;accordions=[];key;constructor(e,n){this.key=e,this.open=n}add(e){this.accordions.push(e),e.open=this.open,e.addEventListener("toggle",()=>{this.toggle(e.open)})}toggle(e){for(let n of this.accordions)n.open=e;C.setItem(this.key,e.toString())}},K=class extends I{constructor(e){super(e);let n=this.el.querySelector("summary"),r=n.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)});let i=`tsd-accordion-${n.dataset.key??n.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`,s;if(oe.has(i))s=oe.get(i);else{let o=C.getItem(i),a=o?o==="true":this.el.open;s=new ae(i,a),oe.set(i,s)}s.add(this.el)}};function Se(t){let e=C.getItem("tsd-theme")||"os";t.value=e,we(e),t.addEventListener("change",()=>{C.setItem("tsd-theme",t.value),we(t.value)})}function we(t){document.documentElement.dataset.theme=t}var ee;function Ce(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",Te),Te())}async function Te(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let e=await H(window.navigationData);ee=document.documentElement.dataset.base,ee.endsWith("/")||(ee+="/"),t.innerHTML="";for(let n of e)Ie(n,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function Ie(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-accordion`:"tsd-accordion";let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.dataset.key=i.join("$"),o.innerHTML='',ke(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let c of t.children)Ie(c,l,i)}else ke(t,r,t.class)}function ke(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=ee+t.path,n&&(r.className=n),location.pathname===r.pathname&&!r.href.includes("#")&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else{let r=e.appendChild(document.createElement("span"));r.innerHTML='',r.appendChild(document.createElement("span")).textContent=t.text}}var te=document.documentElement.dataset.base;te.endsWith("/")||(te+="/");function Pe(){document.querySelector(".tsd-full-hierarchy")?Ye():document.querySelector(".tsd-hierarchy")&&Ze()}function Ye(){document.addEventListener("click",r=>{let i=r.target;for(;i.parentElement&&i.parentElement.tagName!="LI";)i=i.parentElement;i.dataset.dropdown&&(i.dataset.dropdown=String(i.dataset.dropdown!=="true"))});let t=new Map,e=new Set;for(let r of document.querySelectorAll(".tsd-full-hierarchy [data-refl]")){let i=r.querySelector("ul");t.has(r.dataset.refl)?e.add(r.dataset.refl):i&&t.set(r.dataset.refl,i)}for(let r of e)n(r);function n(r){let i=t.get(r).cloneNode(!0);i.querySelectorAll("[id]").forEach(s=>{s.removeAttribute("id")}),i.querySelectorAll("[data-dropdown]").forEach(s=>{s.dataset.dropdown="false"});for(let s of document.querySelectorAll(`[data-refl="${r}"]`)){let o=tt(),a=s.querySelector("ul");s.insertBefore(o,a),o.dataset.dropdown=String(!!a),a||s.appendChild(i.cloneNode(!0))}}}function Ze(){let t=document.getElementById("tsd-hierarchy-script");t&&(t.addEventListener("load",Qe),Qe())}async function Qe(){let t=document.querySelector(".tsd-panel.tsd-hierarchy:has(h4 a)");if(!t||!window.hierarchyData)return;let e=+t.dataset.refl,n=await H(window.hierarchyData),r=t.querySelector("ul"),i=document.createElement("ul");if(i.classList.add("tsd-hierarchy"),Ke(i,n,e),r.querySelectorAll("li").length==i.querySelectorAll("li").length)return;let s=document.createElement("span");s.classList.add("tsd-hierarchy-toggle"),s.textContent=window.translations.hierarchy_expand,t.querySelector("h4 a")?.insertAdjacentElement("afterend",s),s.insertAdjacentText("beforebegin",", "),s.addEventListener("click",()=>{s.textContent===window.translations.hierarchy_expand?(r.insertAdjacentElement("afterend",i),r.remove(),s.textContent=window.translations.hierarchy_collapse):(i.insertAdjacentElement("afterend",r),i.remove(),s.textContent=window.translations.hierarchy_expand)})}function Ke(t,e,n){let r=e.roots.filter(i=>et(e,i,n));for(let i of r)t.appendChild(Oe(e,i,n))}function Oe(t,e,n,r=new Set){if(r.has(e))return;r.add(e);let i=t.reflections[e],s=document.createElement("li");if(s.classList.add("tsd-hierarchy-item"),e===n){let o=s.appendChild(document.createElement("span"));o.textContent=i.name,o.classList.add("tsd-hierarchy-target")}else{for(let a of i.uniqueNameParents||[]){let l=t.reflections[a],c=s.appendChild(document.createElement("a"));c.textContent=l.name,c.href=te+l.url,c.className=l.class+" tsd-signature-type",s.append(document.createTextNode("."))}let o=s.appendChild(document.createElement("a"));o.textContent=t.reflections[e].name,o.href=te+i.url,o.className=i.class+" tsd-signature-type"}if(i.children){let o=s.appendChild(document.createElement("ul"));o.classList.add("tsd-hierarchy");for(let a of i.children){let l=Oe(t,a,n,r);l&&o.appendChild(l)}}return r.delete(e),s}function et(t,e,n){if(e===n)return!0;let r=new Set,i=[t.reflections[e]];for(;i.length;){let s=i.pop();if(!r.has(s)){r.add(s);for(let o of s.children||[]){if(o===n)return!0;i.push(t.reflections[o])}}}return!1}function tt(){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width","20"),t.setAttribute("height","20"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.innerHTML='',t}G(Y,"a[data-toggle]");G(K,".tsd-accordion");G(Z,".tsd-filter-item input[type=checkbox]");var _e=document.getElementById("tsd-theme");_e&&Se(_e);var nt=new J;Object.defineProperty(window,"app",{value:nt});ve();Ce();Pe();})(); +/*! Bundled license information: + +lunr/lunr.js: + (** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + *) + (*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + *) + (*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + *) +*/ diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js new file mode 100644 index 0000000..8353dc0 --- /dev/null +++ b/docs/assets/navigation.js @@ -0,0 +1 @@ +window.navigationData = "eJyVlltvm0AQhf/LPltt4yZp6jcLSGrVwRRw0iqKrA1M8MrLpbvjpFbV/145YHPZ9ULeLPacb4azo8EPfwnCHyQTEoFA9swiikBGpKC4JhOS5vGWg/zYOPywxpSTEdmwLCaT8xGJ1ozHAjIyeTjCCkhlTWEZgnimUQe0F7Vp44vLf6MjxKq1HqQ2FAL2v+MajLuiwzzl6dT59PXL2cV4RCJOpSQTEtfwRgNPIqdxRCVaumyet1mELM/aDeg87eKX540SkQCK8A6+YjDAf29B7BpS2QdXDAa4gJd8857OFYMCf2zgN1BwoQ7i2+NBI5gA6joqAQmg4dUSQGtNWabN6wgoJWZMwJIMhBFTSoxZZICvudioaVQHg/JwXNtbzNxwFf7ynBoF2TatQS1RG3vVaMh1wvuF/92IampOk2ZuKb8FpDFFql0aB2RXbFoeCaCTxUXOMvwGlOM6QIpb7Y0e8Ccs5hs+OIaSh+KCXLRWnRlaqs1oNWItUx9uZyILkWMecQYZqlPZOBw0meVKm6Ysy29BSppoV0mTqjp6V2yAVNxQhHdV6JiMkYgiUqMQRTR0Wd3KxOoEWre25zQ15pv+8bbG+2ANlRnnN99MwfjdV+zkImOu5iJjPiiXwJ7X5rePdWUO7HkbcDZurpUbb7kKlp638EPHXs3c0PGvp5YT1LAXKhh9OvRySt+u8Xl8ssSd49oLfyC/EivwVmxIRaL9L3Y4GRSgMu7lkj4ytJN91b7/6YbKdbgrwIeESRQ73TQciTqDeb72yqXgfdRKZhy2V8o5aFZS+XxQYrZzPV3Ow9XUshZLN1x50yC4X/i27mor7CmLYXqOFtv2nSBYeb5zPfs5pEbLYKhQ7cgoyrf6NVCBWzrzRfXDapGZNKcS5zmN9V+4GlbrDDyWFrkY0FxLZxyjIOZ3lLOY7v2OELlQt5CqMS2kXlwv6/E/Um+00w==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js new file mode 100644 index 0000000..79d1475 --- /dev/null +++ b/docs/assets/search.js @@ -0,0 +1 @@ +window.searchData = "eJytndty2zgSQP+FeVVlCIJXv2VijSc7ieO1nMxuuVIuWoJlbiSRQ1KecaXy71vgtQE0pSalt8RGXwAcNIhuGvxh5enfhXVx/8P6nuxW1oU7s3bxVlgX1lLkZfKULONSWDNrn2+sC2ubrvYbUfwCfvf2udxurJm13MRFIQrrwrJ+zlptfq/uMU/j1TIuyveI3qf9blkm6U7VjIkg5mZWFudiV2o+o14scxGXgu6C0f5E+7l4Sb+PsG+0P9H+X3uRvwJ1xRH7Rvsp9h3P7xzIxLa3mexKkT/FS40o2WaKHWY7YKaLnGznTd34qK1KYshgtn/cJMs/xCvdbC3yvRI50XievMSlGGe9lplo3rGjgHlO5wGA5EZsL0WWC/nvVedP+ZpprgyJTJn7fiiKMs7XWNBqf0GNWGtRvvseF893r5m4FeukKPNXZLl0arH2h7vSuTpkX6r6km+OWG1ajbYVdqY+iaKI1/2Qid1+C2w0vx5tgPXr/lOxfj8Yew+Ye7Mt1nUQVvejwz60KgZ9uR2Mw0d8qQPyWX2px+VSZJv0dStlRw3LCsqd6skmLaY4IsXO6celyNIiKcd7sqoFz+nLl2w1aXb2ldzZZ+cqT/fZqIlZNxInWr+J9yOtZ1LiTNYXZZyXo6zLX5Rnsl6v0I8iLkbGrE0jMtp+vwt8F9kmN/ay6qcjNrL3z3Gywx72akVdi8MhvvZlyMYiWe9EfshG3eIUG4e0j9Pbq/073myA5naI6x9Tx7ie73fLZbrfYV422pRmhx1u3EKtJdsszcuj1pRm063JB5tjpvo2J9n5GBflxzRegedGzFTfbKQ13j+wXs5/e/fl493Du8vL2/li8XBzO//tw386sy9xnsSPAAS8/Rnsv3//+cv13cPNu8Xiz8+3lwQPNImRPvQDvhPl32n+3UC/+fmI+PJJlPEqLmNk1lploNVhh1uvhmzNd6ssTXYlFs6Asa7Zmawt0rxEscRs1o3PY/l3EW/K50UZl3til6HEWB/6Q8H1/O7Pz7d/PNz992aubXutTdhkrCG4xb77cH09v6MaebONk91ODD9SYZK45bv54m6M5VIU5Xkszy+v5mMsi9VanGC5n9b59eXN5w/Xd4fmVWlzwsTe3rwnW3iTZ8ujvVOdx23OF0OjihkVxfExHbIKE1sfruvGRiQEeZhWn9529AgriS754PZQ/WesyTeK7OExMPo34E6hximyK53cedxo2j/IrNN4ZzTp87iU5aIsXyfOlCp8Hofq2U9WU7mpJM/jyqNYPnPnIcvFU/LPeH908fM4tYrFNp26tFThM0GdrsTDczrFHSh6HmfkdlQkE1Z6L3gmjNOVeIRHczrGveSZlrgQ+YQRacXO40ScTZmVRmqyC6DGVe3j6okiz5YjThO3QEP/oCt11L88vF9K+0Oa/13VszaJQM+yjQXQaLqlKmF32E7XZIwVuJ+kZbpUbbTjDX43MoOxTXapXg7oPYd6TYHD/YD+HvBApvqu4lKMcUKTmeIHeIJZbYzxLFZYeQU911/dfHlYfLm5+Xx7N798+Dq/vvx8u0AO9VIl2vZImWW1odj9cH03v/3t3fs5zXTffIx15vTHisXlx85SI1vZWVx+HKPSsd1e51OebhdlnuzWB1W/ke2Ktt2gFdl+yNJLvElWsAyE2gGtTrJydfOFZmid7U+1tSjTHC6jg/aKrjHVpsccsBHvijLfL8s0P2xObUg1pT2bgSMWaqRpMUn7i8iLJN0dGbSu0aQJKkT+kizBGxioEdBqkpW+AHXEkNpwkq0sT5+SzbEegVbTrGzipSB0SGl3ygxdx1viLO2alqfO1K+vN63z5El7fM2AzCQPclGk+3wpvuySI3bblvu65UnWvsab/ZHw1DZ9aZqeMpu3ja73VWg9Pqet7eX0UKxZ/iS2KXiThGJ824qcwz5pR9AcGL8xHPLgXVnmyeO+JC6r1okYip1xJCa604zJ2b26GknmKQ8JzkK1bdZW8K3P0XwQQG6aJ3yiJ/zcnmizUfwqytgZB8ZjI3I2+3y8fT55f43zQjSTcSOPSke2Wdm8cSBrmk+yu413yZMoyvk/Wdo5cNh2KyIqkaITOYP9q036GG/GmF+3Emew/ntaHANfNf7cCEyMAr+XZfY5q07Xxxb+c1lmadd04lqn2+PnsOd8UkeX3lttlM/R96m+8PP7oo3LuME41wiM6/bpfW1DW5zHW/L8twGuFTqx52N84Of1QR+HkSNwtr6P7PXp/aV29PQeUrt26l5B2yCmWlmm22xfds9hC/HXXuyW4nq/fYRFjoEETyXbPYs1srtO9uTz6dHjGzyinnB2gzYpBzdo9rRTG7RMOrJB0yee18o83hVPab69yvbU01Ens872p5+JYO+PHohgz084DVVvC98Cw0d6XLVXRn2q5XpvWzyn+83qV/Fht85FccR488xbiTyKpBOZ3nNKb0/Y+64INl74iVYckhXnNCuiWMaZ+L0uahyaoqrdseLHIUvyNcJ/LT5fHzn+pXn5v2J6JrrdKeqXFo/b67bmqv05LH+l5Nvbxifm3dXejunpmGoCrIytNl/r+kqS7uZ5jlRHzCYHq41Kf+Tvc/NZYEDlm6453hXE2fHFniHblLrPQQfgsB4b03MP6JTRPH0oJ4+jYfrbzEp2K/GPdfGjq29dWM5b/jayZtZTIjYr+YfgVvvGUrptagmrdLmv/vmtafZVSMuycd36F9ua3dsz13trB863b7P7Vrj6RfWDVkf/k0qQWbN7hgkyQ5Apgo41u3cwQccQdBRBbs3uOSbIDUGuCLrW7N7FBF1D0FUEPWt272GCniHoKYK+Nbv3MUHfEPQVwcCa3QeYYGAIBopgaM3uQ0wwNARDRTCyZvcRJhgZgpEKgOSBoewwEx6m0VPhg/ODAKQSxCQXDGWImRAxlSIm2WAoR8wEiakkMckHQ1liJkxMpYlJRhjKEzOBYipRTHLCUKaYCRVTqWKSFYZyxUywmEoWk7wwlC1mwsVUuphkhqF8MRMwphLmSGYclDDHJMxRCXMkMw5KmGMS5mgxqgpSeJRCwpRKmCOZcVDCHJMwRyXMkcw4KGGOSZijEuZIZhyUMMckzFEJcyQzDkqYYxLmqIQ5khkHJcwxCXNUwhzJjIMS5piEOSphjmTGQQlzTMIclTAumeEoYdwkjKuEcckMRwnjJmFcJYxLZjhKGDcJ49pOWG2F+F6IbIYqYVwyw1HCuEkYVwnjkhmOEsZNwrhKGJfMcJQwbhLGVcK4ZIajhHGTMK4SxiUzHCWMm4RxlTAumeEoYdwkjKuEuZIZ157x6G3ku+rTh0mYqxLmSmZclDDXJMxVCXMlMy5KmGsS5qqEuZIZFyXMNQlzteet6oELf+JCHrlUwlzJjOuhA2YS5qqEuZIZFyXMNQlzVcJcyYyLEuaahLkqYa5kxkUJc03CXJUwVzLjooS5JmGuSpg3TJhnEuaphHmSGQ8NgJ5JmKcS5klmPBRPzyTMUwnzJDMeiqdnEuaphHmSGQ/F0zMJ87Sn+uqxHsXTQx7sVcI8yYyHHwpMwjyVME8y46F4eiZhnkqYJ5nxUDw9kzBPJcyTzHgonp5JmKcS5tuDS9I3CfNVwvyKMJRt3yTMVwnzJTM+iqdvEuarhPmSGR/F0zcJ81XCfMmMj+Lpm4T5KmG+ZMZH8fRNwnzt7FgdHlE8feT4qBLmS2Z8fKpMwnyVMF8y4+PnVpMwXyXMl8z4KJ6+SZivEhbYg24HJmGBSlggmfFRtgOTsEAlLKgIQ/EMTMIClbBAMhOgeAYmYYFKWCCZCVA8A5OwQCUskMwEzoz7b70oUoVNwgKVsEAyE6B4BiZhgZahqFIUKJ4BkqRQCQskMwEaPQOTsEAlLJDMBCiegUlYoBIWSmYCFM/QJCxUCQslMwGeXjEJC1XCQslMgBIWmoSFKmGhZCZECQtNwkKVsFAyE6KEhSZhoUpYKJkJ0QAYmoSFKmGhZCZECQtNwkKVsFAyE6KEhSZhoZYHqxJhKGEhkgpTCQslMyFKWGgSFqqERZKZECUsMgmLVMIiyUyIEhaZhEUqYZFkJsSTeCZhkUpYJJmJUMIik7BIJSySzEQoYZFJWKQSFklmIpSwyCQsUgmLJDMRSlhkEhaphEWSmQglLDIJi1TCIslMhBIWmYRFWra1SreihEVIwlXPuEpoIjyPZ2M5Vy3paktuIjyVZyNpV1vLu9oSnQjP5tlI5tXWUq92lXu1B3LGSPbV1tKvdpV/tfG8sY1kYG0tBWtXOVgbzx3bSBbW1tKwdpWHtfH8sY1kYm0tFWtXuVgbzyHbSDbW1tKxdpWPtfE8so1kZG0tJWtXOVkbzyXbSFbW1jBsMv84h1ju30j+V9l/GwcRzf9rINYVABsnEasB6EWAugowUL3A6gB6IaCuBAxVMBAS9WJAXQ0YqGJg9QC9IFBXBAYqGVhNQC8K1FWBgWoGVhfQCwN1ZWCgooHVBvTiQF0dGKhqYPUBrUDAqpw/G6hsIDUCphUJmFPXoXASkToB0woFrMr9s4EKB1IrYFqxgFX5f4ZXORhSL2BawYBVNQCGVzoYUjNgWtGAVXUAhlc7GFI3YFrhgFW1AIZXPBhSO2Ba8YBV9QCGVz0YUj9gWgGBVTUBhlc+GFJDYFoRgVV1AYZXPxhSR2BaIYFVtQHmBNgRliG1BKYVE1hVH8BPdAwpJzCtnsB4XRTFSUZKCkyrKTDOD/UAK41qIFalgqEeIBw2P6tebngR8i2dD/VLDvf3zUUYP6yH5r0Hr3vH44flRdbFj58/+/ccLn78BK86yN9JQ+37Hb0S2blOi5yASlD2g6JPu6gG+OYA34i62uvxlduIgafAT5LCAT12r8ceqycT2xW4CrxXGvVKaTPRXzkEBg100XNGqKmEgCIXkOGGNEXd3THAHx/4ExDVHH5TGkwnAxMhHyVo6sGbQr2uANAWeC3CrP2HS9NdXb0RtzeD9todMLkOcXZrXfIukW1770ev0Oe9Qt8boXCAaNB7IjWVtva+XsxDF3jo03QWypQAdGjyygVTgEEwVh5tIuubEgAdQEVAdEY8xftN+dDQ8JDFRfF3miurlYMxIiLWqV2t5OvNSNzkwFdiDFZuOgC9BjMQ0Kgd+vP7XmkI1mxIc6+76BGEJ9BJl6ilCSjNFXZAF5gFlzYL8D1muBHCDcYhqsLfWodRDm6vDm3Dgfe/gBUFgnpA2wG7q8nAevLAeqIthrU6e/CBwaHtCmtRInGVgwHn1A6VsfwmhaQg775hAYcb7ilUlcvmNnHQRzBKDi1Cr0XZQvpc3Vfb3gAJOgw2Ek5bkkCrqgpMAidPQqeqfQEcKAR0cdojw1qUm7goN8391kAX2JA4bUdai3Lb3TQKNIEgxsm0Vp8KSLTQ5QM0fFrQWYuy+mAQogzEQZ/cw+omObAUAQ4+GdaiuZYewAoGySEPklxC8t1sJQTCWEVTlO0fin2WVTw99LfzKYMFWPWJ2CtqX8RulapPjz58viDiivx5E4wcPgwdRDebv7uBakI4hrRZre+1xyIkwIzT9o6kudsQW00umAiXFjSazzUA2MB+S9wku+utgSdgMbq0Qer//hOMth3BSaMhi19zAI5yIPZHNLTQywuARoBWRCNr4CoIoBPMQ0SbS/2vf+DC9yC14zoN/2wKquRQJS0sGX8SBfW5UB+xx+bJhkG3aNsA9kkgoBA+4BHdUj9lAxYXWO/EZ0X8e1LAPThsxPWKfYsJaISBkjiv2gdkQI/BdDjk6UC+iwT8gxGYiLL6dR/gHohTxGCOf1QLuAeXGu3RUvv8D3APnvyJ0Q/7lBPwDgZUWqjqvroB9i3QR07ro3pFOdgpwJJwm+ykR1sa4I5o8NAF1oNHcw25EgjEYQBwRFsNzfXIwCcQQjwasfV3J4EKoIGmAFwnCJIGYO2ENN6Vm9yBQ2DePKqm/gOOIOUAPCKqaS9kBP0CIxzS6FGuIwYPnmDJ+bR4Cj6LCTwCh3mSlvokonzqFKwSsEhI2tQbD8Fog4AXjldV3UwBn4aV8/h4fWtdHwyexOCOXWEBVcJDDzEgo1dTQJ3wIYO4R2qXQoIpAQ6GZP/Ux22wZbtUdw7sYTBJSdOmnnxdMI1uk6/3acuyus0aLEegyQ9qmYCs6aX7o2JR/801fN6EjznEtL96bypY7GBXDWn79IG7IgEawMdwlIvKNaBAIZjZkAYKdnsjUAjCd0TbBgbuCgU6QbQLacFz4EZDsI2DQBXR4tTALYVAJ1i4EW3hDl1TCjoPgA9pAfD4PZ9APdiXIuI66q50BsADLwOil92tH3ARKhkp4hh2H0yGiQKgh9gtI33rglXs0lZb930toAV0yaXFgqGriOCOA495xGNof28MHHE4UsQTmXaLIlgB8Gxs08Yd3lwGJxCqIk6hecUfVAgfTWzakj94gSLoNjxE2bQ5Rm6mg87C5x6btqAGb/uDeuGDik0L+IcuywWBBL4RQRwCjuVT4VgSz7jaLZtgYmBqwKZtR/B+OzhyUBWx1GRe/ggVwlBn00LdwUs0oW4l/BEXtXllIdQIn45sWjAcvPoR6oVxzCbGsQN3JoO5B2MQEYeg+z4GeOAEPAZEHOHXL8AeCRwKxjmEPBcEIJwFxGh26OkX4k2s4SFZ2wBMZ0CbzfbzxSDLBXyh5Ka/zawsycQm2Qnr4v7bz5//B9ZOsmI="; \ No newline at end of file diff --git a/docs/assets/style.css b/docs/assets/style.css new file mode 100644 index 0000000..7f80f3d --- /dev/null +++ b/docs/assets/style.css @@ -0,0 +1,1610 @@ +@layer typedoc { + :root { + /* Light */ + --light-color-background: #f2f4f8; + --light-color-background-secondary: #eff0f1; + --light-color-warning-text: #222; + --light-color-background-warning: #e6e600; + --light-color-accent: #c5c7c9; + --light-color-active-menu-item: var(--light-color-accent); + --light-color-text: #222; + --light-color-text-aside: #6e6e6e; + + --light-color-icon-background: var(--light-color-background); + --light-color-icon-text: var(--light-color-text); + + --light-color-comment-tag-text: var(--light-color-text); + --light-color-comment-tag: var(--light-color-background); + + --light-color-link: #1f70c2; + --light-color-focus-outline: #3584e4; + + --light-color-ts-keyword: #056bd6; + --light-color-ts-project: #b111c9; + --light-color-ts-module: var(--light-color-ts-project); + --light-color-ts-namespace: var(--light-color-ts-project); + --light-color-ts-enum: #7e6f15; + --light-color-ts-enum-member: var(--light-color-ts-enum); + --light-color-ts-variable: #4760ec; + --light-color-ts-function: #572be7; + --light-color-ts-class: #1f70c2; + --light-color-ts-interface: #108024; + --light-color-ts-constructor: var(--light-color-ts-class); + --light-color-ts-property: #9f5f30; + --light-color-ts-method: #be3989; + --light-color-ts-reference: #ff4d82; + --light-color-ts-call-signature: var(--light-color-ts-method); + --light-color-ts-index-signature: var(--light-color-ts-property); + --light-color-ts-constructor-signature: var( + --light-color-ts-constructor + ); + --light-color-ts-parameter: var(--light-color-ts-variable); + /* type literal not included as links will never be generated to it */ + --light-color-ts-type-parameter: #a55c0e; + --light-color-ts-accessor: #c73c3c; + --light-color-ts-get-signature: var(--light-color-ts-accessor); + --light-color-ts-set-signature: var(--light-color-ts-accessor); + --light-color-ts-type-alias: #d51270; + /* reference not included as links will be colored with the kind that it points to */ + --light-color-document: #000000; + + --light-color-alert-note: #0969d9; + --light-color-alert-tip: #1a7f37; + --light-color-alert-important: #8250df; + --light-color-alert-warning: #9a6700; + --light-color-alert-caution: #cf222e; + + --light-external-icon: url("data:image/svg+xml;utf8,"); + --light-color-scheme: light; + + /* Dark */ + --dark-color-background: #2b2e33; + --dark-color-background-secondary: #1e2024; + --dark-color-background-warning: #bebe00; + --dark-color-warning-text: #222; + --dark-color-accent: #9096a2; + --dark-color-active-menu-item: #5d5d6a; + --dark-color-text: #f5f5f5; + --dark-color-text-aside: #dddddd; + + --dark-color-icon-background: var(--dark-color-background-secondary); + --dark-color-icon-text: var(--dark-color-text); + + --dark-color-comment-tag-text: var(--dark-color-text); + --dark-color-comment-tag: var(--dark-color-background); + + --dark-color-link: #00aff4; + --dark-color-focus-outline: #4c97f2; + + --dark-color-ts-keyword: #3399ff; + --dark-color-ts-project: #e358ff; + --dark-color-ts-module: var(--dark-color-ts-project); + --dark-color-ts-namespace: var(--dark-color-ts-project); + --dark-color-ts-enum: #f4d93e; + --dark-color-ts-enum-member: var(--dark-color-ts-enum); + --dark-color-ts-variable: #798dff; + --dark-color-ts-function: #a280ff; + --dark-color-ts-class: #8ac4ff; + --dark-color-ts-interface: #6cff87; + --dark-color-ts-constructor: var(--dark-color-ts-class); + --dark-color-ts-property: #ff984d; + --dark-color-ts-method: #ff4db8; + --dark-color-ts-reference: #ff4d82; + --dark-color-ts-call-signature: var(--dark-color-ts-method); + --dark-color-ts-index-signature: var(--dark-color-ts-property); + --dark-color-ts-constructor-signature: var(--dark-color-ts-constructor); + --dark-color-ts-parameter: var(--dark-color-ts-variable); + /* type literal not included as links will never be generated to it */ + --dark-color-ts-type-parameter: #e07d13; + --dark-color-ts-accessor: #ff6060; + --dark-color-ts-get-signature: var(--dark-color-ts-accessor); + --dark-color-ts-set-signature: var(--dark-color-ts-accessor); + --dark-color-ts-type-alias: #ff6492; + /* reference not included as links will be colored with the kind that it points to */ + --dark-color-document: #ffffff; + + --dark-color-alert-note: #0969d9; + --dark-color-alert-tip: #1a7f37; + --dark-color-alert-important: #8250df; + --dark-color-alert-warning: #9a6700; + --dark-color-alert-caution: #cf222e; + + --dark-external-icon: url("data:image/svg+xml;utf8,"); + --dark-color-scheme: dark; + } + + @media (prefers-color-scheme: light) { + :root { + --color-background: var(--light-color-background); + --color-background-secondary: var( + --light-color-background-secondary + ); + --color-background-warning: var(--light-color-background-warning); + --color-warning-text: var(--light-color-warning-text); + --color-accent: var(--light-color-accent); + --color-active-menu-item: var(--light-color-active-menu-item); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + + --color-icon-background: var(--light-color-icon-background); + --color-icon-text: var(--light-color-icon-text); + + --color-comment-tag-text: var(--light-color-text); + --color-comment-tag: var(--light-color-background); + + --color-link: var(--light-color-link); + --color-focus-outline: var(--light-color-focus-outline); + + --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-project: var(--light-color-ts-project); + --color-ts-module: var(--light-color-ts-module); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-enum-member: var(--light-color-ts-enum-member); + --color-ts-variable: var(--light-color-ts-variable); + --color-ts-function: var(--light-color-ts-function); + --color-ts-class: var(--light-color-ts-class); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-constructor: var(--light-color-ts-constructor); + --color-ts-property: var(--light-color-ts-property); + --color-ts-method: var(--light-color-ts-method); + --color-ts-reference: var(--light-color-ts-reference); + --color-ts-call-signature: var(--light-color-ts-call-signature); + --color-ts-index-signature: var(--light-color-ts-index-signature); + --color-ts-constructor-signature: var( + --light-color-ts-constructor-signature + ); + --color-ts-parameter: var(--light-color-ts-parameter); + --color-ts-type-parameter: var(--light-color-ts-type-parameter); + --color-ts-accessor: var(--light-color-ts-accessor); + --color-ts-get-signature: var(--light-color-ts-get-signature); + --color-ts-set-signature: var(--light-color-ts-set-signature); + --color-ts-type-alias: var(--light-color-ts-type-alias); + --color-document: var(--light-color-document); + + --color-alert-note: var(--light-color-alert-note); + --color-alert-tip: var(--light-color-alert-tip); + --color-alert-important: var(--light-color-alert-important); + --color-alert-warning: var(--light-color-alert-warning); + --color-alert-caution: var(--light-color-alert-caution); + + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); + } + } + + @media (prefers-color-scheme: dark) { + :root { + --color-background: var(--dark-color-background); + --color-background-secondary: var( + --dark-color-background-secondary + ); + --color-background-warning: var(--dark-color-background-warning); + --color-warning-text: var(--dark-color-warning-text); + --color-accent: var(--dark-color-accent); + --color-active-menu-item: var(--dark-color-active-menu-item); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + + --color-icon-background: var(--dark-color-icon-background); + --color-icon-text: var(--dark-color-icon-text); + + --color-comment-tag-text: var(--dark-color-text); + --color-comment-tag: var(--dark-color-background); + + --color-link: var(--dark-color-link); + --color-focus-outline: var(--dark-color-focus-outline); + + --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-project: var(--dark-color-ts-project); + --color-ts-module: var(--dark-color-ts-module); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-enum-member: var(--dark-color-ts-enum-member); + --color-ts-variable: var(--dark-color-ts-variable); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-constructor: var(--dark-color-ts-constructor); + --color-ts-property: var(--dark-color-ts-property); + --color-ts-method: var(--dark-color-ts-method); + --color-ts-reference: var(--dark-color-ts-reference); + --color-ts-call-signature: var(--dark-color-ts-call-signature); + --color-ts-index-signature: var(--dark-color-ts-index-signature); + --color-ts-constructor-signature: var( + --dark-color-ts-constructor-signature + ); + --color-ts-parameter: var(--dark-color-ts-parameter); + --color-ts-type-parameter: var(--dark-color-ts-type-parameter); + --color-ts-accessor: var(--dark-color-ts-accessor); + --color-ts-get-signature: var(--dark-color-ts-get-signature); + --color-ts-set-signature: var(--dark-color-ts-set-signature); + --color-ts-type-alias: var(--dark-color-ts-type-alias); + --color-document: var(--dark-color-document); + + --color-alert-note: var(--dark-color-alert-note); + --color-alert-tip: var(--dark-color-alert-tip); + --color-alert-important: var(--dark-color-alert-important); + --color-alert-warning: var(--dark-color-alert-warning); + --color-alert-caution: var(--dark-color-alert-caution); + + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); + } + } + + html { + color-scheme: var(--color-scheme); + } + + body { + margin: 0; + } + + :root[data-theme="light"] { + --color-background: var(--light-color-background); + --color-background-secondary: var(--light-color-background-secondary); + --color-background-warning: var(--light-color-background-warning); + --color-warning-text: var(--light-color-warning-text); + --color-icon-background: var(--light-color-icon-background); + --color-accent: var(--light-color-accent); + --color-active-menu-item: var(--light-color-active-menu-item); + --color-text: var(--light-color-text); + --color-text-aside: var(--light-color-text-aside); + --color-icon-text: var(--light-color-icon-text); + + --color-comment-tag-text: var(--light-color-text); + --color-comment-tag: var(--light-color-background); + + --color-link: var(--light-color-link); + --color-focus-outline: var(--light-color-focus-outline); + + --color-ts-keyword: var(--light-color-ts-keyword); + --color-ts-project: var(--light-color-ts-project); + --color-ts-module: var(--light-color-ts-module); + --color-ts-namespace: var(--light-color-ts-namespace); + --color-ts-enum: var(--light-color-ts-enum); + --color-ts-enum-member: var(--light-color-ts-enum-member); + --color-ts-variable: var(--light-color-ts-variable); + --color-ts-function: var(--light-color-ts-function); + --color-ts-class: var(--light-color-ts-class); + --color-ts-interface: var(--light-color-ts-interface); + --color-ts-constructor: var(--light-color-ts-constructor); + --color-ts-property: var(--light-color-ts-property); + --color-ts-method: var(--light-color-ts-method); + --color-ts-reference: var(--light-color-ts-reference); + --color-ts-call-signature: var(--light-color-ts-call-signature); + --color-ts-index-signature: var(--light-color-ts-index-signature); + --color-ts-constructor-signature: var( + --light-color-ts-constructor-signature + ); + --color-ts-parameter: var(--light-color-ts-parameter); + --color-ts-type-parameter: var(--light-color-ts-type-parameter); + --color-ts-accessor: var(--light-color-ts-accessor); + --color-ts-get-signature: var(--light-color-ts-get-signature); + --color-ts-set-signature: var(--light-color-ts-set-signature); + --color-ts-type-alias: var(--light-color-ts-type-alias); + --color-document: var(--light-color-document); + + --color-note: var(--light-color-note); + --color-tip: var(--light-color-tip); + --color-important: var(--light-color-important); + --color-warning: var(--light-color-warning); + --color-caution: var(--light-color-caution); + + --external-icon: var(--light-external-icon); + --color-scheme: var(--light-color-scheme); + } + + :root[data-theme="dark"] { + --color-background: var(--dark-color-background); + --color-background-secondary: var(--dark-color-background-secondary); + --color-background-warning: var(--dark-color-background-warning); + --color-warning-text: var(--dark-color-warning-text); + --color-icon-background: var(--dark-color-icon-background); + --color-accent: var(--dark-color-accent); + --color-active-menu-item: var(--dark-color-active-menu-item); + --color-text: var(--dark-color-text); + --color-text-aside: var(--dark-color-text-aside); + --color-icon-text: var(--dark-color-icon-text); + + --color-comment-tag-text: var(--dark-color-text); + --color-comment-tag: var(--dark-color-background); + + --color-link: var(--dark-color-link); + --color-focus-outline: var(--dark-color-focus-outline); + + --color-ts-keyword: var(--dark-color-ts-keyword); + --color-ts-project: var(--dark-color-ts-project); + --color-ts-module: var(--dark-color-ts-module); + --color-ts-namespace: var(--dark-color-ts-namespace); + --color-ts-enum: var(--dark-color-ts-enum); + --color-ts-enum-member: var(--dark-color-ts-enum-member); + --color-ts-variable: var(--dark-color-ts-variable); + --color-ts-function: var(--dark-color-ts-function); + --color-ts-class: var(--dark-color-ts-class); + --color-ts-interface: var(--dark-color-ts-interface); + --color-ts-constructor: var(--dark-color-ts-constructor); + --color-ts-property: var(--dark-color-ts-property); + --color-ts-method: var(--dark-color-ts-method); + --color-ts-reference: var(--dark-color-ts-reference); + --color-ts-call-signature: var(--dark-color-ts-call-signature); + --color-ts-index-signature: var(--dark-color-ts-index-signature); + --color-ts-constructor-signature: var( + --dark-color-ts-constructor-signature + ); + --color-ts-parameter: var(--dark-color-ts-parameter); + --color-ts-type-parameter: var(--dark-color-ts-type-parameter); + --color-ts-accessor: var(--dark-color-ts-accessor); + --color-ts-get-signature: var(--dark-color-ts-get-signature); + --color-ts-set-signature: var(--dark-color-ts-set-signature); + --color-ts-type-alias: var(--dark-color-ts-type-alias); + --color-document: var(--dark-color-document); + + --color-note: var(--dark-color-note); + --color-tip: var(--dark-color-tip); + --color-important: var(--dark-color-important); + --color-warning: var(--dark-color-warning); + --color-caution: var(--dark-color-caution); + + --external-icon: var(--dark-external-icon); + --color-scheme: var(--dark-color-scheme); + } + + *:focus-visible, + .tsd-accordion-summary:focus-visible svg { + outline: 2px solid var(--color-focus-outline); + } + + .always-visible, + .always-visible .tsd-signatures { + display: inherit !important; + } + + h1, + h2, + h3, + h4, + h5, + h6 { + line-height: 1.2; + } + + h1 { + font-size: 1.875rem; + margin: 0.67rem 0; + } + + h2 { + font-size: 1.5rem; + margin: 0.83rem 0; + } + + h3 { + font-size: 1.25rem; + margin: 1rem 0; + } + + h4 { + font-size: 1.05rem; + margin: 1.33rem 0; + } + + h5 { + font-size: 1rem; + margin: 1.5rem 0; + } + + h6 { + font-size: 0.875rem; + margin: 2.33rem 0; + } + + dl, + menu, + ol, + ul { + margin: 1em 0; + } + + dd { + margin: 0 0 0 34px; + } + + .container { + max-width: 1700px; + padding: 0 2rem; + } + + /* Footer */ + footer { + border-top: 1px solid var(--color-accent); + padding-top: 1rem; + padding-bottom: 1rem; + max-height: 3.5rem; + } + footer > p { + margin: 0 1em; + } + + .container-main { + margin: 0 auto; + /* toolbar, footer, margin */ + min-height: calc(100vh - 41px - 56px - 4rem); + } + + @keyframes fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + @keyframes fade-out { + from { + opacity: 1; + visibility: visible; + } + to { + opacity: 0; + } + } + @keyframes fade-in-delayed { + 0% { + opacity: 0; + } + 33% { + opacity: 0; + } + 100% { + opacity: 1; + } + } + @keyframes fade-out-delayed { + 0% { + opacity: 1; + visibility: visible; + } + 66% { + opacity: 0; + } + 100% { + opacity: 0; + } + } + @keyframes pop-in-from-right { + from { + transform: translate(100%, 0); + } + to { + transform: translate(0, 0); + } + } + @keyframes pop-out-to-right { + from { + transform: translate(0, 0); + visibility: visible; + } + to { + transform: translate(100%, 0); + } + } + body { + background: var(--color-background); + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", + Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; + font-size: 16px; + color: var(--color-text); + } + + a { + color: var(--color-link); + text-decoration: none; + } + a:hover { + text-decoration: underline; + } + a.external[target="_blank"] { + background-image: var(--external-icon); + background-position: top 3px right; + background-repeat: no-repeat; + padding-right: 13px; + } + a.tsd-anchor-link { + color: var(--color-text); + } + + code, + pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 0.875rem; + border-radius: 0.8em; + } + + pre { + position: relative; + white-space: pre-wrap; + word-wrap: break-word; + padding: 10px; + border: 1px solid var(--color-accent); + margin-bottom: 8px; + } + pre code { + padding: 0; + font-size: 100%; + } + pre > button { + position: absolute; + top: 10px; + right: 10px; + opacity: 0; + transition: opacity 0.1s; + box-sizing: border-box; + } + pre:hover > button, + pre > button.visible { + opacity: 1; + } + + blockquote { + margin: 1em 0; + padding-left: 1em; + border-left: 4px solid gray; + } + + .tsd-typography { + line-height: 1.333em; + } + .tsd-typography ul { + list-style: square; + padding: 0 0 0 20px; + margin: 0; + } + .tsd-typography .tsd-index-panel h3, + .tsd-index-panel .tsd-typography h3, + .tsd-typography h4, + .tsd-typography h5, + .tsd-typography h6 { + font-size: 1em; + } + .tsd-typography h5, + .tsd-typography h6 { + font-weight: normal; + } + .tsd-typography p, + .tsd-typography ul, + .tsd-typography ol { + margin: 1em 0; + } + .tsd-typography table { + border-collapse: collapse; + border: none; + } + .tsd-typography td, + .tsd-typography th { + padding: 6px 13px; + border: 1px solid var(--color-accent); + } + .tsd-typography thead, + .tsd-typography tr:nth-child(even) { + background-color: var(--color-background-secondary); + } + + .tsd-alert { + padding: 8px 16px; + margin-bottom: 16px; + border-left: 0.25em solid var(--alert-color); + } + .tsd-alert blockquote > :last-child, + .tsd-alert > :last-child { + margin-bottom: 0; + } + .tsd-alert-title { + color: var(--alert-color); + display: inline-flex; + align-items: center; + } + .tsd-alert-title span { + margin-left: 4px; + } + + .tsd-alert-note { + --alert-color: var(--color-alert-note); + } + .tsd-alert-tip { + --alert-color: var(--color-alert-tip); + } + .tsd-alert-important { + --alert-color: var(--color-alert-important); + } + .tsd-alert-warning { + --alert-color: var(--color-alert-warning); + } + .tsd-alert-caution { + --alert-color: var(--color-alert-caution); + } + + .tsd-breadcrumb { + margin: 0; + padding: 0; + color: var(--color-text-aside); + } + .tsd-breadcrumb a { + color: var(--color-text-aside); + text-decoration: none; + } + .tsd-breadcrumb a:hover { + text-decoration: underline; + } + .tsd-breadcrumb li { + display: inline; + } + .tsd-breadcrumb li:after { + content: " / "; + } + + .tsd-comment-tags { + display: flex; + flex-direction: column; + } + dl.tsd-comment-tag-group { + display: flex; + align-items: center; + overflow: hidden; + margin: 0.5em 0; + } + dl.tsd-comment-tag-group dt { + display: flex; + margin-right: 0.5em; + font-size: 0.875em; + font-weight: normal; + } + dl.tsd-comment-tag-group dd { + margin: 0; + } + code.tsd-tag { + padding: 0.25em 0.4em; + border: 0.1em solid var(--color-accent); + margin-right: 0.25em; + font-size: 70%; + } + h1 code.tsd-tag:first-of-type { + margin-left: 0.25em; + } + + dl.tsd-comment-tag-group dd:before, + dl.tsd-comment-tag-group dd:after { + content: " "; + } + dl.tsd-comment-tag-group dd pre, + dl.tsd-comment-tag-group dd:after { + clear: both; + } + dl.tsd-comment-tag-group p { + margin: 0; + } + + .tsd-panel.tsd-comment .lead { + font-size: 1.1em; + line-height: 1.333em; + margin-bottom: 2em; + } + .tsd-panel.tsd-comment .lead:last-child { + margin-bottom: 0; + } + + .tsd-filter-visibility h4 { + font-size: 1rem; + padding-top: 0.75rem; + padding-bottom: 0.5rem; + margin: 0; + } + .tsd-filter-item:not(:last-child) { + margin-bottom: 0.5rem; + } + .tsd-filter-input { + display: flex; + width: -moz-fit-content; + width: fit-content; + align-items: center; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + } + .tsd-filter-input input[type="checkbox"] { + cursor: pointer; + position: absolute; + width: 1.5em; + height: 1.5em; + opacity: 0; + } + .tsd-filter-input input[type="checkbox"]:disabled { + pointer-events: none; + } + .tsd-filter-input svg { + cursor: pointer; + width: 1.5em; + height: 1.5em; + margin-right: 0.5em; + border-radius: 0.33em; + /* Leaving this at full opacity breaks event listeners on Firefox. + Don't remove unless you know what you're doing. */ + opacity: 0.99; + } + .tsd-filter-input input[type="checkbox"]:focus-visible + svg { + outline: 2px solid var(--color-focus-outline); + } + .tsd-checkbox-background { + fill: var(--color-accent); + } + input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { + stroke: var(--color-text); + } + .tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background { + fill: var(--color-background); + stroke: var(--color-accent); + stroke-width: 0.25rem; + } + .tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark { + stroke: var(--color-accent); + } + + .settings-label { + font-weight: bold; + text-transform: uppercase; + display: inline-block; + } + + .tsd-filter-visibility .settings-label { + margin: 0.75rem 0 0.5rem 0; + } + + .tsd-theme-toggle .settings-label { + margin: 0.75rem 0.75rem 0 0; + } + + .tsd-hierarchy h4 label:hover span { + text-decoration: underline; + } + + .tsd-hierarchy { + list-style: square; + margin: 0; + } + .tsd-hierarchy-target { + font-weight: bold; + } + .tsd-hierarchy-toggle { + color: var(--color-link); + cursor: pointer; + } + + .tsd-full-hierarchy:not(:last-child) { + margin-bottom: 1em; + padding-bottom: 1em; + border-bottom: 1px solid var(--color-accent); + } + .tsd-full-hierarchy, + .tsd-full-hierarchy ul { + list-style: none; + margin: 0; + padding: 0; + } + .tsd-full-hierarchy ul { + padding-left: 1.5rem; + } + .tsd-full-hierarchy a { + padding: 0.25rem 0 !important; + font-size: 1rem; + display: inline-flex; + align-items: center; + color: var(--color-text); + } + .tsd-full-hierarchy svg[data-dropdown] { + cursor: pointer; + } + .tsd-full-hierarchy svg[data-dropdown="false"] { + transform: rotate(-90deg); + } + .tsd-full-hierarchy svg[data-dropdown="false"] ~ ul { + display: none; + } + + .tsd-panel-group.tsd-index-group { + margin-bottom: 0; + } + .tsd-index-panel .tsd-index-list { + list-style: none; + line-height: 1.333em; + margin: 0; + padding: 0.25rem 0 0 0; + overflow: hidden; + display: grid; + grid-template-columns: repeat(3, 1fr); + column-gap: 1rem; + grid-template-rows: auto; + } + @media (max-width: 1024px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(2, 1fr); + } + } + @media (max-width: 768px) { + .tsd-index-panel .tsd-index-list { + grid-template-columns: repeat(1, 1fr); + } + } + .tsd-index-panel .tsd-index-list li { + -webkit-page-break-inside: avoid; + -moz-page-break-inside: avoid; + -ms-page-break-inside: avoid; + -o-page-break-inside: avoid; + page-break-inside: avoid; + } + + .tsd-flag { + display: inline-block; + padding: 0.25em 0.4em; + border-radius: 4px; + color: var(--color-comment-tag-text); + background-color: var(--color-comment-tag); + text-indent: 0; + font-size: 75%; + line-height: 1; + font-weight: normal; + } + + .tsd-anchor { + position: relative; + top: -100px; + } + + .tsd-member { + position: relative; + } + .tsd-member .tsd-anchor + h3 { + display: flex; + align-items: center; + margin-top: 0; + margin-bottom: 0; + border-bottom: none; + } + + .tsd-navigation.settings { + margin: 1rem 0; + } + .tsd-navigation > a, + .tsd-navigation .tsd-accordion-summary { + width: calc(100% - 0.25rem); + display: flex; + align-items: center; + } + .tsd-navigation a, + .tsd-navigation summary > span, + .tsd-page-navigation a { + display: flex; + width: calc(100% - 0.25rem); + align-items: center; + padding: 0.25rem; + color: var(--color-text); + text-decoration: none; + box-sizing: border-box; + } + .tsd-navigation a.current, + .tsd-page-navigation a.current { + background: var(--color-active-menu-item); + } + .tsd-navigation a:hover, + .tsd-page-navigation a:hover { + text-decoration: underline; + } + .tsd-navigation ul, + .tsd-page-navigation ul { + margin-top: 0; + margin-bottom: 0; + padding: 0; + list-style: none; + } + .tsd-navigation li, + .tsd-page-navigation li { + padding: 0; + max-width: 100%; + } + .tsd-navigation .tsd-nav-link { + display: none; + } + .tsd-nested-navigation { + margin-left: 3rem; + } + .tsd-nested-navigation > li > details { + margin-left: -1.5rem; + } + .tsd-small-nested-navigation { + margin-left: 1.5rem; + } + .tsd-small-nested-navigation > li > details { + margin-left: -1.5rem; + } + + .tsd-page-navigation-section { + margin-left: 10px; + } + .tsd-page-navigation-section > summary { + padding: 0.25rem; + } + .tsd-page-navigation-section > div { + margin-left: 20px; + } + .tsd-page-navigation ul { + padding-left: 1.75rem; + } + + #tsd-sidebar-links a { + margin-top: 0; + margin-bottom: 0.5rem; + line-height: 1.25rem; + } + #tsd-sidebar-links a:last-of-type { + margin-bottom: 0; + } + + a.tsd-index-link { + padding: 0.25rem 0 !important; + font-size: 1rem; + line-height: 1.25rem; + display: inline-flex; + align-items: center; + color: var(--color-text); + } + .tsd-accordion-summary { + list-style-type: none; /* hide marker on non-safari */ + outline: none; /* broken on safari, so just hide it */ + } + .tsd-accordion-summary::-webkit-details-marker { + display: none; /* hide marker on safari */ + } + .tsd-accordion-summary, + .tsd-accordion-summary a { + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; + + cursor: pointer; + } + .tsd-accordion-summary a { + width: calc(100% - 1.5rem); + } + .tsd-accordion-summary > * { + margin-top: 0; + margin-bottom: 0; + padding-top: 0; + padding-bottom: 0; + } + .tsd-accordion .tsd-accordion-summary > svg { + margin-left: 0.25rem; + vertical-align: text-top; + } + /* + We need to be careful to target the arrow indicating whether the accordion + is open, but not any other SVGs included in the details element. +*/ + .tsd-accordion:not([open]) > .tsd-accordion-summary > svg:first-child, + .tsd-accordion:not([open]) > .tsd-accordion-summary > h1 > svg:first-child, + .tsd-accordion:not([open]) > .tsd-accordion-summary > h2 > svg:first-child, + .tsd-accordion:not([open]) > .tsd-accordion-summary > h3 > svg:first-child, + .tsd-accordion:not([open]) > .tsd-accordion-summary > h4 > svg:first-child { + transform: rotate(-90deg); + } + .tsd-index-content > :not(:first-child) { + margin-top: 0.75rem; + } + .tsd-index-heading { + margin-top: 1.5rem; + margin-bottom: 0.75rem; + } + + .tsd-no-select { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + .tsd-kind-icon { + margin-right: 0.5rem; + width: 1.25rem; + height: 1.25rem; + min-width: 1.25rem; + min-height: 1.25rem; + } + .tsd-signature > .tsd-kind-icon { + margin-right: 0.8rem; + } + + .tsd-panel { + margin-bottom: 2.5rem; + } + .tsd-panel.tsd-member { + margin-bottom: 4rem; + } + .tsd-panel:empty { + display: none; + } + .tsd-panel > h1, + .tsd-panel > h2, + .tsd-panel > h3 { + margin: 1.5rem -1.5rem 0.75rem -1.5rem; + padding: 0 1.5rem 0.75rem 1.5rem; + } + .tsd-panel > h1.tsd-before-signature, + .tsd-panel > h2.tsd-before-signature, + .tsd-panel > h3.tsd-before-signature { + margin-bottom: 0; + border-bottom: none; + } + + .tsd-panel-group { + margin: 2rem 0; + } + .tsd-panel-group.tsd-index-group { + margin: 2rem 0; + } + .tsd-panel-group.tsd-index-group details { + margin: 2rem 0; + } + .tsd-panel-group > .tsd-accordion-summary { + margin-bottom: 1rem; + } + + #tsd-search { + transition: background-color 0.2s; + } + #tsd-search .title { + position: relative; + z-index: 2; + } + #tsd-search .field { + position: absolute; + left: 0; + top: 0; + right: 2.5rem; + height: 100%; + } + #tsd-search .field input { + box-sizing: border-box; + position: relative; + top: -50px; + z-index: 1; + width: 100%; + padding: 0 10px; + opacity: 0; + outline: 0; + border: 0; + background: transparent; + color: var(--color-text); + } + #tsd-search .field label { + position: absolute; + overflow: hidden; + right: -40px; + } + #tsd-search .field input, + #tsd-search .title, + #tsd-toolbar-links a { + transition: opacity 0.2s; + } + #tsd-search .results { + position: absolute; + visibility: hidden; + top: 40px; + width: 100%; + margin: 0; + padding: 0; + list-style: none; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); + } + #tsd-search .results li { + background-color: var(--color-background); + line-height: initial; + padding: 4px; + } + #tsd-search .results li:nth-child(even) { + background-color: var(--color-background-secondary); + } + #tsd-search .results li.state { + display: none; + } + #tsd-search .results li.current:not(.no-results), + #tsd-search .results li:hover:not(.no-results) { + background-color: var(--color-accent); + } + #tsd-search .results a { + display: flex; + align-items: center; + padding: 0.25rem; + box-sizing: border-box; + } + #tsd-search .results a:before { + top: 10px; + } + #tsd-search .results span.parent { + color: var(--color-text-aside); + font-weight: normal; + } + #tsd-search.has-focus { + background-color: var(--color-accent); + } + #tsd-search.has-focus .field input { + top: 0; + opacity: 1; + } + #tsd-search.has-focus .title, + #tsd-search.has-focus #tsd-toolbar-links a { + z-index: 0; + opacity: 0; + } + #tsd-search.has-focus .results { + visibility: visible; + } + #tsd-search.loading .results li.state.loading { + display: block; + } + #tsd-search.failure .results li.state.failure { + display: block; + } + + #tsd-toolbar-links { + position: absolute; + top: 0; + right: 2rem; + height: 100%; + display: flex; + align-items: center; + justify-content: flex-end; + } + #tsd-toolbar-links a { + margin-left: 1.5rem; + } + #tsd-toolbar-links a:hover { + text-decoration: underline; + } + + .tsd-signature { + margin: 0 0 1rem 0; + padding: 1rem 0.5rem; + border: 1px solid var(--color-accent); + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 14px; + overflow-x: auto; + } + + .tsd-signature-keyword { + color: var(--color-ts-keyword); + font-weight: normal; + } + + .tsd-signature-symbol { + color: var(--color-text-aside); + font-weight: normal; + } + + .tsd-signature-type { + font-style: italic; + font-weight: normal; + } + + .tsd-signatures { + padding: 0; + margin: 0 0 1em 0; + list-style-type: none; + } + .tsd-signatures .tsd-signature { + margin: 0; + border-color: var(--color-accent); + border-width: 1px 0; + transition: background-color 0.1s; + } + .tsd-signatures .tsd-index-signature:not(:last-child) { + margin-bottom: 1em; + } + .tsd-signatures .tsd-index-signature .tsd-signature { + border-width: 1px; + } + .tsd-description .tsd-signatures .tsd-signature { + border-width: 1px; + } + + ul.tsd-parameter-list, + ul.tsd-type-parameter-list { + list-style: square; + margin: 0; + padding-left: 20px; + } + ul.tsd-parameter-list > li.tsd-parameter-signature, + ul.tsd-type-parameter-list > li.tsd-parameter-signature { + list-style: none; + margin-left: -20px; + } + ul.tsd-parameter-list h5, + ul.tsd-type-parameter-list h5 { + font-size: 16px; + margin: 1em 0 0.5em 0; + } + .tsd-sources { + margin-top: 1rem; + font-size: 0.875em; + } + .tsd-sources a { + color: var(--color-text-aside); + text-decoration: underline; + } + .tsd-sources ul { + list-style: none; + padding: 0; + } + + .tsd-page-toolbar { + position: sticky; + z-index: 1; + top: 0; + left: 0; + width: 100%; + color: var(--color-text); + background: var(--color-background-secondary); + border-bottom: 1px var(--color-accent) solid; + transition: transform 0.3s ease-in-out; + } + .tsd-page-toolbar a { + color: var(--color-text); + text-decoration: none; + } + .tsd-page-toolbar a.title { + font-weight: bold; + } + .tsd-page-toolbar a.title:hover { + text-decoration: underline; + } + .tsd-page-toolbar .tsd-toolbar-contents { + display: flex; + justify-content: space-between; + height: 2.5rem; + margin: 0 auto; + } + .tsd-page-toolbar .table-cell { + position: relative; + white-space: nowrap; + line-height: 40px; + } + .tsd-page-toolbar .table-cell:first-child { + width: 100%; + } + .tsd-page-toolbar .tsd-toolbar-icon { + box-sizing: border-box; + line-height: 0; + padding: 12px 0; + } + + .tsd-widget { + display: inline-block; + overflow: hidden; + opacity: 0.8; + height: 40px; + transition: + opacity 0.1s, + background-color 0.2s; + vertical-align: bottom; + cursor: pointer; + } + .tsd-widget:hover { + opacity: 0.9; + } + .tsd-widget.active { + opacity: 1; + background-color: var(--color-accent); + } + .tsd-widget.no-caption { + width: 40px; + } + .tsd-widget.no-caption:before { + margin: 0; + } + + .tsd-widget.options, + .tsd-widget.menu { + display: none; + } + input[type="checkbox"] + .tsd-widget:before { + background-position: -120px 0; + } + input[type="checkbox"]:checked + .tsd-widget:before { + background-position: -160px 0; + } + + img { + max-width: 100%; + } + + .tsd-member-summary-name { + display: inline-flex; + align-items: center; + padding: 0.25rem; + text-decoration: none; + } + + .tsd-anchor-icon { + display: inline-flex; + align-items: center; + margin-left: 0.5rem; + color: var(--color-text); + } + + .tsd-anchor-icon svg { + width: 1em; + height: 1em; + visibility: hidden; + } + + .tsd-member-summary-name:hover > .tsd-anchor-icon svg, + .tsd-anchor-link:hover > .tsd-anchor-icon svg { + visibility: visible; + } + + .deprecated { + text-decoration: line-through !important; + } + + .warning { + padding: 1rem; + color: var(--color-warning-text); + background: var(--color-background-warning); + } + + .tsd-kind-project { + color: var(--color-ts-project); + } + .tsd-kind-module { + color: var(--color-ts-module); + } + .tsd-kind-namespace { + color: var(--color-ts-namespace); + } + .tsd-kind-enum { + color: var(--color-ts-enum); + } + .tsd-kind-enum-member { + color: var(--color-ts-enum-member); + } + .tsd-kind-variable { + color: var(--color-ts-variable); + } + .tsd-kind-function { + color: var(--color-ts-function); + } + .tsd-kind-class { + color: var(--color-ts-class); + } + .tsd-kind-interface { + color: var(--color-ts-interface); + } + .tsd-kind-constructor { + color: var(--color-ts-constructor); + } + .tsd-kind-property { + color: var(--color-ts-property); + } + .tsd-kind-method { + color: var(--color-ts-method); + } + .tsd-kind-reference { + color: var(--color-ts-reference); + } + .tsd-kind-call-signature { + color: var(--color-ts-call-signature); + } + .tsd-kind-index-signature { + color: var(--color-ts-index-signature); + } + .tsd-kind-constructor-signature { + color: var(--color-ts-constructor-signature); + } + .tsd-kind-parameter { + color: var(--color-ts-parameter); + } + .tsd-kind-type-parameter { + color: var(--color-ts-type-parameter); + } + .tsd-kind-accessor { + color: var(--color-ts-accessor); + } + .tsd-kind-get-signature { + color: var(--color-ts-get-signature); + } + .tsd-kind-set-signature { + color: var(--color-ts-set-signature); + } + .tsd-kind-type-alias { + color: var(--color-ts-type-alias); + } + + /* if we have a kind icon, don't color the text by kind */ + .tsd-kind-icon ~ span { + color: var(--color-text); + } + + * { + scrollbar-width: thin; + scrollbar-color: var(--color-accent) var(--color-icon-background); + } + + *::-webkit-scrollbar { + width: 0.75rem; + } + + *::-webkit-scrollbar-track { + background: var(--color-icon-background); + } + + *::-webkit-scrollbar-thumb { + background-color: var(--color-accent); + border-radius: 999rem; + border: 0.25rem solid var(--color-icon-background); + } + + /* mobile */ + @media (max-width: 769px) { + .tsd-widget.options, + .tsd-widget.menu { + display: inline-block; + } + + .container-main { + display: flex; + } + html .col-content { + float: none; + max-width: 100%; + width: 100%; + } + html .col-sidebar { + position: fixed !important; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 1024; + top: 0 !important; + bottom: 0 !important; + left: auto !important; + right: 0 !important; + padding: 1.5rem 1.5rem 0 0; + width: 75vw; + visibility: hidden; + background-color: var(--color-background); + transform: translate(100%, 0); + } + html .col-sidebar > *:last-child { + padding-bottom: 20px; + } + html .overlay { + content: ""; + display: block; + position: fixed; + z-index: 1023; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.75); + visibility: hidden; + } + + .to-has-menu .overlay { + animation: fade-in 0.4s; + } + + .to-has-menu .col-sidebar { + animation: pop-in-from-right 0.4s; + } + + .from-has-menu .overlay { + animation: fade-out 0.4s; + } + + .from-has-menu .col-sidebar { + animation: pop-out-to-right 0.4s; + } + + .has-menu body { + overflow: hidden; + } + .has-menu .overlay { + visibility: visible; + } + .has-menu .col-sidebar { + visibility: visible; + transform: translate(0, 0); + display: flex; + flex-direction: column; + gap: 1.5rem; + max-height: 100vh; + padding: 1rem 2rem; + } + .has-menu .tsd-navigation { + max-height: 100%; + } + #tsd-toolbar-links { + display: none; + } + .tsd-navigation .tsd-nav-link { + display: flex; + } + } + + /* one sidebar */ + @media (min-width: 770px) { + .container-main { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); + grid-template-areas: "sidebar content"; + margin: 2rem auto; + } + + .col-sidebar { + grid-area: sidebar; + } + .col-content { + grid-area: content; + padding: 0 1rem; + } + } + @media (min-width: 770px) and (max-width: 1399px) { + .col-sidebar { + max-height: calc(100vh - 2rem - 42px); + overflow: auto; + position: sticky; + top: 42px; + padding-top: 1rem; + } + .site-menu { + margin-top: 1rem; + } + } + + /* two sidebars */ + @media (min-width: 1200px) { + .container-main { + grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax( + 0, + 20rem + ); + grid-template-areas: "sidebar content toc"; + } + + .col-sidebar { + display: contents; + } + + .page-menu { + grid-area: toc; + padding-left: 1rem; + } + .site-menu { + grid-area: sidebar; + } + + .site-menu { + margin-top: 1rem; + } + + .page-menu, + .site-menu { + max-height: calc(100vh - 2rem - 42px); + overflow: auto; + position: sticky; + top: 42px; + } + } +} diff --git a/docs/classes/SdlValidationError.html b/docs/classes/SdlValidationError.html new file mode 100644 index 0000000..cdf92f0 --- /dev/null +++ b/docs/classes/SdlValidationError.html @@ -0,0 +1,22 @@ +SdlValidationError | @akashnetwork/akashjs

Represents an SDL validation error. +Extends the base ValidationError class.

+

Hierarchy (View Summary)

Constructors

Properties

message: string
name: string
stack?: string
prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any

Optional override for formatting stack traces

+
stackTraceLimit: number

Methods

  • Asserts a condition and throws an SdlValidationError if the condition is false.

    +

    Parameters

    • condition: unknown

      The condition to assert.

      +
    • message: string

      The error message to throw if the assertion fails.

      +

    Returns asserts condition

    SdlValidationError.assert(someCondition, "Condition failed");
    +
    + +
  • Create .stack property on a target object

    +

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

diff --git a/docs/classes/ValidationError.html b/docs/classes/ValidationError.html new file mode 100644 index 0000000..01153d9 --- /dev/null +++ b/docs/classes/ValidationError.html @@ -0,0 +1,22 @@ +ValidationError | @akashnetwork/akashjs

Represents a generic validation error. +Extends the native Error class.

+

Hierarchy (View Summary)

Constructors

Properties

message: string
name: string
stack?: string
prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any

Optional override for formatting stack traces

+
stackTraceLimit: number

Methods

  • Asserts a condition and throws a ValidationError if the condition is false.

    +

    Parameters

    • condition: unknown

      The condition to assert.

      +
    • message: string

      The error message to throw if the assertion fails.

      +

    Returns asserts condition

    ValidationError.assert(someCondition, "Condition failed");
    +
    + +
  • Create .stack property on a target object

    +

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

diff --git a/docs/classes/sdl.SDL.html b/docs/classes/sdl.SDL.html new file mode 100644 index 0000000..6b0ce5a --- /dev/null +++ b/docs/classes/sdl.SDL.html @@ -0,0 +1,107 @@ +SDL | @akashnetwork/akashjs

SDL (Stack Definition Language) parser and validator +Handles parsing and validation of Akash deployment manifests

+
import { SDL } from './SDL';

const yaml = `
version: "2.0"
services:
web:
image: nginx
expose:
- port: 80
as: 80
to:
- global: true
`;

// Parse SDL from YAML string
const sdl = SDL.fromString(yaml);

// Get deployment manifest
const manifest = sdl.manifest();

// Get deployment groups
const groups = sdl.groups(); +
+ +

Constructors

  • Parameters

    • data: v2Sdl
    • version: NetworkVersion = "beta2"
    • networkId: NetworkId = MAINNET_ID

    Returns SDL

Properties

data: v2Sdl
version: NetworkVersion = "beta2"

Methods

  • Computes the endpoint sequence numbers for the given SDL.

    +

    Parameters

    • sdl: v2Sdl

      The SDL data.

      +

    Returns { [k: string]: number }

    An object mapping IPs to their sequence numbers.

    +
    const sequenceNumbers = sdl.computeEndpointSequenceNumbers(sdlData);
    // sequenceNumbers might be { "192.168.1.1": 1, "192.168.1.2": 2 } +
    + +
  • Returns Record<string, v2Deployment>

  • Parameters

    • placement: string

    Returns [string, any][]

  • Escapes HTML characters in a string.

    +

    Parameters

    • raw: string

      The raw string to escape.

      +

    Returns string

    The escaped string.

    +
    const escaped = sdl.escapeHtml("<div>Hello</div>");
    // escaped is "\\u003cdiv\\u003eHello\\u003c/div\\u003e" +
    + +
  • Parameters

    • expose: { externalPort: number; global: boolean; port: number; proto: string }

    Returns boolean

  • Parameters

    • resource: undefined | v2ComputeResources
    • asString: boolean

    Returns any

  • Parameters

    • asString: boolean = false

    Returns v2Manifest | v3Manifest

  • Parameters

    • to: v2ExposeTo

    Returns boolean

  • Parameters

    • expose: v2Expose

    Returns v2Accept

  • Parameters

    • to: v2ExposeTo

    Returns string

  • Returns Promise<Uint8Array<ArrayBuffer>>

  • Parses the service protocol.

    +

    Parameters

    • Optionalproto: string

      The protocol string (e.g., "TCP", "UDP").

      +

    Returns string

    The parsed protocol.

    +

    Will throw an error if the protocol is unsupported.

    +
    const protocol = SDL.parseServiceProto("TCP");
    // protocol is "TCP" +
    + +
  • Returns Record<string, v2ProfilePlacement>

  • Parameters

    • val: string
    • asString: boolean

    Returns { val: string } | { val: number }

  • Parameters

    • computeResources: v2ComputeResources
    • asString: boolean

    Returns {
        attributes: undefined | { key: string; value: any }[];
        units: { val: null | string | Uint8Array<ArrayBufferLike> };
    }

  • Parameters

    • computeResources: v3ComputeResources
    • asString: boolean

    Returns {
        attributes: undefined | { key: string; value: string }[];
        units: { val: null | string | Uint8Array<ArrayBufferLike> };
    }

  • Parameters

    • computeResources: v2ComputeResources
    • asString: boolean

    Returns {
        attributes: undefined | { key: string; value: any }[];
        quantity: { val: null | string | Uint8Array<ArrayBufferLike> };
    }

  • Parameters

    • computeResources: v2ComputeResources
    • asString: boolean

    Returns {
        attributes: undefined | { key: string; value: any }[];
        name: string;
        quantity: { val: null | string | Uint8Array<ArrayBufferLike> };
    }[]

  • Parameters

    • value: null | { toString: () => string }
    • asString: boolean

    Returns null | string | Uint8Array<ArrayBufferLike>

  • Parameters

    • Optionalattributes: Record<string, any>

    Returns undefined | { key: string; value: any }[]

  • Parameters

    • resource: v2ResourceCPU

    Returns
        | {
            attributes: undefined
            | { key: string; value: any }[];
            units: { val: string };
        }
        | { attributes?: undefined; units: { val: string } }

  • Parameters

    • resource: undefined | v3ResourceGPU
    • asString: boolean

    Returns
        | {
            attributes: { key: string; value: string }[];
            units: { val: string } | { val: number | Buffer };
        }
        | {
            attributes?: undefined;
            units: { val: string }
            | { val: number | Buffer };
        }

  • Parameters

    • resource: v2ResourceMemory
    • asString: boolean

    Returns
        | {
            attributes: undefined
            | { key: string; value: any }[];
            [key: string]:
                | undefined
                | { val: string }
                | { val: number }
                | { key: string; value: any }[];
        }
        | {
            attributes?: undefined;
            [key: string]: { val: string }
            | { val: number };
        }

  • Parameters

    • profile: v2ProfileCompute
    • service: v2Service
    • asString: boolean = false

    Returns {
        cpu:
            | {
                attributes: undefined
                | { key: string; value: any }[];
                units: { val: string };
            }
            | { attributes?: undefined; units: { val: string } };
        endpoints: null | { kind: number; sequence_number: number }[];
        memory:
            | {
                attributes: undefined
                | { key: string; value: any }[];
                [key: string]:
                    | undefined
                    | { val: string }
                    | { val: number }
                    | { key: string; value: any }[];
            }
            | {
                attributes?: undefined;
                [key: string]: { val: string }
                | { val: number };
            };
        storage: (
            | {
                attributes: undefined
                | { key: string; value: any }[];
                name: string;
                [key: string]:
                    | undefined
                    | string
                    | { val: string }
                    | { val: number }
                    | { key: string; value: any }[];
            }
            | {
                attributes?: undefined;
                name: string;
                [key: string]: string
                | { val: string }
                | { val: number };
            }
        )[];
    }

  • Parameters

    • id: number
    • profile: v3ProfileCompute
    • service: v2Service
    • asString: boolean = false

    Returns {
        cpu:
            | {
                attributes: undefined
                | { key: string; value: any }[];
                units: { val: string };
            }
            | { attributes?: undefined; units: { val: string } };
        endpoints: (
            | { kind: number; sequence_number: number }
            | { kind?: undefined; sequence_number: number }
        )[];
        gpu:
            | {
                attributes: { key: string; value: string }[];
                units: { val: string } | { val: number | Buffer };
            }
            | {
                attributes?: undefined;
                units: { val: string }
                | { val: number | Buffer };
            };
        id: number;
        memory: | {
            attributes: undefined
            | { key: string; value: any }[];
            [key: string]:
                | undefined
                | { val: string }
                | { val: number }
                | { key: string; value: any }[];
        }
        | {
            attributes?: undefined;
            [key: string]: { val: string }
            | { val: number };
        };
        storage: (
            | {
                attributes: undefined
                | { key: string; value: any }[];
                name: string;
                [key: string]:
                    | undefined
                    | string
                    | { val: string }
                    | { val: number }
                    | { key: string; value: any }[];
            }
            | {
                attributes?: undefined;
                name: string;
                [key: string]: string
                | { val: string }
                | { val: number };
            }
        )[];
    }

  • Parameters

    • resource: v2ResourceStorage | v2ResourceStorageArray
    • asString: boolean

    Returns (
        | {
            attributes: undefined
            | { key: string; value: any }[];
            name: string;
            [key: string]:
                | undefined
                | string
                | { val: string }
                | { val: number }
                | { key: string; value: any }[];
        }
        | {
            attributes?: undefined;
            name: string;
            [key: string]: string
            | { val: string }
            | { val: number };
        }
    )[]

  • Parameters

    • Optionalattributes: v2StorageAttributes

    Returns undefined | { key: string; value: any }[]

  • Parameters

    • attributes: v3GPUAttributes

    Returns { key: string; value: string }[]

  • Parameters

    • http_options: undefined | v2HTTPOptions

    Returns {
        MaxBodySize: number;
        NextCases: string[];
        NextTimeout: number;
        NextTries: number;
        ReadTimeout: number;
        SendTimeout: number;
    }

  • Parameters

    • asString: boolean = false

    Returns v2Manifest

  • Parameters

    • service: v2Service

    Returns v2ServiceExpose[]

  • Parameters

    • expose: v2Expose

    Returns v2ServiceExposeHttpOptions

  • Parameters

    • placement: string
    • name: string
    • asString: boolean

    Returns v2ManifestService

  • Parameters

    • params: v2ServiceParams

    Returns undefined | v2ManifestServiceParams

  • Parameters

    • service: v2Service

    Returns null | { kind: number; sequence_number: number }[]

  • Parameters

    • http_options: undefined | v2HTTPOptions

    Returns {
        maxBodySize: number;
        nextCases: string[];
        nextTimeout: number;
        nextTries: number;
        readTimeout: number;
        sendTimeout: number;
    }

  • Parameters

    • asString: boolean = false

    Returns v3Manifest

  • Parameters

    • service: v2Service

    Returns v3ServiceExpose[]

  • Parameters

    • expose: v2Expose

    Returns v3ServiceExposeHttpOptions

  • Parameters

    • id: number
    • placement: string
    • name: string
    • asString: boolean

    Returns v3ManifestService

  • Parameters

    • params: undefined | v2ServiceParams

    Returns null | v3ManifestServiceParams

  • Parameters

    • service: v2Service

    Returns (
        | { kind: number; sequence_number: number }
        | { kind?: undefined; sequence_number: number }
    )[]

  • Creates an SDL instance from a YAML string.

    +

    Parameters

    • yaml: string

      The YAML string containing the SDL definition.

      +
    • Optionalversion: NetworkVersion = "beta2"

      The SDL version (beta2 or beta3).

      +
    • OptionalnetworkId: NetworkId = MAINNET_ID

      The network ID to validate against.

      +

    Returns SDL

    An instance of the SDL class.

    +
    const yaml = `
    version: "2.0"
    services:
    web:
    image: nginx
    expose:
    - port: 80
    as: 80
    to:
    - global: true
    `;
    const sdl = SDL.fromString(yaml); +
    + +
  • Validates SDL YAML string (deprecated)

    +

    Parameters

    • yaml: string

    Returns v3Sdl

    Use SDL.constructor directly

    +
  • Validates the GPU configuration for a given service profile.

    +

    Parameters

    • name: string

      The name of the service profile.

      +
    • gpu: undefined | v3ResourceGPU

      The GPU resource configuration.

      +

    Returns void

    Will throw an error if the GPU configuration is invalid.

    +
    const gpuConfig = { units: "1", attributes: { vendor: { nvidia: [{ model: "RTX 3080", ram: "10GB" }] } } };
    SDL.validateGPU("web", gpuConfig); +
    + +
  • Validates the storage configuration for a given service.

    +

    Parameters

    • name: string

      The name of the service.

      +
    • Optionalstorage: v2ResourceStorage | v2ResourceStorageArray

      The storage resource configuration.

      +

    Returns void

    Will throw an error if the storage configuration is invalid.

    +
    const storageConfig = { size: "10Gi", attributes: { class: "ssd" } };
    SDL.validateStorage("web", storageConfig); +
    + +
diff --git a/docs/enums/network.ENDPOINT_TYPE.html b/docs/enums/network.ENDPOINT_TYPE.html new file mode 100644 index 0000000..9747618 --- /dev/null +++ b/docs/enums/network.ENDPOINT_TYPE.html @@ -0,0 +1,4 @@ +ENDPOINT_TYPE | @akashnetwork/akashjs

Network endpoint type

+

Enumeration Members

Enumeration Members

REST: "rest"
RPC: "rpc"
diff --git a/docs/enums/network.NETWORK_TYPE.html b/docs/enums/network.NETWORK_TYPE.html new file mode 100644 index 0000000..cd881d9 --- /dev/null +++ b/docs/enums/network.NETWORK_TYPE.html @@ -0,0 +1,5 @@ +NETWORK_TYPE | @akashnetwork/akashjs

Network type identifier

+

Enumeration Members

Enumeration Members

EDGENET: "edgenet"
MAINNET: "mainnet"
TESTNET: "testnet"
diff --git a/docs/enums/stargate.Message.html b/docs/enums/stargate.Message.html new file mode 100644 index 0000000..fecb76e --- /dev/null +++ b/docs/enums/stargate.Message.html @@ -0,0 +1,22 @@ +Message | @akashnetwork/akashjs

Enum for Akash message types.

+

Enumeration Members

MsgCloseDeployment: "/akash.deployment.v1beta3.MsgCloseDeployment"

Message type for closing a deployment.

+
MsgCloseGroup: "/akash.deployment.v1beta3.MsgCloseGroup"

Message type for closing a group.

+
MsgCreateCertificate: "/akash.cert.v1beta3.MsgCreateCertificate"

Message type for creating a certificate.

+
MsgCreateDeployment: "/akash.deployment.v1beta3.MsgCreateDeployment"

Message type for creating a deployment.

+
MsgCreateLease: "/akash.market.v1beta4.MsgCreateLease"

Message type for creating a lease.

+
MsgDepositDeployment: "/akash.deployment.v1beta3.MsgDepositDeployment"

Message type for depositing into a deployment.

+
MsgPauseGroup: "/akash.deployment.v1beta3.MsgPauseGroup"

Message type for pausing a group.

+
MsgRevokeCertificate: "/akash.cert.v1beta3.MsgRevokeCertificate"

Message type for revoking a certificate.

+
MsgStartGroup: "/akash.deployment.v1beta3.MsgStartGroup"

Message type for starting a group.

+
MsgUpdateDeployment: "/akash.deployment.v1beta3.MsgUpdateDeployment"

Message type for updating a deployment.

+
diff --git a/docs/functions/certificate.broadcastCertificate.html b/docs/functions/certificate.broadcastCertificate.html new file mode 100644 index 0000000..c7c07f0 --- /dev/null +++ b/docs/functions/certificate.broadcastCertificate.html @@ -0,0 +1,6 @@ +broadcastCertificate | @akashnetwork/akashjs
  • Broadcasts a certificate to the blockchain.

    +

    Parameters

    • pem: pems | Pick<CertificatePem, "publicKey" | "cert">

      The certificate PEM object.

      +
    • owner: string

      The owner of the certificate.

      +
    • client: SigningStargateClient

      The Stargate client used for signing and broadcasting.

      +

    Returns Promise<DeliverTxResponse>

    A promise that resolves to the transaction response.

    +
diff --git a/docs/functions/certificate.createCertificate.html b/docs/functions/certificate.createCertificate.html new file mode 100644 index 0000000..5851353 --- /dev/null +++ b/docs/functions/certificate.createCertificate.html @@ -0,0 +1,4 @@ +createCertificate | @akashnetwork/akashjs
diff --git a/docs/functions/certificate.queryCertificates.html b/docs/functions/certificate.queryCertificates.html new file mode 100644 index 0000000..83226a8 --- /dev/null +++ b/docs/functions/certificate.queryCertificates.html @@ -0,0 +1,4 @@ +queryCertificates | @akashnetwork/akashjs
  • Queries certificates based on a filter.

    +

    Parameters

    • filter: CertificateFilter

      The filter criteria for querying certificates.

      +

    Returns Promise<QueryCertificatesResponse>

    A promise that resolves to the query response.

    +
diff --git a/docs/functions/certificate.revokeCertificate.html b/docs/functions/certificate.revokeCertificate.html new file mode 100644 index 0000000..4359b86 --- /dev/null +++ b/docs/functions/certificate.revokeCertificate.html @@ -0,0 +1,6 @@ +revokeCertificate | @akashnetwork/akashjs
  • Revokes a certificate on the blockchain.

    +

    Parameters

    • owner: string

      The owner of the certificate.

      +
    • serial: string

      The serial number of the certificate to revoke.

      +
    • client: SigningStargateClient

      The Stargate client used for signing and broadcasting.

      +

    Returns Promise<DeliverTxResponse>

    A promise that resolves to the transaction response.

    +
diff --git a/docs/functions/keplr.get.html b/docs/functions/keplr.get.html new file mode 100644 index 0000000..217cde0 --- /dev/null +++ b/docs/functions/keplr.get.html @@ -0,0 +1,6 @@ +get | @akashnetwork/akashjs
  • Connects to a blockchain endpoint with a given signer.

    +

    Parameters

    • chain: Chain

      The blockchain chain to connect to.

      +
    • signer: OfflineSigner

      The signer to use for the connection.

      +
    • endPoint: string

      The endpoint URL to connect to.

      +

    Returns Promise<SigningStargateClient>

    A promise that resolves to the connected client.

    +
diff --git a/docs/functions/keplr.getChains.html b/docs/functions/keplr.getChains.html new file mode 100644 index 0000000..4b59451 --- /dev/null +++ b/docs/functions/keplr.getChains.html @@ -0,0 +1,3 @@ +getChains | @akashnetwork/akashjs
  • Returns the available blockchain chains.

    +

    Returns {
        mainnet: { id: string; messagePath: string; name: string };
        testnet: { id: string; messagePath: string; name: string };
    }

    An object containing mainnet and testnet chain configurations.

    +
diff --git a/docs/functions/keplr.getSigner.html b/docs/functions/keplr.getSigner.html new file mode 100644 index 0000000..f06cd6e --- /dev/null +++ b/docs/functions/keplr.getSigner.html @@ -0,0 +1,4 @@ +getSigner | @akashnetwork/akashjs
  • Retrieves the signer for a given blockchain chain.

    +

    Parameters

    • chain: Chain

      The blockchain chain for which to get the signer.

      +

    Returns Promise<OfflineSigner>

    A promise that resolves to the signer.

    +
diff --git a/docs/functions/network.getEndpointHealthStatus.html b/docs/functions/network.getEndpointHealthStatus.html new file mode 100644 index 0000000..cdd9438 --- /dev/null +++ b/docs/functions/network.getEndpointHealthStatus.html @@ -0,0 +1,7 @@ +getEndpointHealthStatus | @akashnetwork/akashjs
  • Creates a function to check the health status of an endpoint.

    +

    Parameters

    • timeout: number

      The timeout duration for the health check request in milliseconds.

      +

    Returns (
        __namedParameters: { address: string },
    ) => Promise<
        | { address: string; responseTime: number }
        | { address: string; responseTime: null },
    >

    A function that takes an endpoint object and returns a promise resolving to the endpoint's health status, including its address and response time.

    +
    import { getEndpointHealthStatus, getEndpoints, NETWORK_TYPE, ENDPOINT_TYPE } from "@akashnetwork/akashjs/build/network";

    const checkEndpointHealth = async () => {
    try {
    const endpoints = await getEndpoints(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.RPC);
    const healthStatusPromises = endpoints.map(endpoint => getEndpointHealthStatus(800)(endpoint));
    const healthStatuses = await Promise.all(healthStatusPromises);

    console.log("Endpoint Health Statuses:");
    healthStatuses.forEach(status => {
    console.log(`Address: ${status.address}, Response Time: ${status.responseTime !== null ? status.responseTime + 'ms' : 'Unresponsive'}`);
    });
    } catch (error) {
    console.error("Error checking endpoint health:", error);
    }
    };
    checkEndpointHealth(); +
    + +
diff --git a/docs/functions/network.getEndpoints.html b/docs/functions/network.getEndpoints.html new file mode 100644 index 0000000..fc8e701 --- /dev/null +++ b/docs/functions/network.getEndpoints.html @@ -0,0 +1,8 @@ +getEndpoints | @akashnetwork/akashjs
  • Retrieves endpoints for a specific network and type.

    +

    Parameters

    Returns Promise<{ address: string }[]>

    A promise that resolves to an array of endpoint addresses.

    +
    import { NETWORK_TYPE, ENDPOINT_TYPE, getEndpoints } from "@akashnetwork/akashjs/build/network";

    async function fetchEndpoints() {
    try {
    const endpoints = await getEndpoints(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.REST);
    console.log("Endpoints:", JSON.stringify(endpoints, null, 2));
    } catch (error) {
    console.error("Error fetching endpoints:", error);
    }
    }

    fetchEndpoints(); +
    + +
diff --git a/docs/functions/network.getEndpointsSorted.html b/docs/functions/network.getEndpointsSorted.html new file mode 100644 index 0000000..9f2e479 --- /dev/null +++ b/docs/functions/network.getEndpointsSorted.html @@ -0,0 +1,8 @@ +getEndpointsSorted | @akashnetwork/akashjs
  • Retrieves and sorts endpoints by their health status.

    +

    Parameters

    Returns Promise<{ address: string; responseTime: number | null }[]>

    A promise that resolves to an array of endpoints sorted by response time.

    +
    import { NETWORK_TYPE, ENDPOINT_TYPE, getEndpointsSorted } from "@akashnetwork/akashjs/build/network";

    const displaySortedEndpoints = async () => {
    try {
    const endpoints = await getEndpointsSorted(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.RPC);
    console.log("Sorted Endpoints:", JSON.stringify(endpoints, null, 2));
    } catch (error) {
    console.error("Error fetching sorted endpoints:", error);
    }
    };

    displaySortedEndpoints(); +
    + +
diff --git a/docs/functions/network.getMetadata.html b/docs/functions/network.getMetadata.html new file mode 100644 index 0000000..a0aa6d4 --- /dev/null +++ b/docs/functions/network.getMetadata.html @@ -0,0 +1,7 @@ +getMetadata | @akashnetwork/akashjs
  • Fetches metadata for a specified network.

    +

    Parameters

    • network: NETWORK_TYPE

      The network identifier for which to fetch metadata.

      +

    Returns Promise<INetworkMetadata>

    A promise that resolves to the network metadata.

    +
    import { NETWORK_TYPE, getMetadata } from "@akashnetwork/akashjs/build/network";

    async function displayNetworkMetadata() {
    try {
    const metadata = await getMetadata(NETWORK_TYPE.MAINNET);
    console.log("Network Metadata:", metadata);
    } catch (error) {
    console.error("Error fetching network metadata:", error);
    }
    }

    displayNetworkMetadata(); +
    + +
diff --git a/docs/functions/protoclient.createAminoMessage.html b/docs/functions/protoclient.createAminoMessage.html new file mode 100644 index 0000000..771c60f --- /dev/null +++ b/docs/functions/protoclient.createAminoMessage.html @@ -0,0 +1,5 @@ +createAminoMessage | @akashnetwork/akashjs
  • Creates an Amino message object.

    +

    Parameters

    • message: Message

      The type of the message.

      +
    • messageBody: AminoMsg

      The body of the message.

      +

    Returns { typeUrl: Message; value: AminoMsg }

    The Amino message object.

    +
diff --git a/docs/functions/protoclient.createStarGateMessage.html b/docs/functions/protoclient.createStarGateMessage.html new file mode 100644 index 0000000..3e65a59 --- /dev/null +++ b/docs/functions/protoclient.createStarGateMessage.html @@ -0,0 +1,5 @@ +createStarGateMessage | @akashnetwork/akashjs
  • Creates a Stargate message object with a fee.

    +

    Type Parameters

    • T extends keyof MessageTypes

    Parameters

    • message: T

      The type of the message.

      +
    • messageBody: MessageTypes[T]

      The body of the message.

      +

    Returns {
        fee: { amount: { amount: string; denom: string }[]; gas: string };
        message: { typeUrl: T; value: MessageTypes[T] };
    }

    The Stargate message object with a fee.

    +
diff --git a/docs/functions/rpc.getMsgClient.html b/docs/functions/rpc.getMsgClient.html new file mode 100644 index 0000000..78d9268 --- /dev/null +++ b/docs/functions/rpc.getMsgClient.html @@ -0,0 +1,6 @@ +getMsgClient | @akashnetwork/akashjs
  • Creates a message client for sending transactions to the Akash network

    +

    Parameters

    • endpoint: string

      The RPC endpoint URL to connect to

      +
    • signer: OfflineSigner

      The signer used to sign transactions

      +

    Returns Promise<SigningStargateClient>

    A client for signing and sending transactions

    +

    If connection to the endpoint fails or if there are issues with the signer

    +
diff --git a/docs/functions/rpc.getQueryClient.html b/docs/functions/rpc.getQueryClient.html new file mode 100644 index 0000000..b98df61 --- /dev/null +++ b/docs/functions/rpc.getQueryClient.html @@ -0,0 +1,5 @@ +getQueryClient | @akashnetwork/akashjs
  • Creates a query client for making read-only requests to the Akash network

    +

    Parameters

    • endpoint: string

      The RPC endpoint URL to connect to

      +

    Returns Promise<ProtobufRpcClient>

    A protobuf RPC client for queries

    +

    If connection to the endpoint fails

    +
diff --git a/docs/functions/rpc.getRpc.html b/docs/functions/rpc.getRpc.html new file mode 100644 index 0000000..c58bc4f --- /dev/null +++ b/docs/functions/rpc.getRpc.html @@ -0,0 +1,5 @@ +getRpc | @akashnetwork/akashjs
  • Gets an RPC client for interacting with the Akash network

    +

    Parameters

    • endpoint: string

      The RPC endpoint URL to connect to

      +

    Returns Promise<ProtobufRpcClient>

    A protobuf RPC client instance

    +

    If connection to the endpoint fails

    +
diff --git a/docs/functions/stargate.getAkashTypeRegistry.html b/docs/functions/stargate.getAkashTypeRegistry.html new file mode 100644 index 0000000..dac8b78 --- /dev/null +++ b/docs/functions/stargate.getAkashTypeRegistry.html @@ -0,0 +1,3 @@ +getAkashTypeRegistry | @akashnetwork/akashjs

Retrieves the Akash type registry.

+
  • Returns [string, MessageType<UnknownMessage>][]

    An array of tuples containing the type URL and the corresponding message type.

    +
diff --git a/docs/functions/stargate.getTypeUrl.html b/docs/functions/stargate.getTypeUrl.html new file mode 100644 index 0000000..57c3199 --- /dev/null +++ b/docs/functions/stargate.getTypeUrl.html @@ -0,0 +1,4 @@ +getTypeUrl | @akashnetwork/akashjs

Gets the type URL for a given message type.

+
  • Parameters

    • type: MessageType<UnknownMessage>

      The message type for which to get the URL.

      +

    Returns string

    The URL string for the specified message type.

    +
diff --git a/docs/functions/wallet.createAccount.html b/docs/functions/wallet.createAccount.html new file mode 100644 index 0000000..47fbc29 --- /dev/null +++ b/docs/functions/wallet.createAccount.html @@ -0,0 +1,6 @@ +createAccount | @akashnetwork/akashjs
  • Creates a new wallet account with a randomly generated mnemonic and returns the mnemonic and address.

    +

    Returns Promise<{ address: any; mnemonic: any }>

    The newly created wallet's mnemonic and address.

    +
    // Example usage:
    createAccount().then(({ mnemonic, address }) => {
    console.log(`Mnemonic: ${mnemonic}`);
    console.log(`Address: ${address}`);
    }); +
    + +
diff --git a/docs/functions/wallet.getAccount.html b/docs/functions/wallet.getAccount.html new file mode 100644 index 0000000..f4fcd3b --- /dev/null +++ b/docs/functions/wallet.getAccount.html @@ -0,0 +1,10 @@ +getAccount | @akashnetwork/akashjs
  • Retrieves a wallet account by address.

    +

    This function fetches the mnemonic associated with the given address from local storage +and imports the account using that mnemonic.

    +

    Parameters

    • address: string

      The address of the account to retrieve.

      +

    Returns Promise<any>

    The wallet accounts associated with the given address.

    +

    Will throw an error if the mnemonic for the given address is not found in local storage.

    +
    // Example usage:
    getAccount("akash1xyz...").then((accounts) => {
    console.log(accounts);
    }).catch((error) => {
    console.error("Error retrieving account:", error);
    }); +
    + +
diff --git a/docs/functions/wallet.getLastLoaded.html b/docs/functions/wallet.getLastLoaded.html new file mode 100644 index 0000000..f3e1123 --- /dev/null +++ b/docs/functions/wallet.getLastLoaded.html @@ -0,0 +1,3 @@ +getLastLoaded | @akashnetwork/akashjs
  • Gets the most recently loaded wallet

    +

    Returns Promise<any>

    The last loaded wallet instance

    +
diff --git a/docs/functions/wallet.importAccount.html b/docs/functions/wallet.importAccount.html new file mode 100644 index 0000000..7e6d4d0 --- /dev/null +++ b/docs/functions/wallet.importAccount.html @@ -0,0 +1,7 @@ +importAccount | @akashnetwork/akashjs
  • Imports an existing wallet using a mnemonic phrase and returns a promise with algo, pubkey, and address

    +

    Parameters

    • mnemonic: string

      The mnemonic phrase to import

      +

    Returns Promise<any>

    The imported wallet accounts

    +
    // Example usage:
    importAccount("family maximum shoulder all reduce trash across beach gun law flame bird").then((accounts) => {
    console.log(accounts);
    }); +
    + +
diff --git a/docs/hierarchy.html b/docs/hierarchy.html new file mode 100644 index 0000000..83eba62 --- /dev/null +++ b/docs/hierarchy.html @@ -0,0 +1 @@ +@akashnetwork/akashjs

@akashnetwork/akashjs

Hierarchy Summary

diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..bd85591 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,122 @@ +@akashnetwork/akashjs

@akashnetwork/akashjs

akashjs

build:main

+

Connect and communicate with the Akash Network. Pure JS library can be used in browser for unsigned transactions, and with node.js for full compatibility.

+

This repository is the home of akashjs, a library designed to facilitate interaction with the Akash Network. However, for full functionality, users will need to integrate several additional libraries. The Akash Network is built using the Cosmos SDK and utilizes the Stargate client for transaction signing and broadcasting. These packages are specifically tailored to enhance interaction with the Akash Network.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
PackageDescription
@akashnetwork/akashjsMain library for interacting with the Akash Network
@akashnetwork/akash-apiAkash API generated from Akash API for interacting with the Akash Network. Documentation is available for node and provider.
@cosmjs/stargateA client library for the Cosmos SDK 0.40+ (Stargate).
@cosmjs/proto-signingA library for signing and broadcasting transactions using the Cosmos SDK.
+

Documentation for the library is available here.

+

Compatible with modern browsers, nodejs 14+ and Webpack 5

+

To install the library, run the following command:

+
npm install @akashnetwork/akashjs
+
+ +

Or use the UMD bundle (the object returned is Window.akjs):

+
<script type="text/javascript" src="https://unpkg.com/@akashnetwork/akashjs@0.10.0/umd/akashjs.js" ></script>
+
+ +

The following example demonstrates how to fetch the state of the network.

+
import { getMetadata } from "@akashnetwork/akashjs/build/network/index.js";

console.log(JSON.stringify(await getMetadata("mainnet"), null, 2)) +
+ +

More elborate examples can be found in the examples directory.

+

This repository is primarily written in TypeScript and uses Node.js version 18. We use Webpack 5 for UMD bundling. These tools ensure that our development environment is consistent and our builds are stable.

+
    +
  1. +

    Prerequisites

    +
      +
    • Node.js 18 or higher
    • +
    • npm or yarn
    • +
    • Go 1.19 or higher (for akash-api dependency)
    • +
    +
  2. +
  3. +

    Installation

    +
  4. +
+
# Clone the repository
git clone https://github.com/akash-network/akashjs
cd akashjs

# Install dependencies
npm install

# Setup git hooks
npm run setup-git-hooks +
+ +
    +
  1. Development Commands
  2. +
+
# Watch mode for development
npm run dev:watch

# Run tests
npm run test

# Run linting
npm run lint

# Fix linting issues
npm run lint:fix

# Format code
npm run format

# Build the project
npm run build +
+ +
    +
  1. +

    TypeScript

    +
      +
    • Use strict TypeScript types
    • +
    • Avoid using any type where possible
    • +
    • Document complex types with JSDoc comments
    • +
    +
  2. +
  3. +

    Testing

    +
      +
    • Write unit tests for new features
    • +
    • Maintain test coverage
    • +
    • Run npm test before submitting PRs
    • +
    +
  4. +
  5. +

    Code Style

    +
      +
    • Follow the existing code style
    • +
    • Use Prettier for formatting
    • +
    • Follow ESLint rules
    • +
    +
  6. +
+

Our project enforces high standards of code quality and consistency through:

+
    +
  • Code Linting: ESLint analyzes code for potential errors and style issues
  • +
  • Code Formatting: Prettier ensures consistent code formatting
  • +
  • Commit Linting: Commits must follow Conventional Commits specification
  • +
  • Automated Testing: Tests run automatically on pull requests
  • +
  • Semantic Release: Automated versioning based on commit messages
  • +
  • Continuous Integration: Validates PRs and manages releases
  • +
+

To enable git hooks for local development:

+
npm run setup-git-hooks
+
+ +
    +
  1. Create a feature branch from main
  2. +
  3. Make your changes following our guidelines
  4. +
  5. Ensure all tests pass
  6. +
  7. Update documentation as needed
  8. +
  9. Submit a PR with a clear description of changes
  10. +
  11. Wait for review and address any feedback
  12. +
+
    +
  • Use the dev:watch command for live reloading during development
  • +
  • Check the examples directory for implementation references
  • +
  • Use Jest's debugging capabilities with --inspect flag
  • +
  • Set DEBUG=akashjs:* environment variable for detailed logs
  • +
+

PRs are welcome! By adhering to these guidelines and leveraging our automated systems, we can maintain a high-quality codebase and streamline our development processes.

+
diff --git a/docs/interfaces/certificate.pems.html b/docs/interfaces/certificate.pems.html new file mode 100644 index 0000000..e289620 --- /dev/null +++ b/docs/interfaces/certificate.pems.html @@ -0,0 +1,8 @@ +pems | @akashnetwork/akashjs

Interface representing the PEM-formatted certificate components

+
interface pems {
    csr: string;
    privateKey: string;
    publicKey: string;
}

Properties

Properties

csr: string

The Certificate Signing Request (CSR) in PEM format

+
privateKey: string

The private key in PEM format

+
publicKey: string

The public key in PEM format

+
diff --git a/docs/interfaces/network.INetworkMetadata.html b/docs/interfaces/network.INetworkMetadata.html new file mode 100644 index 0000000..a8b153a --- /dev/null +++ b/docs/interfaces/network.INetworkMetadata.html @@ -0,0 +1,27 @@ +INetworkMetadata | @akashnetwork/akashjs

Network metadata interface +INetworkMetadata

+
interface INetworkMetadata {
    apis: { [type: string]: { address: string }[] };
    bech32_prefix: string;
    chain_id: string;
    chain_name: string;
    codebase: {
        binaries: { [target: string]: string };
        compatible_versions: string[];
        git_repo: string;
        recommended_version: string;
    };
    daemon_name: string;
    genesis: { genesis_url: string };
    network_type: string;
    node_home: string;
    peers: {
        persistent_peers: { address: string; id: string }[];
        seeds: { address: string; id: string }[];
    };
    pretty_name: string;
    status: string;
}

Properties

apis: { [type: string]: { address: string }[] }

A mapping of API types to their respective endpoint addresses.

+
bech32_prefix: string

The prefix used for Bech32 encoded addresses on the network.

+
chain_id: string

A unique identifier for the blockchain network.

+
chain_name: string

The name of the blockchain network.

+
codebase: {
    binaries: { [target: string]: string };
    compatible_versions: string[];
    git_repo: string;
    recommended_version: string;
}

Details about the codebase of the network.

+
daemon_name: string

The name of the daemon process used by the network.

+
genesis: { genesis_url: string }

Information about the genesis block of the network.

+
network_type: string

The type of network, indicating whether it's a mainnet, testnet, or edgenet.

+
node_home: string

The directory path where the node's data is stored.

+
peers: {
    persistent_peers: { address: string; id: string }[];
    seeds: { address: string; id: string }[];
}

Information about network peers.

+
pretty_name: string

A human-readable name for the network.

+
status: string

The current operational status of the network (e.g., active, inactive).

+
diff --git a/docs/modules.html b/docs/modules.html new file mode 100644 index 0000000..752c504 --- /dev/null +++ b/docs/modules.html @@ -0,0 +1,2 @@ +@akashnetwork/akashjs
diff --git a/docs/modules/certificate.html b/docs/modules/certificate.html new file mode 100644 index 0000000..ea1cd85 --- /dev/null +++ b/docs/modules/certificate.html @@ -0,0 +1,3 @@ +certificate | @akashnetwork/akashjs

Certificate module for handling SSL/TLS certificates.

+

module:certificate

+

Interfaces

pems

Type Aliases

CertificatePemDeprecated

Functions

broadcastCertificate
createCertificate
queryCertificates
revokeCertificate
diff --git a/docs/modules/keplr.html b/docs/modules/keplr.html new file mode 100644 index 0000000..06ee721 --- /dev/null +++ b/docs/modules/keplr.html @@ -0,0 +1,3 @@ +keplr | @akashnetwork/akashjs

Keplr module for Keplr wallet integration.

+

module:keplr

+

Functions

get
getChains
getSigner
diff --git a/docs/modules/network.html b/docs/modules/network.html new file mode 100644 index 0000000..7eb83f2 --- /dev/null +++ b/docs/modules/network.html @@ -0,0 +1,3 @@ +network | @akashnetwork/akashjs

Network module for network-related operations.

+

module:network

+

Enumerations

ENDPOINT_TYPE
NETWORK_TYPE

Interfaces

INetworkMetadata

Functions

getEndpointHealthStatus
getEndpoints
getEndpointsSorted
getMetadata
diff --git a/docs/modules/protoclient.html b/docs/modules/protoclient.html new file mode 100644 index 0000000..f925958 --- /dev/null +++ b/docs/modules/protoclient.html @@ -0,0 +1,3 @@ +protoclient | @akashnetwork/akashjs

Protocol client module for protocol buffer client operations.

+

module:protoclient

+

Functions

createAminoMessage
createStarGateMessage
diff --git a/docs/modules/rpc.html b/docs/modules/rpc.html new file mode 100644 index 0000000..1565ee3 --- /dev/null +++ b/docs/modules/rpc.html @@ -0,0 +1,3 @@ +rpc | @akashnetwork/akashjs

RPC module for remote procedure calls.

+

module:rpc

+

Functions

getMsgClient
getQueryClient
getRpc
diff --git a/docs/modules/sdl.html b/docs/modules/sdl.html new file mode 100644 index 0000000..80fd391 --- /dev/null +++ b/docs/modules/sdl.html @@ -0,0 +1,3 @@ +sdl | @akashnetwork/akashjs

SDL module for handling SDL files.

+

module:sdl

+

Classes

SDL

Variables

GPU_SUPPORTED_INTERFACES
GPU_SUPPORTED_VENDORS
diff --git a/docs/modules/stargate.html b/docs/modules/stargate.html new file mode 100644 index 0000000..66252ab --- /dev/null +++ b/docs/modules/stargate.html @@ -0,0 +1,3 @@ +stargate | @akashnetwork/akashjs

Stargate module for interacting with the Cosmos SDK.

+

module:stargate

+

Enumerations

Message

Functions

getAkashTypeRegistry
getTypeUrl
diff --git a/docs/modules/wallet.html b/docs/modules/wallet.html new file mode 100644 index 0000000..a83294f --- /dev/null +++ b/docs/modules/wallet.html @@ -0,0 +1,3 @@ +wallet | @akashnetwork/akashjs

Wallet module for managing cryptocurrency wallets.

+

module:wallet

+

Variables

DEFAULT_ACCOUNT_PASSWORD
DEFAULT_ADDRESS_PREFIX

Functions

createAccount
getAccount
getLastLoaded
importAccount
diff --git a/docs/types/certificate.CertificatePemDeprecated.html b/docs/types/certificate.CertificatePemDeprecated.html new file mode 100644 index 0000000..9b42686 --- /dev/null +++ b/docs/types/certificate.CertificatePemDeprecated.html @@ -0,0 +1,3 @@ +CertificatePemDeprecated | @akashnetwork/akashjs
CertificatePemDeprecated: CertificatePem & { csr: string }

Deprecated type for CertificatePem with an additional csr field.

+

Use CertificatePem with cert instead of csr.

+
diff --git a/docs/variables/sdl.GPU_SUPPORTED_INTERFACES.html b/docs/variables/sdl.GPU_SUPPORTED_INTERFACES.html new file mode 100644 index 0000000..9624219 --- /dev/null +++ b/docs/variables/sdl.GPU_SUPPORTED_INTERFACES.html @@ -0,0 +1 @@ +GPU_SUPPORTED_INTERFACES | @akashnetwork/akashjs

Variable GPU_SUPPORTED_INTERFACESConst

GPU_SUPPORTED_INTERFACES: string[] = ...
diff --git a/docs/variables/sdl.GPU_SUPPORTED_VENDORS.html b/docs/variables/sdl.GPU_SUPPORTED_VENDORS.html new file mode 100644 index 0000000..a0f9717 --- /dev/null +++ b/docs/variables/sdl.GPU_SUPPORTED_VENDORS.html @@ -0,0 +1 @@ +GPU_SUPPORTED_VENDORS | @akashnetwork/akashjs

Variable GPU_SUPPORTED_VENDORSConst

GPU_SUPPORTED_VENDORS: string[] = ...
diff --git a/docs/variables/wallet.DEFAULT_ACCOUNT_PASSWORD.html b/docs/variables/wallet.DEFAULT_ACCOUNT_PASSWORD.html new file mode 100644 index 0000000..86556d0 --- /dev/null +++ b/docs/variables/wallet.DEFAULT_ACCOUNT_PASSWORD.html @@ -0,0 +1 @@ +DEFAULT_ACCOUNT_PASSWORD | @akashnetwork/akashjs

Variable DEFAULT_ACCOUNT_PASSWORDConst

DEFAULT_ACCOUNT_PASSWORD: "AkashNetwork"
diff --git a/docs/variables/wallet.DEFAULT_ADDRESS_PREFIX.html b/docs/variables/wallet.DEFAULT_ADDRESS_PREFIX.html new file mode 100644 index 0000000..1cf9094 --- /dev/null +++ b/docs/variables/wallet.DEFAULT_ADDRESS_PREFIX.html @@ -0,0 +1 @@ +DEFAULT_ADDRESS_PREFIX | @akashnetwork/akashjs

Variable DEFAULT_ADDRESS_PREFIXConst

DEFAULT_ADDRESS_PREFIX: "akash"
diff --git a/examples/get_state.ts b/examples/get_state.ts deleted file mode 100644 index 7e7a4d1..0000000 --- a/examples/get_state.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { getMetadata } from "@akashnetwork/akashjs/build/network"; - -async function fetchMetadata() { - try { - console.log("Fetching metadata..."); - const metadata = await getMetadata("mainnet"); - console.log(JSON.stringify(metadata, null, 2)); - } catch (error) { - console.error("Error fetching metadata:", error); - } -} - -fetchMetadata(); \ No newline at end of file diff --git a/examples/network.ts b/examples/network.ts new file mode 100644 index 0000000..b3312de --- /dev/null +++ b/examples/network.ts @@ -0,0 +1,51 @@ +import { + getEndpointHealthStatus, + getEndpointsSorted, + getMetadata, + getEndpoints, + ENDPOINT_TYPE, + NETWORK_TYPE +} from "../src/network"; + +// Example to fetch metadata about Akash Network +async function fetchMetadata() { + try { + console.log("Fetching metadata..."); + const metadata = await getMetadata(NETWORK_TYPE.MAINNET); + console.log(JSON.stringify(metadata, null, 2)); + } catch (error) { + console.error("Error fetching metadata:", error); + } +} + +// Example to fetch REST endpoints +async function fetchEndpoints() { + try { + const endpoints = await getEndpoints(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.REST); + endpoints.forEach(endpoint => { + console.log(endpoint.address); + }); + } catch (error) { + console.error("Error fetching endpoints:", error); + } +} + +// Example to check endpoint health +async function checkEndpointHealth() { + try { + const endpoints = await getEndpoints(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.REST); + const healthStatusPromises = endpoints.map(getEndpointHealthStatus(800)); + const healthStatuses = await Promise.all(healthStatusPromises); + + console.log("Endpoint Health Statuses:"); + healthStatuses.forEach(status => { + console.log(`Address: ${status.address}, Response Time: ${status.responseTime !== null ? status.responseTime + 'ms' : 'Unresponsive'}`); + }); + } catch (error) { + console.error("Error checking endpoint health:", error); + } +} + +fetchMetadata(); +fetchEndpoints(); +checkEndpointHealth(); \ No newline at end of file diff --git a/examples/wallet.ts b/examples/wallet.ts new file mode 100644 index 0000000..e45d52b --- /dev/null +++ b/examples/wallet.ts @@ -0,0 +1,31 @@ +import { + createAccount, + importAccount, + getAccount +} +from "../src/wallet"; + +// example to create a new wallet account +async function createWalletAccount() { + const account = await createAccount(); + console.log(account); +} + +// createWalletAccount(); + + +// example to import an existing wallet account with menomic family maximum shoulder all reduce trash across beach gun law flame bird +async function importWalletAccount() { + const account = await importAccount("family maximum shoulder all reduce trash across beach gun law flame bird"); + console.log(account); +} + +//importWalletAccount(); + +// example for getAccount +async function getAccountInfo() { + const account = await getAccount("akash1ek67a6maje35nruku3x7np9ewaq2msw7xf3cmt"); + console.log(account); +} + +getAccountInfo(); diff --git a/package-lock.json b/package-lock.json index 9237f30..8479c2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,7 +67,8 @@ "ts-node": "^10.0.0", "ts-proto": "^1.104.0", "tsconfig-paths": "^4.2.0", - "typescript": "^4.7.4", + "typedoc": "^0.27.5", + "typescript": "^5.7.2", "webpack": "^5.41.1", "webpack-cli": "^4.7.2" }, @@ -1135,20 +1136,6 @@ "typescript": ">=4" } }, - "node_modules/@commitlint/load/node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/@commitlint/message": { "version": "19.0.0", "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-19.0.0.tgz", @@ -1883,6 +1870,18 @@ "npm": ">=6.14.13" } }, + "node_modules/@gerrit0/mini-shiki": { + "version": "1.24.4", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.4.tgz", + "integrity": "sha512-YEHW1QeAg6UmxEmswiQbOVEg1CW22b1XUD/lNTliOsu0LD0wqoyleFMnmbTp697QE0pcadQiR5cVtbbAPncvpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-oniguruma": "^1.24.2", + "@shikijs/types": "^1.24.2", + "@shikijs/vscode-textmate": "^9.3.1" + } + }, "node_modules/@grpc/grpc-js": { "version": "1.10.7", "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.10.7.tgz", @@ -3463,6 +3462,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.2.tgz", + "integrity": "sha512-ZN6k//aDNWRJs1uKB12pturKHh7GejKugowOFGAuG7TxDRLod1Bd5JhpOikOiFqPmKjKEPtEA6mRCf7q3ulDyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.2.tgz", + "integrity": "sha512-bdeWZiDtajGLG9BudI0AHet0b6e7FbR0EsE4jpGaI0YwHm/XJunI9+3uZnzFtX65gsyJ6ngCIWUfA4NWRPnBkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.1.tgz", + "integrity": "sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==", + "dev": true, + "license": "MIT" + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -3650,6 +3678,16 @@ "@types/node": "*" } }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -3776,6 +3814,13 @@ "@types/node": "*" } }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -6457,6 +6502,19 @@ "node": ">=10.13.0" } }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/env-ci": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-11.0.0.tgz", @@ -10397,6 +10455,16 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, "node_modules/lint-staged": { "version": "15.2.2", "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.2.tgz", @@ -10815,6 +10883,13 @@ "node": "14 || >=16.14" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true, + "license": "MIT" + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -10854,6 +10929,24 @@ "tmpl": "1.0.5" } }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, "node_modules/marked": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.1.tgz", @@ -10911,6 +11004,13 @@ "safe-buffer": "^5.1.2" } }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT" + }, "node_modules/meow": { "version": "12.1.1", "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", @@ -15282,6 +15382,16 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/pure-rand": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.4.tgz", @@ -16146,21 +16256,6 @@ "node": ">=8" } }, - "node_modules/semantic-release/node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true, - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/semantic-release/node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -20120,19 +20215,79 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typedoc": { + "version": "0.27.5", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.5.tgz", + "integrity": "sha512-x+fhKJtTg4ozXwKayh/ek4wxZQI/+2hmZUdO2i2NGDBRUflDble70z+ewHod3d4gRpXSO6fnlnjbDTnJk7HlkQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@gerrit0/mini-shiki": "^1.24.0", + "lunr": "^2.3.9", + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.6.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typedoc/node_modules/yaml": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" + }, "node_modules/uglify-js": { "version": "3.17.4", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", diff --git a/package.json b/package.json index c4b0157..0ac12bf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@akashnetwork/akashjs", "version": "0.10.1", - "description": "Akash Network JS SDK", + "description": "Akash Network JavaScript SDK", "repository": { "url": "https://github.com/akash-network/akashjs" }, @@ -36,7 +36,8 @@ "test:unit": "tap --ts tests/test_*.ts && jest --selectProjects unit", "test:unit-snapshot": "tap --ts --snapshot tests/test_*.ts", "test:unit:cov": "jest --selectProjects unit --coverage", - "test:unit:watch": "jest --selectProjects unit --watch" + "test:unit:watch": "jest --selectProjects unit --watch", + "docs": "npx typedoc src/index.ts --out docs" }, "lint-staged": { "*.{js,jsx,ts,tsx}": [ @@ -60,13 +61,13 @@ "json-stable-stringify": "^1.0.2", "jsrsasign": "^11.1.0", "keytar": "^7.7.0", + "lodash": "^4.17.21", "node-fetch": "2", "pkijs": "^3.0.0", "process": "^0.11.10", "pvutils": "^1.0.17", "simple-jsonrpc-js": "^1.2.0", - "sort-json": "^2.0.1", - "lodash": "^4.17.21" + "sort-json": "^2.0.1" }, "devDependencies": { "@commitlint/cli": "^19.2.2", @@ -104,7 +105,8 @@ "ts-node": "^10.0.0", "ts-proto": "^1.104.0", "tsconfig-paths": "^4.2.0", - "typescript": "^4.7.4", + "typedoc": "^0.27.5", + "typescript": "^5.7.2", "webpack": "^5.41.1", "webpack-cli": "^4.7.2" }, diff --git a/src/index.ts b/src/index.ts index 312a4c3..e2ece4f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,13 +3,56 @@ * @module akashjs */ +/** + * Certificate module for handling SSL/TLS certificates. + * @see module:certificate + */ export * as certificate from "./certificates"; + +/** + * Stargate module for interacting with the Cosmos SDK. + * @see module:stargate + */ export * as stargate from "./stargate"; + +/** + * Keplr module for Keplr wallet integration. + * @see module:keplr + */ export * as keplr from "./keplr"; + +/** + * Wallet module for managing cryptocurrency wallets. + * @see module:wallet + */ export * as wallet from "./wallet"; + +/** + * Network module for network-related operations. + * @see module:network + */ export * as network from "./network"; + +/** + * RPC module for remote procedure calls. + * @see module:rpc + */ export * as rpc from "./rpc"; +/** + * Protocol client module for protocol buffer client operations. + * @see module:protoclient + */ export * as protoclient from "./pbclient/pbclient"; + +/** + * SDL module for handling SDL files. + * @see module:sdl + */ export * as sdl from "./sdl"; + +/** + * Error module for error handling. + * @see module:error + */ export * from "./error"; diff --git a/src/network/index.ts b/src/network/index.ts index 2a76f05..31b6404 100644 --- a/src/network/index.ts +++ b/src/network/index.ts @@ -8,15 +8,43 @@ import { performance } from "perf_hooks"; import { awaitAll, filter, map, prop, sortBy } from "../util"; /** Network type identifier */ -type NETWORK_TYPE = "mainnet" | "testnet" | "edgenet"; +export enum NETWORK_TYPE { + MAINNET = "mainnet", + TESTNET = "testnet", + EDGENET = "edgenet" +} /** Network endpoint type */ -type ENDPOINT_TYPE = "rpc" | "rest"; +export enum ENDPOINT_TYPE { + RPC = "rpc", + REST = "rest" +} /** * Network metadata interface + * @interface INetworkMetadata + * @property {string} chain_name - The name of the blockchain network. + * @property {string} status - The current operational status of the network (e.g., active, inactive). + * @property {string} network_type - The type of network, indicating whether it's a mainnet, testnet, or edgenet. + * @property {string} pretty_name - A human-readable name for the network. + * @property {string} chain_id - A unique identifier for the blockchain network. + * @property {string} bech32_prefix - The prefix used for Bech32 encoded addresses on the network. + * @property {string} daemon_name - The name of the daemon process used by the network. + * @property {string} node_home - The directory path where the node's data is stored. + * @property {object} genesis - Information about the genesis block of the network. + * @property {string} genesis.genesis_url - The URL where the genesis file can be accessed. + * @property {object} codebase - Details about the codebase of the network. + * @property {string} codebase.git_repo - The URL of the Git repository containing the network's codebase. + * @property {string} codebase.recommended_version - The recommended version of the software to run on the network. + * @property {string[]} codebase.compatible_versions - An array of software versions that are compatible with the network. + * @property {object} codebase.binaries - A mapping of target platforms to binary URLs. + * @property {object} peers - Information about network peers. + * @property {Array<{id: string, address: string}>} peers.seeds - An array of seed nodes with their IDs and addresses. + * @property {Array<{id: string, address: string}>} peers.persistent_peers - An array of persistent peers with their IDs and addresses. + * @property {object} apis - A mapping of API types to their respective endpoint addresses. + * @property {Array<{address: string}>} apis[type] - An array of API endpoint objects, each containing an address. */ -interface INetworkMetadata { +export interface INetworkMetadata { chain_name: string; status: string; network_type: string; @@ -31,82 +59,139 @@ interface INetworkMetadata { codebase: { git_repo: string; recommended_version: string; - compatible_versions: [string]; + compatible_versions: string[]; binaries: { [target: string]: string; }; }; peers: { - seeds: [ - { - id: string; - address: string; - } - ]; - persistent_peers: [ - { - id: string; - address: string; - } - ]; + seeds: Array<{ + id: string; + address: string; + }>; + persistent_peers: Array<{ + id: string; + address: string; + }>; }; apis: { - [type: string]: [{ address: string }]; + [type: string]: Array<{ address: string }>; }; } /** - * Gets metadata for a specific network - * @param {NETWORK_TYPE} network - The network to get metadata for - * @returns {Promise} The network metadata + * Fetches metadata for a specified network. + * @param {NETWORK_TYPE} network - The network identifier for which to fetch metadata. + * @returns {Promise} A promise that resolves to the network metadata. + * + * @example + * import { NETWORK_TYPE, getMetadata } from "@akashnetwork/akashjs/build/network"; + * + * async function displayNetworkMetadata() { + * try { + * const metadata = await getMetadata(NETWORK_TYPE.MAINNET); + * console.log("Network Metadata:", metadata); + * } catch (error) { + * console.error("Error fetching network metadata:", error); + * } + * } + * + * displayNetworkMetadata(); */ export async function getMetadata(network: NETWORK_TYPE): Promise { - return fetch(`https://raw.githubusercontent.com/ovrclk/net/master/${network}/meta.json`).then(res => res.json()); + const response = await fetch(`https://raw.githubusercontent.com/ovrclk/net/master/${network}/meta.json`); + return response.json(); } /** - * Retrieves endpoints for a specific network and type - * @param {NETWORK_TYPE} network - The network to get endpoints for - * @param {ENDPOINT_TYPE} type - The type of endpoint to retrieve - * @returns {Promise<{ address: string }[]>} A promise that resolves to an array of endpoint addresses + * Retrieves endpoints for a specific network and type. + * @param {NETWORK_TYPE} network - The network to get endpoints for. + * @param {ENDPOINT_TYPE} type - The type of endpoint to retrieve. + * @returns {Promise>} A promise that resolves to an array of endpoint addresses. + * + * @example + * import { NETWORK_TYPE, ENDPOINT_TYPE, getEndpoints } from "@akashnetwork/akashjs/build/network"; + * + * async function fetchEndpoints() { + * try { + * const endpoints = await getEndpoints(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.REST); + * console.log("Endpoints:", JSON.stringify(endpoints, null, 2)); + * } catch (error) { + * console.error("Error fetching endpoints:", error); + * } + * } + * + * fetchEndpoints(); */ -export function getEndpoints(network: NETWORK_TYPE, type: ENDPOINT_TYPE) { +export function getEndpoints(network: NETWORK_TYPE, type: ENDPOINT_TYPE): Promise> { return getMetadata(network).then(meta => meta.apis[type]); } /** - * Retrieves and sorts endpoints by their health status - * @param {NETWORK_TYPE} network - The network to get endpoints for - * @param {ENDPOINT_TYPE} type - The type of endpoint to retrieve - * @returns {Promise<{ address: string, responseTime: number | null }[]>} A promise that resolves to an array of endpoints sorted by response time + * Retrieves and sorts endpoints by their health status. + * @param {NETWORK_TYPE} network - The network to get endpoints for. + * @param {ENDPOINT_TYPE} type - The type of endpoint to retrieve. + * @returns {Promise>} A promise that resolves to an array of endpoints sorted by response time. + * + * @example + * import { NETWORK_TYPE, ENDPOINT_TYPE, getEndpointsSorted } from "@akashnetwork/akashjs/build/network"; + * + * const displaySortedEndpoints = async () => { + * try { + * const endpoints = await getEndpointsSorted(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.RPC); + * console.log("Sorted Endpoints:", JSON.stringify(endpoints, null, 2)); + * } catch (error) { + * console.error("Error fetching sorted endpoints:", error); + * } + * }; + * + * displaySortedEndpoints(); */ -export function getEndpointsSorted(network: NETWORK_TYPE, type: ENDPOINT_TYPE) { +export function getEndpointsSorted(network: NETWORK_TYPE, type: ENDPOINT_TYPE): Promise> { return getEndpoints(network, type) - .then(map(getEndpointHealthStatus(800))) - .then(awaitAll) - .then(filter(isNodeResponsive)) - .then(sortBy(prop("responseTime"))); + .then(endpoints => Promise.all(endpoints.map(getEndpointHealthStatus(800)))) + .then(healthStatuses => healthStatuses.filter(isNodeResponsive)) + .then(responsiveEndpoints => responsiveEndpoints.sort((a, b) => (a.responseTime ?? Infinity) - (b.responseTime ?? Infinity))); } /** - * Checks if a node is responsive based on its response time - * @param {{ responseTime: number | null }} endpoint - The endpoint to check - * @returns {boolean} True if the node is responsive, false otherwise + * Checks if a node is responsive based on its response time. + * @param {{ responseTime: number | null }} endpoint - The endpoint to check. + * @returns {boolean} True if the node is responsive, false otherwise. */ -function isNodeResponsive(endpoint: { responseTime: number | null }) { +function isNodeResponsive(endpoint: { responseTime: number | null }): boolean { return endpoint.responseTime !== null; } /** - * Returns a function that checks the health status of an endpoint - * @param {number} timeout - The timeout for the health check request - * @returns {function({ address: string }): Promise<{ address: string, responseTime: number | null }>} A function that returns a promise resolving to the endpoint's health status + * Creates a function to check the health status of an endpoint. + * @param timeout - The timeout duration for the health check request in milliseconds. + * @returns A function that takes an endpoint object and returns a promise resolving to the endpoint's health status, including its address and response time. + * + * @example + * import { getEndpointHealthStatus, getEndpoints, NETWORK_TYPE, ENDPOINT_TYPE } from "@akashnetwork/akashjs/build/network"; + * + * const checkEndpointHealth = async () => { + * try { + * const endpoints = await getEndpoints(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.RPC); + * const healthStatusPromises = endpoints.map(endpoint => getEndpointHealthStatus(800)(endpoint)); + * const healthStatuses = await Promise.all(healthStatusPromises); + * + * console.log("Endpoint Health Statuses:"); + * healthStatuses.forEach(status => { + * console.log(`Address: ${status.address}, Response Time: ${status.responseTime !== null ? status.responseTime + 'ms' : 'Unresponsive'}`); + * }); + * } catch (error) { + * console.error("Error checking endpoint health:", error); + * } + * }; + * checkEndpointHealth(); */ -function getEndpointHealthStatus(timeout: number) { +export function getEndpointHealthStatus(timeout: number) { return ({ address }: { address: string }) => { const startTime = performance.now(); - return fetch(`${address}/node_info`, { timeout }) + return fetch(`${address}/node_info`, { method: 'GET', timeout }) .then(() => ({ address, responseTime: Math.floor(performance.now() - startTime) diff --git a/src/sdl/types.ts b/src/sdl/types.ts index dd39181..a32b353 100644 --- a/src/sdl/types.ts +++ b/src/sdl/types.ts @@ -1,243 +1,492 @@ +/** + * Represents a version 2 manifest consisting of multiple groups. + */ export type v2Manifest = v2Group[]; +/** + * Represents a version 3 manifest consisting of multiple groups. + */ export type v3Manifest = v3Group[]; +/** + * Represents a group in a version 3 manifest. + */ export type v3Group = { + /** The name of the group. */ name: string; + /** The services included in the group. */ services: v3ManifestService[]; }; +/** + * Represents a group in a version 2 manifest. + */ export type v2Group = { + /** The name of the group. */ Name: string; + /** The services included in the group. */ Services: v2ManifestService[]; }; +/** + * Represents a service in a version 2 manifest. + */ export type v2ManifestService = { + /** The name of the service. */ Name: string; + /** The image used by the service. */ Image: string; + /** The command to run the service. */ Command: string[] | null; + /** The arguments for the command. */ Args: string[] | null; + /** The environment variables for the service. */ Env: string[] | null; + /** The resources required by the service. */ Resources: ResourceUnits; + /** The number of instances of the service. */ Count: number; + /** The exposed ports and protocols. */ Expose: v2ServiceExpose[]; + /** Optional parameters for the service. */ params?: v2ManifestServiceParams; }; +/** + * Represents a service in a version 3 manifest. + */ export type v3ManifestService = { + /** The name of the service. */ name: string; + /** The image used by the service. */ image: string; + /** The command to run the service. */ command: string[] | null; + /** The arguments for the command. */ args: string[] | null; + /** The environment variables for the service. */ env: string[] | null; + /** The resources required by the service. */ resources: ResourceUnits; + /** The number of instances of the service. */ count: number; + /** The exposed ports and protocols. */ expose: v3ServiceExpose[]; + /** Optional parameters for the service. */ params: v3ManifestServiceParams | null; + /** Optional credentials for accessing the service image. */ credentials: v2ServiceImageCredentials | null; }; +/** + * HTTP options for exposing a service in version 2. + */ export type v2ServiceExposeHttpOptions = { + /** Maximum body size for HTTP requests. */ MaxBodySize: number; + /** Read timeout for HTTP requests. */ ReadTimeout: number; + /** Send timeout for HTTP requests. */ SendTimeout: number; + /** Number of retries for HTTP requests. */ NextTries: number; + /** Timeout between retries for HTTP requests. */ NextTimeout: number; + /** Cases for retrying HTTP requests. */ NextCases: string[]; }; +/** + * HTTP options for exposing a service in version 3. + */ export type v3ServiceExposeHttpOptions = { + /** Maximum body size for HTTP requests. */ maxBodySize: number; + /** Read timeout for HTTP requests. */ readTimeout: number; + /** Send timeout for HTTP requests. */ sendTimeout: number; + /** Number of retries for HTTP requests. */ nextTries: number; + /** Timeout between retries for HTTP requests. */ nextTimeout: number; + /** Cases for retrying HTTP requests. */ nextCases: string[]; }; +/** + * Represents resource units. + */ export type ResourceUnits = Record; +/** + * Represents the exposure configuration for a service in version 2. + */ export type v2ServiceExpose = { + /** The port number. */ Port: number; + /** The external port number. */ ExternalPort: number; + /** The protocol used. */ Proto: string; + /** The service being exposed. */ Service: any; + /** Whether the service is globally accessible. */ Global: boolean; + /** The hosts for the service. */ Hosts: any; + /** HTTP options for the service. */ HTTPOptions: v2ServiceExposeHttpOptions; + /** The IP address for the service. */ IP: string; + /** The sequence number for the endpoint. */ EndpointSequenceNumber: number; }; +/** + * Represents the exposure configuration for a service in version 3. + */ export type v3ServiceExpose = { + /** The port number. */ port: number; + /** The external port number. */ externalPort: number; + /** The protocol used. */ proto: string; + /** The service being exposed. */ service: any; + /** Whether the service is globally accessible. */ global: boolean; + /** The hosts for the service. */ hosts: any; + /** HTTP options for the service. */ httpOptions: v3ServiceExposeHttpOptions; + /** The IP address for the service. */ ip: string; + /** The sequence number for the endpoint. */ endpointSequenceNumber: number; }; +/** + * Optional parameters for a version 2 manifest service. + */ export type v2ManifestServiceParams = { + /** Storage parameters for the service. */ Storage: v2ServiceStorageParams[]; }; +/** + * Optional parameters for a version 3 manifest service. + */ export type v3ManifestServiceParams = { + /** Storage parameters for the service. */ storage: v2ServiceStorageParams[]; }; +/** + * Represents a version 2 SDL (Service Definition Language). + */ export type v2Sdl = { + /** The services defined in the SDL. */ services: Record; + /** The profiles defined in the SDL. */ profiles: v2Profiles; + /** The deployment configurations. */ deployment: Record; + /** The endpoints defined in the SDL. */ endpoints: Record; }; +/** + * Represents a version 3 SDL (Service Definition Language). + */ export type v3Sdl = { + /** The services defined in the SDL. */ services: Record; + /** The profiles defined in the SDL. */ profiles: v3Profiles; + /** The deployment configurations. */ deployment: Record; + /** The endpoints defined in the SDL. */ endpoints: Record; }; +/** + * Represents an endpoint in version 2. + */ export type v2Endpoint = { + /** The kind of endpoint. */ kind: string; }; +/** + * Represents the exposure configuration for a service in version 2. + */ export type v2ExposeTo = { + /** The service to expose to. */ service?: string; + /** Whether the service is globally accessible. */ global?: boolean; + /** HTTP options for the service. */ http_options: v2HTTPOptions; + /** The IP address for the service. */ ip: string; }; +/** + * HTTP options for a service in version 2. + */ export type v2HTTPOptions = { + /** Maximum body size for HTTP requests. */ max_body_size: number; + /** Read timeout for HTTP requests. */ read_timeout: number; + /** Send timeout for HTTP requests. */ send_timeout: number; + /** Number of retries for HTTP requests. */ next_tries: number; + /** Timeout between retries for HTTP requests. */ next_timeout: number; + /** Cases for retrying HTTP requests. */ next_cases: string[]; }; +/** + * Represents accepted items for a service in version 2. + */ export type v2Accept = { + /** The items accepted by the service. */ items?: string[]; }; +/** + * Represents the exposure configuration for a service in version 2. + */ export type v2Expose = { + /** The port number. */ port: number; + /** The alias for the port. */ as: number; + /** The protocol used. */ proto?: string; + /** The services to expose to. */ to?: v2ExposeTo[]; + /** The accepted items for the service. */ accept: v2Accept; + /** HTTP options for the service. */ http_options: v2HTTPOptions; }; +/** + * Represents a dependency for a service in version 2. + */ export type v2Dependency = { + /** The service that is a dependency. */ service: string; }; +/** + * Represents storage parameters for a service in version 2. + */ export type v2ServiceStorageParams = { + /** The name of the storage. */ name: string; + /** The mount point for the storage. */ mount: string; + /** Whether the storage is read-only. */ readOnly: boolean; }; +/** + * Optional parameters for a service in version 2. + */ export type v2ServiceParams = { + /** Storage parameters for the service. */ storage?: Record; }; +/** + * Represents image credentials for a service in version 2. + */ export type v2ServiceImageCredentials = { + /** The host for the image. */ host: string; + /** The email associated with the credentials. */ email?: string; + /** The username for the credentials. */ username: string; + /** The password for the credentials. */ password: string; }; +/** + * Represents a service in version 2. + */ export type v2Service = { + /** The image used by the service. */ image: string; + /** The command to run the service. */ command: string[] | null; + /** The arguments for the command. */ args: string[] | null; + /** The environment variables for the service. */ env: string[] | null; + /** The exposed ports and protocols. */ expose: v2Expose[]; + /** The dependencies for the service. */ dependencies?: v2Dependency[]; + /** Optional parameters for the service. */ params?: v2ServiceParams; + /** Optional credentials for accessing the service image. */ credentials?: v2ServiceImageCredentials; }; +/** + * Represents the deployment configuration for a service in version 2. + */ export type v2ServiceDeployment = { + /** The profile used for deployment. */ profile: string; + /** The number of instances to deploy. */ count: number; }; +/** + * Represents a deployment configuration in version 2. + */ export type v2Deployment = Record; +/** + * Represents CPU attributes in version 2. + */ export type v2CPUAttributes = Record; +/** + * Represents CPU resources in version 2. + */ export type v2ResourceCPU = { + /** The units of CPU. */ units: number | string; + /** Optional attributes for the CPU. */ attributes?: v2CPUAttributes; }; +/** + * Represents memory resources in version 2. + */ export type v2ResourceMemory = { + /** The size of the memory. */ size: string; + /** Optional attributes for the memory. */ attributes?: Record; }; +/** + * Represents GPU attributes in version 3. + */ export type v3GPUAttributes = { + /** The vendor-specific attributes for the GPU. */ vendor: { [vendor: string]: Array<{ model: string; ram?: string; interface?: string }>; }; }; +/** + * Represents GPU resources in version 3. + */ export type v3ResourceGPU = { + /** The units of GPU. */ units: number | string; + /** Optional attributes for the GPU. */ attributes?: v3GPUAttributes; }; +/** + * Represents storage attributes in version 2. + */ export type v2StorageAttributes = Record; +/** + * Represents storage resources in version 2. + */ export type v2ResourceStorage = { + /** The name of the storage. */ name: string; + /** The size of the storage. */ size: string; + /** The attributes for the storage. */ attributes: v2StorageAttributes; }; +/** + * Represents an array of storage resources in version 2. + */ export type v2ResourceStorageArray = v2ResourceStorage[]; +/** + * Represents compute resources in version 2. + */ export type v2ComputeResources = { + /** The CPU resources. */ cpu: v2ResourceCPU; + /** The memory resources. */ memory: v2ResourceMemory; + /** The storage resources. */ storage: v2ResourceStorageArray | v2ResourceStorage; }; +/** + * Represents compute resources in version 3. + */ export type v3ComputeResources = { + /** The CPU resources. */ cpu: v2ResourceCPU; + /** The memory resources. */ memory: v2ResourceMemory; + /** The storage resources. */ storage: v2ResourceStorageArray | v2ResourceStorage; + /** The GPU resources. */ gpu: v3ResourceGPU; + /** The ID of the resource. */ id: number; }; +/** + * Represents a compute profile in version 2. + */ export type v2ProfileCompute = { + /** The resources for the compute profile. */ resources: v2ComputeResources; }; +/** + * Represents a compute profile in version 3. + */ export type v3ProfileCompute = { + /** The resources for the compute profile. */ resources: v3ComputeResources; }; +/** + * Represents placement attributes in version 2. + */ export type v2PlacementAttributes = Attributes; +/** + * Represents a coin in version 2. + */ export type v2Coin = { + /** The denomination of the coin. */ denom: string; + /** The value of the coin. */ value: number; + /** The amount of the coin. */ amount: number; }; +/** + * Represents placement pricing in version 2. + */ export type v2PlacementPricing = Record; export type SignedBy = { diff --git a/src/wallet/index.ts b/src/wallet/index.ts index 28f180f..7e14f68 100644 --- a/src/wallet/index.ts +++ b/src/wallet/index.ts @@ -6,16 +6,30 @@ import { Secp256k1HdWallet } from "@cosmjs/launchpad"; import keytar from "keytar"; +// define default prefix for wallet +export const DEFAULT_ADDRESS_PREFIX = "akash"; + +// default password for wallet +export const DEFAULT_ACCOUNT_PASSWORD = "AkashNetwork"; + let wallet: any; /** - * Creates a new wallet account - * @returns {Promise<{mnemonic: string, address: string}>} The newly created wallet's mnemonic and address + * Creates a new wallet account with a randomly generated mnemonic and returns the mnemonic and address. + * + * @returns {Promise<{mnemonic: string, address: string}>} The newly created wallet's mnemonic and address. + * + * @example + * // Example usage: + * createAccount().then(({ mnemonic, address }) => { + * console.log(`Mnemonic: ${mnemonic}`); + * console.log(`Address: ${address}`); + * }); */ export async function createAccount() { - wallet = await Secp256k1HdWallet.generate(undefined, { prefix: "akash" }); + wallet = await Secp256k1HdWallet.generate(undefined, { prefix: DEFAULT_ADDRESS_PREFIX }); const [{ address }] = await wallet.getAccounts(); - keytar.setPassword("AkashNetwork", address, wallet.mnemonic); + keytar.setPassword(DEFAULT_ACCOUNT_PASSWORD, address, wallet.mnemonic); return { mnemonic: wallet.mnemonic, address @@ -23,23 +37,48 @@ export async function createAccount() { } /** - * Imports an existing wallet using a mnemonic phrase + * Imports an existing wallet using a mnemonic phrase and returns a promise with algo, pubkey, and address + * * @param {string} mnemonic - The mnemonic phrase to import * @returns {Promise} The imported wallet accounts + * + * @example + * // Example usage: + * importAccount("family maximum shoulder all reduce trash across beach gun law flame bird").then((accounts) => { + * console.log(accounts); + * }); */ export async function importAccount(mnemonic: string) { - wallet = await Secp256k1HdWallet.fromMnemonic(mnemonic); + wallet = await Secp256k1HdWallet.fromMnemonic(mnemonic, { prefix: DEFAULT_ADDRESS_PREFIX }); const accounts = await wallet.getAccounts(); return accounts; } /** - * Retrieves a wallet account by address - * @param {string} address - The address of the account to retrieve - * @returns {Promise} The wallet accounts + * Retrieves a wallet account by address. + * + * This function fetches the mnemonic associated with the given address from local storage + * and imports the account using that mnemonic. + * + * @param {string} address - The address of the account to retrieve. + * @returns {Promise} The wallet accounts associated with the given address. + * + * @throws Will throw an error if the mnemonic for the given address is not found in local storage. + * + * @example + * // Example usage: + * getAccount("akash1xyz...").then((accounts) => { + * console.log(accounts); + * }).catch((error) => { + * console.error("Error retrieving account:", error); + * }); */ export async function getAccount(address: string) { - const mnemonic: any = await keytar.getPassword("AkashNetwork", address); + const mnemonic: any = await keytar.getPassword(DEFAULT_ACCOUNT_PASSWORD, address); + // if the mnemonic is not found, throw an error + if (!mnemonic) { + throw new Error("Unable to find mnemonic for the given address from the local storage"); + } return importAccount(mnemonic); } diff --git a/tsconfig.json b/tsconfig.json index 621f6ca..c41331b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,9 @@ { "extends": "./tsconfig.build.json", "include": ["./src/**/*"], - "exclude": ["./examples", "./tests", "./test", "./src/**/*.spec.ts"] + "exclude": ["./examples", "./tests", "./test", "./src/**/*.spec.ts"], + "compilerOptions": { + "module": "Node16", + "moduleResolution": "Node16" + } }