diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..d96cb2a3 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +# Dist folder +dist/ + +# Generated code +src/lib/jm-api/** + +# Other common ignores +node_modules/ +.DS_Store diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..d5ea7cac --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "printWidth": 120, + "semi": false, + "singleQuote": true, + "plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"], + "importOrder": ["^react$", "", "^@/(.*)$", "^[./]"] +} diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 2973a55f..241d8e8d 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,5 +1,5 @@ -import '../src/index.css' import type { Preview } from '@storybook/react-vite' +import '../src/index.css' const preview: Preview = { parameters: { diff --git a/eslint.config.js b/eslint.config.js index 1d25a705..ba5f1c68 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,14 +1,13 @@ // For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format -import storybook from 'eslint-plugin-storybook' - import js from '@eslint/js' -import globals from 'globals' import reactHooks from 'eslint-plugin-react-hooks' import reactRefresh from 'eslint-plugin-react-refresh' +import storybook from 'eslint-plugin-storybook' +import globals from 'globals' import tseslint from 'typescript-eslint' export default tseslint.config( - { ignores: ['dist'] }, + { ignores: ['dist', 'src/lib/jm-api/**'] }, { extends: [js.configs.recommended, ...tseslint.configs.recommended], files: ['**/*.{ts,tsx}'], diff --git a/package-lock.json b/package-lock.json index 2d4fd42d..724925b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "@storybook/addon-docs": "^9.0.12", "@storybook/addon-vitest": "^9.0.12", "@storybook/react-vite": "^9.0.12", + "@trivago/prettier-plugin-sort-imports": "^5.2.2", "@types/node": "^22.15.29", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", @@ -3043,6 +3044,41 @@ "@testing-library/dom": ">=7.21.4" } }, + "node_modules/@trivago/prettier-plugin-sort-imports": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-5.2.2.tgz", + "integrity": "sha512-fYDQA9e6yTNmA13TLVSA+WMQRc5Bn/c0EUBditUHNfMMxN7M82c38b1kEggVE3pLpZ0FwkwJkUEKMiOi52JXFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/generator": "^7.26.5", + "@babel/parser": "^7.26.7", + "@babel/traverse": "^7.26.7", + "@babel/types": "^7.26.7", + "javascript-natural-sort": "^0.7.1", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">18.12" + }, + "peerDependencies": { + "@vue/compiler-sfc": "3.x", + "prettier": "2.x - 3.x", + "prettier-plugin-svelte": "3.x", + "svelte": "4.x || 5.x" + }, + "peerDependenciesMeta": { + "@vue/compiler-sfc": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + }, + "svelte": { + "optional": true + } + } + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", @@ -5632,6 +5668,13 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "dev": true, + "license": "MIT" + }, "node_modules/jiti": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", diff --git a/package.json b/package.json index 6e6209e1..83f32fad 100644 --- a/package.json +++ b/package.json @@ -33,14 +33,6 @@ ], "*.{json,css,md}": "prettier --write" }, - "prettier": { - "printWidth": 120, - "semi": false, - "singleQuote": true, - "plugins": [ - "prettier-plugin-tailwindcss" - ] - }, "dependencies": { "@hey-api/client-fetch": "^0.13.1", "@radix-ui/react-avatar": "^1.1.10", @@ -71,6 +63,7 @@ "@storybook/addon-docs": "^9.0.12", "@storybook/addon-vitest": "^9.0.12", "@storybook/react-vite": "^9.0.12", + "@trivago/prettier-plugin-sort-imports": "^5.2.2", "@types/node": "^22.15.29", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", diff --git a/src/App.tsx b/src/App.tsx index e6e1d386..ca5bec85 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,19 +1,19 @@ -import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom' -import JamLanding from './components/JamLanding' -import LoginPage from './components/Login' -import CreateWallet from './components/CreateWallet' -import { Layout } from './components/layout/Layout' -import { clearSession, getSession, setSession } from './lib/session' -import { Toaster } from './components/ui/sonner' -import { QueryClientProvider } from '@tanstack/react-query' -import { queryClient } from './lib/queryClient' -import { useApiClient } from './hooks/useApiClient' import { useEffect } from 'react' -import { JM_API_AUTH_TOKEN_EXPIRY } from './constants/jm' -import { setIntervalDebounced } from './lib/utils' -import { toast } from 'sonner' -import { token } from './lib/jm-api/generated/client' +import { QueryClientProvider } from '@tanstack/react-query' import { ThemeProvider } from 'next-themes' +import { Navigate, Route, BrowserRouter as Router, Routes } from 'react-router-dom' +import { toast } from 'sonner' +import CreateWallet from '@/components/CreateWallet' +import JamLanding from '@/components/JamLanding' +import LoginPage from '@/components/Login' +import { Layout } from '@/components/layout/Layout' +import { Toaster } from '@/components/ui/sonner' +import { JM_API_AUTH_TOKEN_EXPIRY } from '@/constants/jm' +import { useApiClient } from '@/hooks/useApiClient' +import { token } from '@/lib/jm-api/generated/client' +import { queryClient } from '@/lib/queryClient' +import { clearSession, getSession, setSession } from '@/lib/session' +import { setIntervalDebounced } from '@/lib/utils' const isAuthenticated = () => { const session = getSession() diff --git a/src/components/CreateWallet.tsx b/src/components/CreateWallet.tsx index 02a33391..c60eefc3 100644 --- a/src/components/CreateWallet.tsx +++ b/src/components/CreateWallet.tsx @@ -1,15 +1,15 @@ import React, { useState } from 'react' -import { useNavigate, Link } from 'react-router-dom' -import { setSession, clearSession } from '@/lib/session' -import { formatWalletName } from '@/lib/utils' +import { AlertCircle, Eye, EyeOff, Loader2, Lock, Wallet } from 'lucide-react' +import { Link, useNavigate } from 'react-router-dom' +import { toast } from 'sonner' +import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' -import { Alert, AlertDescription } from '@/components/ui/alert' -import { AlertCircle, Wallet, Lock, Loader2, Eye, EyeOff } from 'lucide-react' -import { toast } from 'sonner' -import { createwallet, session, type CreateWalletResponse } from '@/lib/jm-api/generated/client' +import { type CreateWalletResponse, createwallet, session } from '@/lib/jm-api/generated/client' +import { clearSession, setSession } from '@/lib/session' +import { formatWalletName } from '@/lib/utils' const CreateWallet = () => { const navigate = useNavigate() diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 8889f220..9cc9f8ea 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,5 +1,5 @@ import { File } from 'lucide-react' -import { Button } from './ui/button' +import { Button } from '@/components/ui/button' export function Footer() { return ( diff --git a/src/components/JamLanding.tsx b/src/components/JamLanding.tsx index 894604d9..ae6020f7 100644 --- a/src/components/JamLanding.tsx +++ b/src/components/JamLanding.tsx @@ -1,10 +1,10 @@ -import { Card } from './ui/card' -import { Button } from './ui/button' -import { Jar } from './layout/Jar' -import { Info, RefreshCw, Loader2 } from 'lucide-react' -import { Tooltip, TooltipTrigger, TooltipContent } from './ui/tooltip' -import { Alert, AlertDescription } from './ui/alert' -import { useJamDisplayContext } from './layout/display-mode-context' +import { Info, Loader2, RefreshCw } from 'lucide-react' +import { Jar } from '@/components/layout/Jar' +import { useJamDisplayContext } from '@/components/layout/display-mode-context' +import { Alert, AlertDescription } from '@/components/ui/alert' +import { Button } from '@/components/ui/button' +import { Card } from '@/components/ui/card' +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' export default function JamLanding() { const { diff --git a/src/components/Login.tsx b/src/components/Login.tsx index 47ce56a7..6d52ad3d 100644 --- a/src/components/Login.tsx +++ b/src/components/Login.tsx @@ -1,20 +1,20 @@ import React, { useEffect, useMemo, useState } from 'react' -import { toast } from 'sonner' +import { useMutation, useQuery } from '@tanstack/react-query' +import { AlertCircle, Eye, EyeOff, Loader2, Lock, RefreshCwIcon, Wallet } from 'lucide-react' import { useNavigate } from 'react-router-dom' -import { setSession } from '@/lib/session' +import { toast } from 'sonner' +import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' -import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' -import { AlertCircle, Wallet, Lock, Loader2, Eye, EyeOff, RefreshCwIcon } from 'lucide-react' -import { formatWalletName } from '@/lib/utils' -import { useMutation, useQuery } from '@tanstack/react-query' -import { listwalletsOptions, unlockwalletMutation } from '@/lib/jm-api/generated/client/@tanstack/react-query.gen' +import { Skeleton } from '@/components/ui/skeleton' +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { useApiClient } from '@/hooks/useApiClient' -import { Skeleton } from './ui/skeleton' -import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip' +import { listwalletsOptions, unlockwalletMutation } from '@/lib/jm-api/generated/client/@tanstack/react-query.gen' +import { setSession } from '@/lib/session' +import { formatWalletName } from '@/lib/utils' const LoginFormSkeleton = () => { return ( diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index d31b2573..8ba24b91 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,8 +1,8 @@ -import { Wallet, Sun, Moon, Settings, LogOut, Loader2 } from 'lucide-react' -import { Button } from './ui/button' -import { Badge } from './ui/badge' +import { Loader2, LogOut, Moon, Settings, Sun, Wallet } from 'lucide-react' +import type { Jar } from '@/components/layout/display-mode-context' +import { Badge } from '@/components/ui/badge' +import { Button } from '@/components/ui/button' import { clearSession } from '@/lib/session' -import type { Jar } from './layout/display-mode-context' interface NavbarProps { theme: string diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx index a98f96e0..f2439b1d 100644 --- a/src/components/layout/Layout.tsx +++ b/src/components/layout/Layout.tsx @@ -1,10 +1,10 @@ -import { Navbar } from '../Navbar' -import { Footer } from '../Footer' -import { DisplayModeContext } from './display-mode-context' import { useTheme } from 'next-themes' +import { DisplayLogo } from '@/components/DisplayLogo' +import { Footer } from '@/components/Footer' +import { Navbar } from '@/components/Navbar' import { useDisplayMode } from '@/hooks/useDisplayMode' import { useWalletDisplay } from '@/hooks/useWalletDisplay' -import { DisplayLogo } from '../DisplayLogo' +import { DisplayModeContext } from './display-mode-context' interface LayoutProps { children: React.ReactNode diff --git a/src/components/ui/alert.tsx b/src/components/ui/alert.tsx index 56cf69a2..c111b42c 100644 --- a/src/components/ui/alert.tsx +++ b/src/components/ui/alert.tsx @@ -1,6 +1,5 @@ import * as React from 'react' -import { cva, type VariantProps } from 'class-variance-authority' - +import { type VariantProps, cva } from 'class-variance-authority' import { cn } from '@/lib/utils' const alertVariants = cva( diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx index 05571387..0cbf04c5 100644 --- a/src/components/ui/avatar.tsx +++ b/src/components/ui/avatar.tsx @@ -1,6 +1,5 @@ import * as React from 'react' import * as AvatarPrimitive from '@radix-ui/react-avatar' - import { cn } from '@/lib/utils' function Avatar({ className, ...props }: React.ComponentProps) { diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx index bad23d50..ea65a85f 100644 --- a/src/components/ui/badge.tsx +++ b/src/components/ui/badge.tsx @@ -1,7 +1,6 @@ import * as React from 'react' import { Slot } from '@radix-ui/react-slot' -import { cva, type VariantProps } from 'class-variance-authority' - +import { type VariantProps, cva } from 'class-variance-authority' import { cn } from '@/lib/utils' const badgeVariants = cva( diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 5ab06ef8..000f1d8f 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1,7 +1,6 @@ import * as React from 'react' import { Slot } from '@radix-ui/react-slot' -import { cva, type VariantProps } from 'class-variance-authority' - +import { type VariantProps, cva } from 'class-variance-authority' import { cn } from '@/lib/utils' const buttonVariants = cva( diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index bf20394f..081c4225 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -1,5 +1,4 @@ import * as React from 'react' - import { cn } from '@/lib/utils' function Card({ className, ...props }: React.ComponentProps<'div'>) { diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 75fee7df..7d47d056 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -1,5 +1,4 @@ import * as React from 'react' - import { cn } from '@/lib/utils' function Input({ className, type, ...props }: React.ComponentProps<'input'>) { diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsx index 6a36e7cf..dee03c88 100644 --- a/src/components/ui/label.tsx +++ b/src/components/ui/label.tsx @@ -1,6 +1,5 @@ import * as React from 'react' import * as LabelPrimitive from '@radix-ui/react-label' - import { cn } from '@/lib/utils' function Label({ className, ...props }: React.ComponentProps) { diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index 6c9d8e64..b57690c7 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -1,9 +1,6 @@ -'use client' - import * as React from 'react' import * as SelectPrimitive from '@radix-ui/react-select' import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react' - import { cn } from '@/lib/utils' function Select({ ...props }: React.ComponentProps) { diff --git a/src/components/ui/separator.tsx b/src/components/ui/separator.tsx index f43aaf55..f6a4f1cd 100644 --- a/src/components/ui/separator.tsx +++ b/src/components/ui/separator.tsx @@ -1,8 +1,5 @@ -'use client' - import * as React from 'react' import * as SeparatorPrimitive from '@radix-ui/react-separator' - import { cn } from '@/lib/utils' function Separator({ diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx index 9780c07b..3c8c8ebd 100644 --- a/src/components/ui/tooltip.tsx +++ b/src/components/ui/tooltip.tsx @@ -1,6 +1,5 @@ import * as React from 'react' import * as TooltipPrimitive from '@radix-ui/react-tooltip' - import { cn } from '@/lib/utils' function TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps) { diff --git a/src/hooks/useWalletDisplay/index.ts b/src/hooks/useWalletDisplay/index.ts index 85a5d201..57fd587f 100644 --- a/src/hooks/useWalletDisplay/index.ts +++ b/src/hooks/useWalletDisplay/index.ts @@ -1,9 +1,9 @@ import { useQuery } from '@tanstack/react-query' -import { listutxosOptions, sessionOptions } from '@/lib/jm-api/generated/client/@tanstack/react-query.gen' -import { useApiClient } from '@/hooks/useApiClient' -import { getSession } from '@/lib/session' import { jarTemplates } from '@/components/layout/display-mode-context' import type { Jar, JarColor } from '@/components/layout/display-mode-context' +import { useApiClient } from '@/hooks/useApiClient' +import { listutxosOptions, sessionOptions } from '@/lib/jm-api/generated/client/@tanstack/react-query.gen' +import { getSession } from '@/lib/session' export interface UseWalletDisplayResult { jars: Jar[] diff --git a/src/lib/config.ts b/src/lib/config.ts index e32f9d3f..41a9bf44 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -1,7 +1,7 @@ import type { Client } from '@hey-api/client-fetch' -import { createClient } from './jm-api' -import type { ClientOptions, UnlockWalletResponse } from './jm-api/generated/client' -import { getSession } from './session' +import { createClient } from '@/lib/jm-api' +import type { ClientOptions, UnlockWalletResponse } from '@/lib/jm-api/generated/client' +import { getSession } from '@/lib/session' type ApiToken = UnlockWalletResponse['token'] diff --git a/src/lib/jm-api/generated/client/@tanstack/react-query.gen.ts b/src/lib/jm-api/generated/client/@tanstack/react-query.gen.ts index db2d0ce7..db76f755 100644 --- a/src/lib/jm-api/generated/client/@tanstack/react-query.gen.ts +++ b/src/lib/jm-api/generated/client/@tanstack/react-query.gen.ts @@ -1,120 +1,42 @@ // This file is auto-generated by @hey-api/openapi-ts -import { - type Options, - token, - createwallet, - recoverwallet, - unlockwallet, - lockwallet, - displaywallet, - session, - version, - listwallets, - yieldgenreport, - getaddress, - rescanblockchain, - getrescaninfo, - gettimelockaddress, - listutxos, - directsend, - startmaker, - stopmaker, - docoinjoin, - getschedule, - runschedule, - stopcoinjoin, - configsetting, - configget, - freeze, - getseed, -} from '../sdk.gen' -import { queryOptions, type UseMutationOptions } from '@tanstack/react-query' -import type { - TokenData, - TokenError, - TokenResponse2, - CreatewalletData, - CreatewalletError, - CreatewalletResponse, - RecoverwalletData, - RecoverwalletError, - RecoverwalletResponse, - UnlockwalletData, - UnlockwalletError, - UnlockwalletResponse, - LockwalletData, - DisplaywalletData, - SessionData, - VersionData, - ListwalletsData, - YieldgenreportData, - GetaddressData, - RescanblockchainData, - GetrescaninfoData, - GettimelockaddressData, - ListutxosData, - DirectsendData, - DirectsendError, - DirectsendResponse, - StartmakerData, - StartmakerError, - StopmakerData, - DocoinjoinData, - DocoinjoinError, - GetscheduleData, - RunscheduleData, - RunscheduleError, - RunscheduleResponse, - StopcoinjoinData, - ConfigsettingData, - ConfigsettingError, - ConfigsettingResponse, - ConfiggetData, - ConfiggetError, - ConfiggetResponse, - FreezeData, - FreezeError, - FreezeResponse2, - GetseedData, -} from '../types.gen' -import { client as _heyApiClient } from '../client.gen' +import { type Options, token, createwallet, recoverwallet, unlockwallet, lockwallet, displaywallet, session, version, listwallets, yieldgenreport, getaddress, rescanblockchain, getrescaninfo, gettimelockaddress, listutxos, directsend, startmaker, stopmaker, docoinjoin, getschedule, runschedule, stopcoinjoin, configsetting, configget, freeze, getseed } from '../sdk.gen'; +import { queryOptions, type UseMutationOptions } from '@tanstack/react-query'; +import type { TokenData, TokenError, TokenResponse2, CreatewalletData, CreatewalletError, CreatewalletResponse, RecoverwalletData, RecoverwalletError, RecoverwalletResponse, UnlockwalletData, UnlockwalletError, UnlockwalletResponse, LockwalletData, DisplaywalletData, SessionData, VersionData, ListwalletsData, YieldgenreportData, GetaddressData, RescanblockchainData, GetrescaninfoData, GettimelockaddressData, ListutxosData, DirectsendData, DirectsendError, DirectsendResponse, StartmakerData, StartmakerError, StopmakerData, DocoinjoinData, DocoinjoinError, GetscheduleData, RunscheduleData, RunscheduleError, RunscheduleResponse, StopcoinjoinData, ConfigsettingData, ConfigsettingError, ConfigsettingResponse, ConfiggetData, ConfiggetError, ConfiggetResponse, FreezeData, FreezeError, FreezeResponse2, GetseedData } from '../types.gen'; +import { client as _heyApiClient } from '../client.gen'; export type QueryKey = [ - Pick & { - _id: string - _infinite?: boolean - }, -] + Pick & { + _id: string; + _infinite?: boolean; + } +]; -const createQueryKey = ( - id: string, - options?: TOptions, - infinite?: boolean, -): [QueryKey[0]] => { - const params: QueryKey[0] = { - _id: id, - baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl, - } as QueryKey[0] - if (infinite) { - params._infinite = infinite - } - if (options?.body) { - params.body = options.body - } - if (options?.headers) { - params.headers = options.headers - } - if (options?.path) { - params.path = options.path - } - if (options?.query) { - params.query = options.query - } - return [params] -} +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): [ + QueryKey[0] +] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return [ + params + ]; +}; -export const tokenQueryKey = (options?: Options) => createQueryKey('token', options) +export const tokenQueryKey = (options?: Options) => createQueryKey('token', options); /** * The token endpoint is used by the client to obtain an access token using a grant such as refresh token @@ -122,271 +44,262 @@ export const tokenQueryKey = (options?: Options) => createQueryKey('t * */ export const tokenOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await token({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: tokenQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await token({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: tokenQueryKey(options) + }); +}; /** * The token endpoint is used by the client to obtain an access token using a grant such as refresh token * Give a refresh token and get back both an access and refresh token. On initially creating, unlocking or recovering a wallet, store both the refresh and access tokens, the latter is valid for only 30 minutes (must be used for any authenticated call) while the former is for 4 hours (can only be used in the refresh request parameters). Use /token endpoint on a regular basis to get new access and refresh tokens, ideally before access token expiration to avoid authentication errors and in any case, before refresh token expiration. The newly issued tokens must be used in subsequent calls since operation invalidates previously issued tokens. * */ -export const tokenMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await token({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const tokenMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await token({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const createwalletQueryKey = (options?: Options) => createQueryKey('createwallet', options) +export const createwalletQueryKey = (options?: Options) => createQueryKey('createwallet', options); /** * create a new wallet * Give a filename (.jmdat must be included) and a password, create the wallet and get back the seedphrase for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. Note that this operation cannot be performed when a wallet is already loaded (unlocked). */ export const createwalletOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await createwallet({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: createwalletQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await createwallet({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: createwalletQueryKey(options) + }); +}; /** * create a new wallet * Give a filename (.jmdat must be included) and a password, create the wallet and get back the seedphrase for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. Note that this operation cannot be performed when a wallet is already loaded (unlocked). */ -export const createwalletMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await createwallet({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const createwalletMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await createwallet({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const recoverwalletQueryKey = (options?: Options) => createQueryKey('recoverwallet', options) +export const recoverwalletQueryKey = (options?: Options) => createQueryKey('recoverwallet', options); /** * recover a wallet from a seedphrase * Give a filename (.jmdat must be included), a wallettype, a seedphrase and a password, create the wallet for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. The seedphrase must be a single string with words space-separated, and must conform to BIP39 (else 400 is returned). Note that this operation cannot be performed when a wallet is already loaded (unlocked). */ export const recoverwalletOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await recoverwallet({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: recoverwalletQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await recoverwallet({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: recoverwalletQueryKey(options) + }); +}; /** * recover a wallet from a seedphrase * Give a filename (.jmdat must be included), a wallettype, a seedphrase and a password, create the wallet for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. The seedphrase must be a single string with words space-separated, and must conform to BIP39 (else 400 is returned). Note that this operation cannot be performed when a wallet is already loaded (unlocked). */ -export const recoverwalletMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await recoverwallet({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const recoverwalletMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await recoverwallet({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const unlockwalletQueryKey = (options: Options) => createQueryKey('unlockwallet', options) +export const unlockwalletQueryKey = (options: Options) => createQueryKey('unlockwallet', options); /** * decrypt an existing wallet * Give the password for the specified (existing) wallet file, and it will be decrypted ready for use. Note that this operation cannot be performed when another wallet is already loaded (unlocked). */ export const unlockwalletOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await unlockwallet({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: unlockwalletQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await unlockwallet({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: unlockwalletQueryKey(options) + }); +}; /** * decrypt an existing wallet * Give the password for the specified (existing) wallet file, and it will be decrypted ready for use. Note that this operation cannot be performed when another wallet is already loaded (unlocked). */ -export const unlockwalletMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await unlockwallet({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const unlockwalletMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await unlockwallet({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const lockwalletQueryKey = (options: Options) => createQueryKey('lockwallet', options) +export const lockwalletQueryKey = (options: Options) => createQueryKey('lockwallet', options); /** * block access to a currently decrypted wallet * After this (authenticated) action, the wallet will not be readable or writeable. */ export const lockwalletOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await lockwallet({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: lockwalletQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await lockwallet({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: lockwalletQueryKey(options) + }); +}; -export const displaywalletQueryKey = (options: Options) => createQueryKey('displaywallet', options) +export const displaywalletQueryKey = (options: Options) => createQueryKey('displaywallet', options); /** * get detailed breakdown of wallet contents by account. * get detailed breakdown of wallet contents by account. */ export const displaywalletOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await displaywallet({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: displaywalletQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await displaywallet({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: displaywalletQueryKey(options) + }); +}; -export const sessionQueryKey = (options?: Options) => createQueryKey('session', options) +export const sessionQueryKey = (options?: Options) => createQueryKey('session', options); /** * get current status of backend * get whether a wallet is loaded and whether coinjoin/maker are happening. if an auth token is provided, which is optional, it will be validated. */ export const sessionOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await session({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: sessionQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await session({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: sessionQueryKey(options) + }); +}; -export const versionQueryKey = (options?: Options) => createQueryKey('version', options) +export const versionQueryKey = (options?: Options) => createQueryKey('version', options); /** * get info on backend * get information about backend, including the version of Joinmarket running. */ export const versionOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await version({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: versionQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await version({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: versionQueryKey(options) + }); +}; -export const listwalletsQueryKey = (options?: Options) => createQueryKey('listwallets', options) +export const listwalletsQueryKey = (options?: Options) => createQueryKey('listwallets', options); /** * get current available wallets * get all wallet filenames in standard location as a list */ export const listwalletsOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listwallets({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: listwalletsQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listwallets({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listwalletsQueryKey(options) + }); +}; -export const yieldgenreportQueryKey = (options?: Options) => - createQueryKey('yieldgenreport', options) +export const yieldgenreportQueryKey = (options?: Options) => createQueryKey('yieldgenreport', options); /** * get latest report on yield generating activity @@ -394,494 +307,478 @@ export const yieldgenreportQueryKey = (options?: Options) => * */ export const yieldgenreportOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await yieldgenreport({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: yieldgenreportQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await yieldgenreport({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: yieldgenreportQueryKey(options) + }); +}; -export const getaddressQueryKey = (options: Options) => createQueryKey('getaddress', options) +export const getaddressQueryKey = (options: Options) => createQueryKey('getaddress', options); /** * get a fresh address in the given account for depositing funds. * get a fresh address in the given account for depositing funds. */ export const getaddressOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getaddress({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: getaddressQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getaddress({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getaddressQueryKey(options) + }); +}; -export const rescanblockchainQueryKey = (options: Options) => - createQueryKey('rescanblockchain', options) +export const rescanblockchainQueryKey = (options: Options) => createQueryKey('rescanblockchain', options); /** * Rescan the blockchain from a given blockheight * Use this operation on recovered wallets to re-sync the wallet */ export const rescanblockchainOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await rescanblockchain({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: rescanblockchainQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await rescanblockchain({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: rescanblockchainQueryKey(options) + }); +}; -export const getrescaninfoQueryKey = (options: Options) => createQueryKey('getrescaninfo', options) +export const getrescaninfoQueryKey = (options: Options) => createQueryKey('getrescaninfo', options); /** * get the current rescan status * get the current rescan status */ export const getrescaninfoOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getrescaninfo({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: getrescaninfoQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getrescaninfo({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getrescaninfoQueryKey(options) + }); +}; -export const gettimelockaddressQueryKey = (options: Options) => - createQueryKey('gettimelockaddress', options) +export const gettimelockaddressQueryKey = (options: Options) => createQueryKey('gettimelockaddress', options); /** * get a fresh timelock address * get a new timelocked address, for depositing funds, to create a fidelity bond, which will automatically be used when the maker is started. specify the date in YYYY-mm as the last path parameter. Note that mixdepth is not specified as timelock addresses are always in mixdepth(account) zero. */ export const gettimelockaddressOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await gettimelockaddress({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: gettimelockaddressQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await gettimelockaddress({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: gettimelockaddressQueryKey(options) + }); +}; -export const listutxosQueryKey = (options: Options) => createQueryKey('listutxos', options) +export const listutxosQueryKey = (options: Options) => createQueryKey('listutxos', options); /** * list details of all utxos currently in the wallet. * list details of all utxos currently in the wallet. */ export const listutxosOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listutxos({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: listutxosQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listutxos({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listutxosQueryKey(options) + }); +}; -export const directsendQueryKey = (options: Options) => createQueryKey('directsend', options) +export const directsendQueryKey = (options: Options) => createQueryKey('directsend', options); /** * create and broadcast a transaction (without coinjoin) * create and broadcast a transaction (without coinjoin) */ export const directsendOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await directsend({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: directsendQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await directsend({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: directsendQueryKey(options) + }); +}; /** * create and broadcast a transaction (without coinjoin) * create and broadcast a transaction (without coinjoin) */ -export const directsendMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await directsend({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const directsendMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await directsend({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const startmakerQueryKey = (options: Options) => createQueryKey('startmaker', options) +export const startmakerQueryKey = (options: Options) => createQueryKey('startmaker', options); /** * Start the yield generator service. * Start the yield generator service with the configuration settings specified in the POST request. Note that if fidelity bonds are enabled in the wallet, and a timelock address has been generated, and then funded, the fidelity bond will automatically be advertised without any specific configuration in this request. Note that if the wallet does not have confirmed coins, or another taker or maker coinjoin service is already running, the maker will not start. */ export const startmakerOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await startmaker({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: startmakerQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await startmaker({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: startmakerQueryKey(options) + }); +}; /** * Start the yield generator service. * Start the yield generator service with the configuration settings specified in the POST request. Note that if fidelity bonds are enabled in the wallet, and a timelock address has been generated, and then funded, the fidelity bond will automatically be advertised without any specific configuration in this request. Note that if the wallet does not have confirmed coins, or another taker or maker coinjoin service is already running, the maker will not start. */ -export const startmakerMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await startmaker({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const startmakerMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await startmaker({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const stopmakerQueryKey = (options: Options) => createQueryKey('stopmaker', options) +export const stopmakerQueryKey = (options: Options) => createQueryKey('stopmaker', options); /** * stop the yield generator service * stop the yield generator service */ export const stopmakerOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await stopmaker({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: stopmakerQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await stopmaker({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: stopmakerQueryKey(options) + }); +}; -export const docoinjoinQueryKey = (options: Options) => createQueryKey('docoinjoin', options) +export const docoinjoinQueryKey = (options: Options) => createQueryKey('docoinjoin', options); /** * initiate a coinjoin as taker * initiate a coinjoin as taker */ export const docoinjoinOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await docoinjoin({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: docoinjoinQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await docoinjoin({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: docoinjoinQueryKey(options) + }); +}; /** * initiate a coinjoin as taker * initiate a coinjoin as taker */ -export const docoinjoinMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await docoinjoin({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const docoinjoinMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await docoinjoin({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const getscheduleQueryKey = (options: Options) => createQueryKey('getschedule', options) +export const getscheduleQueryKey = (options: Options) => createQueryKey('getschedule', options); /** * get the schedule that is currently running * Get the current transaction schedule if one is running. */ export const getscheduleOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getschedule({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: getscheduleQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getschedule({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getscheduleQueryKey(options) + }); +}; -export const runscheduleQueryKey = (options: Options) => createQueryKey('runschedule', options) +export const runscheduleQueryKey = (options: Options) => createQueryKey('runschedule', options); /** * create and run a schedule of transactions * Creates and then starts a schedule of transactions. */ export const runscheduleOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await runschedule({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: runscheduleQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await runschedule({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: runscheduleQueryKey(options) + }); +}; /** * create and run a schedule of transactions * Creates and then starts a schedule of transactions. */ -export const runscheduleMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await runschedule({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const runscheduleMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await runschedule({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const stopcoinjoinQueryKey = (options: Options) => createQueryKey('stopcoinjoin', options) +export const stopcoinjoinQueryKey = (options: Options) => createQueryKey('stopcoinjoin', options); /** * stop a running coinjoin attempt * stop a running coinjoin attempt */ export const stopcoinjoinOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await stopcoinjoin({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: stopcoinjoinQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await stopcoinjoin({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: stopcoinjoinQueryKey(options) + }); +}; -export const configsettingQueryKey = (options: Options) => createQueryKey('configsetting', options) +export const configsettingQueryKey = (options: Options) => createQueryKey('configsetting', options); /** * change a config variable * change a config variable (for the duration of this backend daemon process instance) */ export const configsettingOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await configsetting({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: configsettingQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await configsetting({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: configsettingQueryKey(options) + }); +}; /** * change a config variable * change a config variable (for the duration of this backend daemon process instance) */ -export const configsettingMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await configsetting({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const configsettingMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await configsetting({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const configgetQueryKey = (options: Options) => createQueryKey('configget', options) +export const configgetQueryKey = (options: Options) => createQueryKey('configget', options); /** * get the value of a specific config setting * Get the value of a specific config setting. Note values are always returned as string. */ export const configgetOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await configget({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: configgetQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await configget({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: configgetQueryKey(options) + }); +}; /** * get the value of a specific config setting * Get the value of a specific config setting. Note values are always returned as string. */ -export const configgetMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await configget({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const configgetMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await configget({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const freezeQueryKey = (options: Options) => createQueryKey('freeze', options) +export const freezeQueryKey = (options: Options) => createQueryKey('freeze', options); /** * freeze or unfreeze an individual utxo for spending * freeze or unfreeze an individual utxo for spending */ export const freezeOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await freeze({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: freezeQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await freeze({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: freezeQueryKey(options) + }); +}; /** * freeze or unfreeze an individual utxo for spending * freeze or unfreeze an individual utxo for spending */ -export const freezeMutation = ( - options?: Partial>, -): UseMutationOptions> => { - const mutationOptions: UseMutationOptions> = { - mutationFn: async (localOptions) => { - const { data } = await freeze({ - ...options, - ...localOptions, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const freezeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (localOptions) => { + const { data } = await freeze({ + ...options, + ...localOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; -export const getseedQueryKey = (options: Options) => createQueryKey('getseed', options) +export const getseedQueryKey = (options: Options) => createQueryKey('getseed', options); /** * get the mnemonic recovery phrase with the optional passphrase * Get the mnemonic recovery phrase with the optional passphrase. Not the response is a sentence with few line breaks. */ export const getseedOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getseed({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }) - return data - }, - queryKey: getseedQueryKey(options), - }) -} + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getseed({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getseedQueryKey(options) + }); +}; \ No newline at end of file diff --git a/src/lib/jm-api/generated/client/client.gen.ts b/src/lib/jm-api/generated/client/client.gen.ts index 114fba20..258c7148 100644 --- a/src/lib/jm-api/generated/client/client.gen.ts +++ b/src/lib/jm-api/generated/client/client.gen.ts @@ -1,12 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ClientOptions } from './types.gen' -import { - type Config, - type ClientOptions as DefaultClientOptions, - createClient, - createConfig, -} from '@hey-api/client-fetch' +import type { ClientOptions } from './types.gen'; +import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch'; /** * The `createClientConfig()` function will be called on client initialization @@ -16,12 +11,8 @@ import { * `setConfig()`. This is useful for example if you're using Next.js * to ensure your client always has the correct values. */ -export type CreateClientConfig = ( - override?: Config, -) => Config & T> +export type CreateClientConfig = (override?: Config) => Config & T>; -export const client = createClient( - createConfig({ - baseUrl: 'https://none', - }), -) +export const client = createClient(createConfig({ + baseUrl: 'https://none' +})); \ No newline at end of file diff --git a/src/lib/jm-api/generated/client/index.ts b/src/lib/jm-api/generated/client/index.ts index 16b44b61..e64537d2 100644 --- a/src/lib/jm-api/generated/client/index.ts +++ b/src/lib/jm-api/generated/client/index.ts @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './types.gen' -export * from './sdk.gen' +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/src/lib/jm-api/generated/client/sdk.gen.ts b/src/lib/jm-api/generated/client/sdk.gen.ts index 20d888fd..273f6fc2 100644 --- a/src/lib/jm-api/generated/client/sdk.gen.ts +++ b/src/lib/jm-api/generated/client/sdk.gen.ts @@ -1,103 +1,22 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch' -import type { - TokenData, - TokenResponses, - TokenErrors, - CreatewalletData, - CreatewalletResponses, - CreatewalletErrors, - RecoverwalletData, - RecoverwalletResponses, - RecoverwalletErrors, - UnlockwalletData, - UnlockwalletResponses, - UnlockwalletErrors, - LockwalletData, - LockwalletResponses, - LockwalletErrors, - DisplaywalletData, - DisplaywalletResponses, - DisplaywalletErrors, - SessionData, - SessionResponses, - SessionErrors, - VersionData, - VersionResponses, - ListwalletsData, - ListwalletsResponses, - ListwalletsErrors, - YieldgenreportData, - YieldgenreportResponses, - YieldgenreportErrors, - GetaddressData, - GetaddressResponses, - GetaddressErrors, - RescanblockchainData, - RescanblockchainResponses, - RescanblockchainErrors, - GetrescaninfoData, - GetrescaninfoResponses, - GetrescaninfoErrors, - GettimelockaddressData, - GettimelockaddressResponses, - GettimelockaddressErrors, - ListutxosData, - ListutxosResponses, - ListutxosErrors, - DirectsendData, - DirectsendResponses, - DirectsendErrors, - StartmakerData, - StartmakerResponses, - StartmakerErrors, - StopmakerData, - StopmakerResponses, - StopmakerErrors, - DocoinjoinData, - DocoinjoinResponses, - DocoinjoinErrors, - GetscheduleData, - GetscheduleResponses, - GetscheduleErrors, - RunscheduleData, - RunscheduleResponses, - RunscheduleErrors, - StopcoinjoinData, - StopcoinjoinResponses, - StopcoinjoinErrors, - ConfigsettingData, - ConfigsettingResponses, - ConfigsettingErrors, - ConfiggetData, - ConfiggetResponses, - ConfiggetErrors, - FreezeData, - FreezeResponses, - FreezeErrors, - GetseedData, - GetseedResponses, - GetseedErrors, -} from './types.gen' -import { client as _heyApiClient } from './client.gen' +import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch'; +import type { TokenData, TokenResponses, TokenErrors, CreatewalletData, CreatewalletResponses, CreatewalletErrors, RecoverwalletData, RecoverwalletResponses, RecoverwalletErrors, UnlockwalletData, UnlockwalletResponses, UnlockwalletErrors, LockwalletData, LockwalletResponses, LockwalletErrors, DisplaywalletData, DisplaywalletResponses, DisplaywalletErrors, SessionData, SessionResponses, SessionErrors, VersionData, VersionResponses, ListwalletsData, ListwalletsResponses, ListwalletsErrors, YieldgenreportData, YieldgenreportResponses, YieldgenreportErrors, GetaddressData, GetaddressResponses, GetaddressErrors, RescanblockchainData, RescanblockchainResponses, RescanblockchainErrors, GetrescaninfoData, GetrescaninfoResponses, GetrescaninfoErrors, GettimelockaddressData, GettimelockaddressResponses, GettimelockaddressErrors, ListutxosData, ListutxosResponses, ListutxosErrors, DirectsendData, DirectsendResponses, DirectsendErrors, StartmakerData, StartmakerResponses, StartmakerErrors, StopmakerData, StopmakerResponses, StopmakerErrors, DocoinjoinData, DocoinjoinResponses, DocoinjoinErrors, GetscheduleData, GetscheduleResponses, GetscheduleErrors, RunscheduleData, RunscheduleResponses, RunscheduleErrors, StopcoinjoinData, StopcoinjoinResponses, StopcoinjoinErrors, ConfigsettingData, ConfigsettingResponses, ConfigsettingErrors, ConfiggetData, ConfiggetResponses, ConfiggetErrors, FreezeData, FreezeResponses, FreezeErrors, GetseedData, GetseedResponses, GetseedErrors } from './types.gen'; +import { client as _heyApiClient } from './client.gen'; -export type Options = ClientOptions< - TData, - ThrowOnError -> & { - /** - * You can provide a client instance returned by `createClient()` instead of - * individual options. This might be also useful if you want to implement a - * custom client. - */ - client?: Client - /** - * You can pass arbitrary values through the `meta` object. This can be - * used to access values that aren't defined as part of the SDK function. - */ - meta?: Record -} +export type Options = ClientOptions & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; /** * The token endpoint is used by the client to obtain an access token using a grant such as refresh token @@ -105,468 +24,448 @@ export type Options(options?: Options) => { - return (options?.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/token', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - }, - }) -} + return (options?.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/token', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } + }); +}; /** * create a new wallet * Give a filename (.jmdat must be included) and a password, create the wallet and get back the seedphrase for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. Note that this operation cannot be performed when a wallet is already loaded (unlocked). */ -export const createwallet = ( - options?: Options, -) => { - return (options?.client ?? _heyApiClient).post({ - url: '/wallet/create', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - }, - }) -} +export const createwallet = (options?: Options) => { + return (options?.client ?? _heyApiClient).post({ + url: '/wallet/create', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } + }); +}; /** * recover a wallet from a seedphrase * Give a filename (.jmdat must be included), a wallettype, a seedphrase and a password, create the wallet for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. The seedphrase must be a single string with words space-separated, and must conform to BIP39 (else 400 is returned). Note that this operation cannot be performed when a wallet is already loaded (unlocked). */ -export const recoverwallet = ( - options?: Options, -) => { - return (options?.client ?? _heyApiClient).post({ - url: '/wallet/recover', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - }, - }) -} +export const recoverwallet = (options?: Options) => { + return (options?.client ?? _heyApiClient).post({ + url: '/wallet/recover', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } + }); +}; /** * decrypt an existing wallet * Give the password for the specified (existing) wallet file, and it will be decrypted ready for use. Note that this operation cannot be performed when another wallet is already loaded (unlocked). */ -export const unlockwallet = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).post({ - url: '/wallet/{walletname}/unlock', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} +export const unlockwallet = (options: Options) => { + return (options.client ?? _heyApiClient).post({ + url: '/wallet/{walletname}/unlock', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * block access to a currently decrypted wallet * After this (authenticated) action, the wallet will not be readable or writeable. */ export const lockwallet = (options: Options) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/lock', - ...options, - }) -} + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/lock', + ...options + }); +}; /** * get detailed breakdown of wallet contents by account. * get detailed breakdown of wallet contents by account. */ -export const displaywallet = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/display', - ...options, - }) -} +export const displaywallet = (options: Options) => { + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/display', + ...options + }); +}; /** * get current status of backend * get whether a wallet is loaded and whether coinjoin/maker are happening. if an auth token is provided, which is optional, it will be validated. */ export const session = (options?: Options) => { - return (options?.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/session', - ...options, - }) -} + return (options?.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/session', + ...options + }); +}; /** * get info on backend * get information about backend, including the version of Joinmarket running. */ export const version = (options?: Options) => { - return (options?.client ?? _heyApiClient).get({ - url: '/getinfo', - ...options, - }) -} + return (options?.client ?? _heyApiClient).get({ + url: '/getinfo', + ...options + }); +}; /** * get current available wallets * get all wallet filenames in standard location as a list */ export const listwallets = (options?: Options) => { - return (options?.client ?? _heyApiClient).get({ - url: '/wallet/all', - ...options, - }) -} + return (options?.client ?? _heyApiClient).get({ + url: '/wallet/all', + ...options + }); +}; /** * get latest report on yield generating activity * Get list of coinjoins taken part in as maker (across all wallets). Data returned as list of strings, each one in the same comma separated format as found in yigen-statement.csv. Note that this returns all lines in the file, including the lines that are only present to represent the starting of a bot. Those lines contain the word Connected and can be thus discarded. The header line is also delivered and so can be ignored as per the client requirements. * */ -export const yieldgenreport = ( - options?: Options, -) => { - return (options?.client ?? _heyApiClient).get({ - url: '/wallet/yieldgen/report', - ...options, - }) -} +export const yieldgenreport = (options?: Options) => { + return (options?.client ?? _heyApiClient).get({ + url: '/wallet/yieldgen/report', + ...options + }); +}; /** * get a fresh address in the given account for depositing funds. * get a fresh address in the given account for depositing funds. */ export const getaddress = (options: Options) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/address/new/{mixdepth}', - ...options, - }) -} + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/address/new/{mixdepth}', + ...options + }); +}; /** * Rescan the blockchain from a given blockheight * Use this operation on recovered wallets to re-sync the wallet */ -export const rescanblockchain = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/rescanblockchain/{blockheight}', - ...options, - }) -} +export const rescanblockchain = (options: Options) => { + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/rescanblockchain/{blockheight}', + ...options + }); +}; /** * get the current rescan status * get the current rescan status */ -export const getrescaninfo = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/getrescaninfo', - ...options, - }) -} +export const getrescaninfo = (options: Options) => { + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/getrescaninfo', + ...options + }); +}; /** * get a fresh timelock address * get a new timelocked address, for depositing funds, to create a fidelity bond, which will automatically be used when the maker is started. specify the date in YYYY-mm as the last path parameter. Note that mixdepth is not specified as timelock addresses are always in mixdepth(account) zero. */ -export const gettimelockaddress = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/address/timelock/new/{lockdate}', - ...options, - }) -} +export const gettimelockaddress = (options: Options) => { + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/address/timelock/new/{lockdate}', + ...options + }); +}; /** * list details of all utxos currently in the wallet. * list details of all utxos currently in the wallet. */ export const listutxos = (options: Options) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/utxos', - ...options, - }) -} + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/utxos', + ...options + }); +}; /** * create and broadcast a transaction (without coinjoin) * create and broadcast a transaction (without coinjoin) */ export const directsend = (options: Options) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/taker/direct-send', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/taker/direct-send', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * Start the yield generator service. * Start the yield generator service with the configuration settings specified in the POST request. Note that if fidelity bonds are enabled in the wallet, and a timelock address has been generated, and then funded, the fidelity bond will automatically be advertised without any specific configuration in this request. Note that if the wallet does not have confirmed coins, or another taker or maker coinjoin service is already running, the maker will not start. */ export const startmaker = (options: Options) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/maker/start', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/maker/start', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * stop the yield generator service * stop the yield generator service */ export const stopmaker = (options: Options) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/maker/stop', - ...options, - }) -} + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/maker/stop', + ...options + }); +}; /** * initiate a coinjoin as taker * initiate a coinjoin as taker */ export const docoinjoin = (options: Options) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/taker/coinjoin', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/taker/coinjoin', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * get the schedule that is currently running * Get the current transaction schedule if one is running. */ export const getschedule = (options: Options) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/taker/schedule', - ...options, - }) -} + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/taker/schedule', + ...options + }); +}; /** * create and run a schedule of transactions * Creates and then starts a schedule of transactions. */ export const runschedule = (options: Options) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/taker/schedule', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/taker/schedule', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * stop a running coinjoin attempt * stop a running coinjoin attempt */ -export const stopcoinjoin = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/taker/stop', - ...options, - }) -} +export const stopcoinjoin = (options: Options) => { + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/taker/stop', + ...options + }); +}; /** * change a config variable * change a config variable (for the duration of this backend daemon process instance) */ -export const configsetting = ( - options: Options, -) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/configset', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} +export const configsetting = (options: Options) => { + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/configset', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * get the value of a specific config setting * Get the value of a specific config setting. Note values are always returned as string. */ export const configget = (options: Options) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/configget', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/configget', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * freeze or unfreeze an individual utxo for spending * freeze or unfreeze an individual utxo for spending */ export const freeze = (options: Options) => { - return (options.client ?? _heyApiClient).post({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/freeze', - ...options, - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - }) -} + return (options.client ?? _heyApiClient).post({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/freeze', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } + }); +}; /** * get the mnemonic recovery phrase with the optional passphrase * Get the mnemonic recovery phrase with the optional passphrase. Not the response is a sentence with few line breaks. */ export const getseed = (options: Options) => { - return (options.client ?? _heyApiClient).get({ - security: [ - { - scheme: 'bearer', - type: 'http', - }, - ], - url: '/wallet/{walletname}/getseed', - ...options, - }) -} + return (options.client ?? _heyApiClient).get({ + security: [ + { + scheme: 'bearer', + type: 'http' + } + ], + url: '/wallet/{walletname}/getseed', + ...options + }); +}; \ No newline at end of file diff --git a/src/lib/jm-api/generated/client/types.gen.ts b/src/lib/jm-api/generated/client/types.gen.ts index e0c85e9a..928a3e53 100644 --- a/src/lib/jm-api/generated/client/types.gen.ts +++ b/src/lib/jm-api/generated/client/types.gen.ts @@ -1,1156 +1,1156 @@ // This file is auto-generated by @hey-api/openapi-ts export type FreezeRequest = { - 'utxo-string': string - freeze: boolean -} + 'utxo-string': string; + freeze: boolean; +}; export type ConfigSetRequest = { - section: string - field: string - value: string -} + section: string; + field: string; + value: string; +}; export type ConfigGetRequest = { - section: string - field: string -} + section: string; + field: string; +}; export type ConfigGetResponse = { - configvalue: string -} + configvalue: string; +}; export type ConfigSetResponse = { - [key: string]: unknown -} + [key: string]: unknown; +}; export type FreezeResponse = { - [key: string]: unknown -} + [key: string]: unknown; +}; export type DoCoinjoinRequest = { - mixdepth: number - amount_sats: number - counterparties: number - destination: string - /** - * Bitcoin miner fee to use for transaction. A number higher than 1000 is used as satoshi per kvB tx fee. The number lower than that uses the dynamic fee estimation of blockchain provider as confirmation target. - */ - txfee?: unknown -} + mixdepth: number; + amount_sats: number; + counterparties: number; + destination: string; + /** + * Bitcoin miner fee to use for transaction. A number higher than 1000 is used as satoshi per kvB tx fee. The number lower than that uses the dynamic fee estimation of blockchain provider as confirmation target. + */ + txfee?: unknown; +}; export type TokenRequest = { - grant_type: string - refresh_token: string -} + grant_type: string; + refresh_token: string; +}; export type TokenResponse = { - token: string - token_type: string - expires_in: number - scope: string - refresh_token: string -} + token: string; + token_type: string; + expires_in: number; + scope: string; + refresh_token: string; +}; export type RunScheduleRequest = { - destination_addresses?: Array - tumbler_options?: { - addrcount?: number - minmakercount?: number - makercountrange?: Array - mixdepthcount?: number - mintxcount?: number - txcountparams?: Array - timelambda?: number - stage1_timelambda_increase?: number - liquiditywait?: number - waittime?: number - mixdepthsrc?: number - restart?: boolean - schedulefile?: string - mincjamount?: number - amtmixdepths?: number - rounding_chance?: number - rounding_sigfig_weights?: Array - } -} + destination_addresses?: Array; + tumbler_options?: { + addrcount?: number; + minmakercount?: number; + makercountrange?: Array; + mixdepthcount?: number; + mintxcount?: number; + txcountparams?: Array; + timelambda?: number; + stage1_timelambda_increase?: number; + liquiditywait?: number; + waittime?: number; + mixdepthsrc?: number; + restart?: boolean; + schedulefile?: string; + mincjamount?: number; + amtmixdepths?: number; + rounding_chance?: number; + rounding_sigfig_weights?: Array; + }; +}; export type StartMakerRequest = { - txfee: string - cjfee_a: string - cjfee_r: string - ordertype: string - minsize: string -} + txfee: string; + cjfee_a: string; + cjfee_r: string; + ordertype: string; + minsize: string; +}; -export type GetAddressResponse = string +export type GetAddressResponse = string; export type ListWalletsResponse = { - wallets?: Array -} + wallets?: Array; +}; -export type YieldGenReportResponse = Array +export type YieldGenReportResponse = Array; export type GetinfoResponse = { - version: string -} + version: string; +}; export type RescanBlockchainResponse = { - walletname: string -} + walletname: string; +}; export type RescanInfoResponse = { - rescanning: boolean - progress?: number -} + rescanning: boolean; + progress?: number; +}; export type SessionResponse = { - session: boolean - maker_running: boolean - coinjoin_in_process: boolean - schedule?: Array> - wallet_name: string - offer_list?: Array<{ - oid?: number - ordertype?: string - minsize?: number - maxsize?: number - txfee?: number - cjfee?: string - }> - nickname?: string - rescanning: boolean - block_height?: number -} + session: boolean; + maker_running: boolean; + coinjoin_in_process: boolean; + schedule?: Array>; + wallet_name: string; + offer_list?: Array<{ + oid?: number; + ordertype?: string; + minsize?: number; + maxsize?: number; + txfee?: number; + cjfee?: string; + }>; + nickname?: string; + rescanning: boolean; + block_height?: number; +}; export type ListUtxosResponse = { - utxos?: Array<{ - utxo?: string - address?: string - path?: string - label?: string - value?: number - tries?: number - tries_remaining?: number - external?: boolean - mixdepth?: number - confirmations?: number - frozen?: boolean - }> -} + utxos?: Array<{ + utxo?: string; + address?: string; + path?: string; + label?: string; + value?: number; + tries?: number; + tries_remaining?: number; + external?: boolean; + mixdepth?: number; + confirmations?: number; + frozen?: boolean; + }>; +}; export type WalletDisplayResponse = { - walletname: string - walletinfo: { - wallet_name: string - total_balance: string - available_balance?: string - accounts: Array<{ - account?: string - account_balance?: string - available_balance?: string - branches?: Array<{ - branch?: string - balance?: string - available_balance?: string - entries?: Array<{ - hd_path?: string - address?: string - amount?: string - available_balance?: string - status?: string - label?: string - extradata?: string - }> - }> - }> - } -} + walletname: string; + walletinfo: { + wallet_name: string; + total_balance: string; + available_balance?: string; + accounts: Array<{ + account?: string; + account_balance?: string; + available_balance?: string; + branches?: Array<{ + branch?: string; + balance?: string; + available_balance?: string; + entries?: Array<{ + hd_path?: string; + address?: string; + amount?: string; + available_balance?: string; + status?: string; + label?: string; + extradata?: string; + }>; + }>; + }>; + }; +}; export type CreateWalletResponse = { - walletname: string - seedphrase: string - token: string - refresh_token: string -} + walletname: string; + seedphrase: string; + token: string; + refresh_token: string; +}; export type UnlockWalletResponse = { - walletname: string - token: string - refresh_token: string -} + walletname: string; + token: string; + refresh_token: string; +}; export type DirectSendResponse = { - txinfo: { - hex?: string - inputs?: Array<{ - outpoint?: string - scriptSig?: string - nSequence?: number - witness?: string - }> - outputs?: Array<{ - value_sats?: number - scriptPubKey?: string - address?: string - }> - txid?: string - nLockTime?: number - nVersion?: number - } -} + txinfo: { + hex?: string; + inputs?: Array<{ + outpoint?: string; + scriptSig?: string; + nSequence?: number; + witness?: string; + }>; + outputs?: Array<{ + value_sats?: number; + scriptPubKey?: string; + address?: string; + }>; + txid?: string; + nLockTime?: number; + nVersion?: number; + }; +}; export type GetSeedResponse = { - seedphrase: string -} + seedphrase: string; +}; export type GetScheduleResponse = { - schedule: Array> -} + schedule: Array>; +}; export type LockWalletResponse = { - walletname: string - already_locked: boolean -} + walletname: string; + already_locked: boolean; +}; export type CreateWalletRequest = { - walletname: string - password: string - wallettype: string -} + walletname: string; + password: string; + wallettype: string; +}; export type RecoverWalletRequest = { - walletname: string - password: string - wallettype: string - seedphrase: string -} + walletname: string; + password: string; + wallettype: string; + seedphrase: string; +}; export type UnlockWalletRequest = { - password: string -} + password: string; +}; export type DirectSendRequest = { - mixdepth: number - amount_sats: number - destination: string - /** - * Bitcoin miner fee to use for transaction. A number higher than 1000 is used as satoshi per kvB tx fee. The number lower than that uses the dynamic fee estimation of blockchain provider as confirmation target. - */ - txfee?: number -} + mixdepth: number; + amount_sats: number; + destination: string; + /** + * Bitcoin miner fee to use for transaction. A number higher than 1000 is used as satoshi per kvB tx fee. The number lower than that uses the dynamic fee estimation of blockchain provider as confirmation target. + */ + txfee?: number; +}; export type ErrorMessage = { - message?: string - error_description?: string -} + message?: string; + error_description?: string; +}; export type TokenData = { - /** - * token refresh parameters - */ - body?: TokenRequest - path?: never - query?: never - url: '/token' -} + /** + * token refresh parameters + */ + body?: TokenRequest; + path?: never; + query?: never; + url: '/token'; +}; export type TokenErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; +}; -export type TokenError = TokenErrors[keyof TokenErrors] +export type TokenError = TokenErrors[keyof TokenErrors]; export type TokenResponses = { - /** - * Access token obtained successfully - */ - 200: TokenResponse -} + /** + * Access token obtained successfully + */ + 200: TokenResponse; +}; -export type TokenResponse2 = TokenResponses[keyof TokenResponses] +export type TokenResponse2 = TokenResponses[keyof TokenResponses]; export type CreatewalletData = { - /** - * wallet creation parameters - */ - body?: CreateWalletRequest - path?: never - query?: never - url: '/wallet/create' -} + /** + * wallet creation parameters + */ + body?: CreateWalletRequest; + path?: never; + query?: never; + url: '/wallet/create'; +}; export type CreatewalletErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Unable to complete request because object already exists. - */ - 409: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Unable to complete request because object already exists. + */ + 409: ErrorMessage; +}; -export type CreatewalletError = CreatewalletErrors[keyof CreatewalletErrors] +export type CreatewalletError = CreatewalletErrors[keyof CreatewalletErrors]; export type CreatewalletResponses = { - /** - * wallet created successfully - */ - 201: CreateWalletResponse -} + /** + * wallet created successfully + */ + 201: CreateWalletResponse; +}; -export type CreatewalletResponse = CreatewalletResponses[keyof CreatewalletResponses] +export type CreatewalletResponse = CreatewalletResponses[keyof CreatewalletResponses]; export type RecoverwalletData = { - /** - * wallet recovery parameters - */ - body?: RecoverWalletRequest - path?: never - query?: never - url: '/wallet/recover' -} + /** + * wallet recovery parameters + */ + body?: RecoverWalletRequest; + path?: never; + query?: never; + url: '/wallet/recover'; +}; export type RecoverwalletErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Unable to complete request because object already exists. - */ - 409: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Unable to complete request because object already exists. + */ + 409: ErrorMessage; +}; -export type RecoverwalletError = RecoverwalletErrors[keyof RecoverwalletErrors] +export type RecoverwalletError = RecoverwalletErrors[keyof RecoverwalletErrors]; export type RecoverwalletResponses = { - /** - * wallet created successfully - */ - 201: CreateWalletResponse -} + /** + * wallet created successfully + */ + 201: CreateWalletResponse; +}; -export type RecoverwalletResponse = RecoverwalletResponses[keyof RecoverwalletResponses] +export type RecoverwalletResponse = RecoverwalletResponses[keyof RecoverwalletResponses]; export type UnlockwalletData = { - /** - * wallet unlocking parameters - */ - body?: UnlockWalletRequest - path: { /** - * name of wallet including .jmdat + * wallet unlocking parameters */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/unlock' -} + body?: UnlockWalletRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/unlock'; +}; export type UnlockwalletErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage - /** - * Unable to complete request because object already exists. - */ - 409: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; + /** + * Unable to complete request because object already exists. + */ + 409: ErrorMessage; +}; -export type UnlockwalletError = UnlockwalletErrors[keyof UnlockwalletErrors] +export type UnlockwalletError = UnlockwalletErrors[keyof UnlockwalletErrors]; export type UnlockwalletResponses = { - /** - * wallet unlocked successfully - */ - 200: UnlockWalletResponse -} + /** + * wallet unlocked successfully + */ + 200: UnlockWalletResponse; +}; -export type UnlockwalletResponse = UnlockwalletResponses[keyof UnlockwalletResponses] +export type UnlockwalletResponse = UnlockwalletResponses[keyof UnlockwalletResponses]; export type LockwalletData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/lock' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/lock'; +}; export type LockwalletErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; +}; -export type LockwalletError = LockwalletErrors[keyof LockwalletErrors] +export type LockwalletError = LockwalletErrors[keyof LockwalletErrors]; export type LockwalletResponses = { - /** - * wallet locked successfully - */ - 200: LockWalletResponse -} + /** + * wallet locked successfully + */ + 200: LockWalletResponse; +}; -export type LockwalletResponse = LockwalletResponses[keyof LockwalletResponses] +export type LockwalletResponse = LockwalletResponses[keyof LockwalletResponses]; export type DisplaywalletData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/display' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/display'; +}; export type DisplaywalletErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type DisplaywalletError = DisplaywalletErrors[keyof DisplaywalletErrors] +export type DisplaywalletError = DisplaywalletErrors[keyof DisplaywalletErrors]; export type DisplaywalletResponses = { - /** - * wallet display contents retrieved successfully. - */ - 200: WalletDisplayResponse -} + /** + * wallet display contents retrieved successfully. + */ + 200: WalletDisplayResponse; +}; -export type DisplaywalletResponse = DisplaywalletResponses[keyof DisplaywalletResponses] +export type DisplaywalletResponse = DisplaywalletResponses[keyof DisplaywalletResponses]; export type SessionData = { - body?: never - path?: never - query?: never - url: '/session' -} + body?: never; + path?: never; + query?: never; + url: '/session'; +}; export type SessionErrors = { - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type SessionError = SessionErrors[keyof SessionErrors] +export type SessionError = SessionErrors[keyof SessionErrors]; export type SessionResponses = { - /** - * successful heartbeat response - */ - 200: SessionResponse -} + /** + * successful heartbeat response + */ + 200: SessionResponse; +}; -export type SessionResponse2 = SessionResponses[keyof SessionResponses] +export type SessionResponse2 = SessionResponses[keyof SessionResponses]; export type VersionData = { - body?: never - path?: never - query?: never - url: '/getinfo' -} + body?: never; + path?: never; + query?: never; + url: '/getinfo'; +}; export type VersionResponses = { - /** - * successful Joinmarket getinfo response - */ - 200: GetinfoResponse -} + /** + * successful Joinmarket getinfo response + */ + 200: GetinfoResponse; +}; -export type VersionResponse = VersionResponses[keyof VersionResponses] +export type VersionResponse = VersionResponses[keyof VersionResponses]; export type ListwalletsData = { - body?: never - path?: never - query?: never - url: '/wallet/all' -} + body?: never; + path?: never; + query?: never; + url: '/wallet/all'; +}; export type ListwalletsErrors = { - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type ListwalletsError = ListwalletsErrors[keyof ListwalletsErrors] +export type ListwalletsError = ListwalletsErrors[keyof ListwalletsErrors]; export type ListwalletsResponses = { - /** - * successful response to listwallets - */ - 200: ListWalletsResponse -} + /** + * successful response to listwallets + */ + 200: ListWalletsResponse; +}; -export type ListwalletsResponse = ListwalletsResponses[keyof ListwalletsResponses] +export type ListwalletsResponse = ListwalletsResponses[keyof ListwalletsResponses]; export type YieldgenreportData = { - body?: never - path?: never - query?: never - url: '/wallet/yieldgen/report' -} + body?: never; + path?: never; + query?: never; + url: '/wallet/yieldgen/report'; +}; export type YieldgenreportErrors = { - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type YieldgenreportError = YieldgenreportErrors[keyof YieldgenreportErrors] +export type YieldgenreportError = YieldgenreportErrors[keyof YieldgenreportErrors]; export type YieldgenreportResponses = { - /** - * get list of coinjoins taken part in as maker (across all wallets) - */ - 200: YieldGenReportResponse -} + /** + * get list of coinjoins taken part in as maker (across all wallets) + */ + 200: YieldGenReportResponse; +}; -export type YieldgenreportResponse = YieldgenreportResponses[keyof YieldgenreportResponses] +export type YieldgenreportResponse = YieldgenreportResponses[keyof YieldgenreportResponses]; export type GetaddressData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - /** - * account or mixdepth to source the address from (0..4) - */ - mixdepth: string - } - query?: never - url: '/wallet/{walletname}/address/new/{mixdepth}' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + /** + * account or mixdepth to source the address from (0..4) + */ + mixdepth: string; + }; + query?: never; + url: '/wallet/{walletname}/address/new/{mixdepth}'; +}; export type GetaddressErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type GetaddressError = GetaddressErrors[keyof GetaddressErrors] +export type GetaddressError = GetaddressErrors[keyof GetaddressErrors]; export type GetaddressResponses = { - /** - * successful retrieval of new address - */ - 200: GetAddressResponse -} + /** + * successful retrieval of new address + */ + 200: GetAddressResponse; +}; -export type GetaddressResponse = GetaddressResponses[keyof GetaddressResponses] +export type GetaddressResponse = GetaddressResponses[keyof GetaddressResponses]; export type RescanblockchainData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - /** - * starting block height for the rescan - */ - blockheight: number - } - query?: never - url: '/wallet/{walletname}/rescanblockchain/{blockheight}' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + /** + * starting block height for the rescan + */ + blockheight: number; + }; + query?: never; + url: '/wallet/{walletname}/rescanblockchain/{blockheight}'; +}; export type RescanblockchainErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type RescanblockchainError = RescanblockchainErrors[keyof RescanblockchainErrors] +export type RescanblockchainError = RescanblockchainErrors[keyof RescanblockchainErrors]; export type RescanblockchainResponses = { - /** - * Blockchain rescan started successfully - */ - 200: RescanBlockchainResponse -} + /** + * Blockchain rescan started successfully + */ + 200: RescanBlockchainResponse; +}; -export type RescanblockchainResponse = RescanblockchainResponses[keyof RescanblockchainResponses] +export type RescanblockchainResponse = RescanblockchainResponses[keyof RescanblockchainResponses]; export type GetrescaninfoData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/getrescaninfo' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/getrescaninfo'; +}; export type GetrescaninfoErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type GetrescaninfoError = GetrescaninfoErrors[keyof GetrescaninfoErrors] +export type GetrescaninfoError = GetrescaninfoErrors[keyof GetrescaninfoErrors]; export type GetrescaninfoResponses = { - /** - * Blockchain rescan status retrieved successfully - */ - 200: RescanInfoResponse -} + /** + * Blockchain rescan status retrieved successfully + */ + 200: RescanInfoResponse; +}; -export type GetrescaninfoResponse = GetrescaninfoResponses[keyof GetrescaninfoResponses] +export type GetrescaninfoResponse = GetrescaninfoResponses[keyof GetrescaninfoResponses]; export type GettimelockaddressData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - /** - * month whose first day will be the end of the timelock, for this address. - */ - lockdate: string - } - query?: never - url: '/wallet/{walletname}/address/timelock/new/{lockdate}' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + /** + * month whose first day will be the end of the timelock, for this address. + */ + lockdate: string; + }; + query?: never; + url: '/wallet/{walletname}/address/timelock/new/{lockdate}'; +}; export type GettimelockaddressErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type GettimelockaddressError = GettimelockaddressErrors[keyof GettimelockaddressErrors] +export type GettimelockaddressError = GettimelockaddressErrors[keyof GettimelockaddressErrors]; export type GettimelockaddressResponses = { - /** - * successful retrieval of new address - */ - 200: GetAddressResponse -} + /** + * successful retrieval of new address + */ + 200: GetAddressResponse; +}; -export type GettimelockaddressResponse = GettimelockaddressResponses[keyof GettimelockaddressResponses] +export type GettimelockaddressResponse = GettimelockaddressResponses[keyof GettimelockaddressResponses]; export type ListutxosData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/utxos' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/utxos'; +}; export type ListutxosErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type ListutxosError = ListutxosErrors[keyof ListutxosErrors] +export type ListutxosError = ListutxosErrors[keyof ListutxosErrors]; export type ListutxosResponses = { - /** - * successful retrieval of utxo list - */ - 200: ListUtxosResponse -} + /** + * successful retrieval of utxo list + */ + 200: ListUtxosResponse; +}; -export type ListutxosResponse = ListutxosResponses[keyof ListutxosResponses] +export type ListutxosResponse = ListutxosResponses[keyof ListutxosResponses]; export type DirectsendData = { - /** - * transaction creation parameters - */ - body?: DirectSendRequest - path: { /** - * name of wallet including .jmdat + * transaction creation parameters */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/taker/direct-send' -} + body?: DirectSendRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/taker/direct-send'; +}; export type DirectsendErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage - /** - * Transaction failed to broadcast. - */ - 409: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; + /** + * Transaction failed to broadcast. + */ + 409: ErrorMessage; +}; -export type DirectsendError = DirectsendErrors[keyof DirectsendErrors] +export type DirectsendError = DirectsendErrors[keyof DirectsendErrors]; export type DirectsendResponses = { - /** - * transaction broadcast OK. - */ - 200: DirectSendResponse -} + /** + * transaction broadcast OK. + */ + 200: DirectSendResponse; +}; -export type DirectsendResponse = DirectsendResponses[keyof DirectsendResponses] +export type DirectsendResponse = DirectsendResponses[keyof DirectsendResponses]; export type StartmakerData = { - /** - * yield generator config parameters - */ - body?: StartMakerRequest - path: { /** - * name of wallet including .jmdat + * yield generator config parameters */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/maker/start' -} + body?: StartMakerRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/maker/start'; +}; export type StartmakerErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage - /** - * Maker could not start without confirmed balance. - */ - 409: ErrorMessage - /** - * The server is not ready to process the request. - */ - 503: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; + /** + * Maker could not start without confirmed balance. + */ + 409: ErrorMessage; + /** + * The server is not ready to process the request. + */ + 503: ErrorMessage; +}; -export type StartmakerError = StartmakerErrors[keyof StartmakerErrors] +export type StartmakerError = StartmakerErrors[keyof StartmakerErrors]; export type StartmakerResponses = { - /** - * The request has been submitted successfully for processing, but the processing has not been completed. - */ - 202: unknown -} + /** + * The request has been submitted successfully for processing, but the processing has not been completed. + */ + 202: unknown; +}; export type StopmakerData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/maker/stop' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/maker/stop'; +}; export type StopmakerErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type StopmakerError = StopmakerErrors[keyof StopmakerErrors] +export type StopmakerError = StopmakerErrors[keyof StopmakerErrors]; export type StopmakerResponses = { - /** - * The request has been submitted successfully for processing, but the processing has not been completed. - */ - 202: unknown -} + /** + * The request has been submitted successfully for processing, but the processing has not been completed. + */ + 202: unknown; +}; export type DocoinjoinData = { - /** - * taker side coinjoin parameters - */ - body?: DoCoinjoinRequest - path: { /** - * name of wallet including .jmdat + * taker side coinjoin parameters */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/taker/coinjoin' -} + body?: DoCoinjoinRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/taker/coinjoin'; +}; export type DocoinjoinErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage - /** - * Unable to complete request because config settings are missing. - */ - 409: ErrorMessage - /** - * The server is not ready to process the request. - */ - 503: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; + /** + * Unable to complete request because config settings are missing. + */ + 409: ErrorMessage; + /** + * The server is not ready to process the request. + */ + 503: ErrorMessage; +}; -export type DocoinjoinError = DocoinjoinErrors[keyof DocoinjoinErrors] +export type DocoinjoinError = DocoinjoinErrors[keyof DocoinjoinErrors]; export type DocoinjoinResponses = { - /** - * The request has been submitted successfully for processing, but the processing has not been completed. - */ - 202: unknown -} + /** + * The request has been submitted successfully for processing, but the processing has not been completed. + */ + 202: unknown; +}; export type GetscheduleData = { - body?: never - path: { - /** - * name of the wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/taker/schedule' -} + body?: never; + path: { + /** + * name of the wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/taker/schedule'; +}; export type GetscheduleErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type GetscheduleError = GetscheduleErrors[keyof GetscheduleErrors] +export type GetscheduleError = GetscheduleErrors[keyof GetscheduleErrors]; export type GetscheduleResponses = { - /** - * schedule retrieved successfully - */ - 200: GetScheduleResponse -} + /** + * schedule retrieved successfully + */ + 200: GetScheduleResponse; +}; -export type GetscheduleResponse = GetscheduleResponses[keyof GetscheduleResponses] +export type GetscheduleResponse = GetscheduleResponses[keyof GetscheduleResponses]; export type RunscheduleData = { - /** - * taker side schedule parameters - */ - body?: RunScheduleRequest - path: { /** - * name of wallet including .jmdat + * taker side schedule parameters */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/taker/schedule' -} + body?: RunScheduleRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/taker/schedule'; +}; export type RunscheduleErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage - /** - * Unable to complete request because config settings are missing. - */ - 409: ErrorMessage - /** - * The server is not ready to process the request. - */ - 503: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; + /** + * Unable to complete request because config settings are missing. + */ + 409: ErrorMessage; + /** + * The server is not ready to process the request. + */ + 503: ErrorMessage; +}; -export type RunscheduleError = RunscheduleErrors[keyof RunscheduleErrors] +export type RunscheduleError = RunscheduleErrors[keyof RunscheduleErrors]; export type RunscheduleResponses = { - /** - * schedule started successfully - */ - 202: GetScheduleResponse -} + /** + * schedule started successfully + */ + 202: GetScheduleResponse; +}; -export type RunscheduleResponse = RunscheduleResponses[keyof RunscheduleResponses] +export type RunscheduleResponse = RunscheduleResponses[keyof RunscheduleResponses]; export type StopcoinjoinData = { - body?: never - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/taker/stop' -} + body?: never; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/taker/stop'; +}; export type StopcoinjoinErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to authorise the credentials that were supplied. - */ - 401: ErrorMessage - /** - * Item not found. - */ - 404: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to authorise the credentials that were supplied. + */ + 401: ErrorMessage; + /** + * Item not found. + */ + 404: ErrorMessage; +}; -export type StopcoinjoinError = StopcoinjoinErrors[keyof StopcoinjoinErrors] +export type StopcoinjoinError = StopcoinjoinErrors[keyof StopcoinjoinErrors]; export type StopcoinjoinResponses = { - /** - * The request has been submitted successfully for processing, but the processing has not been completed. - */ - 202: unknown -} + /** + * The request has been submitted successfully for processing, but the processing has not been completed. + */ + 202: unknown; +}; export type ConfigsettingData = { - /** - * config editing parameters - */ - body?: ConfigSetRequest - path: { /** - * name of wallet including .jmdat + * config editing parameters */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/configset' -} + body?: ConfigSetRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/configset'; +}; export type ConfigsettingErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to complete request because config settings are missing. - */ - 409: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to complete request because config settings are missing. + */ + 409: ErrorMessage; +}; -export type ConfigsettingError = ConfigsettingErrors[keyof ConfigsettingErrors] +export type ConfigsettingError = ConfigsettingErrors[keyof ConfigsettingErrors]; export type ConfigsettingResponses = { - /** - * successful update of config value - */ - 200: ConfigSetResponse -} + /** + * successful update of config value + */ + 200: ConfigSetResponse; +}; -export type ConfigsettingResponse = ConfigsettingResponses[keyof ConfigsettingResponses] +export type ConfigsettingResponse = ConfigsettingResponses[keyof ConfigsettingResponses]; export type ConfiggetData = { - body?: ConfigGetRequest - path: { - /** - * name of wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/configget' -} + body?: ConfigGetRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/configget'; +}; export type ConfiggetErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage - /** - * Unable to complete request because config settings are missing. - */ - 409: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; + /** + * Unable to complete request because config settings are missing. + */ + 409: ErrorMessage; +}; -export type ConfiggetError = ConfiggetErrors[keyof ConfiggetErrors] +export type ConfiggetError = ConfiggetErrors[keyof ConfiggetErrors]; export type ConfiggetResponses = { - /** - * successful retrieval of config value - */ - 200: ConfigGetResponse -} + /** + * successful retrieval of config value + */ + 200: ConfigGetResponse; +}; -export type ConfiggetResponse = ConfiggetResponses[keyof ConfiggetResponses] +export type ConfiggetResponse = ConfiggetResponses[keyof ConfiggetResponses]; export type FreezeData = { - /** - * utxo string and freeze toggle as boolean - */ - body?: FreezeRequest - path: { /** - * name of wallet including .jmdat + * utxo string and freeze toggle as boolean */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/freeze' -} + body?: FreezeRequest; + path: { + /** + * name of wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/freeze'; +}; export type FreezeErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; +}; -export type FreezeError = FreezeErrors[keyof FreezeErrors] +export type FreezeError = FreezeErrors[keyof FreezeErrors]; export type FreezeResponses = { - /** - * freeze or unfreeze utxo action completed successfully - */ - 200: FreezeResponse -} + /** + * freeze or unfreeze utxo action completed successfully + */ + 200: FreezeResponse; +}; -export type FreezeResponse2 = FreezeResponses[keyof FreezeResponses] +export type FreezeResponse2 = FreezeResponses[keyof FreezeResponses]; export type GetseedData = { - body?: never - path: { - /** - * name of the wallet including .jmdat - */ - walletname: string - } - query?: never - url: '/wallet/{walletname}/getseed' -} + body?: never; + path: { + /** + * name of the wallet including .jmdat + */ + walletname: string; + }; + query?: never; + url: '/wallet/{walletname}/getseed'; +}; export type GetseedErrors = { - /** - * Bad request format. - */ - 400: ErrorMessage -} + /** + * Bad request format. + */ + 400: ErrorMessage; +}; -export type GetseedError = GetseedErrors[keyof GetseedErrors] +export type GetseedError = GetseedErrors[keyof GetseedErrors]; export type GetseedResponses = { - /** - * seedphrase retrieved successfully - */ - 200: GetSeedResponse -} + /** + * seedphrase retrieved successfully + */ + 200: GetSeedResponse; +}; -export type GetseedResponse = GetseedResponses[keyof GetseedResponses] +export type GetseedResponse = GetseedResponses[keyof GetseedResponses]; export type ClientOptions = { - baseUrl: 'https://none' | (string & {}) -} + baseUrl: 'https://none' | (string & {}); +}; \ No newline at end of file diff --git a/src/lib/jm-api/index.ts b/src/lib/jm-api/index.ts index 4d5d177c..34dde881 100644 --- a/src/lib/jm-api/index.ts +++ b/src/lib/jm-api/index.ts @@ -1,4 +1,4 @@ -import type { ClientOptions } from './generated/client/types.gen' import { createClient as __createClient, createConfig } from '@hey-api/client-fetch' +import type { ClientOptions } from '@/lib/jm-api/generated/client' export const createClient = (options: ClientOptions) => __createClient(createConfig(options)) diff --git a/src/lib/session.ts b/src/lib/session.ts index d9f419f2..946a4c95 100644 --- a/src/lib/session.ts +++ b/src/lib/session.ts @@ -1,4 +1,4 @@ -import type { UnlockWalletResponse } from './jm-api/generated/client' +import type { UnlockWalletResponse } from '@/lib/jm-api/generated/client' interface SessionData { walletFileName: string diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 378867de..13ea979c 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,4 +1,4 @@ -import { clsx, type ClassValue } from 'clsx' +import { type ClassValue, clsx } from 'clsx' import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { diff --git a/src/main.tsx b/src/main.tsx index bef5202a..fe1e8797 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,7 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' +import App from '@/App.tsx' import './index.css' -import App from './App.tsx' createRoot(document.getElementById('root')!).render( diff --git a/src/stories/Alert.stories.tsx b/src/stories/Alert.stories.tsx index 509fc680..c91b24f0 100644 --- a/src/stories/Alert.stories.tsx +++ b/src/stories/Alert.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Alert, AlertTitle, AlertDescription } from '../components/ui/alert' import { AlertCircle, CheckCircle2 } from 'lucide-react' +import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' const meta: Meta = { title: 'Core/Alert', diff --git a/src/stories/Avatar.stories.tsx b/src/stories/Avatar.stories.tsx index 4f6b9bd0..6a659e02 100644 --- a/src/stories/Avatar.stories.tsx +++ b/src/stories/Avatar.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Avatar, AvatarImage, AvatarFallback } from '../components/ui/avatar' +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' const meta: Meta = { title: 'Core/Avatar', diff --git a/src/stories/Badge.stories.tsx b/src/stories/Badge.stories.tsx index fc6321ab..0beddfe0 100644 --- a/src/stories/Badge.stories.tsx +++ b/src/stories/Badge.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Badge } from '../components/ui/badge' +import { Badge } from '@/components/ui/badge' const meta: Meta = { title: 'Core/Badge', diff --git a/src/stories/Button.stories.tsx b/src/stories/Button.stories.tsx index 4f4f3a59..d9c04151 100644 --- a/src/stories/Button.stories.tsx +++ b/src/stories/Button.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Button } from '../components/ui/button' +import { Button } from '@/components/ui/button' const meta: Meta = { title: 'Core/Button', diff --git a/src/stories/Card.stories.tsx b/src/stories/Card.stories.tsx index 577e8cf8..3e30f9ac 100644 --- a/src/stories/Card.stories.tsx +++ b/src/stories/Card.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Card, CardHeader, CardTitle, CardDescription } from '../components/ui/card' +import { Card, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' const meta: Meta = { title: 'Core/Card', diff --git a/src/stories/Footer.stories.tsx b/src/stories/Footer.stories.tsx index bc953717..1c0d42b7 100644 --- a/src/stories/Footer.stories.tsx +++ b/src/stories/Footer.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Footer } from '../components/Footer' +import { Footer } from '@/components/Footer' const meta: Meta = { title: 'Core/Footer', diff --git a/src/stories/Input.stories.tsx b/src/stories/Input.stories.tsx index cc0464cf..17556548 100644 --- a/src/stories/Input.stories.tsx +++ b/src/stories/Input.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Input } from '../components/ui/input' -import { Label } from '../components/ui/label' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' const meta: Meta = { title: 'Core/Input', diff --git a/src/stories/Jar.stories.tsx b/src/stories/Jar.stories.tsx index 055bc489..68233123 100644 --- a/src/stories/Jar.stories.tsx +++ b/src/stories/Jar.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Jar } from '../components/layout/Jar' +import { Jar } from '@/components/layout/Jar' const meta: Meta = { title: 'Core/Jar', diff --git a/src/stories/Label.stories.tsx b/src/stories/Label.stories.tsx index 85e80430..f010c308 100644 --- a/src/stories/Label.stories.tsx +++ b/src/stories/Label.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Label } from '../components/ui/label' -import { Input } from '../components/ui/input' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' const meta: Meta = { title: 'Core/Label', diff --git a/src/stories/Navbar.stories.tsx b/src/stories/Navbar.stories.tsx index 885d672e..932e061b 100644 --- a/src/stories/Navbar.stories.tsx +++ b/src/stories/Navbar.stories.tsx @@ -1,7 +1,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Navbar } from '../components/Navbar' import { Bitcoin } from 'lucide-react' import { MemoryRouter } from 'react-router-dom' +import { Navbar } from '@/components/Navbar' import type { JarColor } from '@/components/layout/display-mode-context' const meta: Meta = { diff --git a/src/stories/Navigation.stories.tsx b/src/stories/Navigation.stories.tsx index 568fcd6d..044eecb3 100644 --- a/src/stories/Navigation.stories.tsx +++ b/src/stories/Navigation.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Navigation } from '../components/layout/Navigation' +import { Navigation } from '@/components/layout/Navigation' const meta: Meta = { title: 'Core/Navigation', diff --git a/src/stories/Select.stories.tsx b/src/stories/Select.stories.tsx index 31ffcda1..80532d50 100644 --- a/src/stories/Select.stories.tsx +++ b/src/stories/Select.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' +import { Label } from '@/components/ui/label' import { Select, SelectContent, @@ -8,8 +9,7 @@ import { SelectSeparator, SelectTrigger, SelectValue, -} from '../components/ui/select' -import { Label } from '../components/ui/label' +} from '@/components/ui/select' const meta: Meta = { title: 'Core/Select', diff --git a/src/stories/Separator.stories.tsx b/src/stories/Separator.stories.tsx index 0346d1a3..9f3b484b 100644 --- a/src/stories/Separator.stories.tsx +++ b/src/stories/Separator.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Separator } from '../components/ui/separator' +import { Separator } from '@/components/ui/separator' const meta: Meta = { title: 'Core/Separator', diff --git a/src/stories/Sonner.stories.tsx b/src/stories/Sonner.stories.tsx index 3f239aec..e5fa6e18 100644 --- a/src/stories/Sonner.stories.tsx +++ b/src/stories/Sonner.stories.tsx @@ -1,7 +1,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Toaster } from '../components/ui/sonner' -import { Button } from '../components/ui/button' import { toast } from 'sonner' +import { Button } from '@/components/ui/button' +import { Toaster } from '@/components/ui/sonner' const meta: Meta = { title: 'Core/Sonner', diff --git a/src/stories/ThemeToggle.stories.tsx b/src/stories/ThemeToggle.stories.tsx index 93a67347..51f6ccd0 100644 --- a/src/stories/ThemeToggle.stories.tsx +++ b/src/stories/ThemeToggle.stories.tsx @@ -1,5 +1,5 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' import { useEffect, useState } from 'react' +import type { Meta, StoryObj } from '@storybook/react-vite' const meta: Meta = { title: 'Core/ThemeToggle', diff --git a/src/stories/Tooltip.stories.tsx b/src/stories/Tooltip.stories.tsx index be8fb8fc..c1aeaafe 100644 --- a/src/stories/Tooltip.stories.tsx +++ b/src/stories/Tooltip.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite' -import { Tooltip, TooltipTrigger, TooltipContent } from '../components/ui/tooltip' +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' const meta: Meta = { title: 'Core/Tooltip', diff --git a/vite.config.ts b/vite.config.ts index 68a7c298..1d57f9d0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,8 @@ -import path from 'path' +import { storybookTest } from '@storybook/addon-vitest/vitest-plugin' import tailwindcss from '@tailwindcss/vite' import react from '@vitejs/plugin-react' -import { defineConfig, type ServerOptions, type UserConfig } from 'vite' -import { storybookTest } from '@storybook/addon-vitest/vitest-plugin' +import path from 'path' +import { type ServerOptions, type UserConfig, defineConfig } from 'vite' const BACKEND_NATIVE = 'native' const BACKEND_STANDALONE = 'jam-standalone'