taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

commit 115e263ae3773ce51d22015ab048550f7cb59219
parent 26cbc830f9aad8178d0413e6c608b442f757d0eb
Author: Florian Dold <dold@taler.net>
Date:   Fri, 21 Aug 2026 11:07:33 +0200

TypeScript docs: correct declaration extraction and linking

Diffstat:
MMakefile | 4+---
M_exts/typescriptdomain.py | 276+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Mextract-tsdefs/README.md | 5++++-
Mextract-tsdefs/extract.ts | 523++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mextract-tsdefs/package.json | 2+-
Mextract-tsdefs/pnpm-lock.yaml | 12++++++------
Mwallet/wallet-core.md | 2086++++++++++++++++++++++++++++++++++++++-----------------------------------------
7 files changed, 1455 insertions(+), 1453 deletions(-)

diff --git a/Makefile b/Makefile @@ -55,11 +55,9 @@ diagrams: $(MAKE) -C images/ -# The html-linked builder does not support caching, so we -# remove all cached state first. html: diagrams # -W = exit 1 on warning; --keep-going = complete build anyway; -w /tmp/sphinx-warnings.log = write log to ~/warnings.log - $(SPHINXBUILD) -b html-linked $(ALLSPHINXOPTS) $(BUILDDIR)/html + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff --git a/_exts/typescriptdomain.py b/_exts/typescriptdomain.py @@ -8,32 +8,40 @@ TypeScript domain. import re -from pathlib import Path - from docutils import nodes -from typing import List, Optional, Iterable, Dict, Tuple -from typing import cast +from typing import Dict, Iterator, List, Tuple -from pygments.lexers import get_lexer_by_name from pygments.filter import Filter -from pygments.token import Literal, Text, Operator, Keyword, Name, Number -from pygments.token import Comment, Token, _TokenType -from pygments.token import * +from pygments.token import ( + Comment, + Keyword, + Name, + Number, + Operator, + Punctuation, + String, + Text, + Token, + _TokenType, +) from pygments.lexer import RegexLexer, bygroups, include from pygments.formatters import HtmlFormatter -from docutils import nodes from docutils.nodes import Element, Node from sphinx.roles import XRefRole -from sphinx.domains import Domain, ObjType, Index +from sphinx.domains import Domain, ObjType from sphinx.directives import directives +from sphinx.directives.code import ( + container_wrapper, + dedent_lines, + parse_line_num_spec, +) +from sphinx.locale import __ from sphinx.util.docutils import SphinxDirective from sphinx.util.nodes import make_refnode from sphinx.util import logging from sphinx.highlighting import PygmentsBridge -from sphinx.builders.html import StandaloneHTMLBuilder -from sphinx.pygments_styles import SphinxStyle logger = logging.getLogger(__name__) @@ -67,11 +75,12 @@ class TypeScriptDefinition(SphinxDirective): if linespec: try: nlines = len(self.content) - hl_lines = parselinenos(linespec, nlines) + hl_lines = parse_line_num_spec(linespec, nlines) if any(i >= nlines for i in hl_lines): logger.warning( - __("line number spec is out of range(1-%d): %r") - % (nlines, self.options["emphasize-lines"]), + __("line number spec is out of range(1-%d): %r"), + nlines, + self.options["emphasize-lines"], location=location, ) @@ -83,9 +92,9 @@ class TypeScriptDefinition(SphinxDirective): if "dedent" in self.options: location = self.state_machine.get_source_and_line(self.lineno) - lines = code.split("\n") + lines = code.splitlines(True) lines = dedent_lines(lines, self.options["dedent"], location=location) - code = "\n".join(lines) + code = "".join(lines) literal = nodes.literal_block(code, code) # type: Element if "linenos" in self.options or "lineno-start" in self.options: @@ -122,6 +131,12 @@ class TypeScriptDomain(Domain): name = "ts" label = "TypeScript" + object_types = { + "type": ObjType("type", "type"), + } + initial_data = { + "objects": {}, + } directives = { "def": TypeScriptDefinition, @@ -138,15 +153,11 @@ class TypeScriptDomain(Domain): } def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): - try: - info = self.objects[(str(typ), str(target))] - except KeyError: - logger.warn("type {}/{} not found".format(typ, target)) + info = self.find_object(str(typ), str(target), fromdocname) + if info is None: return None - else: - anchor = "tsref-type-{}".format(str(target)) - title = typ.upper() + " " + target - return make_refnode(builder, fromdocname, info[0], anchor, contnode, title) + title = typ.upper() + " " + target + return make_refnode(builder, fromdocname, info[0], info[1], contnode, title) def resolve_any_xref(self, env, fromdocname, builder, target, node, contnode): """Resolve the pending_xref *node* with the given *target*. @@ -161,25 +172,61 @@ class TypeScriptDomain(Domain): is the name of a role that could have created the same reference, """ ret = [] - try: - info = self.objects[("type", str(target))] - except KeyError: - pass - else: - anchor = "tsref-type-{}".format(str(target)) + info = self.find_object("type", str(target), fromdocname) + if info is not None: title = "TYPE" + " " + target - node = make_refnode(builder, fromdocname, info[0], anchor, contnode, title) + node = make_refnode(builder, fromdocname, info[0], info[1], contnode, title) ret.append(("ts:type", node)) return ret @property - def objects(self) -> Dict[Tuple[str, str], Tuple[str, str]]: - return self.data.setdefault( - "objects", {} - ) # (objtype, name) -> docname, labelid + def objects(self) -> Dict[Tuple[str, str], List[Tuple[str, str]]]: + """Map ``(object type, name)`` to all documents defining it.""" + + objects = self.data.setdefault("objects", {}) + # Environments written by the old extension stored just one tuple. + for key, value in list(objects.items()): + if isinstance(value, tuple): + objects[key] = [value] + return objects def add_object(self, objtype: str, name: str, docname: str, labelid: str) -> None: - self.objects[objtype, name] = (docname, labelid) + locations = self.objects.setdefault((objtype, name), []) + location = (docname, labelid) + if location not in locations: + locations.append(location) + + def find_object( + self, objtype: str, name: str, fromdocname: str + ) -> Tuple[str, str] | None: + locations = self.objects.get((objtype, name), []) + for location in locations: + if location[0] == fromdocname: + return location + if locations: + return sorted(locations)[0] + return None + + def clear_doc(self, docname: str) -> None: + for key, locations in list(self.objects.items()): + remaining = [location for location in locations if location[0] != docname] + if remaining: + self.objects[key] = remaining + else: + del self.objects[key] + + def merge_domaindata(self, docnames, otherdata) -> None: + for (objtype, name), locations in otherdata.get("objects", {}).items(): + if isinstance(locations, tuple): + locations = [locations] + for docname, labelid in locations: + if docname in docnames: + self.add_object(objtype, name, docname, labelid) + + def get_objects(self) -> Iterator[Tuple[str, str, str, str, str, int]]: + for (objtype, name), locations in self.objects.items(): + for docname, labelid in locations: + yield name, name, objtype, docname, labelid, 1 class BetterTypeScriptLexer(RegexLexer): @@ -212,16 +259,40 @@ class BetterTypeScriptLexer(RegexLexer): ], "badregex": [(r"\n", Text, "#pop")], "typeexp": [ - (r"[a-zA-Z0-9_?.$]+", Keyword.Type), - (r"\s+", Text), - (r"[|]", Text), - (r"\n", Text, "#pop"), - (r";", Text, "#pop"), - (r"", Text, "#pop"), + include("commentsandwhitespace"), + (r"`(?:\\.|[^`])*`", String.Backtick), + (r'"(\\\\|\\"|[^"])*"', String.Double), + (r"'(\\\\|\\'|[^'])*'", String.Single), + (r";", Punctuation, "#pop"), + # Object-property names occur inside inline type literals. Leave + # those as ordinary names; their value type remains in this state. + (r"[$a-zA-Z_][a-zA-Z0-9_$]*(?=\s*\??\s*:)", Name.Other), + (r"[$a-zA-Z_][a-zA-Z0-9_$]*(?:\.[$a-zA-Z_][a-zA-Z0-9_$]*)*", Keyword.Type), + (r"[{}()\[\],.?]", Punctuation), + (r"[|&<>=:+*\-/]", Operator), + (r"[0-9]+", Number.Integer), + (r".", Text), + ], + "heritage": [ + include("commentsandwhitespace"), + (r"{", Punctuation, "#pop"), + (r"[$a-zA-Z_][a-zA-Z0-9_$]*(?:\.[$a-zA-Z_][a-zA-Z0-9_$]*)*", Keyword.Type), + (r"[<>,.?\[\]&|]", Punctuation), + (r".", Text), ], "root": [ (r"^(?=\s|/|<!--)", Text, "slashstartsregex"), include("commentsandwhitespace"), + # TypeScript template literal types and string templates. Full + # interpolation highlighting is unnecessary here, but recognizing + # the complete literal avoids falling back to relaxed lexing. + (r"`(?:\\.|[^`])*`", String.Backtick), + # A reserved word can still be an object-property name (for + # example ``class``). Enter the type state when its colon arrives. + (r"(:)(\s*)", bygroups(Text, Text), "typeexp"), + # Resume a multi-line union/intersection after an inline object + # member caused the type state to end at its semicolon. + (r"([|&])(\s*)", bygroups(Operator, Text), "typeexp"), ( r"\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|" r"(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?", @@ -244,7 +315,7 @@ class BetterTypeScriptLexer(RegexLexer): ), ( r"(abstract|boolean|byte|char|class|const|debugger|double|enum|export|" - r"extends|final|float|goto|implements|import|int|interface|long|native|" + r"final|float|goto|import|int|interface|long|native|" r"package|private|protected|public|short|static|super|synchronized|throws|" r"transient|volatile)\b", Keyword.Reserved, @@ -268,6 +339,12 @@ class BetterTypeScriptLexer(RegexLexer): (r"\b(string|bool|number)\b", Keyword.Type), # Match stuff like: constructor (r"\b(constructor|declare|interface|as|AS)\b", Keyword.Reserved), + # Match interface/class heritage clauses. + ( + r"\b(extends|implements)(\s+)", + bygroups(Keyword.Reserved, Text), + "heritage", + ), # Match stuff like: super(argument, list) ( r"(super)(\s*)\(([a-zA-Z0-9,_?.$\s]+\s*)\)", @@ -284,7 +361,7 @@ class BetterTypeScriptLexer(RegexLexer): ), # Match stuff like: type Foo = Bar | Baz ( - r"\b(type)(\s*)([a-zA-Z0-9_?.$]+)(\s*)(=)(\s*)", + r"\b(type)(\s+)([$a-zA-Z_][a-zA-Z0-9_$]*)([^=]*)(=)(\s*)", bygroups(Keyword.Reserved, Text, Name.Other, Text, Operator, Text), "typeexp", ), @@ -305,10 +382,6 @@ token_props = {} class LinkFilter(Filter): - def __init__(self, app, **options): - self.app = app - Filter.__init__(self, **options) - def _filter_one_literal(self, ttype, value): last = 0 for m in re.finditer(literal_reg, value): @@ -329,6 +402,7 @@ class LinkFilter(Filter): t = copy_token(ttype) tok_setprop(t, "xref", value.strip()) tok_setprop(t, "is_identifier", True) + tok_setprop(t, "optional_xref", True) yield t, value elif ttype in Token.Comment: last = 0 @@ -349,6 +423,11 @@ class LinkFilter(Filter): tok_setprop(t, "caption", caption) if x0.endswith("_"): tok_setprop(t, "trailing_underscore", True) + elif x2 is None: + # A bare single-backtick span is also how Markdown/JSDoc + # writes inline code. Link it when a target exists, but + # only diagnose explicit reStructuredText references. + tok_setprop(t, "optional_xref", True) yield t, m.group(1) last = m.end() post = value[last:] @@ -359,11 +438,11 @@ class LinkFilter(Filter): _escape_html_table = { - ord("&"): u"&amp;", - ord("<"): u"&lt;", - ord(">"): u"&gt;", - ord('"'): u"&quot;", - ord("'"): u"&#39;", + ord("&"): "&amp;", + ord("<"): "&lt;", + ord(">"): "&gt;", + ord('"'): "&quot;", + ord("'"): "&#39;", } @@ -381,31 +460,17 @@ class LinkingHtmlFormatter(HtmlFormatter): return '<span style="font-weight: bolder">%s</span>' % (value,) if tok_getprop(tok, "trailing_underscore"): - logger.warn( + logger.warning( "{}:{}: code block contains xref to '{}' with unsupported trailing underscore".format( self._bridge.path, self._bridge.line, xref ) ) if tok_getprop(tok, "is_identifier"): - if xref.startswith('"'): + if not xref or xref.startswith('"'): return value if re.match("^[0-9]+$", xref) is not None: return value - if xref in ( - "number", - "object", - "string", - "boolean", - "any", - "true", - "false", - "null", - "undefined", - "Array", - "unknown", - ): - return value if self._bridge.docname is None: return value @@ -413,7 +478,16 @@ class LinkingHtmlFormatter(HtmlFormatter): return value content = caption if caption is not None else value ts = self._builder.env.get_domain("ts") - r1 = ts.objects.get(("type", xref), None) + r1 = ts.find_object("type", xref, self._bridge.docname) + # Qualified type references are currently one lexer token. Link + # ``Namespace.Member`` to the closest documented prefix if the member + # itself is not registered as a standalone declaration. + if r1 is None and tok_getprop(tok, "is_identifier") and "." in xref: + parts = xref.split(".") + for end in range(len(parts) - 1, 0, -1): + r1 = ts.find_object("type", ".".join(parts[:end]), self._bridge.docname) + if r1 is not None: + break if r1 is not None: rel_uri = ( self._builder.get_relative_uri(self._bridge.docname, r1[0]) @@ -425,6 +499,9 @@ class LinkingHtmlFormatter(HtmlFormatter): % (rel_uri, content) ) + if tok_getprop(tok, "is_identifier") and tok_getprop(tok, "optional_xref"): + return value + std = self._builder.env.get_domain("std") r2 = std.labels.get(xref.lower(), None) if r2 is not None: @@ -449,11 +526,12 @@ class LinkingHtmlFormatter(HtmlFormatter): % (rel_uri, content) ) - logger.warn( - "{}:{}: code block contains unresolved xref '{}'".format( - self._bridge.path, self._bridge.line, xref + if not tok_getprop(tok, "optional_xref"): + logger.warning( + "{}:{}: code block contains unresolved xref '{}'".format( + self._bridge.path, self._bridge.line, xref + ) ) - ) return value @@ -474,8 +552,6 @@ class LinkingHtmlFormatter(HtmlFormatter): line = "" for ttype, value in tokensource: - link = get_annotation(ttype, "link") - parts = value.translate(escape_table).split("\n") if len(parts) == 0: @@ -495,12 +571,12 @@ class LinkingHtmlFormatter(HtmlFormatter): yield 1, line + lsep -class MyPygmentsBridge(PygmentsBridge): - def __init__(self, builder, trim_doctest_flags): +class LinkingPygmentsBridge(PygmentsBridge): + def __init__(self, builder, style): self.dest = "html" - self.trim_doctest_flags = trim_doctest_flags + self.latex_engine = None self.formatter_args = { - "style": SphinxStyle, + "style": style, "_builder": builder, "_bridge": self, } @@ -513,6 +589,9 @@ class MyPygmentsBridge(PygmentsBridge): def highlight_block( self, source, lang, opts=None, force=False, location=None, **kwargs ): + self.path = None + self.line = None + self.docname = None if isinstance(location, tuple): docname, line = location self.line = line @@ -534,24 +613,21 @@ class MyPygmentsBridge(PygmentsBridge): return super().highlight_block(source, lang, opts, force, location, **kwargs) -class MyHtmlBuilder(StandaloneHTMLBuilder): - name = "html-linked" +def install_linking_highlighters(app): + """Wrap the highlighters created by any standard HTML-family builder.""" - def init_highlighter(self): - if self.config.pygments_style is not None: - style = self.config.pygments_style - elif self.theme: - style = self.theme.get_confstr("theme", "pygments_style", "none") - else: - style = "sphinx" - self.highlighter = MyPygmentsBridge(self, self.config.trim_doctest_flags) - self.dark_highlighter = None + builder = app.builder + if builder.format != "html": + return + def replace(highlighter): + if highlighter is None: + return None + style = highlighter.formatter_args["style"] + return LinkingPygmentsBridge(builder, style) -def get_annotation(tok, key): - if not hasattr(tok, "kv"): - return None - return tok.kv.get(key) + builder.highlighter = replace(builder.highlighter) + builder.dark_highlighter = replace(getattr(builder, "dark_highlighter", None)) def copy_token(tok): @@ -589,8 +665,12 @@ def setup(app): class TsrefLexer(BetterTypeScriptLexer): def __init__(self, **options): super().__init__(**options) - self.add_filter(LinkFilter(app)) + self.add_filter(LinkFilter()) app.add_lexer("tsref", TsrefLexer) app.add_domain(TypeScriptDomain) - app.add_builder(MyHtmlBuilder) + app.connect("builder-inited", install_linking_highlighters) + return { + "parallel_read_safe": True, + "parallel_write_safe": True, + } diff --git a/extract-tsdefs/README.md b/extract-tsdefs/README.md @@ -4,5 +4,8 @@ Usage: ``` pnpm install pnpm run compile -node dist/extract.js $WALLET_CORE_DIR $OUTFILENAME +node dist/extract.js /path/to/taler-typescript-core ../wallet/wallet-core.md ``` + +The first argument is the repository root (the directory containing +`packages/taler-wallet-core`), not the package directory itself. diff --git a/extract-tsdefs/extract.ts b/extract-tsdefs/extract.ts @@ -19,17 +19,17 @@ import * as fs from "fs/promises"; import * as path from "path"; import * as prettier from "prettier"; -if (process.argv.length != 4) { - console.log( - `usage: ${process.argv[0]} ${process.argv[1]} WALLET_CORE_REPO OUTFILE` +if (process.argv.length !== 4) { + console.error( + `usage: ${process.argv[0]} ${process.argv[1]} TALER_TYPESCRIPT_CORE_REPO OUTFILE`, ); process.exit(2); } -const walletRootDir = process.argv[2]; -const outfile = process.argv[3]; +const walletRootDir = path.resolve(process.argv[2]); +const outfile = path.resolve(process.argv[3]); -const walletCoreDir = path.join(walletRootDir, "packages/taler-wallet-core"); +const walletCoreDir = path.join(walletRootDir, "packages", "taler-wallet-core"); const excludedNames = new Set([ "TalerErrorCode", "WalletBackupContentV1", @@ -39,324 +39,337 @@ const excludedNames = new Set([ const configFile = ts.findConfigFile( walletCoreDir, ts.sys.fileExists, - "tsconfig.json" + "tsconfig.json", ); -if (!configFile) throw Error("tsconfig.json not found"); -const { config } = ts.readConfigFile(configFile, ts.sys.readFile); +if (!configFile) { + throw Error(`tsconfig.json not found below ${walletCoreDir}`); +} + +const configResult = ts.readConfigFile(configFile, ts.sys.readFile); +if (configResult.error) { + throw Error(formatDiagnostics([configResult.error])); +} -const { options, fileNames, errors } = ts.parseJsonConfigFileContent( - config, +const parsedConfig = ts.parseJsonConfigFileContent( + configResult.config, ts.sys, - walletCoreDir + path.dirname(configFile), + undefined, + configFile, ); +if (parsedConfig.errors.length > 0) { + throw Error(formatDiagnostics(parsedConfig.errors)); +} const program = ts.createProgram({ - options, - rootNames: fileNames, - configFileParsingDiagnostics: errors, + options: parsedConfig.options, + rootNames: parsedConfig.fileNames, + projectReferences: parsedConfig.projectReferences, }); - +const syntaxDiagnostics = program.getSyntacticDiagnostics(); +if (syntaxDiagnostics.length > 0) { + throw Error(formatDiagnostics(syntaxDiagnostics)); +} const checker = program.getTypeChecker(); +const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); -const walletApiTypesFiles = `${walletCoreDir}/src/wallet-api-types.ts`; -console.log("api types file:", walletApiTypesFiles); - -const sourceFile = program.getSourceFile(walletApiTypesFiles); - +const walletApiTypesFile = path.join( + walletCoreDir, + "src", + "wallet-api-types.ts", +); +const sourceFile = program.getSourceFile(walletApiTypesFile); if (!sourceFile) { - throw Error(); + throw Error( + `TypeScript source file is not part of the program: ${walletApiTypesFile}`, + ); } -const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); - -const fileSymbol = program.getTypeChecker().getSymbolAtLocation(sourceFile); - -const expo = fileSymbol?.exports; -if (!expo) { - throw Error(); +const fileSymbol = checker.getSymbolAtLocation(sourceFile); +if (!fileSymbol?.exports) { + throw Error(`Could not read exports from ${walletApiTypesFile}`); } +const exportedSymbols: ts.SymbolTable = fileSymbol.exports; interface PerOpGatherState { opName: string; - nameSet: Set<string>; + visitedSymbols: Set<ts.Symbol>; + declarationSymbols: Set<ts.Symbol>; group: string; - /** - * Enum member declaration in the form 'Foo = "bar"'. - */ + /** Enum member declaration in the form 'Foo = "bar"'. */ enumMemberDecl: string | undefined; } interface GatherState { - declTexts: Map<string, string>; + declTexts: Map<ts.Symbol, string>; + declNames: Map<ts.Symbol, string>; +} + +function formatDiagnostics(diagnostics: readonly ts.Diagnostic[]): string { + return ts.formatDiagnostics(diagnostics, { + getCanonicalFileName: (fileName) => fileName, + getCurrentDirectory: ts.sys.getCurrentDirectory, + getNewLine: () => ts.sys.newLine, + }); +} + +function isDefaultLibraryDeclaration(decl: ts.Declaration): boolean { + const source = decl.getSourceFile(); + return ( + source.hasNoDefaultLib || + (source.isDeclarationFile && path.basename(source.fileName).startsWith("lib.")) + ); +} + +function isDocumentedDeclaration( + decl: ts.Declaration, +): decl is + | ts.InterfaceDeclaration + | ts.EnumDeclaration + | ts.TypeAliasDeclaration + | ts.ClassDeclaration { + return ( + ts.isInterfaceDeclaration(decl) || + ts.isEnumDeclaration(decl) || + ts.isTypeAliasDeclaration(decl) || + ts.isClassDeclaration(decl) + ); } +function resolveAlias(symbol: ts.Symbol): ts.Symbol { + if (symbol.flags & ts.SymbolFlags.Alias) { + return checker.getAliasedSymbol(symbol); + } + return symbol; +} + +/** + * Enum-member references such as WalletApiOperation.InitWallet need the enum + * declaration, not a non-standalone EnumMember snippet. + */ +function declarationOwner(symbol: ts.Symbol): ts.Symbol { + const resolved = resolveAlias(symbol); + const declarations = resolved.getDeclarations(); + if (!declarations?.some(ts.isEnumMember)) { + return resolved; + } + const enumMember = declarations.find(ts.isEnumMember); + if (!enumMember) { + return resolved; + } + return checker.getSymbolAtLocation(enumMember.parent.name) ?? resolved; +} + +function printableDeclarations(symbol: ts.Symbol): ts.Declaration[] { + return (symbol.getDeclarations() ?? []).filter( + (decl) => isDocumentedDeclaration(decl) && !isDefaultLibraryDeclaration(decl), + ); +} + +/** + * Gather declarations referenced by a declaration. Resolve identifiers to + * their symbols instead of asking for the type of every syntax node: the latter + * mistakes property names for dependencies and repeatedly walks large runtime + * declarations that can never be emitted as TypeScript type definitions. + */ function gatherDecls( node: ts.Node, gatherState: GatherState, - perOpState: PerOpGatherState + perOpState: PerOpGatherState, ): void { - switch (node.kind) { - case ts.SyntaxKind.EnumDeclaration: - // Always handled via parent - return; - case ts.SyntaxKind.Identifier: - case ts.SyntaxKind.TypeReference: { - console.log(`start typeref-or-id ${node.getText()}`); - const type = checker.getTypeAtLocation(node); - if (type.flags === ts.TypeFlags.String) { - console.log("string!"); - break; - } - const symbol = type.aliasSymbol || type.symbol; - if (!symbol) { - console.log(`no type symbol for ${node.getText()}`); - break; - } - const name = symbol.name; - console.log(`symbol name: ${type.symbol?.name}`); - console.log(`alias symbol name: ${type.aliasSymbol?.name}`); - if (perOpState.nameSet.has(name)) { - console.log(`already found ${name}`); - break; - } - perOpState.nameSet.add(name); - if (excludedNames.has(name)) { - console.log("excluded!"); - break; - } - const decls = symbol.getDeclarations(); - decls?.forEach((decl) => { - const sourceFilename = decl.getSourceFile().fileName; - if (path.basename(sourceFilename).startsWith("lib.")) { - return; - } - switch (decl.kind) { - case ts.SyntaxKind.EnumMember: { - gatherDecls(decl.parent, gatherState, perOpState); - console.log("enum member", decl.getText()); - break; - } - case ts.SyntaxKind.InterfaceDeclaration: - case ts.SyntaxKind.EnumDeclaration: - case ts.SyntaxKind.TypeAliasDeclaration: { - const declText = printer.printNode( - ts.EmitHint.Unspecified, - decl, - decl.getSourceFile()! - ); - gatherState.declTexts.set(name, declText); - console.log(declText); - break; - } - case ts.SyntaxKind.TypeLiteral: - if (!type.aliasSymbol) { - // Just free-standing type literal, no need to emit! - break; + if (ts.isIdentifier(node)) { + const referenced = checker.getSymbolAtLocation(node); + if (referenced) { + const symbol = declarationOwner(referenced); + const name = symbol.getName(); + if (!perOpState.visitedSymbols.has(symbol)) { + perOpState.visitedSymbols.add(symbol); + if (!excludedNames.has(name)) { + const declarations = printableDeclarations(symbol); + if (declarations.length > 0) { + perOpState.declarationSymbols.add(symbol); + const text = declarations + .map((decl) => + printer.printNode(ts.EmitHint.Unspecified, decl, decl.getSourceFile()), + ) + .join("\n"); + gatherState.declTexts.set(symbol, text); + gatherState.declNames.set(symbol, name); + for (const decl of declarations) { + gatherDecls(decl, gatherState, perOpState); } - console.log(`got TypeLiteral for ${name}`); - const declText = printer.printNode( - ts.EmitHint.Unspecified, - decl, - decl.getSourceFile()! - ); - gatherState.declTexts.set(name, `type ${name} = ${declText};`); - console.log(declText); - break; - default: - console.log(`unknown decl kind ${ts.SyntaxKind[decl.kind]}`); - break; + } } - gatherDecls(decl, gatherState, perOpState); - console.log(`end typeref-or-id ${node.getText()}`); - }); - break; + } } - default: - break; } - console.log(`start syntax children for ${node.getText()}`); - node.forEachChild((child) => { - console.log(`syntax child: ${ts.SyntaxKind[child.kind]}`); - gatherDecls(child, gatherState, perOpState); - }); - console.log(`end syntax children for ${node.getText()}`); - //console.log(`// unknown node kind ${ts.SyntaxKind[node.kind]}`); - return; + node.forEachChild((child) => gatherDecls(child, gatherState, perOpState)); } function getOpEnumDecl(decl: ts.Declaration): string | undefined { - console.log("getting OpEnumDecl") - let enumMemberDecl: undefined | string = undefined; - function walk(node: ts.Node, level: number = 0) { - node.forEachChild((x) => { - console.log(`child kind [${level}]: ${ts.SyntaxKind[x.kind]}`); - console.log(x.getText()); - switch (x.kind) { - case ts.SyntaxKind.PropertySignature: { - const sig = x as ts.PropertySignature; - if (sig.name.getText() == "op") { - const type = checker.getTypeFromTypeNode(sig.type!); - enumMemberDecl = type.symbol.declarations![0]!.getText(); - } - break; - } + let enumMemberDecl: string | undefined; + function walk(node: ts.Node): void { + if (enumMemberDecl) { + return; + } + if (ts.isPropertySignature(node) && node.name.getText() === "op" && node.type) { + let symbol: ts.Symbol | undefined; + if (ts.isTypeReferenceNode(node.type)) { + symbol = checker.getSymbolAtLocation(node.type.typeName); + } + const member = symbol + ?.getDeclarations() + ?.find((candidate): candidate is ts.EnumMember => ts.isEnumMember(candidate)); + if (member) { + enumMemberDecl = member.getText(); + return; } - walk(x, level + 1); - }); + } + node.forEachChild(walk); } walk(decl); return enumMemberDecl; } -const main = async () => { - const f = await fs.open(outfile, "w"); +function groupFromLeadingComments(decl: ts.Declaration): string | undefined { + const source = decl.getSourceFile(); + const ranges = ts.getLeadingCommentRanges(source.getFullText(), decl.getFullStart()); + for (const range of ranges ?? []) { + const comment = source.getFullText().slice(range.pos, range.end); + const match = /\bgroup:\s*([^\r\n*]+)/.exec(comment); + if (match) { + return match[1].trim(); + } + } + return undefined; +} + +function removeGroupComment(text: string): string { + return text.replace(/^\s*\/\/\s*group:[^\r\n]*(?:\r?\n)?/m, ""); +} + +function renderDeclaration(name: string, text: string): string { + const formatted = prettier.format(text, { + semi: true, + parser: "typescript", + }); + return `\`\`\`{ts:def} ${name}\n${formatted.trimEnd()}\n\`\`\`\n`; +} + +async function main(): Promise<void> { const gatherState: GatherState = { - declTexts: new Map<string, string>(), + declTexts: new Map(), + declNames: new Map(), }; const perOpStates: PerOpGatherState[] = []; + let currentGroup = "Unknown Group"; - let currentGroup: string = "Unknown Group"; - - expo.forEach((v, k) => { - if (!v.name.endsWith("Op")) { + exportedSymbols.forEach((exportedSymbol) => { + if (!exportedSymbol.name.endsWith("Op")) { return; } - console.log(`gathering documentation for export ${v.name}`); - const decls = v.getDeclarations(); - if (!decls) { + const symbol = declarationOwner(exportedSymbol); + const declarations = printableDeclarations(symbol); + if (declarations.length === 0) { return; } - console.log(`has ${decls.length} declarations`); - decls.forEach((decl) => { - console.log(`export decl, kind ${ts.SyntaxKind[decl.kind]}`); - - const commentRanges = ts.getLeadingCommentRanges( - sourceFile.getFullText(), - decl.getFullStart() - ); - commentRanges?.forEach((r) => { - const text = sourceFile.getFullText().slice(r.pos, r.end); - console.log("comment text:", text); - const groupPrefix = "group:"; - const loc = text.indexOf(groupPrefix); - if (loc >= 0) { - const groupName = text.slice(loc + groupPrefix.length); - console.log("got new group", groupName); - currentGroup = groupName; - } - }); - - const perOpState: PerOpGatherState = { - opName: v.name, - nameSet: new Set<string>(), - group: currentGroup, - enumMemberDecl: getOpEnumDecl(decl), - }; - let declText = printer.printNode( - ts.EmitHint.Unspecified, - decl, - decl.getSourceFile()! - ); - if (perOpState.enumMemberDecl) { - declText = declText + `\n// ${perOpState.enumMemberDecl}\n`; - } - console.log("replacing group in", declText); - // Remove group comments - declText = declText.replace(/\/\/ group: [^\n]*[\n]/m, ""); - perOpState.nameSet.add(v.name); - gatherState.declTexts.set(v.name, declText); + currentGroup = + declarations + .map(groupFromLeadingComments) + .find((group): group is string => group !== undefined) ?? currentGroup; + const perOpState: PerOpGatherState = { + opName: exportedSymbol.name, + visitedSymbols: new Set([symbol]), + declarationSymbols: new Set([symbol]), + group: currentGroup, + enumMemberDecl: declarations + .map(getOpEnumDecl) + .find((member): member is string => member !== undefined), + }; + let declText = declarations + .map((decl) => + printer.printNode(ts.EmitHint.Unspecified, decl, decl.getSourceFile()), + ) + .join("\n"); + if (perOpState.enumMemberDecl) { + declText += `\n// ${perOpState.enumMemberDecl}\n`; + } + gatherState.declTexts.set(symbol, removeGroupComment(declText)); + gatherState.declNames.set(symbol, exportedSymbol.name); + for (const decl of declarations) { gatherDecls(decl, gatherState, perOpState); - perOpStates.push(perOpState); - }); + } + perOpStates.push(perOpState); }); - const allNames: Set<string> = new Set(); - - for (const g of perOpStates) { - for (const k of g.nameSet.values()) { - allNames.add(k); + const symbolsByName = new Map<string, ts.Symbol>(); + for (const [symbol, name] of gatherState.declNames) { + const previous = symbolsByName.get(name); + if (previous && previous !== symbol) { + throw Error(`Cannot emit two different TypeScript declarations named ${name}`); } + symbolsByName.set(name, symbol); } - const commonNames: Set<string> = new Set(); - - for (const name of allNames) { - let count = 0; - for (const g of perOpStates) { - for (const k of g.nameSet.values()) { - if (name === k) { - count++; - } - } - } - if (count > 1) { - console.log(`common name: ${name}`); - commonNames.add(name); + const symbolUseCounts = new Map<ts.Symbol, number>(); + for (const operation of perOpStates) { + for (const symbol of operation.declarationSymbols) { + symbolUseCounts.set(symbol, (symbolUseCounts.get(symbol) ?? 0) + 1); } } - - const groups = new Set<string>(); - for (const g of perOpStates) { - groups.add(g.group); - } - - await f.write(`# Wallet-Core API Documentation\n`); - - await f.write( - `This file is auto-generated from the [taler-typescript-core](https://git.taler.net/taler-typescript-core.git/tree/packages/taler-wallet-core/src/wallet-api-types.ts) repository.\n` + const commonSymbols = new Set( + [...symbolUseCounts] + .filter(([, count]) => count > 1) + .map(([symbol]) => symbol), ); - await f.write(`## Overview\n`); - for (const g of groups.values()) { - await f.write(`### ${g}\n`); - for (const op of perOpStates) { - if (op.group !== g) { - continue; + const groups = new Set(perOpStates.map((operation) => operation.group)); + const output: string[] = [ + "# Wallet-Core API Documentation\n", + "This file is auto-generated from the [taler-typescript-core](https://git.taler.net/taler-typescript-core.git/tree/packages/taler-wallet-core/src/wallet-api-types.ts) repository.\n", + "## Overview\n", + ]; + for (const group of groups) { + output.push(`### ${group}\n`); + for (const operation of perOpStates) { + if (operation.group === group) { + output.push(`* [${operation.opName}](#${operation.opName.toLowerCase()})\n`); } - await f.write(`* [${op.opName}](#${op.opName.toLowerCase()})\n`); } } - await f.write(`## Operation Reference\n`); - for (const g of perOpStates) { - // Not yet supported, switch to myst first! - // await f.write(`(${g.opName.toLowerCase()})=\n`); - await f.write(`### ${g.opName}\n`); - for (const name of g.nameSet.values()) { - if (commonNames.has(name)) { + output.push("## Operation Reference\n"); + for (const operation of perOpStates) { + output.push(`### ${operation.opName}\n`); + for (const symbol of operation.declarationSymbols) { + if (commonSymbols.has(symbol)) { continue; } - const text = gatherState.declTexts.get(name); - if (!text) { - continue; + const text = gatherState.declTexts.get(symbol); + const name = gatherState.declNames.get(symbol); + if (text && name) { + output.push(renderDeclaration(name, text)); } - await f.write("```typescript\n"); - const formatted = prettier.format(text, { - semi: true, - parser: "typescript", - }); - await f.write(`${formatted}\n`); - await f.write("```\n"); } - await f.write("\n"); + output.push("\n"); } - await f.write(`## Common Declarations\n`); - for (const name of commonNames.values()) { - const text = gatherState.declTexts.get(name); - if (!text) { - continue; + output.push("## Common Declarations\n"); + for (const symbol of commonSymbols) { + const text = gatherState.declTexts.get(symbol); + const name = gatherState.declNames.get(symbol); + if (text && name) { + output.push(renderDeclaration(name, text)); } - await f.write("```typescript\n"); - const formatted = prettier.format(text, { - semi: true, - parser: "typescript", - }); - await f.write(`${formatted}`); - await f.write("```\n"); } - await f.close(); -}; + await fs.writeFile(outfile, output.join("")); + console.log( + `Wrote ${gatherState.declTexts.size} declarations for ${perOpStates.length} operations to ${outfile}`, + ); +} -main(); +main().catch((error: unknown) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/extract-tsdefs/package.json b/extract-tsdefs/package.json @@ -14,6 +14,6 @@ "@types/node": "^18.8.1", "@types/prettier": "^2.7.1", "prettier": "^2.7.1", - "typescript": "^4.8.4" + "typescript": "^5.9.3" } } diff --git a/extract-tsdefs/pnpm-lock.yaml b/extract-tsdefs/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^2.7.1 version: 2.7.1 typescript: - specifier: ^4.8.4 - version: 4.8.4 + specifier: ^5.9.3 + version: 5.9.3 packages: @@ -34,9 +34,9 @@ packages: engines: {node: '>=10.13.0'} hasBin: true - typescript@4.8.4: - resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} - engines: {node: '>=4.2.0'} + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} hasBin: true snapshots: @@ -47,4 +47,4 @@ snapshots: prettier@2.7.1: {} - typescript@4.8.4: {} + typescript@5.9.3: {} diff --git a/wallet/wallet-core.md b/wallet/wallet-core.md @@ -1,29 +1,29 @@ # Wallet-Core API Documentation This file is auto-generated from the [taler-typescript-core](https://git.taler.net/taler-typescript-core.git/tree/packages/taler-wallet-core/src/wallet-api-types.ts) repository. ## Overview -### Initialization +### Initialization * [InitWalletOp](#initwalletop) * [ShutdownOp](#shutdownop) * [HintApplicationResumedOp](#hintapplicationresumedop) * [SetWalletRunConfigOp](#setwalletrunconfigop) * [GetVersionOp](#getversionop) * [HintNetworkAvailabilityOp](#hintnetworkavailabilityop) -### Generic request handling +### Generic request handling * [RetryProgressTokenNowOp](#retryprogresstokennowop) * [CancelProgressTokenOp](#cancelprogresstokenop) -### Donau +### Donau * [SetDonauOp](#setdonauop) * [GetDonauOp](#getdonauop) * [GetDonauStatementsOp](#getdonaustatementsop) -### Contacts +### Contacts * [AddContactOp](#addcontactop) * [DeleteContactOp](#deletecontactop) * [GetContactsOp](#getcontactsop) -### Taldir +### Taldir * [RegisterAliasOp](#registeraliasop) * [CompleteRegisterAliasOp](#completeregisteraliasop) * [LookupAliasOp](#lookupaliasop) -### Mailbox +### Mailbox * [RefreshMailboxOp](#refreshmailboxop) * [InitializeMailboxOp](#initializemailboxop) * [GetMailboxOp](#getmailboxop) @@ -31,13 +31,13 @@ This file is auto-generated from the [taler-typescript-core](https://git.taler.n * [DeleteMailboxMessageOp](#deletemailboxmessageop) * [AddMailboxMessageOp](#addmailboxmessageop) * [SendTalerUriMailboxMessageOp](#sendtalerurimailboxmessageop) -### Basic Wallet Information +### Basic Wallet Information * [GetBalancesOp](#getbalancesop) * [GetBalancesDetailOp](#getbalancesdetailop) * [ConvertDepositAmountOp](#convertdepositamountop) * [GetMaxDepositAmountOp](#getmaxdepositamountop) * [GetMaxPeerPushDebitAmountOp](#getmaxpeerpushdebitamountop) -### Managing Transactions +### Managing Transactions * [GetTransactionsOp](#gettransactionsop) * [GetTransactionsV2Op](#gettransactionsv2op) * [ListAssociatedRefreshesOp](#listassociatedrefreshesop) @@ -50,14 +50,14 @@ This file is auto-generated from the [taler-typescript-core](https://git.taler.n * [FailTransactionOp](#failtransactionop) * [SuspendTransactionOp](#suspendtransactionop) * [ResumeTransactionOp](#resumetransactionop) -### Withdrawals +### Withdrawals * [GetWithdrawalDetailsForAmountOp](#getwithdrawaldetailsforamountop) * [GetWithdrawalDetailsForUriOp](#getwithdrawaldetailsforuriop) * [PrepareBankIntegratedWithdrawalOp](#preparebankintegratedwithdrawalop) * [ConfirmWithdrawalOp](#confirmwithdrawalop) * [AcceptBankIntegratedWithdrawalOp](#acceptbankintegratedwithdrawalop) * [AcceptManualWithdrawalOp](#acceptmanualwithdrawalop) -### Merchant Payments +### Merchant Payments * [PreparePayForUriV2Op](#preparepayforuriv2op) * [PreparePayForTemplateV2Op](#preparepayfortemplatev2op) * [PreparePayForPaivanaOp](#preparepayforpaivanaop) @@ -68,19 +68,19 @@ This file is auto-generated from the [taler-typescript-core](https://git.taler.n * [ConfirmPayOp](#confirmpayop) * [StartRefundQueryForUriOp](#startrefundqueryforuriop) * [StartRefundQueryOp](#startrefundqueryop) -### Token family management +### Token family management * [ListDiscountsOp](#listdiscountsop) * [DeleteDiscountOp](#deletediscountop) * [ListSubscriptionsOp](#listsubscriptionsop) * [DeleteSubscriptionOp](#deletesubscriptionop) -### Global Currency management +### Global Currency management * [ListGlobalCurrencyAuditorsOp](#listglobalcurrencyauditorsop) * [ListGlobalCurrencyExchangesOp](#listglobalcurrencyexchangesop) * [AddGlobalCurrencyExchangeOp](#addglobalcurrencyexchangeop) * [AddGlobalCurrencyAuditorOp](#addglobalcurrencyauditorop) * [RemoveGlobalCurrencyExchangeOp](#removeglobalcurrencyexchangeop) * [RemoveGlobalCurrencyAuditorOp](#removeglobalcurrencyauditorop) -### Exchange Management +### Exchange Management * [CompleteExchangeBaseUrlOp](#completeexchangebaseurlop) * [ListExchangesOp](#listexchangesop) * [StartExchangeWalletKycOp](#startexchangewalletkycop) @@ -106,13 +106,13 @@ This file is auto-generated from the [taler-typescript-core](https://git.taler.n * [GetExchangeResourcesOp](#getexchangeresourcesop) * [DeleteExchangeOp](#deleteexchangeop) * [GetCurrencySpecificationOp](#getcurrencyspecificationop) -### Deposits +### Deposits * [CreateDepositGroupOp](#createdepositgroupop) * [CheckDepositOp](#checkdepositop) -### Backups +### Backups * [ExportDbToFileOp](#exportdbtofileop) * [ImportDbFromFileOp](#importdbfromfileop) -### Peer Payments +### Peer Payments * [CheckPeerPushDebitOp](#checkpeerpushdebitop) * [CheckPeerPushDebitV2Op](#checkpeerpushdebitv2op) * [InitiatePeerPushDebitOp](#initiatepeerpushdebitop) @@ -122,19 +122,19 @@ This file is auto-generated from the [taler-typescript-core](https://git.taler.n * [InitiatePeerPullCreditOp](#initiatepeerpullcreditop) * [PreparePeerPullDebitOp](#preparepeerpulldebitop) * [ConfirmPeerPullDebitOp](#confirmpeerpulldebitop) -### Data Validation and Conversion +### Data Validation and Conversion * [ValidateIbanOp](#validateibanop) * [CanonicalizeBaseUrlOp](#canonicalizebaseurlop) * [GetQrCodesForPaytoOp](#getqrcodesforpaytoop) * [ConvertIbanAccountFieldToPaytoOp](#convertibanaccountfieldtopaytoop) * [ConvertIbanPaytoToAccountFieldOp](#convertibanpaytotoaccountfieldop) * [GetBankingChoicesForPaytoOp](#getbankingchoicesforpaytoop) -### Database Management +### Database Management * [ExportDbOp](#exportdbop) * [ImportDbOp](#importdbop) * [ClearDbOp](#cleardbop) * [RecycleOp](#recycleop) -### Testing and Debugging +### Testing and Debugging * [ApplyDevExperimentOp](#applydevexperimentop) * [RunIntegrationTestOp](#runintegrationtestop) * [RunIntegrationTestV2Op](#runintegrationtestv2op) @@ -165,7 +165,7 @@ This file is auto-generated from the [taler-typescript-core](https://git.taler.n * [ForceRefreshOp](#forcerefreshop) ## Operation Reference ### InitWalletOp -```typescript +```{ts:def} InitWalletOp /** * Initialize wallet-core. * @@ -177,22 +177,20 @@ export type InitWalletOp = { response: InitResponse; }; // InitWallet = "initWallet" - ``` ### ShutdownOp -```typescript +```{ts:def} ShutdownOp export type ShutdownOp = { op: WalletApiOperation.Shutdown; request: EmptyObject; response: EmptyObject; }; // Shutdown = "shutdown" - ``` ### HintApplicationResumedOp -```typescript +```{ts:def} HintApplicationResumedOp /** * Give wallet-core a kick and restart all pending tasks. * Useful when the host application gets suspended and resumed, @@ -204,18 +202,16 @@ export type HintApplicationResumedOp = { response: HintApplicationResumedResponse; }; // HintApplicationResumed = "hintApplicationResumed" - ``` -```typescript +```{ts:def} HintApplicationResumedResponse export interface HintApplicationResumedResponse { dbWriteHealthy: boolean; dbReadHealthy: boolean; } - ``` ### SetWalletRunConfigOp -```typescript +```{ts:def} SetWalletRunConfigOp /** * Change the configuration of wallet-core. * @@ -227,75 +223,67 @@ export type SetWalletRunConfigOp = { response: InitResponse; }; // SetWalletRunConfig = "setWalletRunConfig" - ``` ### GetVersionOp -```typescript +```{ts:def} GetVersionOp export type GetVersionOp = { op: WalletApiOperation.GetVersion; request: EmptyObject; response: WalletCoreVersion; }; // GetVersion = "getVersion" - ``` ### HintNetworkAvailabilityOp -```typescript +```{ts:def} HintNetworkAvailabilityOp export type HintNetworkAvailabilityOp = { op: WalletApiOperation.HintNetworkAvailability; request: HintNetworkAvailabilityRequest; response: EmptyObject; }; // HintNetworkAvailability = "hintNetworkAvailability" - ``` -```typescript +```{ts:def} HintNetworkAvailabilityRequest export interface HintNetworkAvailabilityRequest { isNetworkAvailable: boolean; } - ``` ### RetryProgressTokenNowOp -```typescript +```{ts:def} RetryProgressTokenNowOp export type RetryProgressTokenNowOp = { op: WalletApiOperation.RetryProgressTokenNow; request: RetryProgressTokenNowRequest; response: EmptyObject; }; // RetryProgressTokenNow = "retryProgressTokenNow" - ``` -```typescript +```{ts:def} RetryProgressTokenNowRequest export interface RetryProgressTokenNowRequest { operation: string; progressToken: string; } - ``` ### CancelProgressTokenOp -```typescript +```{ts:def} CancelProgressTokenOp export type CancelProgressTokenOp = { op: WalletApiOperation.CancelProgressToken; request: CancelProgressTokenRequest; response: EmptyObject; }; // CancelProgressToken = "cancelProgressToken" - ``` -```typescript +```{ts:def} CancelProgressTokenRequest export interface CancelProgressTokenRequest { operation: string; progressToken: string; } - ``` ### SetDonauOp -```typescript +```{ts:def} SetDonauOp /** * Set the donation authority for this wallet. */ @@ -305,18 +293,16 @@ export type SetDonauOp = { response: EmptyObject; }; // SetDonau = "setDonau" - ``` -```typescript +```{ts:def} SetDonauRequest export interface SetDonauRequest { donauBaseUrl: string; taxPayerId: string; } - ``` ### GetDonauOp -```typescript +```{ts:def} GetDonauOp /** * Get the currently configured donation authority for this * wallet. @@ -327,9 +313,8 @@ export type GetDonauOp = { response: GetDonauResponse; }; // GetDonau = "getDonau" - ``` -```typescript +```{ts:def} GetDonauResponse export interface GetDonauResponse { currentDonauInfo: | { @@ -338,11 +323,10 @@ export interface GetDonauResponse { } | undefined; } - ``` ### GetDonauStatementsOp -```typescript +```{ts:def} GetDonauStatementsOp /** * Get a list of donation statements * for this wallet. @@ -356,21 +340,18 @@ export type GetDonauStatementsOp = { response: GetDonauStatementsResponse; }; // GetDonauStatements = "getDonauStatements" - ``` -```typescript +```{ts:def} GetDonauStatementsRequest export interface GetDonauStatementsRequest { donauBaseUrl?: string; } - ``` -```typescript +```{ts:def} GetDonauStatementsResponse export interface GetDonauStatementsResponse { statements: DonauStatementItem[]; } - ``` -```typescript +```{ts:def} DonauStatementItem export interface DonauStatementItem { total: AmountString; year: number; @@ -379,11 +360,10 @@ export interface DonauStatementItem { donationStatementSig: EddsaSignatureString; donauPub: EddsaPublicKeyString; } - ``` ### AddContactOp -```typescript +```{ts:def} AddContactOp /** * add contact. */ @@ -393,17 +373,15 @@ export type AddContactOp = { response: EmptyObject; }; // AddContact = "addContact" - ``` -```typescript +```{ts:def} AddContactRequest export interface AddContactRequest { contact: ContactEntry; } - ``` ### DeleteContactOp -```typescript +```{ts:def} DeleteContactOp /** * delete contact. */ @@ -413,17 +391,15 @@ export type DeleteContactOp = { response: EmptyObject; }; // DeleteContact = "deleteContact" - ``` -```typescript +```{ts:def} DeleteContactRequest export interface DeleteContactRequest { contact: ContactEntry; } - ``` ### GetContactsOp -```typescript +```{ts:def} GetContactsOp /** * Get contacts. */ @@ -433,17 +409,15 @@ export type GetContactsOp = { response: ContactListResponse; }; // GetContacts = "getContacts" - ``` -```typescript +```{ts:def} ContactListResponse export interface ContactListResponse { contacts: ContactEntry[]; } - ``` ### RegisterAliasOp -```typescript +```{ts:def} RegisterAliasOp /** * Register alias */ @@ -453,9 +427,8 @@ export type RegisterAliasOp = { response: TaldirRegistrationResponse; }; // RegisterAlias = "registerAlias" - ``` -```typescript +```{ts:def} TaldirRegistrationRequest export interface TaldirRegistrationRequest { alias: string; aliasType: string; @@ -463,23 +436,20 @@ export interface TaldirRegistrationRequest { taldirBaseUrl: string; duration: RelativeTime; } - ``` -```typescript +```{ts:def} TaldirRegistrationResponse export type TaldirRegistrationResponse = | TaldirAlreadyPaidResponse | EmptyObject; - ``` -```typescript +```{ts:def} TaldirAlreadyPaidResponse export interface TaldirAlreadyPaidResponse { valid_for: RelativeTime; } - ``` ### CompleteRegisterAliasOp -```typescript +```{ts:def} CompleteRegisterAliasOp /** * Complete alias registration */ @@ -489,9 +459,8 @@ export type CompleteRegisterAliasOp = { response: EmptyObject; }; // CompleteRegisterAlias = "completeRegisterAlias" - ``` -```typescript +```{ts:def} TaldirRegistrationCompletionRequest export interface TaldirRegistrationCompletionRequest { alias: string; aliasType: string; @@ -499,11 +468,10 @@ export interface TaldirRegistrationCompletionRequest { taldirBaseUrl: string; targetUri: string; } - ``` ### LookupAliasOp -```typescript +```{ts:def} LookupAliasOp /** * Lookup alias */ @@ -513,25 +481,22 @@ export type LookupAliasOp = { response: TaldirLookupResponse; }; // LookupAlias = "lookupAlias" - ``` -```typescript +```{ts:def} TaldirLookupRequest export interface TaldirLookupRequest { alias: string; aliasType: string; taldirBaseUrl: string; } - ``` -```typescript +```{ts:def} TaldirLookupResponse export interface TaldirLookupResponse { targetUri?: string; } - ``` ### RefreshMailboxOp -```typescript +```{ts:def} RefreshMailboxOp /** * Refresh mailbox Op. */ @@ -541,17 +506,15 @@ export type RefreshMailboxOp = { response: MailboxMessageRecordsResponse; }; // RefreshMailbox = "refreshMailbox" - ``` -```typescript +```{ts:def} MailboxMessageRecordsResponse export interface MailboxMessageRecordsResponse { messages: MailboxMessageRecord[]; } - ``` ### InitializeMailboxOp -```typescript +```{ts:def} InitializeMailboxOp /** * Initialize messages mailbox Op. */ @@ -561,11 +524,10 @@ export type InitializeMailboxOp = { response: MailboxConfiguration; }; // InitializeMailbox = "initializeMailbox" - ``` ### GetMailboxOp -```typescript +```{ts:def} GetMailboxOp /** * Get messages mailbox Op. */ @@ -575,17 +537,15 @@ export type GetMailboxOp = { response: GetMailboxResponse; }; // GetMailbox = "getMailbox" - ``` -```typescript +```{ts:def} GetMailboxResponse export interface GetMailboxResponse { mailboxConfiguration?: MailboxConfiguration; } - ``` ### GetMailboxMessagesOp -```typescript +```{ts:def} GetMailboxMessagesOp /** * Get Messages Op. */ @@ -595,17 +555,15 @@ export type GetMailboxMessagesOp = { response: MailboxMessagesResponse; }; // GetMailboxMessages = "getMailboxMessage" - ``` -```typescript +```{ts:def} MailboxMessagesResponse export interface MailboxMessagesResponse { messages: MailboxMessageRecord[]; } - ``` ### DeleteMailboxMessageOp -```typescript +```{ts:def} DeleteMailboxMessageOp /** * delete message. */ @@ -615,17 +573,15 @@ export type DeleteMailboxMessageOp = { response: EmptyObject; }; // DeleteMailboxMessage = "deleteMailboxMessage" - ``` -```typescript +```{ts:def} DeleteMailboxMessageRequest export interface DeleteMailboxMessageRequest { message: MailboxMessageRecord; } - ``` ### AddMailboxMessageOp -```typescript +```{ts:def} AddMailboxMessageOp /** * add message. */ @@ -635,17 +591,15 @@ export type AddMailboxMessageOp = { response: EmptyObject; }; // AddMailboxMessage = "addMailboxMessage" - ``` -```typescript +```{ts:def} AddMailboxMessageRequest export interface AddMailboxMessageRequest { message: MailboxMessageRecord; } - ``` ### SendTalerUriMailboxMessageOp -```typescript +```{ts:def} SendTalerUriMailboxMessageOp /** * send message. */ @@ -655,18 +609,16 @@ export type SendTalerUriMailboxMessageOp = { response: EmptyObject; }; // SendTalerUriMailboxMessage = "sendTalerUriMailboxMessage" - ``` -```typescript +```{ts:def} SendTalerUriMailboxMessageRequest export interface SendTalerUriMailboxMessageRequest { contact: ContactEntry; talerUri: string; } - ``` ### GetBalancesOp -```typescript +```{ts:def} GetBalancesOp /** * Get current wallet balance. */ @@ -676,9 +628,8 @@ export type GetBalancesOp = { response: BalancesResponse; }; // GetBalances = "getBalances" - ``` -```typescript +```{ts:def} BalancesResponse /** * Response to a getBalances request. */ @@ -689,9 +640,8 @@ export interface BalancesResponse { haveProdBalance: boolean; donauSummary?: DonauSummaryItem[]; } - ``` -```typescript +```{ts:def} WalletBalance export interface WalletBalance { scopeInfo: ScopeInfo; available: AmountString; @@ -712,18 +662,16 @@ export interface WalletBalance { */ disableDirectDeposits?: boolean; } - ``` -```typescript +```{ts:def} BalanceFlag export declare enum BalanceFlag { IncomingKyc = "incoming-kyc", IncomingAml = "incoming-aml", IncomingConfirmation = "incoming-confirmation", OutgoingKyc = "outgoing-kyc", } - ``` -```typescript +```{ts:def} DonauSummaryItem export interface DonauSummaryItem { /** Base URL of the donau service. */ donauBaseUrl: string; @@ -747,26 +695,23 @@ export interface DonauSummaryItem { */ amountStatement?: AmountString; } - ``` ### GetBalancesDetailOp -```typescript +```{ts:def} GetBalancesDetailOp export type GetBalancesDetailOp = { op: WalletApiOperation.GetBalanceDetail; request: GetBalanceDetailRequest; response: PaymentBalanceDetails; }; // GetBalanceDetail = "getBalanceDetail" - ``` -```typescript +```{ts:def} GetBalanceDetailRequest export interface GetBalanceDetailRequest { currency: string; } - ``` -```typescript +```{ts:def} PaymentBalanceDetails export interface PaymentBalanceDetails { /** * Balance of type "available" (see balance.ts for definition). @@ -814,9 +759,8 @@ export interface PaymentBalanceDetails { */ maxMerchantEffectiveDepositAmount: AmountJson; } - ``` -```typescript +```{ts:def} AmountJson /** * Non-negative financial amount. Fractional values are expressed as multiples * of 1e-8. @@ -835,11 +779,10 @@ export interface AmountJson { */ readonly currency: string; } - ``` ### ConvertDepositAmountOp -```typescript +```{ts:def} ConvertDepositAmountOp /** * @deprecated Use {@link CheckDepositOp} for a concrete instructed amount, * or {@link GetMaxDepositAmountOp} to query deposit limits. @@ -850,9 +793,8 @@ export type ConvertDepositAmountOp = { response: AmountResponse; }; // ConvertDepositAmount = "convertDepositAmount" - ``` -```typescript +```{ts:def} ConvertAmountRequest /** * @deprecated Use {@link CheckDepositRequest} for a concrete instructed * amount, or {@link GetMaxDepositAmountRequest} to query deposit limits. @@ -862,9 +804,8 @@ export interface ConvertAmountRequest { type: TransactionAmountMode; depositPaytoUri: PaytoString; } - ``` -```typescript +```{ts:def} TransactionAmountMode /** * How the amount should be interpreted in a transaction * Effective = how the balance is change @@ -876,27 +817,27 @@ export declare enum TransactionAmountMode { Effective = "effective", Raw = "raw", } - ``` -```typescript +```{ts:def} PaytoString +export type PaytoString = string; +``` +```{ts:def} AmountResponse export interface AmountResponse { effectiveAmount: AmountString; rawAmount: AmountString; } - ``` ### GetMaxDepositAmountOp -```typescript +```{ts:def} GetMaxDepositAmountOp export type GetMaxDepositAmountOp = { op: WalletApiOperation.GetMaxDepositAmount; request: GetMaxDepositAmountRequest; response: GetMaxDepositAmountResponse; }; // GetMaxDepositAmount = "getMaxDepositAmount" - ``` -```typescript +```{ts:def} GetMaxDepositAmountRequest export interface GetMaxDepositAmountRequest { /** * Currency to deposit. @@ -914,9 +855,8 @@ export interface GetMaxDepositAmountRequest { */ restrictScope?: ScopeInfo; } - ``` -```typescript +```{ts:def} GetMaxDepositAmountResponse export interface GetMaxDepositAmountResponse { /** Maximum that can be deposited immediately. */ material: DepositMaximum; @@ -925,9 +865,8 @@ export interface GetMaxDepositAmountResponse { /** Eligibility and maximum amounts for every ready same-currency exchange. */ exchangeDiagnostics: Record<string, DepositExchangeDiagnostics>; } - ``` -```typescript +```{ts:def} DepositMaximum /** Maximum amounts and fees for one coherent deposit coin selection. */ export interface DepositMaximum { /** Gross target amount passed to CheckDeposit or CreateDepositGroup. */ @@ -945,9 +884,8 @@ export interface DepositMaximum { /** Total fees incurred by this deposit selection. */ fees: DepositGroupFees; } - ``` -```typescript +```{ts:def} DepositExchangeDiagnostics export interface DepositExchangeDiagnostics { /** Maximum that can be deposited immediately. */ material: DepositMaximum; @@ -956,9 +894,8 @@ export interface DepositExchangeDiagnostics { /** Eligibility failures, in deterministic evaluation order. */ reasons: DepositEligibilityReason[]; } - ``` -```typescript +```{ts:def} DepositEligibilityReason /** Reason why a ready, same-currency exchange cannot serve a deposit. */ export type DepositEligibilityReason = | { @@ -981,20 +918,27 @@ export type DepositEligibilityReason = wireMethod: string; accountRestrictions: Record<string, AccountRestriction[]>; }; - +``` +```{ts:def} DepositEligibilityReasonType +export declare enum DepositEligibilityReasonType { + DirectDepositDisabled = "direct-deposit-disabled", + ScopeRestricted = "scope-restricted", + WireMethodUnsupported = "wire-method-unsupported", + WireFeeUnavailable = "wire-fee-unavailable", + DepositAccountRestricted = "deposit-account-restricted", +} ``` ### GetMaxPeerPushDebitAmountOp -```typescript +```{ts:def} GetMaxPeerPushDebitAmountOp export type GetMaxPeerPushDebitAmountOp = { op: WalletApiOperation.GetMaxPeerPushDebitAmount; request: GetMaxPeerPushDebitAmountRequest; response: GetMaxPeerPushDebitAmountResponse; }; // GetMaxPeerPushDebitAmount = "getMaxPeerPushDebitAmount" - ``` -```typescript +```{ts:def} GetMaxPeerPushDebitAmountRequest export interface GetMaxPeerPushDebitAmountRequest { currency: string; /** @@ -1003,19 +947,17 @@ export interface GetMaxPeerPushDebitAmountRequest { exchangeBaseUrl?: string; restrictScope?: ScopeInfo; } - ``` -```typescript +```{ts:def} GetMaxPeerPushDebitAmountResponse export interface GetMaxPeerPushDebitAmountResponse { effectiveAmount: AmountString; rawAmount: AmountString; exchangeBaseUrl?: string; } - ``` ### GetTransactionsOp -```typescript +```{ts:def} GetTransactionsOp /** * Get transactions. */ @@ -1025,9 +967,8 @@ export type GetTransactionsOp = { response: TransactionsResponse; }; // GetTransactions = "getTransactions" - ``` -```typescript +```{ts:def} TransactionsRequest export interface TransactionsRequest { /** * return only transactions in the given currency @@ -1062,20 +1003,21 @@ export interface TransactionsRequest { includeRefreshes?: boolean; filterByState?: TransactionStateFilter; } - +``` +```{ts:def} TransactionStateFilter +export type TransactionStateFilter = "nonfinal"; ``` ### GetTransactionsV2Op -```typescript +```{ts:def} GetTransactionsV2Op export type GetTransactionsV2Op = { op: WalletApiOperation.GetTransactionsV2; request: GetTransactionsV2Request; response: TransactionsResponse; }; // GetTransactionsV2 = "getTransactionsV2" - ``` -```typescript +```{ts:def} GetTransactionsV2Request export interface GetTransactionsV2Request { /** * Return only transactions in the given currency. @@ -1138,11 +1080,10 @@ export interface GetTransactionsV2Request { | "nonfinal-approved" | "nonfinal-dialog"; } - ``` ### ListAssociatedRefreshesOp -```typescript +```{ts:def} ListAssociatedRefreshesOp /** * List refresh transactions associated with another transaction. */ @@ -1152,23 +1093,20 @@ export type ListAssociatedRefreshesOp = { response: ListAssociatedRefreshesResponse; }; // ListAssociatedRefreshes = "listAssociatedRefreshes" - ``` -```typescript +```{ts:def} ListAssociatedRefreshesRequest export interface ListAssociatedRefreshesRequest { transactionId: string; } - ``` -```typescript +```{ts:def} ListAssociatedRefreshesResponse export interface ListAssociatedRefreshesResponse { transactionIds: string[]; } - ``` ### TestingGetSampleTransactionsOp -```typescript +```{ts:def} TestingGetSampleTransactionsOp /** * Get sample transactions. */ @@ -1178,20 +1116,18 @@ export type TestingGetSampleTransactionsOp = { response: TransactionsResponse; }; // TestingGetSampleTransactions = "testingGetSampleTransactions" - ``` ### GetTransactionByIdOp -```typescript +```{ts:def} GetTransactionByIdOp export type GetTransactionByIdOp = { op: WalletApiOperation.GetTransactionById; request: TransactionByIdRequest; response: Transaction; }; // GetTransactionById = "getTransactionById" - ``` -```typescript +```{ts:def} TransactionByIdRequest export interface TransactionByIdRequest { transactionId: string; /** @@ -1200,35 +1136,31 @@ export interface TransactionByIdRequest { */ includeContractTerms?: boolean; } - ``` ### ResolveTransactionReferenceOp -```typescript +```{ts:def} ResolveTransactionReferenceOp export type ResolveTransactionReferenceOp = { op: WalletApiOperation.ResolveTransactionReference; request: ResolveTransactionReferenceRequest; response: ResolveTransactionReferenceResponse; }; // ResolveTransactionReference = "resolveTransactionReference" - ``` -```typescript +```{ts:def} ResolveTransactionReferenceRequest /** Resolve a wallet-local transaction identifier to its stable identifier. */ export interface ResolveTransactionReferenceRequest { transactionReference: string; } - ``` -```typescript +```{ts:def} ResolveTransactionReferenceResponse export interface ResolveTransactionReferenceResponse { transactionId: TransactionIdStr; } - ``` ### DeleteTransactionOp -```typescript +```{ts:def} DeleteTransactionOp /** * Delete a transaction locally in the wallet. */ @@ -1238,17 +1170,15 @@ export type DeleteTransactionOp = { response: EmptyObject; }; // DeleteTransaction = "deleteTransaction" - ``` -```typescript +```{ts:def} DeleteTransactionRequest export interface DeleteTransactionRequest { transactionId: TransactionIdStr; } - ``` ### RetryTransactionOp -```typescript +```{ts:def} RetryTransactionOp /** * Immediately retry a transaction. */ @@ -1258,17 +1188,15 @@ export type RetryTransactionOp = { response: EmptyObject; }; // RetryTransaction = "retryTransaction" - ``` -```typescript +```{ts:def} RetryTransactionRequest export interface RetryTransactionRequest { transactionId: TransactionIdStr; } - ``` ### AbortTransactionOp -```typescript +```{ts:def} AbortTransactionOp /** * Abort a transaction * @@ -1280,11 +1208,10 @@ export type AbortTransactionOp = { response: EmptyObject; }; // AbortTransaction = "abortTransaction" - ``` ### FailTransactionOp -```typescript +```{ts:def} FailTransactionOp /** * Cancel aborting a transaction * @@ -1296,17 +1223,18 @@ export type FailTransactionOp = { response: EmptyObject; }; // FailTransaction = "failTransaction" - ``` -```typescript +```{ts:def} FailTransactionRequest +export interface FailTransactionRequest { + transactionId: TransactionIdStr; +} export interface FailTransactionRequest { transactionId: TransactionIdStr; } - ``` ### SuspendTransactionOp -```typescript +```{ts:def} SuspendTransactionOp /** * Suspend a transaction */ @@ -1316,11 +1244,10 @@ export type SuspendTransactionOp = { response: EmptyObject; }; // SuspendTransaction = "suspendTransaction" - ``` ### ResumeTransactionOp -```typescript +```{ts:def} ResumeTransactionOp /** * Resume a transaction */ @@ -1330,11 +1257,10 @@ export type ResumeTransactionOp = { response: EmptyObject; }; // ResumeTransaction = "resumeTransaction" - ``` ### GetWithdrawalDetailsForAmountOp -```typescript +```{ts:def} GetWithdrawalDetailsForAmountOp /** * Get details for withdrawing a particular amount (manual withdrawal). */ @@ -1344,9 +1270,8 @@ export type GetWithdrawalDetailsForAmountOp = { response: WithdrawalDetailsForAmount; }; // GetWithdrawalDetailsForAmount = "getWithdrawalDetailsForAmount" - ``` -```typescript +```{ts:def} GetWithdrawalDetailsForAmountRequest export interface GetWithdrawalDetailsForAmountRequest { exchangeBaseUrl?: string; /** @@ -1359,9 +1284,8 @@ export interface GetWithdrawalDetailsForAmountRequest { restrictAge?: number; progressToken?: string; } - ``` -```typescript +```{ts:def} WithdrawalDetailsForAmount export interface WithdrawalDetailsForAmount { /** * Exchange base URL for the withdrawal. @@ -1419,11 +1343,10 @@ export interface WithdrawalDetailsForAmount { */ paytoUris: string[]; } - ``` ### GetWithdrawalDetailsForUriOp -```typescript +```{ts:def} GetWithdrawalDetailsForUriOp /** * Get details for withdrawing via a particular taler:// URI. * @@ -1435,9 +1358,8 @@ export type GetWithdrawalDetailsForUriOp = { response: WithdrawUriInfoResponse; }; // GetWithdrawalDetailsForUri = "getWithdrawalDetailsForUri" - ``` -```typescript +```{ts:def} GetWithdrawalDetailsForUriRequest export interface GetWithdrawalDetailsForUriRequest { talerWithdrawUri: string; /** @@ -1446,11 +1368,10 @@ export interface GetWithdrawalDetailsForUriRequest { restrictAge?: number; progressToken?: string; } - ``` ### PrepareBankIntegratedWithdrawalOp -```typescript +```{ts:def} PrepareBankIntegratedWithdrawalOp /** * Prepare a bank-integrated withdrawal operation. */ @@ -1460,25 +1381,22 @@ export type PrepareBankIntegratedWithdrawalOp = { response: PrepareBankIntegratedWithdrawalResponse; }; // PrepareBankIntegratedWithdrawal = "prepareBankIntegratedWithdrawal" - ``` -```typescript +```{ts:def} PrepareBankIntegratedWithdrawalRequest export interface PrepareBankIntegratedWithdrawalRequest { talerWithdrawUri: string; progressToken?: string; } - ``` -```typescript +```{ts:def} PrepareBankIntegratedWithdrawalResponse export interface PrepareBankIntegratedWithdrawalResponse { transactionId: TransactionIdStr; info: WithdrawUriInfoResponse; } - ``` ### ConfirmWithdrawalOp -```typescript +```{ts:def} ConfirmWithdrawalOp /** * Confirm a withdrawal transaction. */ @@ -1488,9 +1406,8 @@ export type ConfirmWithdrawalOp = { response: EmptyObject; }; // ConfirmWithdrawal = "confirmWithdrawal" - ``` -```typescript +```{ts:def} ConfirmWithdrawalRequest export interface ConfirmWithdrawalRequest { transactionId: string; exchangeBaseUrl: string; @@ -1499,11 +1416,10 @@ export interface ConfirmWithdrawalRequest { restrictAge?: number; progressToken?: string; } - ``` ### AcceptBankIntegratedWithdrawalOp -```typescript +```{ts:def} AcceptBankIntegratedWithdrawalOp /** * Accept a bank-integrated withdrawal. * @@ -1515,9 +1431,8 @@ export type AcceptBankIntegratedWithdrawalOp = { response: AcceptWithdrawalResponse; }; // AcceptBankIntegratedWithdrawal = "acceptBankIntegratedWithdrawal" - ``` -```typescript +```{ts:def} AcceptBankIntegratedWithdrawalRequest export interface AcceptBankIntegratedWithdrawalRequest { talerWithdrawUri: string; exchangeBaseUrl: string; @@ -1532,18 +1447,16 @@ export interface AcceptBankIntegratedWithdrawalRequest { restrictAge?: number; progressToken?: string; } - ``` -```typescript +```{ts:def} AcceptWithdrawalResponse export interface AcceptWithdrawalResponse { confirmTransferUrl?: string; transactionId: TransactionIdStr; } - ``` ### AcceptManualWithdrawalOp -```typescript +```{ts:def} AcceptManualWithdrawalOp /** * Create a manual withdrawal. */ @@ -1553,9 +1466,8 @@ export type AcceptManualWithdrawalOp = { response: AcceptManualWithdrawalResult; }; // AcceptManualWithdrawal = "acceptManualWithdrawal" - ``` -```typescript +```{ts:def} AcceptManualWithdrawalRequest export interface AcceptManualWithdrawalRequest { exchangeBaseUrl: string; amount: AmountString; @@ -1570,9 +1482,8 @@ export interface AcceptManualWithdrawalRequest { forceReservePriv?: EddsaPrivateKeyString; progressToken?: string; } - ``` -```typescript +```{ts:def} AcceptManualWithdrawalResult export interface AcceptManualWithdrawalResult { /** * Transaction ID of the newly created withdrawal transaction. @@ -1588,11 +1499,10 @@ export interface AcceptManualWithdrawalResult { */ withdrawalAccountsList: WithdrawalExchangeAccountDetails[]; } - ``` ### PreparePayForUriV2Op -```typescript +```{ts:def} PreparePayForUriV2Op /** * Prepare to make a payment based on a taler://pay/ URI. */ @@ -1602,17 +1512,15 @@ export type PreparePayForUriV2Op = { response: PreparePayV2Result; }; // PreparePayForUriV2 = "preparePayForUriV2" - ``` -```typescript +```{ts:def} PreparePayRequest export interface PreparePayRequest { talerPayUri: string; } - ``` ### PreparePayForTemplateV2Op -```typescript +```{ts:def} PreparePayForTemplateV2Op /** * Prepare to make a payment based on a taler://pay-template/ URI. */ @@ -1622,26 +1530,23 @@ export type PreparePayForTemplateV2Op = { response: PreparePayV2Result; }; // PreparePayForTemplateV2 = "preparePayForTemplateV2" - ``` -```typescript +```{ts:def} PreparePayTemplateRequest export interface PreparePayTemplateRequest { talerPayTemplateUri: string; templateParams?: TemplateParams; progressToken?: string; } - ``` -```typescript +```{ts:def} TemplateParams export type TemplateParams = { amount?: AmountString; summary?: string; }; - ``` ### PreparePayForPaivanaOp -```typescript +```{ts:def} PreparePayForPaivanaOp /** Prepare a payment for an HTTP(S) resource protected by Paivana. */ export type PreparePayForPaivanaOp = { op: WalletApiOperation.PreparePayForPaivana; @@ -1649,25 +1554,22 @@ export type PreparePayForPaivanaOp = { response: PreparePayForPaivanaResult; }; // PreparePayForPaivana = "preparePayForPaivana" - ``` -```typescript +```{ts:def} PreparePayForPaivanaRequest export interface PreparePayForPaivanaRequest { url: string; progressToken?: string; } - ``` -```typescript +```{ts:def} PreparePayForPaivanaResult export interface PreparePayForPaivanaResult { transactionId: TransactionIdStr; paivana: PaivanaRedemption; } - ``` ### GetPaivanaCookieOp -```typescript +```{ts:def} GetPaivanaCookieOp /** Redeem a successfully paid Paivana transaction for an access cookie. */ export type GetPaivanaCookieOp = { op: WalletApiOperation.GetPaivanaCookie; @@ -1675,25 +1577,22 @@ export type GetPaivanaCookieOp = { response: GetPaivanaCookieResult; }; // GetPaivanaCookie = "getPaivanaCookie" - ``` -```typescript +```{ts:def} GetPaivanaCookieRequest export interface GetPaivanaCookieRequest { transactionId: TransactionIdStr; paivana: PaivanaRedemption; } - ``` -```typescript +```{ts:def} GetPaivanaCookieResult export interface GetPaivanaCookieResult { /** Plain Cookie request-header value, without Set-Cookie attributes. */ cookie: string; } - ``` ### GetChoicesForPaymentOp -```typescript +```{ts:def} GetChoicesForPaymentOp /** * Get a list of contract v1 choices for a given payment tx * in dialog(confirm) state, as well as additional information @@ -1712,16 +1611,14 @@ export type GetChoicesForPaymentOp = { response: GetChoicesForPaymentResult; }; // GetChoicesForPayment = "getChoicesForPayment" - ``` -```typescript +```{ts:def} GetChoicesForPaymentRequest export interface GetChoicesForPaymentRequest { transactionId: string; forcedCoinSel?: ForcedCoinSel; } - ``` -```typescript +```{ts:def} GetChoicesForPaymentResult export type GetChoicesForPaymentResult = { /** * Details for all choices in the contract. @@ -1766,15 +1663,13 @@ export type GetChoicesForPaymentResult = { */ contractTerms: MerchantContractTerms; }; - ``` -```typescript +```{ts:def} ChoiceSelectionDetail export type ChoiceSelectionDetail = | ChoiceSelectionDetailPaymentPossible | ChoiceSelectionDetailInsufficientBalance; - ``` -```typescript +```{ts:def} ChoiceSelectionDetailPaymentPossible export interface ChoiceSelectionDetailPaymentPossible { status: ChoiceSelectionDetailType.PaymentPossible; amountRaw: AmountString; @@ -1782,9 +1677,14 @@ export interface ChoiceSelectionDetailPaymentPossible { scopeInfo: ScopeInfo | undefined; tokenDetails?: PaymentTokenAvailabilityDetails; } - ``` -```typescript +```{ts:def} ChoiceSelectionDetailType +export declare enum ChoiceSelectionDetailType { + PaymentPossible = "payment-possible", + InsufficientBalance = "insufficient-balance", +} +``` +```{ts:def} PaymentTokenAvailabilityDetails export interface PaymentTokenAvailabilityDetails { /** * Number of tokens requested by the merchant. @@ -1817,97 +1717,85 @@ export interface PaymentTokenAvailabilityDetails { }; }; } - ``` -```typescript +```{ts:def} TokenAvailabilityHint export declare enum TokenAvailabilityHint { WalletTokensAvailableInsufficient = "wallet-tokens-available-insufficient", MerchantUnexpected = "merchant-unexpected", MerchantUntrusted = "merchant-untrusted", } - ``` -```typescript +```{ts:def} ChoiceSelectionDetailInsufficientBalance export interface ChoiceSelectionDetailInsufficientBalance { status: ChoiceSelectionDetailType.InsufficientBalance; amountRaw: AmountString; balanceDetails?: PaymentInsufficientBalanceDetails; tokenDetails?: PaymentTokenAvailabilityDetails; } - ``` ### SharePaymentOp -```typescript +```{ts:def} SharePaymentOp export type SharePaymentOp = { op: WalletApiOperation.SharePayment; request: SharePaymentRequest; response: SharePaymentResult; }; // SharePayment = "sharePayment" - ``` -```typescript +```{ts:def} SharePaymentRequest export interface SharePaymentRequest { merchantBaseUrl: string; orderId: string; } - ``` -```typescript +```{ts:def} SharePaymentResult export interface SharePaymentResult { privatePayUri: string; } - ``` ### CheckPayForTemplateOp -```typescript +```{ts:def} CheckPayForTemplateOp export type CheckPayForTemplateOp = { op: WalletApiOperation.CheckPayForTemplate; request: CheckPayTemplateRequest; response: CheckPayTemplateReponse; }; // CheckPayForTemplate = "checkPayForTemplate" - ``` -```typescript +```{ts:def} CheckPayTemplateRequest export interface CheckPayTemplateRequest { talerPayTemplateUri: string; progressToken?: string; } - ``` -```typescript +```{ts:def} CheckPayTemplateReponse export type CheckPayTemplateReponse = { templateDetails: WalletTemplateDetailsResponse; supportedCurrencies: string[]; }; - ``` -```typescript +```{ts:def} WalletTemplateDetailsResponse export interface WalletTemplateDetailsResponse { template_contract: TemplateContractDetails; editable_defaults?: TemplateContractDetailsDefaults; required_currency?: string; } - ``` -```typescript +```{ts:def} TemplateContractDetails export type TemplateContractDetails = | TemplateContractFixedOrder | TemplateContractInventoryCart | TemplateContractPaivana; - ``` -```typescript +```{ts:def} TemplateContractFixedOrder export interface TemplateContractFixedOrder extends TemplateContractCommon { template_type: TemplateType.FIXED_ORDER; amount?: AmountString; } - ``` -```typescript +```{ts:def} TemplateContractCommon export interface TemplateContractCommon { summary?: string; currency?: string; @@ -1916,9 +1804,15 @@ export interface TemplateContractCommon { minimum_age?: Integer; request_tip?: boolean; } - ``` -```typescript +```{ts:def} TemplateType +export declare enum TemplateType { + FIXED_ORDER = "fixed-order", + INVENTORY_CART = "inventory-cart", + PAIVANA = "paivana", +} +``` +```{ts:def} TemplateContractInventoryCart export interface TemplateContractInventoryCart extends TemplateContractCommon { template_type: TemplateType.INVENTORY_CART; selected_all?: boolean; @@ -1927,17 +1821,15 @@ export interface TemplateContractInventoryCart extends TemplateContractCommon { choose_one?: boolean; inventory_payload?: InventoryPayload; } - ``` -```typescript +```{ts:def} InventoryPayload export interface InventoryPayload { products: InventoryPayloadProduct[]; categories: InventoryPayloadCategory[]; units: InventoryPayloadUnit[]; } - ``` -```typescript +```{ts:def} InventoryPayloadProduct export interface InventoryPayloadProduct { product_id: string; product_name: string; @@ -1954,9 +1846,8 @@ export interface InventoryPayloadProduct { taxes?: Tax[]; image_hash?: string; } - ``` -```typescript +```{ts:def} InventoryPayloadCategory export interface InventoryPayloadCategory { category_id: Integer; category_name: string; @@ -1964,9 +1855,8 @@ export interface InventoryPayloadCategory { [lang_tag: string]: string; }; } - ``` -```typescript +```{ts:def} InventoryPayloadUnit export interface InventoryPayloadUnit { unit: string; unit_name_long: string; @@ -1980,17 +1870,15 @@ export interface InventoryPayloadUnit { unit_allow_fraction: boolean; unit_precision_level: Integer; } - ``` -```typescript +```{ts:def} TemplateContractPaivana export interface TemplateContractPaivana extends TemplateContractCommon { template_type: TemplateType.PAIVANA; website_regex?: string; choices: OrderChoice[]; } - ``` -```typescript +```{ts:def} OrderChoice export interface OrderChoice { amount: AmountString; description?: string; @@ -1999,38 +1887,47 @@ export interface OrderChoice { outputs?: OrderOutput[]; max_fee?: AmountString; } - ``` -```typescript +```{ts:def} OrderInput +export type OrderInput = OrderInputToken; +``` +```{ts:def} OrderInputToken export interface OrderInputToken { type: OrderInputType.Token; token_family_slug: string; count?: Integer; } - ``` -```typescript +```{ts:def} OrderInputType +export declare enum OrderInputType { + Token = "token", +} +``` +```{ts:def} OrderOutput export type OrderOutput = OrderOutputToken | OrderOutputTaxReceipt; - ``` -```typescript +```{ts:def} OrderOutputToken export interface OrderOutputToken { type: OrderOutputType.Token; token_family_slug: string; count?: Integer; valid_at?: TalerProtocolTimestamp; } - ``` -```typescript +```{ts:def} OrderOutputType +export declare enum OrderOutputType { + Token = "token", + TaxReceipt = "tax-receipt", +} +``` +```{ts:def} OrderOutputTaxReceipt export interface OrderOutputTaxReceipt { type: OrderOutputType.TaxReceipt; amount?: AmountString; donau_urls: string[]; } - ``` -```typescript +```{ts:def} TemplateContractDetailsDefaults /** * Key-value pairs matching a subset of the * fields from template_contract that are @@ -2045,11 +1942,10 @@ export interface TemplateContractDetailsDefaults { */ amount?: string; } - ``` ### ConfirmPayOp -```typescript +```{ts:def} ConfirmPayOp /** * Confirm a payment that was previously prepared with * {@link PreparePayForUriV2Op} @@ -2060,9 +1956,8 @@ export type ConfirmPayOp = { response: ConfirmPayResult; }; // ConfirmPay = "confirmPay" - ``` -```typescript +```{ts:def} ConfirmPayRequest export interface ConfirmPayRequest { transactionId: TransactionIdStr; useDonau?: boolean; @@ -2088,13 +1983,11 @@ export interface ConfirmPayRequest { */ noWait?: boolean; } - ``` -```typescript +```{ts:def} ConfirmPayResult export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending; - ``` -```typescript +```{ts:def} ConfirmPayResultDone /** * Result for confirmPay */ @@ -2103,19 +1996,23 @@ export interface ConfirmPayResultDone { contractTerms: MerchantContractTermsV0; transactionId: TransactionIdStr; } - ``` -```typescript +```{ts:def} ConfirmPayResultType +export declare enum ConfirmPayResultType { + Done = "done", + Pending = "pending", +} +``` +```{ts:def} ConfirmPayResultPending export interface ConfirmPayResultPending { type: ConfirmPayResultType.Pending; transactionId: TransactionIdStr; lastError?: TalerErrorDetail | undefined; } - ``` ### StartRefundQueryForUriOp -```typescript +```{ts:def} StartRefundQueryForUriOp /** * Check for a refund based on a taler://refund URI. */ @@ -2125,43 +2022,38 @@ export type StartRefundQueryForUriOp = { response: StartRefundQueryForUriResponse; }; // StartRefundQueryForUri = "startRefundQueryForUri" - ``` -```typescript +```{ts:def} PrepareRefundRequest export interface PrepareRefundRequest { talerRefundUri: string; } - ``` -```typescript +```{ts:def} StartRefundQueryForUriResponse export interface StartRefundQueryForUriResponse { /** * Transaction id of the *payment* where the refund query was started. */ transactionId: TransactionIdStr; } - ``` ### StartRefundQueryOp -```typescript +```{ts:def} StartRefundQueryOp export type StartRefundQueryOp = { op: WalletApiOperation.StartRefundQuery; request: StartRefundQueryRequest; response: EmptyObject; }; // StartRefundQuery = "startRefundQuery" - ``` -```typescript +```{ts:def} StartRefundQueryRequest export interface StartRefundQueryRequest { transactionId: TransactionIdStr; } - ``` ### ListDiscountsOp -```typescript +```{ts:def} ListDiscountsOp /** * List discount tokens stored in the wallet. Listed tokens * will be grouped based on token family details. @@ -2172,37 +2064,33 @@ export type ListDiscountsOp = { response: ListDiscountsResponse; }; // ListDiscounts = "listDiscounts" - ``` -```typescript +```{ts:def} ListDiscountsResponse export interface ListDiscountsResponse { discounts: DiscountListDetail[]; } - ``` ### DeleteDiscountOp -```typescript +```{ts:def} DeleteDiscountOp export type DeleteDiscountOp = { op: WalletApiOperation.DeleteDiscount; request: DeleteDiscountRequest; response: EmptyObject; }; // DeleteDiscount = "deleteDiscount" - ``` -```typescript +```{ts:def} DeleteDiscountRequest export interface DeleteDiscountRequest { /** * Hash of token family info. */ tokenFamilyHash: string; } - ``` ### ListSubscriptionsOp -```typescript +```{ts:def} ListSubscriptionsOp /** * List subscription tokens stored in the wallet. Listed tokens * will be grouped based on token family details. @@ -2213,53 +2101,50 @@ export type ListSubscriptionsOp = { response: ListSubscriptionsResponse; }; // ListSubscriptions = "listSubscriptions" - ``` -```typescript +```{ts:def} ListSubscriptionsRequest +export type ListSubscriptionsRequest = ListDiscountsRequest; +``` +```{ts:def} ListSubscriptionsResponse export interface ListSubscriptionsResponse { subscriptions: SubscriptionListDetail[]; } - ``` -```typescript +```{ts:def} SubscriptionListDetail export type SubscriptionListDetail = Omit< DiscountListDetail, "tokensAvailable" >; - ``` ### DeleteSubscriptionOp -```typescript +```{ts:def} DeleteSubscriptionOp export type DeleteSubscriptionOp = { op: WalletApiOperation.DeleteSubscription; request: DeleteSubscriptionRequest; response: EmptyObject; }; // DeleteSubscription = "deleteSubscription" - ``` -```typescript +```{ts:def} DeleteSubscriptionRequest export interface DeleteSubscriptionRequest { /** * Hash of token family info. */ tokenFamilyHash: string; } - ``` ### ListGlobalCurrencyAuditorsOp -```typescript +```{ts:def} ListGlobalCurrencyAuditorsOp export type ListGlobalCurrencyAuditorsOp = { op: WalletApiOperation.ListGlobalCurrencyAuditors; request: EmptyObject; response: ListGlobalCurrencyAuditorsResponse; }; // ListGlobalCurrencyAuditors = "listGlobalCurrencyAuditors" - ``` -```typescript +```{ts:def} ListGlobalCurrencyAuditorsResponse export interface ListGlobalCurrencyAuditorsResponse { auditors: { currency: string; @@ -2267,20 +2152,18 @@ export interface ListGlobalCurrencyAuditorsResponse { auditorPub: string; }[]; } - ``` ### ListGlobalCurrencyExchangesOp -```typescript +```{ts:def} ListGlobalCurrencyExchangesOp export type ListGlobalCurrencyExchangesOp = { op: WalletApiOperation.ListGlobalCurrencyExchanges; request: EmptyObject; response: ListGlobalCurrencyExchangesResponse; }; // ListGlobalCurrencyExchanges = "listGlobalCurrencyExchanges" - ``` -```typescript +```{ts:def} ListGlobalCurrencyExchangesResponse export interface ListGlobalCurrencyExchangesResponse { exchanges: { currency: string; @@ -2288,87 +2171,78 @@ export interface ListGlobalCurrencyExchangesResponse { exchangeMasterPub: string; }[]; } - ``` ### AddGlobalCurrencyExchangeOp -```typescript +```{ts:def} AddGlobalCurrencyExchangeOp export type AddGlobalCurrencyExchangeOp = { op: WalletApiOperation.AddGlobalCurrencyExchange; request: AddGlobalCurrencyExchangeRequest; response: EmptyObject; }; // AddGlobalCurrencyExchange = "addGlobalCurrencyExchange" - ``` -```typescript +```{ts:def} AddGlobalCurrencyExchangeRequest export interface AddGlobalCurrencyExchangeRequest { currency: string; exchangeBaseUrl: string; exchangeMasterPub: string; } - ``` ### AddGlobalCurrencyAuditorOp -```typescript +```{ts:def} AddGlobalCurrencyAuditorOp export type AddGlobalCurrencyAuditorOp = { op: WalletApiOperation.AddGlobalCurrencyAuditor; request: AddGlobalCurrencyAuditorRequest; response: EmptyObject; }; // AddGlobalCurrencyAuditor = "addGlobalCurrencyAuditor" - ``` -```typescript +```{ts:def} AddGlobalCurrencyAuditorRequest export interface AddGlobalCurrencyAuditorRequest { currency: string; auditorBaseUrl: string; auditorPub: string; } - ``` ### RemoveGlobalCurrencyExchangeOp -```typescript +```{ts:def} RemoveGlobalCurrencyExchangeOp export type RemoveGlobalCurrencyExchangeOp = { op: WalletApiOperation.RemoveGlobalCurrencyExchange; request: RemoveGlobalCurrencyExchangeRequest; response: EmptyObject; }; // RemoveGlobalCurrencyExchange = "removeGlobalCurrencyExchange" - ``` -```typescript +```{ts:def} RemoveGlobalCurrencyExchangeRequest export interface RemoveGlobalCurrencyExchangeRequest { currency: string; exchangeBaseUrl: string; exchangeMasterPub: string; } - ``` ### RemoveGlobalCurrencyAuditorOp -```typescript +```{ts:def} RemoveGlobalCurrencyAuditorOp export type RemoveGlobalCurrencyAuditorOp = { op: WalletApiOperation.RemoveGlobalCurrencyAuditor; request: RemoveGlobalCurrencyAuditorRequest; response: EmptyObject; }; // RemoveGlobalCurrencyAuditor = "removeGlobalCurrencyAuditor" - ``` -```typescript +```{ts:def} RemoveGlobalCurrencyAuditorRequest export interface RemoveGlobalCurrencyAuditorRequest { currency: string; auditorBaseUrl: string; auditorPub: string; } - ``` ### CompleteExchangeBaseUrlOp -```typescript +```{ts:def} CompleteExchangeBaseUrlOp /** * Force a refresh on coins where it would not * be necessary. @@ -2379,16 +2253,14 @@ export type CompleteExchangeBaseUrlOp = { response: CompleteBaseUrlResult; }; // CompleteExchangeBaseUrl = "completeExchangeBaseUrl" - ``` -```typescript +```{ts:def} CompleteBaseUrlRequest export interface CompleteBaseUrlRequest { url: string; progressToken?: string; } - ``` -```typescript +```{ts:def} CompleteBaseUrlResult export type CompleteBaseUrlResult = | { /** @@ -2415,11 +2287,10 @@ export type CompleteBaseUrlResult = */ suggestions?: string[]; }; - ``` ### ListExchangesOp -```typescript +```{ts:def} ListExchangesOp /** * List exchanges known to the wallet. */ @@ -2429,9 +2300,8 @@ export type ListExchangesOp = { response: ExchangesListResponse; }; // ListExchanges = "listExchanges" - ``` -```typescript +```{ts:def} ListExchangesRequest export interface ListExchangesRequest { /** * Filter results to only include exchanges in the given scope. @@ -2448,48 +2318,42 @@ export interface ListExchangesRequest { */ filterByType?: ExchangeType; } - ``` -```typescript +```{ts:def} ExchangeType export type ExchangeType = "demo" | "prod"; - ``` -```typescript +```{ts:def} ExchangesListResponse export interface ExchangesListResponse { exchanges: ExchangeListItem[]; } - ``` ### StartExchangeWalletKycOp -```typescript +```{ts:def} StartExchangeWalletKycOp export type StartExchangeWalletKycOp = { op: WalletApiOperation.StartExchangeWalletKyc; request: StartExchangeWalletKycRequest; response: EmptyObject; }; // StartExchangeWalletKyc = "startExchangeWalletKyc" - ``` -```typescript +```{ts:def} StartExchangeWalletKycRequest export interface StartExchangeWalletKycRequest { exchangeBaseUrl: string; amount: AmountString; } - ``` ### TestingWaitExchangeWalletKycOp -```typescript +```{ts:def} TestingWaitExchangeWalletKycOp export type TestingWaitExchangeWalletKycOp = { op: WalletApiOperation.TestingWaitExchangeWalletKyc; request: TestingWaitWalletKycRequest; response: EmptyObject; }; // TestingWaitExchangeWalletKyc = "testingWaitWalletKyc" - ``` -```typescript +```{ts:def} TestingWaitWalletKycRequest export interface TestingWaitWalletKycRequest { exchangeBaseUrl: string; amount: AmountString; @@ -2500,11 +2364,10 @@ export interface TestingWaitWalletKycRequest { */ passed: boolean; } - ``` ### TestingPlanMigrateExchangeBaseUrlOp -```typescript +```{ts:def} TestingPlanMigrateExchangeBaseUrlOp /** * Enable migration from an old exchange base URL to a new * exchange base URL. @@ -2518,18 +2381,16 @@ export type TestingPlanMigrateExchangeBaseUrlOp = { response: EmptyObject; }; // TestingPlanMigrateExchangeBaseUrl = "testingPlanMigrateExchangeBaseUrl" - ``` -```typescript +```{ts:def} TestingPlanMigrateExchangeBaseUrlRequest export interface TestingPlanMigrateExchangeBaseUrlRequest { oldExchangeBaseUrl: string; newExchangeBaseUrl: string; } - ``` ### PrepareWithdrawExchangeOp -```typescript +```{ts:def} PrepareWithdrawExchangeOp /** * Prepare for withdrawing via a taler://withdraw-exchange URI. */ @@ -2539,9 +2400,8 @@ export type PrepareWithdrawExchangeOp = { response: PrepareWithdrawExchangeResponse; }; // PrepareWithdrawExchange = "prepareWithdrawExchange" - ``` -```typescript +```{ts:def} PrepareWithdrawExchangeRequest export interface PrepareWithdrawExchangeRequest { /** * A taler://withdraw-exchange URI. @@ -2549,9 +2409,8 @@ export interface PrepareWithdrawExchangeRequest { talerUri: string; progressToken?: string; } - ``` -```typescript +```{ts:def} PrepareWithdrawExchangeResponse export interface PrepareWithdrawExchangeResponse { /** * Base URL of the exchange that already existed @@ -2565,11 +2424,10 @@ export interface PrepareWithdrawExchangeResponse { */ amount?: AmountString; } - ``` ### AddExchangeOp -```typescript +```{ts:def} AddExchangeOp /** * Add / force-update an exchange. */ @@ -2579,9 +2437,8 @@ export type AddExchangeOp = { response: AddExchangeResponse; }; // AddExchange = "addExchange" - ``` -```typescript +```{ts:def} AddExchangeRequest export interface AddExchangeRequest { /** * Either an http(s) exchange base URL or @@ -2607,20 +2464,18 @@ export interface AddExchangeRequest { exchangeBaseUrl?: string; progressToken?: string; } - ``` -```typescript +```{ts:def} AddExchangeResponse export interface AddExchangeResponse { /** * Base URL of the exchange that was added to the wallet. */ exchangeBaseUrl: string; } - ``` ### UpdateExchangeEntryOp -```typescript +```{ts:def} UpdateExchangeEntryOp /** * Update an exchange entry. * @@ -2637,67 +2492,62 @@ export type UpdateExchangeEntryOp = { response: EmptyObject; }; // UpdateExchangeEntry = "updateExchangeEntry" - ``` -```typescript +```{ts:def} UpdateExchangeEntryRequest export interface UpdateExchangeEntryRequest { exchangeBaseUrl: string; force?: boolean; } - ``` ### ListBankAccountsOp -```typescript +```{ts:def} ListBankAccountsOp export type ListBankAccountsOp = { op: WalletApiOperation.ListBankAccounts; request: ListBankAccountsRequest; response: ListBankAccountsResponse; }; // ListBankAccounts = "listBankAccounts" - ``` -```typescript +```{ts:def} ListBankAccountsRequest export interface ListBankAccountsRequest { currency?: string; } - ``` -```typescript +```{ts:def} ListBankAccountsResponse export interface ListBankAccountsResponse { accounts: WalletBankAccountInfo[]; } - ``` ### GetBankAccountByIdOp -```typescript +```{ts:def} GetBankAccountByIdOp export type GetBankAccountByIdOp = { op: WalletApiOperation.GetBankAccountById; request: GetBankAccountByIdRequest; response: GetBankAccountByIdResponse; }; // GetBankAccountById = "getBankAccountById" - ``` -```typescript +```{ts:def} GetBankAccountByIdRequest export interface GetBankAccountByIdRequest { bankAccountId: string; } - +``` +```{ts:def} GetBankAccountByIdResponse +export type GetBankAccountByIdResponse = WalletBankAccountInfo; ``` ### AddBankAccountsOp -```typescript +```{ts:def} AddBankAccountsOp export type AddBankAccountsOp = { op: WalletApiOperation.AddBankAccount; request: AddBankAccountRequest; response: AddBankAccountResponse; }; // AddBankAccount = "addBankAccount" - ``` -```typescript +```{ts:def} AddBankAccountRequest export interface AddBankAccountRequest { /** * Payto URI of the bank account that should be added. @@ -2716,37 +2566,33 @@ export interface AddBankAccountRequest { */ replaceBankAccountId?: string; } - ``` -```typescript +```{ts:def} AddBankAccountResponse export interface AddBankAccountResponse { /** * Identifier of the added bank account. */ bankAccountId: string; } - ``` ### ForgetBankAccountsOp -```typescript +```{ts:def} ForgetBankAccountsOp export type ForgetBankAccountsOp = { op: WalletApiOperation.ForgetBankAccount; request: ForgetBankAccountRequest; response: EmptyObject; }; // ForgetBankAccount = "forgetBankAccount" - ``` -```typescript +```{ts:def} ForgetBankAccountRequest export interface ForgetBankAccountRequest { bankAccountId: string; } - ``` ### ConfirmExchangeKeyChangeOp -```typescript +```{ts:def} ConfirmExchangeKeyChangeOp /** * Confirm that the exchange's changed key set is legitimate. * @@ -2763,9 +2609,8 @@ export type ConfirmExchangeKeyChangeOp = { | TalerErrorCode.WALLET_EXCHANGE_KEY_CHANGE_MISMATCH; }; // ConfirmExchangeKeyChange = "confirmExchangeKeyChange" - ``` -```typescript +```{ts:def} ConfirmExchangeKeyChangeRequest export interface ConfirmExchangeKeyChangeRequest { exchangeBaseUrl: string; /** @@ -2776,11 +2621,10 @@ export interface ConfirmExchangeKeyChangeRequest { */ currentMasterPub: string; } - ``` ### SetExchangeTosAcceptedOp -```typescript +```{ts:def} SetExchangeTosAcceptedOp /** * Accept a particular version of the exchange terms of service. */ @@ -2790,11 +2634,10 @@ export type SetExchangeTosAcceptedOp = { response: EmptyObject; }; // SetExchangeTosAccepted = "setExchangeTosAccepted" - ``` ### SetExchangeTosForgottenOp -```typescript +```{ts:def} SetExchangeTosForgottenOp /** * Accept a particular version of the exchange terms of service. */ @@ -2804,11 +2647,10 @@ export type SetExchangeTosForgottenOp = { response: EmptyObject; }; // SetExchangeTosForgotten = "setExchangeTosForgotten" - ``` ### GetExchangeTosOp -```typescript +```{ts:def} GetExchangeTosOp /** * Get the current terms of a service of an exchange. */ @@ -2818,18 +2660,16 @@ export type GetExchangeTosOp = { response: GetExchangeTosResult; }; // GetExchangeTos = "getExchangeTos" - ``` -```typescript +```{ts:def} GetExchangeTosRequest export interface GetExchangeTosRequest { exchangeBaseUrl: string; acceptedFormat?: string[]; acceptLanguage?: string; progressToken?: string; } - ``` -```typescript +```{ts:def} GetExchangeTosResult export interface GetExchangeTosResult { /** * Markdown version of the current ToS. @@ -2860,20 +2700,18 @@ export interface GetExchangeTosResult { tosAvailableLanguages: string[]; tosStatus: ExchangeTosStatus; } - ``` ### GetDepositWireTypesOp -```typescript +```{ts:def} GetDepositWireTypesOp export type GetDepositWireTypesOp = { op: WalletApiOperation.GetDepositWireTypes; request: GetDepositWireTypesRequest; response: GetDepositWireTypesResponse; }; // GetDepositWireTypes = "getDepositWireTypes" - ``` -```typescript +```{ts:def} GetDepositWireTypesRequest export interface GetDepositWireTypesRequest { currency?: string; /** @@ -2882,20 +2720,18 @@ export interface GetDepositWireTypesRequest { */ scopeInfo?: ScopeInfo; } - ``` -```typescript +```{ts:def} GetDepositWireTypesResponse export interface GetDepositWireTypesResponse { /** * Details for each wire type. */ wireTypeDetails: WireTypeDetails[]; } - ``` ### GetDepositWireTypesForCurrencyOp -```typescript +```{ts:def} GetDepositWireTypesForCurrencyOp /** * Get wire types that can be used for a deposit operation * with the provided currency. @@ -2908,9 +2744,8 @@ export type GetDepositWireTypesForCurrencyOp = { response: GetDepositWireTypesForCurrencyResponse; }; // GetDepositWireTypesForCurrency = "getDepositWireTypesForCurrency" - ``` -```typescript +```{ts:def} GetDepositWireTypesForCurrencyRequest export interface GetDepositWireTypesForCurrencyRequest { currency: string; /** @@ -2919,9 +2754,8 @@ export interface GetDepositWireTypesForCurrencyRequest { */ scopeInfo?: ScopeInfo; } - ``` -```typescript +```{ts:def} GetDepositWireTypesForCurrencyResponse /** * Response with wire types that are supported for a deposit. * @@ -2939,11 +2773,10 @@ export interface GetDepositWireTypesForCurrencyResponse { */ wireTypeDetails: WireTypeDetails[]; } - ``` ### GetExchangeDetailedInfoOp -```typescript +```{ts:def} GetExchangeDetailedInfoOp /** * Get the current terms of a service of an exchange. */ @@ -2953,21 +2786,18 @@ export type GetExchangeDetailedInfoOp = { response: ExchangeDetailedResponse; }; // GetExchangeDetailedInfo = "getExchangeDetailedInfo" - ``` -```typescript +```{ts:def} GetExchangeDetailedInfoRequest export interface GetExchangeDetailedInfoRequest { exchangeBaseUrl: string; } - ``` -```typescript +```{ts:def} ExchangeDetailedResponse export interface ExchangeDetailedResponse { exchange: ExchangeFullDetails; } - ``` -```typescript +```{ts:def} ExchangeFullDetails export interface ExchangeFullDetails { exchangeBaseUrl: string; currency: string; @@ -2978,9 +2808,8 @@ export interface ExchangeFullDetails { transferFees: Record<string, FeeDescription[]>; globalFees: FeeDescription[]; } - ``` -```typescript +```{ts:def} ExchangeAuditor /** * Auditor information as given by the exchange in /keys. */ @@ -3002,9 +2831,8 @@ export interface ExchangeAuditor { */ denomination_keys: AuditorDenomSig[]; } - ``` -```typescript +```{ts:def} AuditorDenomSig /** * Signature by the auditor that a particular denomination key is audited. */ @@ -3018,22 +2846,19 @@ export interface AuditorDenomSig { */ auditor_sig: string; } - ``` -```typescript +```{ts:def} WireInfo export interface WireInfo { feesForType: WireFeeMap; accounts: ExchangeWireAccount[]; } - ``` -```typescript +```{ts:def} WireFeeMap export type WireFeeMap = { [wireMethod: string]: WireFee[]; }; - ``` -```typescript +```{ts:def} WireFee /** * Wire fee for one wire method */ @@ -3059,9 +2884,8 @@ export interface WireFee { */ sig: string; } - ``` -```typescript +```{ts:def} ExchangeWireAccount export interface ExchangeWireAccount { payto_uri: string; conversion_url?: string; @@ -3073,30 +2897,26 @@ export interface ExchangeWireAccount { bank_label?: string; priority?: number; } - ``` -```typescript +```{ts:def} DenomOperationMap export type DenomOperationMap<T> = { [op in DenomOperation]: T; }; - ``` -```typescript +```{ts:def} DenomOperation export type DenomOperation = "deposit" | "withdraw" | "refresh" | "refund"; - ``` -```typescript +```{ts:def} FeeDescription export interface FeeDescription { group: string; from: AbsoluteTime; until: AbsoluteTime; fee?: AmountString; } - ``` ### GetDefaultExchangesOp -```typescript +```{ts:def} GetDefaultExchangesOp /** @deprecated Use {@link ListWithdrawalExchangeCandidatesOp} instead. */ export type GetDefaultExchangesOp = { op: WalletApiOperation.GetDefaultExchanges; @@ -3104,9 +2924,8 @@ export type GetDefaultExchangesOp = { response: GetDefaultExchangesResponse; }; // GetDefaultExchanges = "getDefaultExchanges" - ``` -```typescript +```{ts:def} GetDefaultExchangesResponse /** * @deprecated Use {@link ListWithdrawalExchangeCandidatesResponse} instead. */ @@ -3128,26 +2947,27 @@ export interface GetDefaultExchangesResponse { currencySpec: CurrencySpecification; }[]; } - ``` ### ListWithdrawalExchangeCandidatesOp -```typescript +```{ts:def} ListWithdrawalExchangeCandidatesOp export type ListWithdrawalExchangeCandidatesOp = { op: WalletApiOperation.ListWithdrawalExchangeCandidates; request: ListWithdrawalExchangeCandidatesRequest; response: ListWithdrawalExchangeCandidatesResponse; }; // ListWithdrawalExchangeCandidates = "listWithdrawalExchangeCandidates" - ``` -```typescript +```{ts:def} ListWithdrawalExchangeCandidatesRequest +export type ListWithdrawalExchangeCandidatesRequest = + GetDefaultExchangesRequest; +``` +```{ts:def} ListWithdrawalExchangeCandidatesResponse export interface ListWithdrawalExchangeCandidatesResponse { candidates: WithdrawalExchangeCandidate[]; } - ``` -```typescript +```{ts:def} WithdrawalExchangeCandidate export interface WithdrawalExchangeCandidate { /** A taler://withdraw-exchange URI for the exchange. */ talerUri: string; @@ -3160,20 +2980,18 @@ export interface WithdrawalExchangeCandidate { recommendationReasons: ExchangeRecommendationReason[]; lastWithdrawal?: TalerPreciseTimestamp; } - ``` -```typescript +```{ts:def} ExchangeRecommendationReason export declare enum ExchangeRecommendationReason { Preset = "preset", UserAdded = "user-added", PreviousWithdrawal = "previous-withdrawal", PreviouslyUsed = "previously-used", } - ``` ### GetExchangeEntryByUrlOp -```typescript +```{ts:def} GetExchangeEntryByUrlOp /** * Get the current terms of a service of an exchange. */ @@ -3183,17 +3001,18 @@ export type GetExchangeEntryByUrlOp = { response: GetExchangeEntryByUrlResponse; }; // GetExchangeEntryByUrl = "getExchangeEntryByUrl" - ``` -```typescript +```{ts:def} GetExchangeEntryByUrlRequest export interface GetExchangeEntryByUrlRequest { exchangeBaseUrl: string; } - +``` +```{ts:def} GetExchangeEntryByUrlResponse +export type GetExchangeEntryByUrlResponse = ExchangeListItem; ``` ### GetExchangeResourcesOp -```typescript +```{ts:def} GetExchangeResourcesOp /** * Get resources associated with an exchange. */ @@ -3203,23 +3022,20 @@ export type GetExchangeResourcesOp = { response: GetExchangeResourcesResponse; }; // GetExchangeResources = "getExchangeResources" - ``` -```typescript +```{ts:def} GetExchangeResourcesRequest export interface GetExchangeResourcesRequest { exchangeBaseUrl: string; } - ``` -```typescript +```{ts:def} GetExchangeResourcesResponse export interface GetExchangeResourcesResponse { hasResources: boolean; } - ``` ### DeleteExchangeOp -```typescript +```{ts:def} DeleteExchangeOp /** * Delete an exchange and its associated resources. */ @@ -3229,9 +3045,8 @@ export type DeleteExchangeOp = { response: EmptyObject; }; // DeleteExchange = "deleteExchange" - ``` -```typescript +```{ts:def} DeleteExchangeRequest export interface DeleteExchangeRequest { exchangeBaseUrl: string; /** @@ -3239,34 +3054,30 @@ export interface DeleteExchangeRequest { */ purge?: boolean; } - ``` ### GetCurrencySpecificationOp -```typescript +```{ts:def} GetCurrencySpecificationOp export type GetCurrencySpecificationOp = { op: WalletApiOperation.GetCurrencySpecification; request: GetCurrencySpecificationRequest; response: GetCurrencySpecificationResponse; }; // GetCurrencySpecification = "getCurrencySpecification" - ``` -```typescript +```{ts:def} GetCurrencySpecificationRequest export interface GetCurrencySpecificationRequest { scope: ScopeInfo; } - ``` -```typescript +```{ts:def} GetCurrencySpecificationResponse export interface GetCurrencySpecificationResponse { currencySpecification: CurrencySpecification; } - ``` ### CreateDepositGroupOp -```typescript +```{ts:def} CreateDepositGroupOp /** * Create a new deposit group. * @@ -3279,9 +3090,8 @@ export type CreateDepositGroupOp = { response: CreateDepositGroupResponse; }; // CreateDepositGroup = "createDepositGroup" - ``` -```typescript +```{ts:def} CreateDepositGroupRequest export interface CreateDepositGroupRequest { depositPaytoUri: string; /** @@ -3309,9 +3119,8 @@ export interface CreateDepositGroupRequest { transactionId?: TransactionIdStr; progressToken?: string; } - ``` -```typescript +```{ts:def} CreateDepositGroupResponse /** * Response to a createDepositGroup request. */ @@ -3331,20 +3140,18 @@ export interface CreateDepositGroupResponse { */ depositGroupId: string; } - ``` ### CheckDepositOp -```typescript +```{ts:def} CheckDepositOp export type CheckDepositOp = { op: WalletApiOperation.CheckDeposit; request: CheckDepositRequest; response: CheckDepositResponse; }; // CheckDeposit = "checkDeposit" - ``` -```typescript +```{ts:def} CheckDepositRequest export interface CheckDepositRequest { /** * Payto URI to identify the (bank) account that the exchange will wire @@ -3364,9 +3171,8 @@ export interface CheckDepositRequest { restrictScope?: ScopeInfo; progressToken?: string; } - ``` -```typescript +```{ts:def} CheckDepositResponse export interface CheckDepositResponse { totalDepositCost: AmountString; effectiveDepositAmount: AmountString; @@ -3378,11 +3184,10 @@ export interface CheckDepositResponse { */ kycExchanges?: string[]; } - ``` ### ExportDbToFileOp -```typescript +```{ts:def} ExportDbToFileOp /** * Export the database to a file. * @@ -3394,9 +3199,8 @@ export type ExportDbToFileOp = { response: ExportDbToFileResponse; }; // ExportDbToFile = "exportDbToFile" - ``` -```typescript +```{ts:def} ExportDbToFileRequest export interface ExportDbToFileRequest { /** * Directory that the DB should be exported into. @@ -3417,20 +3221,18 @@ export interface ExportDbToFileRequest { */ forceFormat?: string; } - ``` -```typescript +```{ts:def} ExportDbToFileResponse export interface ExportDbToFileResponse { /** * Full path to the backup. */ path: string; } - ``` ### ImportDbFromFileOp -```typescript +```{ts:def} ImportDbFromFileOp /** * Export the database from a file. * @@ -3442,20 +3244,18 @@ export type ImportDbFromFileOp = { response: EmptyObject; }; // ImportDbFromFile = "importDbFromFile" - ``` -```typescript +```{ts:def} ImportDbFromFileRequest export interface ImportDbFromFileRequest { /** * Full path to the backup. */ path: string; } - ``` ### CheckPeerPushDebitOp -```typescript +```{ts:def} CheckPeerPushDebitOp /** * Check if initiating a peer push payment is possible * based on the funds in the wallet. @@ -3466,11 +3266,10 @@ export type CheckPeerPushDebitOp = { response: CheckPeerPushDebitOkResponse; }; // CheckPeerPushDebit = "checkPeerPushDebit" - ``` ### CheckPeerPushDebitV2Op -```typescript +```{ts:def} CheckPeerPushDebitV2Op /** * Check if initiating a peer push payment is possible * based on the funds in the wallet. @@ -3481,24 +3280,21 @@ export type CheckPeerPushDebitV2Op = { response: CheckPeerPushDebitResponse; }; // CheckPeerPushDebitV2 = "checkPeerPushDebitV2" - ``` -```typescript +```{ts:def} CheckPeerPushDebitResponse export type CheckPeerPushDebitResponse = | CheckPeerPushDebitOkResponse | CheckPeerPushDebitInsufficientBalanceResponse; - ``` -```typescript +```{ts:def} CheckPeerPushDebitInsufficientBalanceResponse export interface CheckPeerPushDebitInsufficientBalanceResponse { type: "insufficient-balance"; insufficientBalanceDetails: PaymentInsufficientBalanceDetails; } - ``` ### InitiatePeerPushDebitOp -```typescript +```{ts:def} InitiatePeerPushDebitOp /** * Initiate an outgoing peer push payment. */ @@ -3508,9 +3304,8 @@ export type InitiatePeerPushDebitOp = { response: InitiatePeerPushDebitResponse; }; // InitiatePeerPushDebit = "initiatePeerPushDebit" - ``` -```typescript +```{ts:def} InitiatePeerPushDebitRequest export interface InitiatePeerPushDebitRequest { exchangeBaseUrl?: string; /** @@ -3522,18 +3317,16 @@ export interface InitiatePeerPushDebitRequest { peerPushDebitQuote?: string; partialContractTerms: PartialPeerContractTerms; } - ``` -```typescript +```{ts:def} PartialPeerContractTerms export interface PartialPeerContractTerms { amount: AmountString; summary: string; icon_id?: string; purse_expiration?: TalerProtocolTimestamp; } - ``` -```typescript +```{ts:def} InitiatePeerPushDebitResponse export interface InitiatePeerPushDebitResponse { exchangeBaseUrl: string; pursePub: string; @@ -3541,11 +3334,10 @@ export interface InitiatePeerPushDebitResponse { contractPriv: string; transactionId: TransactionIdStr; } - ``` ### PreparePeerPushCreditOp -```typescript +```{ts:def} PreparePeerPushCreditOp /** * Check an incoming peer push payment. */ @@ -3555,9 +3347,8 @@ export type PreparePeerPushCreditOp = { response: PreparePeerPushCreditResponse; }; // PreparePeerPushCredit = "preparePeerPushCredit" - ``` -```typescript +```{ts:def} PreparePeerPushCreditRequest /** * Result of initiating a peer-push-credit payment. * @@ -3568,9 +3359,8 @@ export interface PreparePeerPushCreditRequest { transactionId?: string; progressToken?: string; } - ``` -```typescript +```{ts:def} PreparePeerPushCreditResponse export interface PreparePeerPushCreditResponse { contractTerms: PeerContractTerms; amountRaw: AmountString; @@ -3587,11 +3377,10 @@ export interface PreparePeerPushCreditResponse { */ amount: AmountString; } - ``` ### ConfirmPeerPushCreditOp -```typescript +```{ts:def} ConfirmPeerPushCreditOp /** * Accept an incoming peer push payment. */ @@ -3601,24 +3390,21 @@ export type ConfirmPeerPushCreditOp = { response: AcceptPeerPushPaymentResponse; }; // ConfirmPeerPushCredit = "confirmPeerPushCredit" - ``` -```typescript +```{ts:def} ConfirmPeerPushCreditRequest export interface ConfirmPeerPushCreditRequest { transactionId: string; progressToken?: string; } - ``` -```typescript +```{ts:def} AcceptPeerPushPaymentResponse export interface AcceptPeerPushPaymentResponse { transactionId: TransactionIdStr; } - ``` ### CheckPeerPullCreditOp -```typescript +```{ts:def} CheckPeerPullCreditOp /** * Check fees for an outgoing peer pull payment. */ @@ -3628,9 +3414,8 @@ export type CheckPeerPullCreditOp = { response: CheckPeerPullCreditResponse; }; // CheckPeerPullCredit = "checkPeerPullCredit" - ``` -```typescript +```{ts:def} CheckPeerPullCreditRequest export interface CheckPeerPullCreditRequest { /** * Require using this particular exchange for this operation. @@ -3640,9 +3425,8 @@ export interface CheckPeerPullCreditRequest { amount: AmountString; progressToken?: string; } - ``` -```typescript +```{ts:def} CheckPeerPullCreditResponse export interface CheckPeerPullCreditResponse { exchangeBaseUrl: string; amountRaw: AmountString; @@ -3657,11 +3441,10 @@ export interface CheckPeerPullCreditResponse { */ numCoins: number; } - ``` ### InitiatePeerPullCreditOp -```typescript +```{ts:def} InitiatePeerPullCreditOp /** * Initiate an outgoing peer pull payment. */ @@ -3671,17 +3454,15 @@ export type InitiatePeerPullCreditOp = { response: InitiatePeerPullCreditResponse; }; // InitiatePeerPullCredit = "initiatePeerPullCredit" - ``` -```typescript +```{ts:def} InitiatePeerPullCreditRequest export interface InitiatePeerPullCreditRequest { exchangeBaseUrl?: string; partialContractTerms: PeerContractTerms; progressToken?: string; } - ``` -```typescript +```{ts:def} InitiatePeerPullCreditResponse export interface InitiatePeerPullCreditResponse { /** * Taler URI for the other party to make the payment @@ -3692,11 +3473,10 @@ export interface InitiatePeerPullCreditResponse { talerUri: string; transactionId: TransactionIdStr; } - ``` ### PreparePeerPullDebitOp -```typescript +```{ts:def} PreparePeerPullDebitOp /** * Prepare for an incoming peer pull payment. */ @@ -3706,9 +3486,8 @@ export type PreparePeerPullDebitOp = { response: PreparePeerPullDebitResponse; }; // PreparePeerPullDebit = "preparePeerPullDebit" - ``` -```typescript +```{ts:def} PreparePeerPullDebitRequest /** * Result of initiating a peer-pull-debit payment. * @@ -3719,9 +3498,8 @@ export interface PreparePeerPullDebitRequest { transactionId?: string; progressToken?: string; } - ``` -```typescript +```{ts:def} PreparePeerPullDebitResponse export interface PreparePeerPullDebitResponse { contractTerms: PeerContractTerms; amountRaw: AmountString; @@ -3738,11 +3516,10 @@ export interface PreparePeerPullDebitResponse { */ amount: AmountString; } - ``` ### ConfirmPeerPullDebitOp -```typescript +```{ts:def} ConfirmPeerPullDebitOp /** * Accept an incoming peer pull payment (i.e. pay the other party). */ @@ -3752,108 +3529,94 @@ export type ConfirmPeerPullDebitOp = { response: AcceptPeerPullPaymentResponse; }; // ConfirmPeerPullDebit = "confirmPeerPullDebit" - ``` -```typescript +```{ts:def} ConfirmPeerPullDebitRequest export interface ConfirmPeerPullDebitRequest { transactionId: TransactionIdStr; } - ``` -```typescript +```{ts:def} AcceptPeerPullPaymentResponse export interface AcceptPeerPullPaymentResponse { transactionId: TransactionIdStr; } - ``` ### ValidateIbanOp -```typescript +```{ts:def} ValidateIbanOp export type ValidateIbanOp = { op: WalletApiOperation.ValidateIban; request: ValidateIbanRequest; response: ValidateIbanResponse; }; // ValidateIban = "validateIban" - ``` -```typescript +```{ts:def} ValidateIbanRequest export interface ValidateIbanRequest { iban: string; } - ``` -```typescript +```{ts:def} ValidateIbanResponse export interface ValidateIbanResponse { valid: boolean; } - ``` ### CanonicalizeBaseUrlOp -```typescript +```{ts:def} CanonicalizeBaseUrlOp export type CanonicalizeBaseUrlOp = { op: WalletApiOperation.CanonicalizeBaseUrl; request: CanonicalizeBaseUrlRequest; response: CanonicalizeBaseUrlResponse; }; // CanonicalizeBaseUrl = "canonicalizeBaseUrl" - ``` -```typescript +```{ts:def} CanonicalizeBaseUrlRequest export interface CanonicalizeBaseUrlRequest { url: string; } - ``` -```typescript +```{ts:def} CanonicalizeBaseUrlResponse export interface CanonicalizeBaseUrlResponse { url: string; } - ``` ### GetQrCodesForPaytoOp -```typescript +```{ts:def} GetQrCodesForPaytoOp export type GetQrCodesForPaytoOp = { op: WalletApiOperation.GetQrCodesForPayto; request: GetQrCodesForPaytoRequest; response: GetQrCodesForPaytoResponse; }; // GetQrCodesForPayto = "getQrCodesForPayto" - ``` -```typescript +```{ts:def} GetQrCodesForPaytoRequest export interface GetQrCodesForPaytoRequest { paytoUri: string; } - ``` -```typescript +```{ts:def} GetQrCodesForPaytoResponse export interface GetQrCodesForPaytoResponse { codes: QrCodeSpec[]; } - ``` ### ConvertIbanAccountFieldToPaytoOp -```typescript +```{ts:def} ConvertIbanAccountFieldToPaytoOp export type ConvertIbanAccountFieldToPaytoOp = { op: WalletApiOperation.ConvertIbanAccountFieldToPayto; request: ConvertIbanAccountFieldToPaytoRequest; response: ConvertIbanAccountFieldToPaytoResponse; }; // ConvertIbanAccountFieldToPayto = "convertIbanAccountFieldToPayto" - ``` -```typescript +```{ts:def} ConvertIbanAccountFieldToPaytoRequest export interface ConvertIbanAccountFieldToPaytoRequest { value: string; currency: string; } - ``` -```typescript +```{ts:def} ConvertIbanAccountFieldToPaytoResponse export type ConvertIbanAccountFieldToPaytoResponse = | { ok: true; @@ -3863,66 +3626,58 @@ export type ConvertIbanAccountFieldToPaytoResponse = | { ok: false; }; - ``` ### ConvertIbanPaytoToAccountFieldOp -```typescript +```{ts:def} ConvertIbanPaytoToAccountFieldOp export type ConvertIbanPaytoToAccountFieldOp = { op: WalletApiOperation.ConvertIbanPaytoToAccountField; request: ConvertIbanPaytoToAccountFieldRequest; response: ConvertIbanPaytoToAccountFieldResponse; }; // ConvertIbanPaytoToAccountField = "convertIbanPaytoToAccountField" - ``` -```typescript +```{ts:def} ConvertIbanPaytoToAccountFieldRequest export interface ConvertIbanPaytoToAccountFieldRequest { paytoUri: string; } - ``` -```typescript +```{ts:def} ConvertIbanPaytoToAccountFieldResponse export interface ConvertIbanPaytoToAccountFieldResponse { type: "iban" | "bban"; value: string; } - ``` ### GetBankingChoicesForPaytoOp -```typescript +```{ts:def} GetBankingChoicesForPaytoOp export type GetBankingChoicesForPaytoOp = { op: WalletApiOperation.GetBankingChoicesForPayto; request: GetBankingChoicesForPaytoRequest; response: GetBankingChoicesForPaytoResponse; }; // GetBankingChoicesForPayto = "getBankingChoicesForPayto" - ``` -```typescript +```{ts:def} GetBankingChoicesForPaytoRequest export interface GetBankingChoicesForPaytoRequest { paytoUri: string; } - ``` -```typescript +```{ts:def} GetBankingChoicesForPaytoResponse export interface GetBankingChoicesForPaytoResponse { choices: BankingChoiceSpec[]; } - ``` -```typescript +```{ts:def} BankingChoiceSpec export interface BankingChoiceSpec { label: string; type: "link"; uri: string; } - ``` ### ExportDbOp -```typescript +```{ts:def} ExportDbOp /** * Export the wallet database's contents to JSON. */ @@ -3932,28 +3687,25 @@ export type ExportDbOp = { response: any; }; // ExportDb = "exportDb" - ``` ### ImportDbOp -```typescript +```{ts:def} ImportDbOp export type ImportDbOp = { op: WalletApiOperation.ImportDb; request: ImportDbRequest; response: EmptyObject; }; // ImportDb = "importDb" - ``` -```typescript +```{ts:def} ImportDbRequest export interface ImportDbRequest { dump?: any; } - ``` ### ClearDbOp -```typescript +```{ts:def} ClearDbOp /** * Dangerously clear the whole wallet database. */ @@ -3963,11 +3715,10 @@ export type ClearDbOp = { response: EmptyObject; }; // ClearDb = "clearDb" - ``` ### RecycleOp -```typescript +```{ts:def} RecycleOp /** * Export a backup, clear the database and re-import it. */ @@ -3977,11 +3728,10 @@ export type RecycleOp = { response: EmptyObject; }; // Recycle = "recycle" - ``` ### ApplyDevExperimentOp -```typescript +```{ts:def} ApplyDevExperimentOp /** * Apply a developer experiment to the current wallet state. * @@ -3994,17 +3744,15 @@ export type ApplyDevExperimentOp = { response: EmptyObject; }; // ApplyDevExperiment = "applyDevExperiment" - ``` -```typescript +```{ts:def} ApplyDevExperimentRequest export interface ApplyDevExperimentRequest { devExperimentUri: string; } - ``` ### RunIntegrationTestOp -```typescript +```{ts:def} RunIntegrationTestOp /** * Run a simple integration test on a test deployment * of the exchange and merchant. @@ -4015,9 +3763,8 @@ export type RunIntegrationTestOp = { response: EmptyObject; }; // RunIntegrationTest = "runIntegrationTest" - ``` -```typescript +```{ts:def} IntegrationTestArgs export interface IntegrationTestArgs { exchangeBaseUrl: string; corebankApiBaseUrl: string; @@ -4026,11 +3773,10 @@ export interface IntegrationTestArgs { amountToWithdraw: AmountString; amountToSpend: AmountString; } - ``` ### RunIntegrationTestV2Op -```typescript +```{ts:def} RunIntegrationTestV2Op /** * Run a simple integration test on a test deployment * of the exchange and merchant. @@ -4041,20 +3787,18 @@ export type RunIntegrationTestV2Op = { response: EmptyObject; }; // RunIntegrationTestV2 = "runIntegrationTestV2" - ``` -```typescript +```{ts:def} IntegrationTestV2Args export interface IntegrationTestV2Args { exchangeBaseUrl: string; corebankApiBaseUrl: string; merchantBaseUrl: string; merchantAuthToken?: string; } - ``` ### TestCryptoOp -```typescript +```{ts:def} TestCryptoOp /** * Test crypto worker. */ @@ -4064,11 +3808,10 @@ export type TestCryptoOp = { response: any; }; // TestCrypto = "testCrypto" - ``` ### WithdrawTestBalanceOp -```typescript +```{ts:def} WithdrawTestBalanceOp /** * Make withdrawal on a test deployment of the exchange * and merchant. @@ -4079,9 +3822,8 @@ export type WithdrawTestBalanceOp = { response: WithdrawTestBalanceResult; }; // WithdrawTestBalance = "withdrawTestBalance" - ``` -```typescript +```{ts:def} WithdrawTestBalanceRequest export interface WithdrawTestBalanceRequest { /** * Amount to withdraw. @@ -4107,11 +3849,10 @@ export interface WithdrawTestBalanceRequest { */ useForeignAccount?: boolean; } - ``` ### WithdrawTestkudosOp -```typescript +```{ts:def} WithdrawTestkudosOp /** * Make a withdrawal of testkudos on test.taler.net. */ @@ -4121,11 +3862,10 @@ export type WithdrawTestkudosOp = { response: WithdrawTestBalanceResult; }; // WithdrawTestkudos = "withdrawTestkudos" - ``` ### TestPayOp -```typescript +```{ts:def} TestPayOp /** * Make a test payment using a test deployment of * the exchange and merchant. @@ -4136,9 +3876,8 @@ export type TestPayOp = { response: TestPayResult; }; // TestPay = "testPay" - ``` -```typescript +```{ts:def} TestPayArgs export interface TestPayArgs { merchantBaseUrl: string; merchantAuthToken?: string; @@ -4146,35 +3885,31 @@ export interface TestPayArgs { summary: string; forcedCoinSel?: ForcedCoinSel; } - ``` -```typescript +```{ts:def} TestPayResult export interface TestPayResult { /** * Number of coins used for the payment. */ numCoins: number; } - ``` ### GetActiveTasksOp -```typescript +```{ts:def} GetActiveTasksOp export type GetActiveTasksOp = { op: WalletApiOperation.GetActiveTasks; request: EmptyObject; response: GetActiveTasksResponse; }; // GetActiveTasks = "getActiveTasks" - ``` -```typescript +```{ts:def} GetActiveTasksResponse export interface GetActiveTasksResponse { tasks: ActiveTask[]; } - ``` -```typescript +```{ts:def} ActiveTask export interface ActiveTask { taskId: string; transaction?: TransactionIdStr | undefined; @@ -4183,11 +3918,10 @@ export interface ActiveTask { retryCounter?: number | undefined; lastError?: TalerErrorDetail | undefined; } - ``` ### GetPerformanceStatsOp -```typescript +```{ts:def} GetPerformanceStatsOp /** * Get a list of performance stats for diagnostics. * @@ -4204,9 +3938,8 @@ export type GetPerformanceStatsOp = { response: GetPerformanceStatsResponse; }; // TestingGetPerformanceStats = "testingGetPerformanceStats" - ``` -```typescript +```{ts:def} GetPerformanceStatsRequest export interface GetPerformanceStatsRequest { /** * Limit to N largest average performance stats of each table. @@ -4215,21 +3948,18 @@ export interface GetPerformanceStatsRequest { */ limit?: number; } - ``` -```typescript +```{ts:def} GetPerformanceStatsResponse export interface GetPerformanceStatsResponse { stats: PerformanceTable; } - ``` -```typescript +```{ts:def} PerformanceTable export type PerformanceTable = { [key in PerformanceStatType]?: PerformanceStat[]; }; - ``` -```typescript +```{ts:def} PerformanceStatType export declare enum PerformanceStatType { HttpFetch = "http-fetch", DbQuery = "db-query", @@ -4237,9 +3967,8 @@ export declare enum PerformanceStatType { WalletRequest = "wallet-request", WalletTask = "wallet-task", } - ``` -```typescript +```{ts:def} PerformanceStat export type PerformanceStat = | { type: PerformanceStatType.HttpFetch; @@ -4287,118 +4016,10 @@ export type PerformanceStat = totalDurationMs: number; count: number; }; - -``` -```typescript -export type ObservabilityEvent = - | { - id: string; - when: AbsoluteTime; - type: ObservabilityEventType.HttpFetchStart; - url: string; - longPolling: boolean; - } - | { - id: string; - when: AbsoluteTime; - type: ObservabilityEventType.HttpFetchFinishSuccess; - url: string; - status: number; - durationMs: number; - longPolling: boolean; - } - | { - id: string; - when: AbsoluteTime; - type: ObservabilityEventType.HttpFetchFinishError; - url: string; - error: TalerErrorDetail; - durationMs: number; - longPolling: boolean; - } - | { - type: ObservabilityEventType.DbQueryStart; - name: string; - location: string; - } - | { - type: ObservabilityEventType.DbQueryFinishSuccess; - name: string; - location: string; - durationMs: number; - } - | { - type: ObservabilityEventType.DbQueryFinishError; - name: string; - location: string; - error: TalerErrorDetail; - durationMs: number; - } - | { - type: ObservabilityEventType.RequestStart; - name: string; - } - | { - type: ObservabilityEventType.RequestFinishSuccess; - operation: string; - requestId: string; - durationMs: number; - } - | { - type: ObservabilityEventType.RequestFinishError; - operation: string; - requestId: string; - durationMs: number; - } - | { - type: ObservabilityEventType.TaskStart; - taskId: string; - } - | { - type: ObservabilityEventType.TaskStop; - taskId: string; - } - | { - type: ObservabilityEventType.TaskReset; - taskId: string; - } - | { - type: ObservabilityEventType.DeclareTaskDependency; - taskId: string; - } - | { - type: ObservabilityEventType.CryptoStart; - operation: string; - } - | { - type: ObservabilityEventType.CryptoFinishSuccess; - operation: string; - durationMs: number; - } - | { - type: ObservabilityEventType.CryptoFinishError; - operation: string; - durationMs: number; - } - | { - type: ObservabilityEventType.ShepherdTaskResult; - taskId: string; - resultType: string; - durationMs: number; - } - | { - type: ObservabilityEventType.Message; - contents: string; - } - | { - type: ObservabilityEventType.DeclareConcernsTransaction; - transactionId: TransactionIdStr; - }; - ``` ### DumpCoinsOp -```typescript +```{ts:def} DumpCoinsOp /** * Dump all coins of the wallet in a simple JSON format. */ @@ -4408,9 +4029,8 @@ export type DumpCoinsOp = { response: CoinDumpJson; }; // DumpCoins = "dumpCoins" - ``` -```typescript +```{ts:def} CoinDumpJson /** * Easy to process format for the public data of coins * managed by the wallet. @@ -4458,29 +4078,31 @@ export interface CoinDumpJson { history: WalletCoinHistoryItem[]; }>; } - ``` -```typescript +```{ts:def} DenominationPubKey export type DenominationPubKey = RsaDenominationPubKey | CsDenominationPubKey; - ``` -```typescript +```{ts:def} RsaDenominationPubKey export interface RsaDenominationPubKey { readonly cipher: DenomKeyType.Rsa; readonly rsa_public_key: string; readonly age_mask: number; } - ``` -```typescript +```{ts:def} DenomKeyType +export declare enum DenomKeyType { + Rsa = "RSA", + ClauseSchnorr = "CS", +} +``` +```{ts:def} CsDenominationPubKey export interface CsDenominationPubKey { readonly cipher: DenomKeyType.ClauseSchnorr; readonly age_mask: number; readonly cs_public_key: string; } - ``` -```typescript +```{ts:def} CoinStatus /** * Status of a coin. */ @@ -4503,16 +4125,14 @@ export declare enum CoinStatus { */ Dormant = "dormant", } - ``` -```typescript +```{ts:def} AgeCommitmentProof export interface AgeCommitmentProof { commitment: AgeCommitment; proof: AgeProof; } - ``` -```typescript +```{ts:def} AgeCommitment export interface AgeCommitment { mask: number; /** @@ -4520,19 +4140,16 @@ export interface AgeCommitment { */ publicKeys: Edx25519PublicKeyEnc[]; } - ``` -```typescript +```{ts:def} Edx25519PublicKeyEnc export type Edx25519PublicKeyEnc = string & FlavorEdx25519PublicKeyEnc; - ``` -```typescript +```{ts:def} FlavorEdx25519PublicKeyEnc type FlavorEdx25519PublicKeyEnc = { readonly [isEdx25519PublicKeyEnc]?: true; }; - ``` -```typescript +```{ts:def} AgeProof export interface AgeProof { /** * Private keys. Typically smaller than the number of public keys, @@ -4540,19 +4157,16 @@ export interface AgeProof { */ privateKeys: Edx25519PrivateKeyEnc[]; } - ``` -```typescript +```{ts:def} Edx25519PrivateKeyEnc export type Edx25519PrivateKeyEnc = string & FlavorEdx25519PrivateKeyEnc; - ``` -```typescript +```{ts:def} FlavorEdx25519PrivateKeyEnc type FlavorEdx25519PrivateKeyEnc = { readonly [isEdx25519PrivateKeyEnc]?: true; }; - ``` -```typescript +```{ts:def} WalletCoinHistoryItem export type WalletCoinHistoryItem = | { type: "withdraw"; @@ -4578,11 +4192,10 @@ export type WalletCoinHistoryItem = transactionId: TransactionIdStr; amount: AmountString; }; - ``` ### TestingSetTimetravelOp -```typescript +```{ts:def} TestingSetTimetravelOp /** * Add an offset to the wallet's internal time. */ @@ -4592,17 +4205,15 @@ export type TestingSetTimetravelOp = { response: EmptyObject; }; // TestingSetTimetravel = "testingSetTimetravel" - ``` -```typescript +```{ts:def} TestingSetTimetravelRequest export interface TestingSetTimetravelRequest { offsetMs: number; } - ``` ### TestingWaitTransactionsFinalOp -```typescript +```{ts:def} TestingWaitTransactionsFinalOp /** * Wait until all transactions are in a final state. */ @@ -4612,11 +4223,10 @@ export type TestingWaitTransactionsFinalOp = { response: EmptyObject; }; // TestingWaitTransactionsFinal = "testingWaitTransactionsFinal" - ``` ### TestingWaitTasksDoneOp -```typescript +```{ts:def} TestingWaitTasksDoneOp /** * Wait until all transactions are in a final state. */ @@ -4626,11 +4236,10 @@ export type TestingWaitTasksDoneOp = { response: EmptyObject; }; // TestingWaitTasksDone = "testingWaitTasksDone" - ``` ### TestingWaitRefreshesFinalOp -```typescript +```{ts:def} TestingWaitRefreshesFinalOp /** * Wait until all refresh transactions are in a final state. */ @@ -4640,11 +4249,10 @@ export type TestingWaitRefreshesFinalOp = { response: EmptyObject; }; // TestingWaitRefreshesFinal = "testingWaitRefreshesFinal" - ``` ### TestingWaitBalanceOp -```typescript +```{ts:def} TestingWaitBalanceOp /** * Wait until a balance has reached the desired value. */ @@ -4654,18 +4262,16 @@ export type TestingWaitBalanceOp = { response: EmptyObject; }; // TestingWaitBalance = "testingWaitBalance" - ``` -```typescript +```{ts:def} TestingWaitBalanceRequest export interface TestingWaitBalanceRequest { type: "material" | "available"; amount: AmountString; } - ``` ### TestingWaitTransactionStateOp -```typescript +```{ts:def} TestingWaitTransactionStateOp /** * Wait until a transaction is in a particular state. */ @@ -4675,9 +4281,8 @@ export type TestingWaitTransactionStateOp = { response: TestingWaitTransactionStateResponse; }; // TestingWaitTransactionState = "testingWaitTransactionState" - ``` -```typescript +```{ts:def} TestingWaitTransactionRequest export interface TestingWaitTransactionRequest { transactionId: TransactionIdStr; /** @@ -4715,9 +4320,18 @@ export interface TestingWaitTransactionRequest { */ bailOnError?: boolean; } - ``` -```typescript +```{ts:def} DurationUnitSpec +export interface DurationUnitSpec { + seconds?: number; + minutes?: number; + hours?: number; + days?: number; + months?: number; + years?: number; +} +``` +```{ts:def} TestingWaitTxStateSpec /** * State(s) to wait for. * @@ -4731,9 +4345,8 @@ export type TestingWaitTxStateSpec = | number | "nonpending" | "final"; - ``` -```typescript +```{ts:def} TransactionStatePattern export interface TransactionStatePattern { major: TransactionMajorState | TransactionStateWildcard; minor?: TransactionMinorState | TransactionStateWildcard; @@ -4746,9 +4359,11 @@ export interface TransactionStatePattern { */ working?: boolean | TransactionStateWildcard; } - ``` -```typescript +```{ts:def} TransactionStateWildcard +export type TransactionStateWildcard = "*"; +``` +```{ts:def} TestingWaitTransactionStateResponse export interface TestingWaitTransactionStateResponse { /** * Which set of states ended the wait: the requested state @@ -4764,11 +4379,10 @@ export interface TestingWaitTransactionStateResponse { */ stId: number; } - ``` ### TestingWaitExchangeStateOp -```typescript +```{ts:def} TestingWaitExchangeStateOp /** * Wait until an exchange entry is in a particular state. */ @@ -4778,18 +4392,16 @@ export type TestingWaitExchangeStateOp = { response: EmptyObject; }; // TestingWaitExchangeState = "testingWaitExchangeState" - ``` -```typescript +```{ts:def} TestingWaitExchangeStateRequest export interface TestingWaitExchangeStateRequest { exchangeBaseUrl: string; walletKycStatus?: ExchangeWalletKycStatus; } - ``` ### TestingWaitExchangeReadyOp -```typescript +```{ts:def} TestingWaitExchangeReadyOp /** * Wait until an exchange entry is ready. * Returns an error if updating the exchange @@ -4801,9 +4413,8 @@ export type TestingWaitExchangeReadyOp = { response: EmptyObject; }; // TestingWaitExchangeReady = "testingWaitExchangeReady" - ``` -```typescript +```{ts:def} TestingWaitExchangeReadyRequest export interface TestingWaitExchangeReadyRequest { exchangeBaseUrl: string; /** @@ -4821,40 +4432,36 @@ export interface TestingWaitExchangeReadyRequest { */ waitAutoRefresh?: boolean; } - ``` ### TestingPingOp -```typescript +```{ts:def} TestingPingOp export type TestingPingOp = { op: WalletApiOperation.TestingPing; request: EmptyObject; response: EmptyObject; }; // TestingPing = "testingPing" - ``` ### TestingGetReserveHistoryOp -```typescript +```{ts:def} TestingGetReserveHistoryOp export type TestingGetReserveHistoryOp = { op: WalletApiOperation.TestingGetReserveHistory; request: TestingGetReserveHistoryRequest; response: any; }; // TestingGetReserveHistory = "testingGetReserveHistory" - ``` -```typescript +```{ts:def} TestingGetReserveHistoryRequest export interface TestingGetReserveHistoryRequest { reservePub: string; exchangeBaseUrl: string; } - ``` ### TestingResetAllRetriesOp -```typescript +```{ts:def} TestingResetAllRetriesOp /** * Reset all task/transaction retries, * resulting in immediate re-try of all operations. @@ -4865,11 +4472,10 @@ export type TestingResetAllRetriesOp = { response: EmptyObject; }; // TestingResetAllRetries = "testingResetAllRetries" - ``` ### TestingGetDenomStatsOp -```typescript +```{ts:def} TestingGetDenomStatsOp /** * Get stats about an exchange denomination. */ @@ -4879,51 +4485,45 @@ export type TestingGetDenomStatsOp = { response: TestingGetDenomStatsResponse; }; // TestingGetDenomStats = "testingGetDenomStats" - ``` -```typescript +```{ts:def} TestingGetDenomStatsRequest export interface TestingGetDenomStatsRequest { exchangeBaseUrl: string; } - ``` -```typescript +```{ts:def} TestingGetDenomStatsResponse export interface TestingGetDenomStatsResponse { numKnown: number; numOffered: number; numLost: number; } - ``` ### TestingRunFixupOp -```typescript +```{ts:def} TestingRunFixupOp export type TestingRunFixupOp = { op: WalletApiOperation.TestingRunFixup; request: RunFixupRequest; response: EmptyObject; }; // TestingRunFixup = "testingRunFixup" - ``` -```typescript +```{ts:def} RunFixupRequest export interface RunFixupRequest { id: string; } - ``` ### TestingGetDiagnosticsOp -```typescript +```{ts:def} TestingGetDiagnosticsOp export type TestingGetDiagnosticsOp = { op: WalletApiOperation.GetDiagnostics; request: EmptyObject; response: TestingGetDiagnosticsResponse; }; // GetDiagnostics = "getDiagnostics" - ``` -```typescript +```{ts:def} TestingGetDiagnosticsResponse export interface TestingGetDiagnosticsResponse { version: 0; /** @@ -4937,60 +4537,53 @@ export interface TestingGetDiagnosticsResponse { numCandidateWithdrawableDenoms: number; }[]; } - ``` ### TestingGetFlightRecordsOp -```typescript +```{ts:def} TestingGetFlightRecordsOp export type TestingGetFlightRecordsOp = { op: WalletApiOperation.TestingGetFlightRecords; request: EmptyObject; response: TestingGetFlightRecordsResponse; }; // TestingGetFlightRecords = "testingGetFlightRecords" - ``` -```typescript +```{ts:def} TestingGetFlightRecordsResponse export interface TestingGetFlightRecordsResponse { flightRecords: FlightRecordEntry[]; } - ``` -```typescript +```{ts:def} FlightRecordEntry export interface FlightRecordEntry { timestamp: TalerPreciseTimestamp; target: string; event: FlightRecordEvent; } - ``` -```typescript +```{ts:def} FlightRecordEvent export declare enum FlightRecordEvent { MeltGone = "melt-gone", WithdrawalRedenominate = "withdrawal-redenominate", } - ``` ### TestingCorruptWithdrawalCoinSelOp -```typescript +```{ts:def} TestingCorruptWithdrawalCoinSelOp export type TestingCorruptWithdrawalCoinSelOp = { op: WalletApiOperation.TestingCorruptWithdrawalCoinSel; request: TestingCorruptWithdrawalCoinSelRequest; response: EmptyObject; }; // TestingCorruptWithdrawalCoinSel = "testingCorruptWithdrawalCoinSel" - ``` -```typescript +```{ts:def} TestingCorruptWithdrawalCoinSelRequest export interface TestingCorruptWithdrawalCoinSelRequest { transactionId: TransactionIdStr; } - ``` ### SetCoinSuspendedOp -```typescript +```{ts:def} SetCoinSuspendedOp /** * Set a coin as (un-)suspended. * Suspended coins won't be used for payments. @@ -5001,18 +4594,16 @@ export type SetCoinSuspendedOp = { response: EmptyObject; }; // SetCoinSuspended = "setCoinSuspended" - ``` -```typescript +```{ts:def} SetCoinSuspendedRequest export interface SetCoinSuspendedRequest { coinPub: string; suspended: boolean; } - ``` ### ForceRefreshOp -```typescript +```{ts:def} ForceRefreshOp /** * Force a refresh on coins where it would not * be necessary. @@ -5023,29 +4614,205 @@ export type ForceRefreshOp = { response: EmptyObject; }; // ForceRefresh = "forceRefresh" - ``` -```typescript +```{ts:def} ForceRefreshRequest export interface ForceRefreshRequest { refreshCoinSpecs: RefreshCoinSpec[]; } - ``` -```typescript +```{ts:def} RefreshCoinSpec export interface RefreshCoinSpec { coinPub: string; amount?: AmountString; } - ``` ## Common Declarations -```typescript +```{ts:def} WalletApiOperation +export enum WalletApiOperation { + // Initialization and wallet lifecycle + InitWallet = "initWallet", + SetWalletRunConfig = "setWalletRunConfig", + GetVersion = "getVersion", + Shutdown = "shutdown", + // Generic request management + RetryProgressTokenNow = "retryProgressTokenNow", + CancelProgressToken = "cancelProgressToken", + // Balances + GetBalances = "getBalances", + GetBalanceDetail = "getBalanceDetail", + // Misc. + GetActiveTasks = "getActiveTasks", + ValidateIban = "validateIban", + GetCurrencySpecification = "getCurrencySpecification", + ListGlobalCurrencyExchanges = "listGlobalCurrencyExchanges", + ListGlobalCurrencyAuditors = "listGlobalCurrencyAuditors", + AddGlobalCurrencyExchange = "addGlobalCurrencyExchange", + RemoveGlobalCurrencyExchange = "removeGlobalCurrencyExchange", + AddGlobalCurrencyAuditor = "addGlobalCurrencyAuditor", + RemoveGlobalCurrencyAuditor = "removeGlobalCurrencyAuditor", + CanonicalizeBaseUrl = "canonicalizeBaseUrl", + StartExchangeWalletKyc = "startExchangeWalletKyc", + GetBankingChoicesForPayto = "getBankingChoicesForPayto", + ConvertIbanAccountFieldToPayto = "convertIbanAccountFieldToPayto", + ConvertIbanPaytoToAccountField = "convertIbanPaytoToAccountField", + // Generic transaction management + GetTransactions = "getTransactions", + GetTransactionsV2 = "getTransactionsV2", + GetTransactionById = "getTransactionById", + ResolveTransactionReference = "resolveTransactionReference", + AbortTransaction = "abortTransaction", + FailTransaction = "failTransaction", + SuspendTransaction = "suspendTransaction", + ResumeTransaction = "resumeTransaction", + DeleteTransaction = "deleteTransaction", + RetryTransaction = "retryTransaction", + ListAssociatedRefreshes = "listAssociatedRefreshes", + // Bank account management + ListBankAccounts = "listBankAccounts", + GetBankAccountById = "getBankAccountById", + AddBankAccount = "addBankAccount", + ForgetBankAccount = "forgetBankAccount", + // Exchange entry management + AddExchange = "addExchange", + ListExchanges = "listExchanges", + ListWithdrawalExchangeCandidates = "listWithdrawalExchangeCandidates", + /** @deprecated Use listWithdrawalExchangeCandidates instead. */ + GetDefaultExchanges = "getDefaultExchanges", + GetExchangeEntryByUrl = "getExchangeEntryByUrl", + UpdateExchangeEntry = "updateExchangeEntry", + GetExchangeResources = "getExchangeResources", + CompleteExchangeBaseUrl = "completeExchangeBaseUrl", + DeleteExchange = "deleteExchange", + ConfirmExchangeKeyChange = "confirmExchangeKeyChange", + SetExchangeTosAccepted = "setExchangeTosAccepted", + SetExchangeTosForgotten = "setExchangeTosForgotten", + GetExchangeTos = "getExchangeTos", + GetExchangeDetailedInfo = "getExchangeDetailedInfo", + // Withdrawals + PrepareWithdrawExchange = "prepareWithdrawExchange", + PrepareBankIntegratedWithdrawal = "prepareBankIntegratedWithdrawal", + ConfirmWithdrawal = "confirmWithdrawal", + AcceptBankIntegratedWithdrawal = "acceptBankIntegratedWithdrawal", + GetWithdrawalDetailsForAmount = "getWithdrawalDetailsForAmount", + AcceptManualWithdrawal = "acceptManualWithdrawal", + // Merchant Payments + GetChoicesForPayment = "getChoicesForPayment", + PreparePayForUriV2 = "preparePayForUriV2", + PreparePayForTemplateV2 = "preparePayForTemplateV2", + PreparePayForPaivana = "preparePayForPaivana", + GetPaivanaCookie = "getPaivanaCookie", + SharePayment = "sharePayment", + CheckPayForTemplate = "checkPayForTemplate", + StartRefundQueryForUri = "startRefundQueryForUri", + StartRefundQuery = "startRefundQuery", + ConfirmPay = "confirmPay", + // Deposits + CheckDeposit = "checkDeposit", + CreateDepositGroup = "createDepositGroup", + /** + * @deprecated Use CheckDeposit for a concrete instructed amount, or + * GetMaxDepositAmount to query deposit limits. + */ + ConvertDepositAmount = "convertDepositAmount", + GetMaxDepositAmount = "getMaxDepositAmount", + GetDepositWireTypes = "getDepositWireTypes", + GetDepositWireTypesForCurrency = "getDepositWireTypesForCurrency", + // P2P Payments + PreparePeerPushCredit = "preparePeerPushCredit", + CheckPeerPushDebit = "checkPeerPushDebit", + CheckPeerPushDebitV2 = "checkPeerPushDebitV2", + InitiatePeerPushDebit = "initiatePeerPushDebit", + ConfirmPeerPushCredit = "confirmPeerPushCredit", + CheckPeerPullCredit = "checkPeerPullCredit", + InitiatePeerPullCredit = "initiatePeerPullCredit", + PreparePeerPullDebit = "preparePeerPullDebit", + ConfirmPeerPullDebit = "confirmPeerPullDebit", + GetMaxPeerPushDebitAmount = "getMaxPeerPushDebitAmount", + // Tokens and token families + ListDiscounts = "listDiscounts", + DeleteDiscount = "deleteDiscount", + ListSubscriptions = "listSubscriptions", + DeleteSubscription = "deleteSubscription", + // Donau + SetDonau = "setDonau", + GetDonau = "getDonau", + GetDonauStatements = "getDonauStatements", + // Mailbox + AddContact = "addContact", + DeleteContact = "deleteContact", + GetContacts = "getContacts", + GetMailbox = "getMailbox", + InitializeMailbox = "initializeMailbox", + GetMailboxMessages = "getMailboxMessage", + AddMailboxMessage = "addMailboxMessage", + DeleteMailboxMessage = "deleteMailboxMessage", + SendTalerUriMailboxMessage = "sendTalerUriMailboxMessage", + RefreshMailbox = "refreshMailbox", + // Taldir + RegisterAlias = "registerAlias", + CompleteRegisterAlias = "completeRegisterAlias", + LookupAlias = "lookupAlias", + // Wallet database management + ImportDb = "importDb", + ExportDb = "exportDb", + ExportDbToFile = "exportDbToFile", + ImportDbFromFile = "importDbFromFile", + ClearDb = "clearDb", + Recycle = "recycle", + // Testing + ApplyDevExperiment = "applyDevExperiment", + TestingGetSampleTransactions = "testingGetSampleTransactions", + WithdrawTestkudos = "withdrawTestkudos", + WithdrawTestBalance = "withdrawTestBalance", + RunIntegrationTest = "runIntegrationTest", + RunIntegrationTestV2 = "runIntegrationTestV2", + DumpCoins = "dumpCoins", + TestCrypto = "testCrypto", + TestPay = "testPay", + SetCoinSuspended = "setCoinSuspended", + ForceRefresh = "forceRefresh", + TestingWaitTransactionsFinal = "testingWaitTransactionsFinal", + TestingWaitRefreshesFinal = "testingWaitRefreshesFinal", + TestingWaitTransactionState = "testingWaitTransactionState", + TestingWaitExchangeState = "testingWaitExchangeState", + TestingWaitExchangeReady = "testingWaitExchangeReady", + TestingWaitTasksDone = "testingWaitTasksDone", + TestingWaitBalance = "testingWaitBalance", + TestingGetDbStats = "testingGetDbStats", + TestingSetTimetravel = "testingSetTimetravel", + TestingGetDenomStats = "testingGetDenomStats", + TestingPing = "testingPing", + TestingGetReserveHistory = "testingGetReserveHistory", + TestingResetAllRetries = "testingResetAllRetries", + TestingWaitExchangeWalletKyc = "testingWaitWalletKyc", + TestingPlanMigrateExchangeBaseUrl = "testingPlanMigrateExchangeBaseUrl", + TestingRunFixup = "testingRunFixup", + TestingGetFlightRecords = "testingGetFlightRecords", + TestingGetPerformanceStats = "testingGetPerformanceStats", + TestingCorruptWithdrawalCoinSel = "testingCorruptWithdrawalCoinSel", + // Diagnostics + GetDiagnostics = "getDiagnostics", + // Hints + HintNetworkAvailability = "hintNetworkAvailability", + HintApplicationResumed = "hintApplicationResumed", + /** + * @deprecated (2025-05-07) + * Use {@link WalletApiOperation.PrepareBankIntegratedWithdrawal} instead. + */ + GetWithdrawalDetailsForUri = "getWithdrawalDetailsForUri", + /** + * @deprecated(2026-05-26) Consult withdrawal transaction details instead. + */ + GetQrCodesForPayto = "getQrCodesForPayto", +} +``` +```{ts:def} InitRequest export interface InitRequest { config?: PartialWalletRunConfig; } ``` -```typescript +```{ts:def} PartialWalletRunConfig export interface PartialWalletRunConfig { testing?: Partial<WalletRunConfig["testing"]>; features?: Partial<WalletRunConfig["features"]>; @@ -5053,7 +4820,7 @@ export interface PartialWalletRunConfig { logLevel?: Partial<WalletRunConfig["logLevel"]>; } ``` -```typescript +```{ts:def} WalletRunConfig export interface WalletRunConfig { /** * Unsafe options which it should only be used to create @@ -5108,7 +4875,7 @@ export interface WalletRunConfig { logLevel: string; } ``` -```typescript +```{ts:def} CoinSelectionAlgorithm /** * Coin selection algorithm the wallet uses when spending. * @@ -5120,14 +4887,14 @@ export interface WalletRunConfig { */ export type CoinSelectionAlgorithm = "default" | "legacy-2024"; ``` -```typescript +```{ts:def} InitResponse export interface InitResponse { versionInfo: WalletCoreVersion; /** Database backend used by the initialized wallet. */ databaseBackend: WalletDatabaseBackend; } ``` -```typescript +```{ts:def} WalletCoreVersion export interface WalletCoreVersion { implementationSemver: string; implementationGitHash: string; @@ -5155,20 +4922,29 @@ export interface WalletCoreVersion { devMode: boolean; } ``` -```typescript +```{ts:def} WalletDatabaseBackend export type WalletDatabaseBackend = "indexeddb" | "sqlite"; ``` -```typescript +```{ts:def} EmptyObject export type EmptyObject = Record<string, never>; ``` -```typescript +```{ts:def} AmountString export type AmountString = | (string & { [__amount_str]: true; }) | LitAmountString; ``` -```typescript +```{ts:def} LitAmountString +export type LitAmountString = `${string}:${number}`; +``` +```{ts:def} EddsaSignatureString +export type EddsaSignatureString = string; +``` +```{ts:def} EddsaPublicKeyString +export type EddsaPublicKeyString = string; +``` +```{ts:def} ContactEntry export interface ContactEntry { /** * Contact alias @@ -5197,22 +4973,18 @@ export interface ContactEntry { petname: string; } ``` -```typescript +```{ts:def} HashCodeString +export type HashCodeString = string; +``` +```{ts:def} RelativeTime +export type RelativeTime = TalerProtocolDuration; +``` +```{ts:def} TalerProtocolDuration export interface TalerProtocolDuration { readonly d_us: number | "forever"; } ``` -```typescript -export interface DurationUnitSpec { - seconds?: number; - minutes?: number; - hours?: number; - days?: number; - months?: number; - years?: number; -} -``` -```typescript +```{ts:def} MailboxConfiguration export interface MailboxConfiguration { mailboxBaseUrl: string; privateKey: EddsaPrivateKeyString; @@ -5222,7 +4994,13 @@ export interface MailboxConfiguration { payUri?: TalerUri; } ``` -```typescript +```{ts:def} EddsaPrivateKeyString +export type EddsaPrivateKeyString = string; +``` +```{ts:def} Timestamp +export type Timestamp = TalerProtocolTimestamp; +``` +```{ts:def} TalerProtocolTimestamp export interface TalerProtocolTimestamp { /** * Seconds (as integer) since epoch. @@ -5231,7 +5009,7 @@ export interface TalerProtocolTimestamp { readonly _flavor?: typeof flavor_TalerProtocolTimestamp; } ``` -```typescript +```{ts:def} TalerUri /** * A parsed taler URI. */ @@ -5249,7 +5027,7 @@ export type TalerUri = | TalerWithdrawalTransferResultUri | TalerAddContactUri; ``` -```typescript +```{ts:def} TalerPayUriResult export interface TalerPayUriResult { type: TalerUriAction.Pay; merchantBaseUrl: HostPortPath; @@ -5269,12 +5047,65 @@ export interface TalerPayUriResult { nfc?: boolean; } ``` -```typescript +```{ts:def} TalerUriAction +export declare enum TalerUriAction { + /** + * https://lsd.gnunet.org/lsd0006/#section-5.1 + */ + Withdraw = "withdraw", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.2 + */ + Pay = "pay", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.3 + */ + Refund = "refund", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.4 + */ + PayPush = "pay-push", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.5 + */ + PayPull = "pay-pull", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.6 + */ + PayTemplate = "pay-template", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.7 + */ + Restore = "restore", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.8 + */ + DevExperiment = "dev-experiment", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.9 + */ + AddExchange = "add-exchange", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.10 + */ + WithdrawExchange = "withdraw-exchange", + /** + * https://lsd.gnunet.org/lsd0006/#section-5.11 + */ + WithdrawalTransferResult = "withdrawal-transfer-result", + /** + * FIXME: LSD + * Add a contact to the wallet + */ + AddContact = "add-contact", +} +``` +```{ts:def} HostPortPath export type HostPortPath = string & { [__hostport_str]: true; }; ``` -```typescript +```{ts:def} TalerPayTemplateUri export interface TalerPayTemplateUri { type: TalerUriAction.PayTemplate; merchantBaseUrl: HostPortPath; @@ -5288,42 +5119,42 @@ export interface TalerPayTemplateUri { nfc?: boolean; } ``` -```typescript +```{ts:def} TalerDevExperimentUri export interface TalerDevExperimentUri { type: TalerUriAction.DevExperiment; devExperimentId: string; query?: Record<string, string>; } ``` -```typescript +```{ts:def} TalerPayPullUri export interface TalerPayPullUri { type: TalerUriAction.PayPull; exchangeBaseUrl: HostPortPath; contractPriv: string; } ``` -```typescript +```{ts:def} TalerPayPushUri export interface TalerPayPushUri { type: TalerUriAction.PayPush; exchangeBaseUrl: HostPortPath; contractPriv: string; } ``` -```typescript +```{ts:def} TalerRestoreUri export interface TalerRestoreUri { type: TalerUriAction.Restore; walletRootPriv: string; providers: Array<HostPortPath>; } ``` -```typescript +```{ts:def} TalerRefundUri export interface TalerRefundUri { type: TalerUriAction.Refund; merchantBaseUrl: HostPortPath; orderId: string; } ``` -```typescript +```{ts:def} TalerWithdrawUri export interface TalerWithdrawUri { type: TalerUriAction.Withdraw; bankIntegrationApiBaseUrl: HostPortPath; @@ -5331,27 +5162,27 @@ export interface TalerWithdrawUri { externalConfirmation?: boolean; } ``` -```typescript +```{ts:def} TalerWithdrawExchangeUri export interface TalerWithdrawExchangeUri { type: TalerUriAction.WithdrawExchange; exchangeBaseUrl: HostPortPath; amount?: AmountString; } ``` -```typescript +```{ts:def} TalerAddExchangeUri export interface TalerAddExchangeUri { type: TalerUriAction.AddExchange; exchangeBaseUrl: HostPortPath; } ``` -```typescript +```{ts:def} TalerWithdrawalTransferResultUri export interface TalerWithdrawalTransferResultUri { type: TalerUriAction.WithdrawalTransferResult; ref: string; status?: "success" | "aborted"; } ``` -```typescript +```{ts:def} TalerAddContactUri export interface TalerAddContactUri { type: TalerUriAction.AddContact; alias: string; @@ -5361,7 +5192,7 @@ export interface TalerAddContactUri { sourceBaseUrl: string; } ``` -```typescript +```{ts:def} MailboxMessageRecord /** * Record metadata for mailbox messages */ @@ -5371,47 +5202,56 @@ export interface MailboxMessageRecord { talerUri: string; } ``` -```typescript +```{ts:def} MailboxBaseUrl export interface MailboxBaseUrl { mailboxBaseUrl: string; } ``` -```typescript +```{ts:def} ScopeInfo export type ScopeInfo = | ScopeInfoGlobal | ScopeInfoExchange | ScopeInfoAuditor | ScopeInfoExchangeLegacyKeys; ``` -```typescript +```{ts:def} ScopeInfoGlobal export type ScopeInfoGlobal = { type: ScopeType.Global; currency: string; }; ``` -```typescript +```{ts:def} ScopeType +export declare enum ScopeType { + Global = "global", + Exchange = "exchange", + Auditor = "auditor", + /** + * Funds issued under a master public key the exchange has since replaced. + * + * A distinct type rather than an optional field on {@link ScopeInfoExchange} + * on purpose: these funds must never be pooled with, or selected alongside, + * funds under the key the exchange currently uses, and a scope that merely + * carried an extra field would render as a second bucket with the same + * label and would still be matched by an existing exchange-scoped filter. + */ + ExchangeLegacyKeys = "exchange-legacy-keys", +} +``` +```{ts:def} ScopeInfoExchange export type ScopeInfoExchange = { type: ScopeType.Exchange; currency: string; url: string; }; ``` -```typescript -export interface Exchange { - url: string; - priority: Integer; - master_pub: EddsaPublicKey; - max_contribution?: AmountString; -} -``` -```typescript +```{ts:def} ScopeInfoAuditor export type ScopeInfoAuditor = { type: ScopeType.Auditor; currency: string; url: string; }; ``` -```typescript +```{ts:def} ScopeInfoExchangeLegacyKeys export type ScopeInfoExchangeLegacyKeys = { type: ScopeType.ExchangeLegacyKeys; currency: string; @@ -5420,19 +5260,19 @@ export type ScopeInfoExchangeLegacyKeys = { masterPub: string; }; ``` -```typescript +```{ts:def} DepositGroupFees export interface DepositGroupFees { coin: AmountString; wire: AmountString; refresh: AmountString; } ``` -```typescript +```{ts:def} AccountRestriction export type AccountRestriction = | RegexAccountRestriction | DenyAllAccountRestriction; ``` -```typescript +```{ts:def} RegexAccountRestriction export interface RegexAccountRestriction { type: "regex"; payto_regex: string; @@ -5440,22 +5280,22 @@ export interface RegexAccountRestriction { human_hint_i18n?: InternationalizedString; } ``` -```typescript +```{ts:def} InternationalizedString export interface InternationalizedString { [lang_tag: string]: string; } ``` -```typescript +```{ts:def} DenyAllAccountRestriction export interface DenyAllAccountRestriction { type: "deny"; } ``` -```typescript +```{ts:def} TransactionsResponse export interface TransactionsResponse { transactions: Transaction[]; } ``` -```typescript +```{ts:def} Transaction export type Transaction = | TransactionWithdrawal | TransactionPayment @@ -5470,7 +5310,7 @@ export type Transaction = | TransactionRecoup | TransactionDenomLoss; ``` -```typescript +```{ts:def} TransactionWithdrawal /** * A withdrawal transaction (either bank-integrated or manual). */ @@ -5491,7 +5331,7 @@ export interface TransactionWithdrawal extends TransactionCommon { withdrawalDetails: WithdrawalDetails; } ``` -```typescript +```{ts:def} TransactionCommon export interface TransactionCommon { transactionId: TransactionIdStr; /** @@ -5548,12 +5388,12 @@ export interface TransactionCommon { kycAuthTransferInfo?: KycAuthTransferInfo; } ``` -```typescript +```{ts:def} TransactionIdStr export type TransactionIdStr = `txn:${string}:${string}` & { [__txId]: true; }; ``` -```typescript +```{ts:def} TransactionType export declare enum TransactionType { Withdrawal = "withdrawal", InternalWithdrawal = "internal-withdrawal", @@ -5569,7 +5409,7 @@ export declare enum TransactionType { DenomLoss = "denom-loss", } ``` -```typescript +```{ts:def} TalerPreciseTimestamp /** * Precise timestamp, typically used in the wallet-core * API but not in other Taler APIs so far. @@ -5586,7 +5426,7 @@ export interface TalerPreciseTimestamp { readonly _flavor?: typeof flavor_TalerPreciseTimestamp; } ``` -```typescript +```{ts:def} TransactionState export interface TransactionState { /** * Major state component of the transaction state. @@ -5607,7 +5447,7 @@ export interface TransactionState { working?: boolean; } ``` -```typescript +```{ts:def} TransactionMajorState export declare enum TransactionMajorState { None = "none", Pending = "pending", @@ -5624,7 +5464,7 @@ export declare enum TransactionMajorState { Deleted = "deleted", } ``` -```typescript +```{ts:def} TransactionMinorState export declare enum TransactionMinorState { AbortingBank = "aborting-bank", AcceptRefund = "accept-refund", @@ -5665,7 +5505,7 @@ export declare enum TransactionMinorState { Abort = "abort", } ``` -```typescript +```{ts:def} TransactionAction export declare enum TransactionAction { Delete = "delete", Suspend = "suspend", @@ -5675,7 +5515,7 @@ export declare enum TransactionAction { Retry = "retry", } ``` -```typescript +```{ts:def} TalerErrorDetail export interface TalerErrorDetail { code: TalerErrorCode; when?: AbsoluteTime; @@ -5683,7 +5523,7 @@ export interface TalerErrorDetail { [x: string]: unknown; } ``` -```typescript +```{ts:def} AbsoluteTime export interface AbsoluteTime { /** * Timestamp in milliseconds. @@ -5693,41 +5533,7 @@ export interface AbsoluteTime { [opaque_AbsoluteTime]: true; } ``` -```typescript -export interface Duration { - /** - * Duration in milliseconds. - */ - readonly d_ms: number | "forever"; -} -``` -```typescript -export type DurationLike = TalerProtocolDuration | Duration; -``` -```typescript -export type TimestampLike = - | AbsoluteTime - | { - t_ms: number | "never"; - } - | TalerProtocolTimestamp - | TalerPreciseTimestamp - | Date - | number - | string - | Record<string, unknown>; -``` -```typescript -export interface FormatDateOptions { - dateFormat?: DateFormatPattern; - includeTime?: boolean; - includeSeconds?: boolean; -} -``` -```typescript -export type DateFormatPattern = "ymd" | "dmy" | "mdy"; -``` -```typescript +```{ts:def} KycAuthTransferInfo export interface KycAuthTransferInfo { /** * Payto URI of the account that must make the transfer. @@ -5779,7 +5585,7 @@ export interface KycAuthTransferInfo { creditPaytoUris: string[]; } ``` -```typescript +```{ts:def} WithdrawalExchangeAccountDetails export interface WithdrawalExchangeAccountDetails { /** * Payto URI to of the exchange. @@ -5839,7 +5645,7 @@ export interface WithdrawalExchangeAccountDetails { transferOptions: TransferOption[]; } ``` -```typescript +```{ts:def} CurrencySpecification /** * DD51 https://docs.taler.net/design-documents/051-fractional-digits.html */ @@ -5854,20 +5660,23 @@ export interface CurrencySpecification { common_amounts?: AmountString[]; } ``` -```typescript +```{ts:def} Integer +export type Integer = number; +``` +```{ts:def} TransferOption export type TransferOption = | TransferOptionPayto | TransferOptionUri | TransferOptionSwissQrBill; ``` -```typescript +```{ts:def} TransferOptionPayto export interface TransferOptionPayto { type: "payto"; paytoUri: string; qrCodes: QrCodeSpec[]; } ``` -```typescript +```{ts:def} QrCodeSpec /** * Specification of a QR code that includes payment information. */ @@ -5885,16 +5694,16 @@ export interface QrCodeSpec { qrContent: string; } ``` -```typescript +```{ts:def} SupportedBankQr export type SupportedBankQr = "epc-qr" | "spc"; ``` -```typescript +```{ts:def} TransferOptionUri export interface TransferOptionUri { type: "uri"; uri: string; } ``` -```typescript +```{ts:def} TransferOptionSwissQrBill export interface TransferOptionSwissQrBill { type: "ch-qr-bill"; paytoUri: string; @@ -5902,12 +5711,12 @@ export interface TransferOptionSwissQrBill { qrCodes: QrCodeSpec[]; } ``` -```typescript +```{ts:def} WithdrawalDetails export type WithdrawalDetails = | WithdrawalDetailsForManualTransfer | WithdrawalDetailsForTalerBankIntegrationApi; ``` -```typescript +```{ts:def} WithdrawalDetailsForManualTransfer interface WithdrawalDetailsForManualTransfer { type: WithdrawalType.ManualTransfer; /** @@ -5931,7 +5740,13 @@ interface WithdrawalDetailsForManualTransfer { reserveClosingDelay: TalerProtocolDuration; } ``` -```typescript +```{ts:def} WithdrawalType +export declare enum WithdrawalType { + TalerBankIntegrationApi = "taler-bank-integration-api", + ManualTransfer = "manual-transfer", +} +``` +```{ts:def} WithdrawalDetailsForTalerBankIntegrationApi interface WithdrawalDetailsForTalerBankIntegrationApi { type: WithdrawalType.TalerBankIntegrationApi; /** @@ -5957,7 +5772,7 @@ interface WithdrawalDetailsForTalerBankIntegrationApi { exchangeCreditAccountDetails?: WithdrawalExchangeAccountDetails[]; } ``` -```typescript +```{ts:def} TransactionPayment export interface TransactionPayment extends TransactionCommon { type: TransactionType.Payment; /** @@ -6026,7 +5841,7 @@ export interface TransactionPayment extends TransactionCommon { choiceIndex?: number; } ``` -```typescript +```{ts:def} OrderShortInfo export interface OrderShortInfo { /** * Order ID, uniquely identifies the order within a merchant instance @@ -6063,7 +5878,7 @@ export interface OrderShortInfo { fulfillmentMessage_i18n?: InternationalizedString; } ``` -```typescript +```{ts:def} MerchantInfo export interface MerchantInfo { name: string; email?: string; @@ -6073,7 +5888,22 @@ export interface MerchantInfo { jurisdiction?: Location; } ``` -```typescript +```{ts:def} ImageDataUrl +export type ImageDataUrl = string; +``` +```{ts:def} Location +export interface Location { + country?: string; + country_subdivision?: string; + district?: string; + town?: string; + town_location?: string; + post_code?: string; + street?: string; + building_name?: string; + building_number?: string; + address_lines?: string[]; +} export interface Location { country?: string; country_subdivision?: string; @@ -6087,19 +5917,19 @@ export interface Location { address_lines?: string[]; } ``` -```typescript +```{ts:def} MerchantContractTerms export type MerchantContractTerms = | MerchantContractTermsV0 | MerchantContractTermsV1; ``` -```typescript +```{ts:def} MerchantContractTermsV0 export interface MerchantContractTermsV0 extends MerchantContractTermsCommon { version?: MerchantContractVersion.V0; amount: AmountString; max_fee: AmountString; } ``` -```typescript +```{ts:def} MerchantContractTermsCommon /** * Contract terms from a merchant. */ @@ -6131,7 +5961,18 @@ interface MerchantContractTermsCommon { default_money_pot?: Integer; } ``` -```typescript +```{ts:def} Exchange +export interface Exchange { + url: string; + priority: Integer; + master_pub: EddsaPublicKey; + max_contribution?: AmountString; +} +``` +```{ts:def} EddsaPublicKey +export type EddsaPublicKey = EddsaPublicKeyString; +``` +```{ts:def} ProductSold export interface ProductSold { product_id?: string; product_name?: string; @@ -6151,13 +5992,26 @@ export interface ProductSold { product_money_pot?: Integer; } ``` -```typescript +```{ts:def} DecimalQuantity +export type DecimalQuantity = string; +``` +```{ts:def} Tax +export interface Tax { + name: string; + tax: AmountString; +} export interface Tax { name: string; tax: AmountString; } ``` -```typescript +```{ts:def} MerchantContractVersion +export declare enum MerchantContractVersion { + V0 = 0, + V1 = 1, +} +``` +```{ts:def} MerchantContractTermsV1 export interface MerchantContractTermsV1 extends MerchantContractTermsCommon { version: MerchantContractVersion.V1; choices: MerchantContractChoice[]; @@ -6166,7 +6020,7 @@ export interface MerchantContractTermsV1 extends MerchantContractTermsCommon { }; } ``` -```typescript +```{ts:def} MerchantContractChoice export interface MerchantContractChoice { amount: AmountString; description?: string; @@ -6176,19 +6030,27 @@ export interface MerchantContractChoice { max_fee: AmountString; } ``` -```typescript +```{ts:def} MerchantContractInput +export type MerchantContractInput = MerchantContractInputToken; +``` +```{ts:def} MerchantContractInputToken export interface MerchantContractInputToken { type: MerchantContractInputType.Token; token_family_slug: string; count?: Integer; } ``` -```typescript +```{ts:def} MerchantContractInputType +export declare enum MerchantContractInputType { + Token = "token", +} +``` +```{ts:def} MerchantContractOutput export type MerchantContractOutput = | MerchantContractOutputToken | MerchantContractOutputTaxReceipt; ``` -```typescript +```{ts:def} MerchantContractOutputToken export interface MerchantContractOutputToken { type: MerchantContractOutputType.Token; token_family_slug: string; @@ -6197,14 +6059,20 @@ export interface MerchantContractOutputToken { key_index: Integer; } ``` -```typescript +```{ts:def} MerchantContractOutputType +export declare enum MerchantContractOutputType { + Token = "token", + TaxReceipt = "tax-receipt", +} +``` +```{ts:def} MerchantContractOutputTaxReceipt export interface MerchantContractOutputTaxReceipt { type: MerchantContractOutputType.TaxReceipt; donau_urls: string[]; amount?: AmountString; } ``` -```typescript +```{ts:def} MerchantContractTokenFamily export interface MerchantContractTokenFamily { name: string; description: string; @@ -6216,12 +6084,12 @@ export interface MerchantContractTokenFamily { critical: boolean; } ``` -```typescript +```{ts:def} TokenIssuePublicKey export type TokenIssuePublicKey = | TokenIssueRsaPublicKey | TokenIssueCsPublicKey; ``` -```typescript +```{ts:def} TokenIssueRsaPublicKey export interface TokenIssueRsaPublicKey { cipher: "RSA"; rsa_pub: RsaPublicKey; @@ -6229,7 +6097,10 @@ export interface TokenIssueRsaPublicKey { signature_validity_end: Timestamp; } ``` -```typescript +```{ts:def} RsaPublicKey +export type RsaPublicKey = string; +``` +```{ts:def} TokenIssueCsPublicKey export interface TokenIssueCsPublicKey { cipher: "CS"; cs_pub: Cs25519Point; @@ -6237,24 +6108,36 @@ export interface TokenIssueCsPublicKey { signature_validity_end: Timestamp; } ``` -```typescript +```{ts:def} Cs25519Point +/** + * 32-byte value representing a point on Curve25519. + */ +export type Cs25519Point = string; +``` +```{ts:def} MerchantContractTokenDetails export type MerchantContractTokenDetails = | MerchantContractSubscriptionTokenDetails | MerchantContractDiscountTokenDetails; ``` -```typescript +```{ts:def} MerchantContractSubscriptionTokenDetails export interface MerchantContractSubscriptionTokenDetails { class: MerchantContractTokenKind.Subscription; trusted_domains: string[]; } ``` -```typescript +```{ts:def} MerchantContractTokenKind +export declare enum MerchantContractTokenKind { + Subscription = "subscription", + Discount = "discount", +} +``` +```{ts:def} MerchantContractDiscountTokenDetails export interface MerchantContractDiscountTokenDetails { class: MerchantContractTokenKind.Discount; expected_domains: string[]; } ``` -```typescript +```{ts:def} RefundInfoShort export interface RefundInfoShort { transactionId: string; timestamp: TalerProtocolTimestamp; @@ -6262,7 +6145,7 @@ export interface RefundInfoShort { amountRaw: AmountString; } ``` -```typescript +```{ts:def} TransactionRefund export interface TransactionRefund extends TransactionCommon { type: TransactionType.Refund; amountRaw: AmountString; @@ -6271,7 +6154,7 @@ export interface TransactionRefund extends TransactionCommon { paymentInfo: RefundPaymentInfo | undefined; } ``` -```typescript +```{ts:def} RefundPaymentInfo /** * Summary information about the payment that we got a refund for. */ @@ -6284,7 +6167,7 @@ export interface RefundPaymentInfo { merchant: MerchantInfo; } ``` -```typescript +```{ts:def} TransactionRefresh /** * A transaction shown for refreshes. * Only shown for (1) refreshes not associated with other transactions @@ -6314,7 +6197,7 @@ export interface TransactionRefresh extends TransactionCommon { refreshOutputAmount: AmountString; } ``` -```typescript +```{ts:def} RefreshReason /** * Reasons for why a coin is being refreshed. */ @@ -6334,7 +6217,7 @@ export declare enum RefreshReason { Scheduled = "scheduled", } ``` -```typescript +```{ts:def} TransactionDeposit /** * Deposit transaction, which effectively sends * money from this wallet somewhere else. @@ -6367,7 +6250,7 @@ export interface TransactionDeposit extends TransactionCommon { trackingState: Array<DepositTransactionTrackingState>; } ``` -```typescript +```{ts:def} DepositTransactionTrackingState export interface DepositTransactionTrackingState { wireTransferId: string; timestampExecuted: TalerProtocolTimestamp; @@ -6375,7 +6258,7 @@ export interface DepositTransactionTrackingState { wireFee: AmountString; } ``` -```typescript +```{ts:def} TransactionPeerPullCredit /** * Credit because we were paid for a P2P invoice we created. */ @@ -6402,14 +6285,14 @@ export interface TransactionPeerPullCredit extends TransactionCommon { talerUri: string | undefined; } ``` -```typescript +```{ts:def} PeerInfoShort export interface PeerInfoShort { expiration: TalerProtocolTimestamp | undefined; summary: string | undefined; iconId: string | undefined; } ``` -```typescript +```{ts:def} TransactionPeerPullDebit /** * Debit because we paid someone's invoice. */ @@ -6424,7 +6307,7 @@ export interface TransactionPeerPullDebit extends TransactionCommon { amountEffective: AmountString; } ``` -```typescript +```{ts:def} TransactionPeerPushCredit /** * We received money via a P2P payment. */ @@ -6445,7 +6328,7 @@ export interface TransactionPeerPushCredit extends TransactionCommon { amountEffective: AmountString; } ``` -```typescript +```{ts:def} TransactionPeerPushDebit /** * We sent money via a P2P payment. */ @@ -6473,7 +6356,7 @@ export interface TransactionPeerPushDebit extends TransactionCommon { talerUri?: string; } ``` -```typescript +```{ts:def} TransactionInternalWithdrawal /** * Internal withdrawal operation, only reported on request. * @@ -6504,7 +6387,7 @@ export interface TransactionInternalWithdrawal extends TransactionCommon { withdrawalDetails: WithdrawalDetails; } ``` -```typescript +```{ts:def} TransactionRecoup /** * The exchange revoked a key and the wallet recoups funds. */ @@ -6512,7 +6395,7 @@ export interface TransactionRecoup extends TransactionCommon { type: TransactionType.Recoup; } ``` -```typescript +```{ts:def} TransactionDenomLoss /** * A transaction to indicate financial loss due to denominations * that became unusable for deposits. @@ -6523,7 +6406,7 @@ export interface TransactionDenomLoss extends TransactionCommon { exchangeBaseUrl: string; } ``` -```typescript +```{ts:def} DenomLossEventType export declare enum DenomLossEventType { DenomExpired = "denom-expired", DenomVanished = "denom-vanished", @@ -6536,12 +6419,12 @@ export declare enum DenomLossEventType { DenomRevoked = "denom-revoked", } ``` -```typescript +```{ts:def} AbortTransactionRequest export interface AbortTransactionRequest { transactionId: TransactionIdStr; } ``` -```typescript +```{ts:def} ExchangeKeyChangeInfo /** * Info about an exchange entry in the wallet. */ @@ -6573,7 +6456,7 @@ export interface ExchangeKeyChangeInfo { firstSeen: TalerPreciseTimestamp; } ``` -```typescript +```{ts:def} WithdrawUriInfoResponse export interface WithdrawUriInfoResponse { operationId: string; status: WithdrawalOperationStatusFlag; @@ -6595,14 +6478,14 @@ export interface WithdrawUriInfoResponse { possibleExchanges: ExchangeListItem[]; } ``` -```typescript +```{ts:def} WithdrawalOperationStatusFlag export type WithdrawalOperationStatusFlag = | "pending" | "selected" | "aborted" | "confirmed"; ``` -```typescript +```{ts:def} ExchangeListItem export interface ExchangeListItem { exchangeBaseUrl: string; source?: ExchangeEntrySource; @@ -6655,7 +6538,7 @@ export interface ExchangeListItem { currencySpec: CurrencySpecification; } ``` -```typescript +```{ts:def} ExchangeEntrySource /** How an exchange entry became known to the wallet. */ export declare enum ExchangeEntrySource { Builtin = "builtin", @@ -6664,7 +6547,7 @@ export declare enum ExchangeEntrySource { Unknown = "unknown", } ``` -```typescript +```{ts:def} ExchangeTosStatus export declare enum ExchangeTosStatus { Pending = "pending", Proposed = "proposed", @@ -6672,14 +6555,14 @@ export declare enum ExchangeTosStatus { MissingTos = "missing-tos", } ``` -```typescript +```{ts:def} ExchangeEntryStatus export declare enum ExchangeEntryStatus { Preset = "preset", Ephemeral = "ephemeral", Used = "used", } ``` -```typescript +```{ts:def} ExchangeUpdateStatus export declare enum ExchangeUpdateStatus { Initial = "initial", InitialUpdate = "initial-update", @@ -6690,7 +6573,7 @@ export declare enum ExchangeUpdateStatus { OutdatedUpdate = "outdated-update", } ``` -```typescript +```{ts:def} ExchangeWalletKycStatus export declare enum ExchangeWalletKycStatus { Done = "done", /** @@ -6703,12 +6586,12 @@ export declare enum ExchangeWalletKycStatus { Legi = "legi", } ``` -```typescript +```{ts:def} OperationErrorInfo export interface OperationErrorInfo { error: TalerErrorDetail; } ``` -```typescript +```{ts:def} ForcedDenomSel export interface ForcedDenomSel { denoms: { value: AmountString; @@ -6716,12 +6599,12 @@ export interface ForcedDenomSel { }[]; } ``` -```typescript +```{ts:def} PreparePayV2Result export interface PreparePayV2Result { transactionId: TransactionIdStr; } ``` -```typescript +```{ts:def} PaivanaRedemption /** Information needed to redeem a paid Paivana order for an access cookie. */ export interface PaivanaRedemption { /** Canonical HTTP(S) URL of the protected resource. */ @@ -6732,7 +6615,7 @@ export interface PaivanaRedemption { expiration: TalerProtocolTimestamp; } ``` -```typescript +```{ts:def} ForcedCoinSel /** * Forced coin selection for deposits/payments. */ @@ -6743,7 +6626,7 @@ export interface ForcedCoinSel { }[]; } ``` -```typescript +```{ts:def} PaymentInsufficientBalanceDetails /** * Detailed reason for why the wallet's balance is insufficient. * @@ -6758,7 +6641,7 @@ export type PaymentInsufficientBalanceDetails = | PaymentInsufficientBalanceLegacyOnly ); ``` -```typescript +```{ts:def} PaymentInsufficientBalanceCompatibilityDetails /** * Request context and compatibility fields shared by old and current * insufficient-balance responses. @@ -6962,7 +6845,7 @@ interface PaymentInsufficientBalanceCompatibilityDetails { }; } ``` -```typescript +```{ts:def} InsufficientBalanceHint export declare enum InsufficientBalanceHint { /** * Merchant doesn't accept money from exchange(s) that the wallet supports. @@ -7003,7 +6886,7 @@ export declare enum InsufficientBalanceHint { FeesNotCovered = "fees-not-covered", } ``` -```typescript +```{ts:def} PaymentInsufficientBalanceStructuredDetails /** Structured explanation emitted by current wallet-core versions. */ export interface PaymentInsufficientBalanceStructuredDetails { /** Balance in the requested sender scope before payment restrictions. */ @@ -7020,7 +6903,7 @@ export interface PaymentInsufficientBalanceStructuredDetails { exchanges: Record<string, CoinSelectionExchangeFailureDiagnostics>; } ``` -```typescript +```{ts:def} CoinSelectionBalanceSnapshot /** * Balance amounts before age, receiver, wire and fee restrictions. * @@ -7037,7 +6920,7 @@ export interface CoinSelectionBalanceSnapshot { available: AmountString; } ``` -```typescript +```{ts:def} CoinSelectionFailureReason export type CoinSelectionFailureReason = | { type: CoinSelectionFailureReasonType.AvailableBalanceInsufficient; @@ -7096,7 +6979,32 @@ export type CoinSelectionFailureReason = type: CoinSelectionFailureReasonType.SelectionFailed; }; ``` -```typescript +```{ts:def} CoinSelectionFailureReasonType +/** + * Machine-readable reasons that prevented a requested coin selection. + * + * Unlike {@link InsufficientBalanceHint}, these values are exhaustive and can + * be reported together. Consumers must branch on the discriminator instead + * of assuming that the first entry is the only cause. + */ +export declare enum CoinSelectionFailureReasonType { + AvailableBalanceInsufficient = "available-balance-insufficient", + PendingRefresh = "pending-refresh", + MinimumAge = "minimum-age", + ScopeRestricted = "scope-restricted", + ReceiverNotAccepted = "receiver-not-accepted", + ReceiverExchangeMasterPubMismatch = "receiver-exchange-master-pub-mismatch", + WireMethodUnsupported = "wire-method-unsupported", + WireFeeUnavailable = "wire-fee-unavailable", + DepositAccountRestricted = "deposit-account-restricted", + ExchangeGlobalFeesUnavailable = "exchange-global-fees-unavailable", + FeesNotCovered = "fees-not-covered", + BalanceFragmented = "balance-fragmented", + SupersededExchangeMasterPub = "superseded-exchange-master-pub", + SelectionFailed = "selection-failed", +} +``` +```{ts:def} CoinSelectionExchangeFailureDiagnostics export interface CoinSelectionExchangeFailureDiagnostics { /** Balance held at this exchange before payment restrictions. */ balance: CoinSelectionBalanceSnapshot; @@ -7106,7 +7014,7 @@ export interface CoinSelectionExchangeFailureDiagnostics { reasons: CoinSelectionFailureReason[]; } ``` -```typescript +```{ts:def} PaymentInsufficientBalanceLegacyOnly interface PaymentInsufficientBalanceLegacyOnly { balance?: undefined; maximumPayableAmount?: undefined; @@ -7114,7 +7022,7 @@ interface PaymentInsufficientBalanceLegacyOnly { exchanges?: undefined; } ``` -```typescript +```{ts:def} ListDiscountsRequest export interface ListDiscountsRequest { /** * Filter by hash of token issue public key. @@ -7126,7 +7034,7 @@ export interface ListDiscountsRequest { merchantBaseUrl?: string; } ``` -```typescript +```{ts:def} DiscountListDetail export interface DiscountListDetail { /** * Hash of token family info. @@ -7170,7 +7078,7 @@ export interface DiscountListDetail { tokensAvailable: number; } ``` -```typescript +```{ts:def} WalletBankAccountInfo export interface WalletBankAccountInfo { bankAccountId: string; paytoUri: string; @@ -7188,12 +7096,12 @@ export interface WalletBankAccountInfo { label: string | undefined; } ``` -```typescript +```{ts:def} AcceptExchangeTosRequest export interface AcceptExchangeTosRequest { exchangeBaseUrl: string; } ``` -```typescript +```{ts:def} WireTypeDetails export interface WireTypeDetails { paymentTargetType: string; /** @@ -7213,7 +7121,7 @@ export interface WireTypeDetails { talerBankHostnames?: string[]; } ``` -```typescript +```{ts:def} GetDefaultExchangesRequest /** * @deprecated Use {@link ListWithdrawalExchangeCandidatesRequest} instead. */ @@ -7231,7 +7139,7 @@ export interface GetDefaultExchangesRequest { withTest?: boolean; } ``` -```typescript +```{ts:def} CheckPeerPushDebitRequest export interface CheckPeerPushDebitRequest { /** * Preferred exchange to use for the p2p payment. @@ -7251,7 +7159,7 @@ export interface CheckPeerPushDebitRequest { progressToken?: string; } ``` -```typescript +```{ts:def} CheckPeerPushDebitOkResponse export interface CheckPeerPushDebitOkResponse { type: "ok"; amountRaw: AmountString; @@ -7285,7 +7193,7 @@ export interface CheckPeerPushDebitOkResponse { peerPushDebitQuote?: string; } ``` -```typescript +```{ts:def} PeerContractTerms /** * Contract terms between two wallets (as opposed to a merchant and wallet). */ @@ -7296,7 +7204,7 @@ export interface PeerContractTerms { purse_expiration: TalerProtocolTimestamp; } ``` -```typescript +```{ts:def} WithdrawTestBalanceResult export interface WithdrawTestBalanceResult { /** * Transaction ID of the newly created withdrawal transaction.