diff --git a/libs/sia-central-js/.babelrc b/libs/sia-central-js/.babelrc deleted file mode 100644 index 1ea870ead..000000000 --- a/libs/sia-central-js/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic", - "useBuiltIns": "usage" - } - ] - ], - "plugins": [] -} diff --git a/libs/sia-central-js/.eslintrc.json b/libs/sia-central-js/.eslintrc.json deleted file mode 100644 index 12e4c0bb1..000000000 --- a/libs/sia-central-js/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": ["libs/sia-central-js/rollup.config.js"] - } - ] - }, - "overrides": [ - { - "files": ["*.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": "error" - } - } - ] -} diff --git a/libs/sia-central-js/CHANGELOG.md b/libs/sia-central-js/CHANGELOG.md deleted file mode 100644 index 167510ccb..000000000 --- a/libs/sia-central-js/CHANGELOG.md +++ /dev/null @@ -1,76 +0,0 @@ -# @siafoundation/sia-central-js - -## 0.5.3 - -### Patch Changes - -- Updated dependencies [0d7fdf2e] - - @siafoundation/sia-central-types@0.2.0 - -## 0.5.2 - -### Patch Changes - -- Update dependencies. -- Updated dependencies - - @siafoundation/sia-central-types@0.1.1 - -## 0.5.1 - -### Patch Changes - -- Updated dependencies [3a983801] - - @siafoundation/request@0.2.0 - -## 0.5.0 - -### Minor Changes - -- 8e2d3999: The SDK has been updated to use the request library. - -## 0.4.0 - -### Minor Changes - -- a12625e7: sia-central is now named sia-central-js. - -### Patch Changes - -- Updated dependencies [a12625e7] - - @siafoundation/sia-central-types@0.1.0 - -## 0.3.3 - -### Patch Changes - -- b3e12c99: The package has been updated to use Next 14. - -## 0.3.2 - -### Patch Changes - -- Reconfigure rollup. - -## 0.3.1 - -### Patch Changes - -- Preserve modules and directives. - -## 0.3.0 - -### Minor Changes - -- d8528c8e: Package build and bundling has been updated. - -## 0.2.6 - -### Patch Changes - -- e24c8935: esm support - -## 0.1.0 - -### Minor Changes - -- 1c376d0e: Package publishing format has been updated. diff --git a/libs/sia-central-js/README.md b/libs/sia-central-js/README.md deleted file mode 100644 index 32f78de2e..000000000 --- a/libs/sia-central-js/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# sia-central-js - -Methods and types for interacting with the Sia Central API. - -## Installation - -```sh -npm install @siafoundation/sia-central-js -``` - -## Usage - -```js -import { SiaCentral } from '@siafoundation/sia-central-js' - -export async function example() { - const siaCentral = SiaCentral() - const latestBlock = await siaCentral.blockLatest() - const metrics = await siaCentral.hostsNetworkMetrics() - const averages = await siaCentral.hostsNetworkAverages() - const exchangeRates = await siaCentral.exchangeRates({ - params: { - currencies: 'sc', - }, - }) - console.log({ latestBlock, metrics, averages, exchangeRates }) -} -``` diff --git a/libs/sia-central-js/jest.config.ts b/libs/sia-central-js/jest.config.ts deleted file mode 100644 index b1b82c844..000000000 --- a/libs/sia-central-js/jest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'sia-central-js', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': [ - 'babel-jest', - { - presets: ['@nx/next/babel'], - plugins: ['@babel/plugin-transform-private-methods'], - }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/sia-central-js', -} diff --git a/libs/sia-central-js/package.json b/libs/sia-central-js/package.json deleted file mode 100644 index f61396e8d..000000000 --- a/libs/sia-central-js/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@siafoundation/sia-central-js", - "description": "Methods and types for interacting with the Sia Central API.", - "version": "0.5.3", - "license": "MIT", - "dependencies": { - "@siafoundation/sia-central-types": "0.2.0", - "@siafoundation/request": "0.2.0" - }, - "types": "./src/index.d.ts" -} diff --git a/libs/sia-central-js/project.json b/libs/sia-central-js/project.json deleted file mode 100644 index a094d9ce0..000000000 --- a/libs/sia-central-js/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "sia-central-js", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/sia-central-js/src", - "projectType": "library", - "tags": [], - "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/sia-central-js", - "tsConfig": "libs/sia-central-js/tsconfig.lib.json", - "project": "libs/sia-central-js/package.json", - "entryFile": "libs/sia-central-js/src/index.ts", - "external": ["react/jsx-runtime"], - "compiler": "tsc", - "outputFileName": "index.js", - "rollupConfig": "libs/sia-central-js/rollup.config.js", - "assets": [ - { - "glob": "libs/sia-central-js/*.md", - "input": ".", - "output": "." - } - ] - }, - "configurations": {} - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/libs/sia-central-js"], - "options": { - "jestConfig": "libs/sia-central-js/jest.config.ts" - } - } - } -} diff --git a/libs/sia-central-js/rollup.config.js b/libs/sia-central-js/rollup.config.js deleted file mode 100644 index 3f5e4e997..000000000 --- a/libs/sia-central-js/rollup.config.js +++ /dev/null @@ -1,18 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const preserveDirectives = require('rollup-plugin-preserve-directives') - -// https://github.com/rollup/rollup/issues/4699#issuecomment-1465302665 -function getRollupOptions(options) { - return { - ...options, - output: { - ...options.output, - preserveModules: true, - format: 'esm', - sourcemap: true, - }, - plugins: options.plugins.concat(preserveDirectives.default()), - } -} - -module.exports = getRollupOptions diff --git a/libs/sia-central-js/src/example.ts b/libs/sia-central-js/src/example.ts deleted file mode 100644 index c8764c99f..000000000 --- a/libs/sia-central-js/src/example.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { SiaCentral } from '.' - -export async function example() { - const siaCentral = SiaCentral() - const latestBlock = await siaCentral.blockLatest() - const metrics = await siaCentral.hostsNetworkMetrics() - const averages = await siaCentral.hostsNetworkAverages() - const exchangeRates = await siaCentral.exchangeRates({ - params: { - currencies: 'sc', - }, - }) - console.log({ latestBlock, metrics, averages, exchangeRates }) -} diff --git a/libs/sia-central-js/src/index.ts b/libs/sia-central-js/src/index.ts deleted file mode 100644 index 3a2efc293..000000000 --- a/libs/sia-central-js/src/index.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { - defaultApi, - SiaCentralAddressParams, - SiaCentralAddressPayload, - SiaCentralAddressResponse, - SiaCentralBlockLatestParams, - SiaCentralBlockLatestPayload, - SiaCentralBlockLatestResponse, - SiaCentralBlockParams, - SiaCentralBlockPayload, - SiaCentralBlockResponse, - SiaCentralBlocksParams, - SiaCentralBlocksPayload, - SiaCentralBlocksResponse, - SiaCentralContractParams, - SiaCentralContractPayload, - SiaCentralContractResponse, - SiaCentralExchangeRatesParams, - SiaCentralExchangeRatesPayload, - SiaCentralExchangeRatesResponse, - SiaCentralHostParams, - SiaCentralHostPayload, - SiaCentralHostResponse, - SiaCentralHostsNetworkAveragesParams, - SiaCentralHostsNetworkAveragesPayload, - SiaCentralHostsNetworkAveragesResponse, - SiaCentralHostsNetworkMetricsParams, - SiaCentralHostsNetworkMetricsPayload, - SiaCentralHostsNetworkMetricsResponse, - SiaCentralHostsParams, - SiaCentralHostsPayload, - SiaCentralHostsResponse, - SiaCentralSearchParams, - SiaCentralSearchPayload, - SiaCentralSearchResponse, - SiaCentralTransactionParams, - SiaCentralTransactionPayload, - SiaCentralTransactionResponse, -} from '@siafoundation/sia-central-types' -import { buildRequestHandler, initAxios } from '@siafoundation/request' - -export function SiaCentral({ api }: { api: string } = { api: defaultApi }) { - const axios = initAxios(api) - return { - address: buildRequestHandler< - SiaCentralAddressParams, - SiaCentralAddressPayload, - SiaCentralAddressResponse - >(axios, 'get', '/wallet/addresses/:id'), - block: buildRequestHandler< - SiaCentralBlockParams, - SiaCentralBlockPayload, - SiaCentralBlockResponse - >(axios, 'get', '/explorer/blocks/:id'), - blockLatest: buildRequestHandler< - SiaCentralBlockLatestParams, - SiaCentralBlockLatestPayload, - SiaCentralBlockLatestResponse - >(axios, 'get', '/explorer/blocks'), - blocks: buildRequestHandler< - SiaCentralBlocksParams, - SiaCentralBlocksPayload, - SiaCentralBlocksResponse - >(axios, 'post', '/explorer/blocks'), - contract: buildRequestHandler< - SiaCentralContractParams, - SiaCentralContractPayload, - SiaCentralContractResponse - >(axios, 'get', '/explorer/contracts/:id'), - exchangeRates: buildRequestHandler< - SiaCentralExchangeRatesParams, - SiaCentralExchangeRatesPayload, - SiaCentralExchangeRatesResponse - >(axios, 'get', '/market/exchange-rate', { - defaultParams: { - currencies: 'sc', - }, - }), - host: buildRequestHandler< - SiaCentralHostParams, - SiaCentralHostPayload, - SiaCentralHostResponse - >(axios, 'get', '/hosts/:id'), - hosts: buildRequestHandler< - SiaCentralHostsParams, - SiaCentralHostsPayload, - SiaCentralHostsResponse - >(axios, 'get', '/hosts/list', { - defaultParams: { - showinactive: false, - sort: 'used_storage', - dir: 'desc', - protocol: 'rhp3', - limit: 10, - page: 1, - }, - }), - hostsNetworkAverages: buildRequestHandler< - SiaCentralHostsNetworkAveragesParams, - SiaCentralHostsNetworkAveragesPayload, - SiaCentralHostsNetworkAveragesResponse - >(axios, 'get', '/hosts/network/averages'), - hostsNetworkMetrics: buildRequestHandler< - SiaCentralHostsNetworkMetricsParams, - SiaCentralHostsNetworkMetricsPayload, - SiaCentralHostsNetworkMetricsResponse - >(axios, 'get', '/hosts/network/metrics'), - search: buildRequestHandler< - SiaCentralSearchParams, - SiaCentralSearchPayload, - SiaCentralSearchResponse - >(axios, 'post', '/explorer/search'), - transaction: buildRequestHandler< - SiaCentralTransactionParams, - SiaCentralTransactionPayload, - SiaCentralTransactionResponse - >(axios, 'get', '/explorer/transactions/:id'), - } -} diff --git a/libs/sia-central-js/tsconfig.json b/libs/sia-central-js/tsconfig.json deleted file mode 100644 index 4c089585e..000000000 --- a/libs/sia-central-js/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/sia-central-js/tsconfig.lib.json b/libs/sia-central-js/tsconfig.lib.json deleted file mode 100644 index d73537814..000000000 --- a/libs/sia-central-js/tsconfig.lib.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": [ - "node", - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/libs/sia-central-js/tsconfig.spec.json b/libs/sia-central-js/tsconfig.spec.json deleted file mode 100644 index 503e9a83d..000000000 --- a/libs/sia-central-js/tsconfig.spec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/libs/sia-central-mock/.babelrc b/libs/sia-central-mock/.babelrc deleted file mode 100644 index 1ea870ead..000000000 --- a/libs/sia-central-mock/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic", - "useBuiltIns": "usage" - } - ] - ], - "plugins": [] -} diff --git a/libs/sia-central-mock/.eslintrc.json b/libs/sia-central-mock/.eslintrc.json deleted file mode 100644 index 59968999c..000000000 --- a/libs/sia-central-mock/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": ["libs/sia-central-mock/rollup.config.js"] - } - ] - }, - "overrides": [ - { - "files": ["*.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": "error" - } - } - ] -} diff --git a/libs/sia-central-mock/CHANGELOG.md b/libs/sia-central-mock/CHANGELOG.md deleted file mode 100644 index 1839d650b..000000000 --- a/libs/sia-central-mock/CHANGELOG.md +++ /dev/null @@ -1,37 +0,0 @@ -# @siafoundation/sia-central-mock - -## 0.3.0 - -### Minor Changes - -- 0d7fdf2e: Removed unsupported currencies from Sia Central SDKs. - -### Patch Changes - -- Updated dependencies [0d7fdf2e] - - @siafoundation/sia-central-types@0.2.0 - -## 0.2.0 - -### Minor Changes - -- 5f34c9a6: Add mock for hosts network averages. - -## 0.1.1 - -### Patch Changes - -- Update dependencies. -- Updated dependencies - - @siafoundation/sia-central-types@0.1.1 - -## 0.1.0 - -### Minor Changes - -- 1b1952e5: Libraries now follow new naming scheme. - -### Patch Changes - -- Updated dependencies [a12625e7] - - @siafoundation/sia-central-types@0.1.0 diff --git a/libs/sia-central-mock/README.md b/libs/sia-central-mock/README.md deleted file mode 100644 index 4bcfb7280..000000000 --- a/libs/sia-central-mock/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# sia-central-mock - -Sia Central data and API mock library for testing. diff --git a/libs/sia-central-mock/jest.config.ts b/libs/sia-central-mock/jest.config.ts deleted file mode 100644 index b639d7230..000000000 --- a/libs/sia-central-mock/jest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'sia-central-mock', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': [ - 'babel-jest', - { - presets: ['@nx/next/babel'], - plugins: ['@babel/plugin-transform-private-methods'], - }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/sia-central-mock', -} diff --git a/libs/sia-central-mock/package.json b/libs/sia-central-mock/package.json deleted file mode 100644 index f3d3976ce..000000000 --- a/libs/sia-central-mock/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@siafoundation/sia-central-mock", - "description": "Sia Central data and API mock library for testing.", - "version": "0.3.0", - "license": "MIT", - "dependencies": { - "playwright": "^1.49.1", - "@siafoundation/sia-central-types": "0.2.0" - }, - "types": "./src/index.d.ts" -} diff --git a/libs/sia-central-mock/project.json b/libs/sia-central-mock/project.json deleted file mode 100644 index 2bd8874cd..000000000 --- a/libs/sia-central-mock/project.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "sia-central-mock", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/sia-central-mock/src", - "projectType": "library", - "tags": [], - "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/sia-central-mock", - "tsConfig": "libs/sia-central-mock/tsconfig.lib.json", - "project": "libs/sia-central-mock/package.json", - "entryFile": "libs/sia-central-mock/src/index.ts", - "external": ["react/jsx-runtime"], - "compiler": "tsc", - "outputFileName": "index.js", - "rollupConfig": "libs/sia-central-mock/rollup.config.js", - "assets": [ - { - "glob": "libs/sia-central-mock/*.md", - "input": ".", - "output": "." - } - ] - }, - "configurations": {} - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - } -} diff --git a/libs/sia-central-mock/rollup.config.js b/libs/sia-central-mock/rollup.config.js deleted file mode 100644 index 3f5e4e997..000000000 --- a/libs/sia-central-mock/rollup.config.js +++ /dev/null @@ -1,18 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const preserveDirectives = require('rollup-plugin-preserve-directives') - -// https://github.com/rollup/rollup/issues/4699#issuecomment-1465302665 -function getRollupOptions(options) { - return { - ...options, - output: { - ...options.output, - preserveModules: true, - format: 'esm', - sourcemap: true, - }, - plugins: options.plugins.concat(preserveDirectives.default()), - } -} - -module.exports = getRollupOptions diff --git a/libs/sia-central-mock/src/index.ts b/libs/sia-central-mock/src/index.ts deleted file mode 100644 index b45445417..000000000 --- a/libs/sia-central-mock/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './siaCentralExchangeRates' -export * from './siaCentralHostsNetworkAverages' diff --git a/libs/sia-central-mock/src/siaCentralExchangeRates.ts b/libs/sia-central-mock/src/siaCentralExchangeRates.ts deleted file mode 100644 index 0eccbb6c3..000000000 --- a/libs/sia-central-mock/src/siaCentralExchangeRates.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { SiaCentralExchangeRatesResponse } from '@siafoundation/sia-central-types' -import { Page } from 'playwright' - -export function getMockSiaCentralExchangeRatesResponse(): SiaCentralExchangeRatesResponse { - return { - message: 'successfully retrieved exchange rate', - type: 'success', - rates: { - sc: { - aud: '0.016136871549', - bch: '0.000021499880703', - btc: '0.000000149047', - cad: '0.014328484298', - cny: '0.076310722577', - eth: '0.0000029068532077', - eur: '0.009737538604', - gbp: '0.008359151948', - jpy: '1.600530478116', - ltc: '0.000116295710314', - rub: '0.978819669836', - usd: '0.010571307522', - }, - }, - timestamp: '2024-03-26T13:12:22.7348119Z', - } -} - -export async function mockApiSiaCentralExchangeRates({ page }: { page: Page }) { - const json = getMockSiaCentralExchangeRatesResponse() - await page.route( - 'https://api.siacentral.com/v2/market/exchange-rate?currencies=sc', - async (route) => { - await route.fulfill({ json }) - } - ) - return json -} diff --git a/libs/sia-central-mock/src/siaCentralHostsNetworkAverages.ts b/libs/sia-central-mock/src/siaCentralHostsNetworkAverages.ts deleted file mode 100644 index 90a88c784..000000000 --- a/libs/sia-central-mock/src/siaCentralHostsNetworkAverages.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { SiaCentralHostsNetworkAveragesResponse } from '@siafoundation/sia-central-types' -import { Page } from 'playwright' - -export function getMockSiaCentralHostsNetworkAverages(): Partial { - return { - message: 'successfully got average settings', - type: 'success', - settings: { - max_download_batch_size: 45731232, - max_duration: 24903, - max_revise_batch_size: 42863669, - remaining_storage: 6374863381719, - sector_size: 4194304, - total_storage: 10437764381948, - window_size: 144, - revision_number: 0, - base_rpc_price: '575911952425466771', - collateral: '164150939887', - max_collateral: '5102329350609040404570949799', - contract_price: '177909940261449239357414', - download_price: '899214551757733', - sector_access_price: '786075245626037457', - storage_price: '78941314716', - upload_price: '75987987303050', - }, - price_table: { - uid: '00000000000000000000000000000000', - validity: 1669565217391, - hostblockheight: 484542, - updatepricetablecost: '1', - accountbalancecost: '1', - fundaccountcost: '1', - latestrevisioncost: '2416730419428409022', - subscriptionmemorycost: '0', - subscriptionnotificationcost: '0', - initbasecost: '575911952425466771', - memorytimecost: '1', - downloadbandwidthcost: '899214551757733', - uploadbandwidthcost: '75987987303050', - dropsectorsbasecost: '1', - dropsectorsunitcost: '1', - hassectorbasecost: '1', - readbasecost: '786075245626037457', - readlengthcost: '1', - renewcontractcost: '0', - revisionbasecost: '0', - swapsectorcost: '1', - writebasecost: '786075245626037457', - writelengthcost: '1', - writestorecost: '78941314716', - txnfeeminrecommended: '10742866192394797545', - txnfeemaxrecommended: '32228598577184392635', - contractprice: '0', - collateralcost: '164150939887', - maxcollateral: '0', - maxduration: 0, - windowsize: 0, - registryentriesleft: 3264413, - registryentriestotal: 3317868, - }, - benchmarks: { - contract_time: 7586, - upload_time: 12047, - download_time: 18929, - data_size: 41943040, - }, - } -} - -export async function mockApiSiaCentralHostsNetworkAverages({ - page, -}: { - page: Page -}) { - const json = getMockSiaCentralHostsNetworkAverages() - await page.route( - 'https://api.siacentral.com/v2/hosts/network/averages', - async (route) => { - await route.fulfill({ json }) - } - ) - return json -} - -export async function mockApiSiaCentralHostsNetworkAveragesUnroute({ - page, -}: { - page: Page -}) { - await page.unroute('https://api.siacentral.com/v2/hosts/network/averages') -} - -export async function mockApiSiaCentralHostsNetworkAveragesHanging({ - page, -}: { - page: Page -}) { - await page.route( - 'https://api.siacentral.com/v2/hosts/network/averages', - async () => { - return new Promise(() => { - // Never resolve, leaving the request hanging. - }) - } - ) -} diff --git a/libs/sia-central-mock/tsconfig.json b/libs/sia-central-mock/tsconfig.json deleted file mode 100644 index 4c089585e..000000000 --- a/libs/sia-central-mock/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/sia-central-mock/tsconfig.lib.json b/libs/sia-central-mock/tsconfig.lib.json deleted file mode 100644 index d73537814..000000000 --- a/libs/sia-central-mock/tsconfig.lib.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": [ - "node", - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/libs/sia-central-mock/tsconfig.spec.json b/libs/sia-central-mock/tsconfig.spec.json deleted file mode 100644 index 503e9a83d..000000000 --- a/libs/sia-central-mock/tsconfig.spec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/libs/sia-central-react/.babelrc b/libs/sia-central-react/.babelrc deleted file mode 100644 index 1ea870ead..000000000 --- a/libs/sia-central-react/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic", - "useBuiltIns": "usage" - } - ] - ], - "plugins": [] -} diff --git a/libs/sia-central-react/.eslintrc.json b/libs/sia-central-react/.eslintrc.json deleted file mode 100644 index 43c89ab78..000000000 --- a/libs/sia-central-react/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": ["libs/sia-central-react/rollup.config.js"] - } - ] - }, - "overrides": [ - { - "files": ["*.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": "error" - } - } - ] -} diff --git a/libs/sia-central-react/CHANGELOG.md b/libs/sia-central-react/CHANGELOG.md deleted file mode 100644 index 3793c805d..000000000 --- a/libs/sia-central-react/CHANGELOG.md +++ /dev/null @@ -1,119 +0,0 @@ -# @siafoundation/sia-central-react - -## 3.1.3 - -### Patch Changes - -- @siafoundation/react-core@2.0.0 - -## 3.1.2 - -### Patch Changes - -- Updated dependencies [0d7fdf2e] -- Updated dependencies [0d7fdf2e] - - @siafoundation/react-core@1.8.0 - - @siafoundation/sia-central-types@0.2.0 - -## 3.1.1 - -### Patch Changes - -- Update dependencies. -- Updated dependencies - - @siafoundation/sia-central-types@0.1.1 - -## 3.1.0 - -### Minor Changes - -- 1b1952e5: Libraries now follow new naming scheme. - -### Patch Changes - -- Updated dependencies [1b1952e5] -- Updated dependencies [0d7249a4] -- Updated dependencies [a12625e7] - - @siafoundation/react-core@1.2.0 - - @siafoundation/sia-central-types@0.1.0 - -## 3.0.0 - -### Patch Changes - -- Updated dependencies [40e402ad] - - @siafoundation/react-core@1.1.0 - -## 2.0.3 - -### Patch Changes - -- b3e12c99: The package has been updated to use Next 14. -- Updated dependencies [b3e12c99] - - @siafoundation/react-core@1.0.3 - - @siafoundation/sia-central@0.3.3 - -## 2.0.2 - -### Patch Changes - -- Reconfigure rollup. -- Updated dependencies - - @siafoundation/react-core@1.0.2 - - @siafoundation/sia-central@0.3.2 - -## 2.0.1 - -### Patch Changes - -- Preserve modules and directives. -- Updated dependencies - - @siafoundation/react-core@1.0.1 - - @siafoundation/sia-central@0.3.1 - -## 2.0.0 - -### Minor Changes - -- d8528c8e: Package build and bundling has been updated. - -### Patch Changes - -- Updated dependencies [d8528c8e] - - @siafoundation/react-core@1.0.0 - - @siafoundation/sia-central@0.3.0 - -## 1.0.6 - -### Patch Changes - -- e24c8935: esm support -- Updated dependencies [e24c8935] - - @siafoundation/react-core@0.16.11 - - @siafoundation/sia-central@0.2.6 - -## 1.0.0 - -### Minor Changes - -- d0c8a592: Refactored internal dependencies. - -### Patch Changes - -- Updated dependencies [d0c8a592] - - @siafoundation/react-core@0.16.0 - - @siafoundation/sia-central@0.2.0 - -## 0.0.3 - -### Patch Changes - -- Updated dependencies [1c376d0e] - - @siafoundation/sia-central@0.1.0 - -## 0.0.2 - -### Patch Changes - -- Updated dependencies [21972d75] - - @siafoundation/react-core@0.15.0 diff --git a/libs/sia-central-react/README.md b/libs/sia-central-react/README.md deleted file mode 100644 index e44b75510..000000000 --- a/libs/sia-central-react/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# sia-central-react - -React hooks for interacting with the Sia Central API. - -## Running unit tests - -Run `nx test sia-central-react` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/sia-central-react/jest.config.ts b/libs/sia-central-react/jest.config.ts deleted file mode 100644 index fc4b92594..000000000 --- a/libs/sia-central-react/jest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'sia-central-react', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': [ - 'babel-jest', - { - presets: ['@nx/next/babel'], - plugins: ['@babel/plugin-transform-private-methods'], - }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/sia-central-react', -} diff --git a/libs/sia-central-react/package.json b/libs/sia-central-react/package.json deleted file mode 100644 index 62b20a9da..000000000 --- a/libs/sia-central-react/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@siafoundation/sia-central-react", - "description": "React hooks for interacting with the Sia Central API.", - "version": "3.1.3", - "license": "MIT", - "dependencies": { - "@siafoundation/react-core": "^2.0.0", - "@siafoundation/sia-central-types": "0.2.0" - }, - "types": "./src/index.d.ts" -} diff --git a/libs/sia-central-react/project.json b/libs/sia-central-react/project.json deleted file mode 100644 index fcb49da56..000000000 --- a/libs/sia-central-react/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "sia-central-react", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/sia-central-react/src", - "projectType": "library", - "tags": [], - "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/sia-central-react", - "tsConfig": "libs/sia-central-react/tsconfig.lib.json", - "project": "libs/sia-central-react/package.json", - "entryFile": "libs/sia-central-react/src/index.ts", - "external": ["react/jsx-runtime"], - "compiler": "tsc", - "outputFileName": "index.js", - "rollupConfig": "libs/sia-central-react/rollup.config.js", - "assets": [ - { - "glob": "libs/sia-central-react/*.md", - "input": ".", - "output": "." - } - ] - }, - "configurations": {} - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/libs/sia-central-react"], - "options": { - "jestConfig": "libs/sia-central-react/jest.config.ts" - } - } - } -} diff --git a/libs/sia-central-react/rollup.config.js b/libs/sia-central-react/rollup.config.js deleted file mode 100644 index 3f5e4e997..000000000 --- a/libs/sia-central-react/rollup.config.js +++ /dev/null @@ -1,18 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const preserveDirectives = require('rollup-plugin-preserve-directives') - -// https://github.com/rollup/rollup/issues/4699#issuecomment-1465302665 -function getRollupOptions(options) { - return { - ...options, - output: { - ...options.output, - preserveModules: true, - format: 'esm', - sourcemap: true, - }, - plugins: options.plugins.concat(preserveDirectives.default()), - } -} - -module.exports = getRollupOptions diff --git a/libs/sia-central-react/src/index.ts b/libs/sia-central-react/src/index.ts deleted file mode 100644 index e5c4ea378..000000000 --- a/libs/sia-central-react/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export * from './useSiaCentralAddress' -export * from './useSiaCentralBlockLatest' -export * from './useSiaCentralBlock' -export * from './useSiaCentralBlocks' -export * from './useSiaCentralContract' -export * from './useSiaCentralHosts' -export * from './useSiaCentralHostsNetworkAverages' -export * from './useSiaCentralHostsNetworkMetrics' -export * from './useSiaCentralExchangeRates' -export * from './useSiaCentralTransaction' -export * from './useSiaCentralSearch' diff --git a/libs/sia-central-react/src/useSiaCentralAddress.tsx b/libs/sia-central-react/src/useSiaCentralAddress.tsx deleted file mode 100644 index 7bee3c15d..000000000 --- a/libs/sia-central-react/src/useSiaCentralAddress.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { - useAppSettings, - HookArgsSwr, - useGetSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralAddressParams, - SiaCentralAddressResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralAddress( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/wallet/addresses/:id', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralBlock.tsx b/libs/sia-central-react/src/useSiaCentralBlock.tsx deleted file mode 100644 index 28558bda2..000000000 --- a/libs/sia-central-react/src/useSiaCentralBlock.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { - useAppSettings, - HookArgsSwr, - useGetSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralBlockParams, - SiaCentralBlockResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralBlock( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/explorer/blocks/:id', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralBlockLatest.tsx b/libs/sia-central-react/src/useSiaCentralBlockLatest.tsx deleted file mode 100644 index 3557fd773..000000000 --- a/libs/sia-central-react/src/useSiaCentralBlockLatest.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { - useAppSettings, - HookArgsSwr, - useGetSwr, -} from '@siafoundation/react-core' -import { defaultApi, SiaCentralBlock } from '@siafoundation/sia-central-types' - -type SiaCentralBlockLatestResponse = { - message: string - block: Omit -} - -export function useSiaCentralBlockLatest( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/explorer/blocks', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralBlocks.tsx b/libs/sia-central-react/src/useSiaCentralBlocks.tsx deleted file mode 100644 index 1e4db9e35..000000000 --- a/libs/sia-central-react/src/useSiaCentralBlocks.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { - useAppSettings, - usePostSwr, - HookArgsWithPayloadSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralBlock, - SiaCentralBlocksPayload, -} from '@siafoundation/sia-central-types' - -type SiaCentralBlocksResposne = { - message: string - blocks: SiaCentralBlock[] -} - -export function useSiaCentralBlocks( - args: HookArgsWithPayloadSwr< - void, - SiaCentralBlocksPayload, - SiaCentralBlocksResposne - > -) { - const { settings } = useAppSettings() - return usePostSwr({ - api: defaultApi, - ...args, - route: '/explorer/blocks', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralContract.tsx b/libs/sia-central-react/src/useSiaCentralContract.tsx deleted file mode 100644 index a59cac1c3..000000000 --- a/libs/sia-central-react/src/useSiaCentralContract.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralContractParams, - SiaCentralContractResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralContract( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/explorer/contracts/:id', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralExchangeRates.tsx b/libs/sia-central-react/src/useSiaCentralExchangeRates.tsx deleted file mode 100644 index ff873f82f..000000000 --- a/libs/sia-central-react/src/useSiaCentralExchangeRates.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralExchangeRatesResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralExchangeRates( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/market/exchange-rate?currencies=sc', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralHost.tsx b/libs/sia-central-react/src/useSiaCentralHost.tsx deleted file mode 100644 index 9baddbec5..000000000 --- a/libs/sia-central-react/src/useSiaCentralHost.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - SiaCentralHostResponse, - SiaCentralHostParams, - defaultApi, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralHost( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/hosts/:id', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralHosts.tsx b/libs/sia-central-react/src/useSiaCentralHosts.tsx deleted file mode 100644 index 10c0580da..000000000 --- a/libs/sia-central-react/src/useSiaCentralHosts.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - SiaCentralHostsResponse, - defaultApi, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralHosts( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: - '/hosts/list?showinactive=false&sort=download_speed&dir=desc&protocol=rhp3&page=0&limit=1000', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralHostsNetworkAverages.tsx b/libs/sia-central-react/src/useSiaCentralHostsNetworkAverages.tsx deleted file mode 100644 index f5cbd6522..000000000 --- a/libs/sia-central-react/src/useSiaCentralHostsNetworkAverages.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralHostsNetworkAveragesResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralHostsNetworkAverages( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/hosts/network/averages', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralHostsNetworkMetrics.tsx b/libs/sia-central-react/src/useSiaCentralHostsNetworkMetrics.tsx deleted file mode 100644 index 48e61b00e..000000000 --- a/libs/sia-central-react/src/useSiaCentralHostsNetworkMetrics.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralHostsNetworkMetricsResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralHostsNetworkMetrics( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/hosts/network/metrics', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralSearch.tsx b/libs/sia-central-react/src/useSiaCentralSearch.tsx deleted file mode 100644 index e8f03489c..000000000 --- a/libs/sia-central-react/src/useSiaCentralSearch.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - useAppSettings, - useGetFunc, - HookArgsCallback, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralSearchParams, - SiaCentralSearchResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralSearch( - args?: HookArgsCallback< - SiaCentralSearchParams, - void, - SiaCentralSearchResponse - > -) { - const { settings } = useAppSettings() - return useGetFunc({ - api: defaultApi, - ...args, - route: '/explorer/search/:query', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/src/useSiaCentralTransaction.tsx b/libs/sia-central-react/src/useSiaCentralTransaction.tsx deleted file mode 100644 index 34b9aff0e..000000000 --- a/libs/sia-central-react/src/useSiaCentralTransaction.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { - useGetSwr, - useAppSettings, - HookArgsSwr, -} from '@siafoundation/react-core' -import { - defaultApi, - SiaCentralTransactionParams, - SiaCentralTransactionResponse, -} from '@siafoundation/sia-central-types' - -export function useSiaCentralTransaction( - args?: HookArgsSwr -) { - const { settings } = useAppSettings() - return useGetSwr({ - api: defaultApi, - ...args, - route: '/explorer/transactions/:id', - disabled: args?.disabled || !settings.siaCentral, - }) -} diff --git a/libs/sia-central-react/tsconfig.json b/libs/sia-central-react/tsconfig.json deleted file mode 100644 index 4c089585e..000000000 --- a/libs/sia-central-react/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/sia-central-react/tsconfig.lib.json b/libs/sia-central-react/tsconfig.lib.json deleted file mode 100644 index d73537814..000000000 --- a/libs/sia-central-react/tsconfig.lib.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": [ - "node", - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/libs/sia-central-react/tsconfig.spec.json b/libs/sia-central-react/tsconfig.spec.json deleted file mode 100644 index 503e9a83d..000000000 --- a/libs/sia-central-react/tsconfig.spec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/libs/sia-central-types/.babelrc b/libs/sia-central-types/.babelrc deleted file mode 100644 index 1ea870ead..000000000 --- a/libs/sia-central-types/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic", - "useBuiltIns": "usage" - } - ] - ], - "plugins": [] -} diff --git a/libs/sia-central-types/.eslintrc.json b/libs/sia-central-types/.eslintrc.json deleted file mode 100644 index 54f8472e1..000000000 --- a/libs/sia-central-types/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": ["libs/sia-central-types/rollup.config.js"] - } - ] - }, - "overrides": [ - { - "files": ["*.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": "error" - } - } - ] -} diff --git a/libs/sia-central-types/CHANGELOG.md b/libs/sia-central-types/CHANGELOG.md deleted file mode 100644 index da56ce2d7..000000000 --- a/libs/sia-central-types/CHANGELOG.md +++ /dev/null @@ -1,19 +0,0 @@ -# @siafoundation/sia-central-types - -## 0.2.0 - -### Minor Changes - -- 0d7fdf2e: Removed unsupported currencies from Sia Central SDKs. - -## 0.1.1 - -### Patch Changes - -- Update dependencies. - -## 0.1.0 - -### Minor Changes - -- a12625e7: Introduced new library for sia central types. diff --git a/libs/sia-central-types/README.md b/libs/sia-central-types/README.md deleted file mode 100644 index 71c8af024..000000000 --- a/libs/sia-central-types/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# sia-central-types - -Types for the Sia Central API. diff --git a/libs/sia-central-types/jest.config.ts b/libs/sia-central-types/jest.config.ts deleted file mode 100644 index 0656a1299..000000000 --- a/libs/sia-central-types/jest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'sia-central-types', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': [ - 'babel-jest', - { - presets: ['@nx/next/babel'], - plugins: ['@babel/plugin-transform-private-methods'], - }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/sia-central-types', -} diff --git a/libs/sia-central-types/package.json b/libs/sia-central-types/package.json deleted file mode 100644 index 5188ec519..000000000 --- a/libs/sia-central-types/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@siafoundation/sia-central-types", - "description": "Types for the Sia Central API.", - "version": "0.2.0", - "license": "MIT", - "dependencies": {}, - "types": "./src/index.d.ts" -} diff --git a/libs/sia-central-types/project.json b/libs/sia-central-types/project.json deleted file mode 100644 index f9a9886b9..000000000 --- a/libs/sia-central-types/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "sia-central-types", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/sia-central-types/src", - "projectType": "library", - "tags": [], - "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/sia-central-types", - "tsConfig": "libs/sia-central-types/tsconfig.lib.json", - "project": "libs/sia-central-types/package.json", - "entryFile": "libs/sia-central-types/src/index.ts", - "external": ["react/jsx-runtime"], - "compiler": "tsc", - "outputFileName": "index.js", - "rollupConfig": "libs/sia-central-types/rollup.config.js", - "assets": [ - { - "glob": "libs/sia-central-types/*.md", - "input": ".", - "output": "." - } - ] - }, - "configurations": {} - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/libs/sia-central-types"], - "options": { - "jestConfig": "libs/sia-central-types/jest.config.ts" - } - } - } -} diff --git a/libs/sia-central-types/rollup.config.js b/libs/sia-central-types/rollup.config.js deleted file mode 100644 index 3f5e4e997..000000000 --- a/libs/sia-central-types/rollup.config.js +++ /dev/null @@ -1,18 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const preserveDirectives = require('rollup-plugin-preserve-directives') - -// https://github.com/rollup/rollup/issues/4699#issuecomment-1465302665 -function getRollupOptions(options) { - return { - ...options, - output: { - ...options.output, - preserveModules: true, - format: 'esm', - sourcemap: true, - }, - plugins: options.plugins.concat(preserveDirectives.default()), - } -} - -module.exports = getRollupOptions diff --git a/libs/sia-central-types/src/address.ts b/libs/sia-central-types/src/address.ts deleted file mode 100644 index 9735850fa..000000000 --- a/libs/sia-central-types/src/address.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { SiaCentralSiafundOutput, SiaCentralTransaction } from './types' - -export type SiaCentralAddressParams = { - id: string -} -export type SiaCentralAddressPayload = void -export type SiaCentralAddressResponse = { - message: 'successfully got transactions' - type: 'success' - transactions?: SiaCentralTransaction[] - unconfirmed_transactions?: SiaCentralTransaction[] - unspent_siacoins: string - unspent_siafunds: string - unspent_siacoin_outputs?: { - output_id: string - unlock_hash: string - source: string - maturity_height: number - block_height: number - value: string - }[] - unspent_siafund_outputs?: SiaCentralSiafundOutput[] -} diff --git a/libs/sia-central-types/src/block.ts b/libs/sia-central-types/src/block.ts deleted file mode 100644 index d81ebb66a..000000000 --- a/libs/sia-central-types/src/block.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { SiaCentralBlock } from './types' - -export type SiaCentralBlockParams = { - id: string -} -export type SiaCentralBlockPayload = void -export type SiaCentralBlockResponse = { - message: string - block: SiaCentralBlock -} diff --git a/libs/sia-central-types/src/blockLatest.ts b/libs/sia-central-types/src/blockLatest.ts deleted file mode 100644 index 27a164ab0..000000000 --- a/libs/sia-central-types/src/blockLatest.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { SiaCentralBlock } from './types' - -export type SiaCentralBlockLatestParams = void -export type SiaCentralBlockLatestPayload = void -export type SiaCentralBlockLatestResponse = { - message: string - type: string - block?: Omit -} diff --git a/libs/sia-central-types/src/blocks.ts b/libs/sia-central-types/src/blocks.ts deleted file mode 100644 index 63d6aea2f..000000000 --- a/libs/sia-central-types/src/blocks.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SiaCentralBlock } from './types' - -export type SiaCentralBlocksParams = void -export type SiaCentralBlocksResponse = { - message: string - blocks: SiaCentralBlock[] -} -export type SiaCentralBlocksPayload = { - block_ids?: number[] - heights?: number[] -} diff --git a/libs/sia-central-types/src/config.ts b/libs/sia-central-types/src/config.ts deleted file mode 100644 index a3528c8b0..000000000 --- a/libs/sia-central-types/src/config.ts +++ /dev/null @@ -1 +0,0 @@ -export const defaultApi = 'https://api.siacentral.com/v2' diff --git a/libs/sia-central-types/src/contract.ts b/libs/sia-central-types/src/contract.ts deleted file mode 100644 index 616439251..000000000 --- a/libs/sia-central-types/src/contract.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { SiaCentralContract } from './types' - -export type SiaCentralContractParams = { - id: string -} -export type SiaCentralContractPayload = void -export type SiaCentralContractResponse = { - message: string - contract: SiaCentralContract -} diff --git a/libs/sia-central-types/src/exchangeRates.ts b/libs/sia-central-types/src/exchangeRates.ts deleted file mode 100644 index 89c261809..000000000 --- a/libs/sia-central-types/src/exchangeRates.ts +++ /dev/null @@ -1,29 +0,0 @@ -export type SiaCentralExchangeRates = { - sc: { - bch: string - btc: string - cad: string - cny: string - eth: string - eur: string - aud: string - gbp: string - jpy: string - ltc: string - rub: string - usd: string - } -} - -export type SiaCentralCurrency = keyof SiaCentralExchangeRates['sc'] - -export type SiaCentralExchangeRatesParams = { - currencies?: string -} -export type SiaCentralExchangeRatesPayload = void -export type SiaCentralExchangeRatesResponse = { - message: string - type: string - rates: SiaCentralExchangeRates - timestamp: string -} diff --git a/libs/sia-central-types/src/host.ts b/libs/sia-central-types/src/host.ts deleted file mode 100644 index 841a7e10f..000000000 --- a/libs/sia-central-types/src/host.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SiaCentralHost } from './types' - -export type SiaCentralHostParams = { - id: string -} -export type SiaCentralHostPayload = void -export type SiaCentralHostResponse = { - message: string - type: string - host: SiaCentralHost -} diff --git a/libs/sia-central-types/src/hosts.ts b/libs/sia-central-types/src/hosts.ts deleted file mode 100644 index e5e7c3aa2..000000000 --- a/libs/sia-central-types/src/hosts.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { SiaCentralHost } from './types' - -export type SiaCentralHostsParams = { - limit?: number - page?: number - showinactive?: boolean - sort?: string - dir?: 'asc' | 'desc' - protocol?: string -} -export type SiaCentralHostsPayload = void -export type SiaCentralHostsResponse = { - message: string - count: number - total: number - type: string - hosts: SiaCentralHost[] -} diff --git a/libs/sia-central-types/src/hostsNetworkAverages.ts b/libs/sia-central-types/src/hostsNetworkAverages.ts deleted file mode 100644 index 423e47a96..000000000 --- a/libs/sia-central-types/src/hostsNetworkAverages.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { SiaCentralNetworkStats } from './types' - -export type SiaCentralHostsNetworkAveragesParams = void -export type SiaCentralHostsNetworkAveragesPayload = void -export type SiaCentralHostsNetworkAveragesResponse = { - message: string - type: string -} & SiaCentralNetworkStats diff --git a/libs/sia-central-types/src/hostsNetworkMetrics.ts b/libs/sia-central-types/src/hostsNetworkMetrics.ts deleted file mode 100644 index 54348a6f4..000000000 --- a/libs/sia-central-types/src/hostsNetworkMetrics.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { SiaCentralNetworkStats } from './types' - -export type SiaCentralHostsNetworkMetricsParams = void -export type SiaCentralHostsNetworkMetricsPayload = void -export type SiaCentralHostsNetworkMetricsResponse = { - message: string - type: string - average: SiaCentralNetworkStats - top: SiaCentralNetworkStats - bottom: SiaCentralNetworkStats - totals: { - remaining_registry_entries: number - total_registry_entries: number - remaining_storage: number - total_storage: number - active_hosts: number - total_hosts: number - } -} diff --git a/libs/sia-central-types/src/index.ts b/libs/sia-central-types/src/index.ts deleted file mode 100644 index 7b55efa41..000000000 --- a/libs/sia-central-types/src/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export * from './types' -export * from './config' -export * from './address' -export * from './blockLatest' -export * from './block' -export * from './blocks' -export * from './contract' -export * from './host' -export * from './hosts' -export * from './hostsNetworkAverages' -export * from './hostsNetworkMetrics' -export * from './exchangeRates' -export * from './transaction' -export * from './search' diff --git a/libs/sia-central-types/src/search.ts b/libs/sia-central-types/src/search.ts deleted file mode 100644 index 7adf0d6a9..000000000 --- a/libs/sia-central-types/src/search.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { - SiaCentralBlock, - SiaCentralContract, - SiaCentralHost, - SiaCentralTransaction, - SiaCentralUnlockHash, -} from './types' - -export type SiaCentralSearchParams = { - query: string -} -export type SiaCentralSearchPayload = void -export type SiaCentralSearchResponse = { - message: string - blocks?: SiaCentralBlock[] - contracts?: SiaCentralContract[] - transactions?: SiaCentralTransaction[] - hosts?: SiaCentralHost[] - unlock_hashes?: SiaCentralUnlockHash[] -} diff --git a/libs/sia-central-types/src/transaction.ts b/libs/sia-central-types/src/transaction.ts deleted file mode 100644 index 9af9415d8..000000000 --- a/libs/sia-central-types/src/transaction.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SiaCentralTransaction } from './types' - -export type SiaCentralTransactionParams = { - id: string -} -export type SiaCentralTransactionPayload = void -export type SiaCentralTransactionResponse = { - message: string - type?: 'error' - transaction: SiaCentralTransaction -} diff --git a/libs/sia-central-types/src/types.ts b/libs/sia-central-types/src/types.ts deleted file mode 100644 index 3d8387f55..000000000 --- a/libs/sia-central-types/src/types.ts +++ /dev/null @@ -1,328 +0,0 @@ -export type SiaCentralNetworkStats = { - settings: { - max_download_batch_size: number - max_duration: number - max_revise_batch_size: number - remaining_storage: number - sector_size: number - total_storage: number - window_size: number - revision_number: number - base_rpc_price: string - collateral: string - max_collateral: string - contract_price: string - download_price: string - sector_access_price: string - storage_price: string - upload_price: string - } - price_table: { - uid: string - validity: number - hostblockheight: number - updatepricetablecost: string - accountbalancecost: string - fundaccountcost: string - latestrevisioncost: string - subscriptionmemorycost: string - subscriptionnotificationcost: string - initbasecost: string - memorytimecost: string - downloadbandwidthcost: string - uploadbandwidthcost: string - dropsectorsbasecost: string - dropsectorsunitcost: string - hassectorbasecost: string - readbasecost: string - readlengthcost: string - renewcontractcost: string - revisionbasecost: string - swapsectorcost: string - writebasecost: string - writelengthcost: string - writestorecost: string - txnfeeminrecommended: string - txnfeemaxrecommended: string - contractprice: string - collateralcost: string - maxcollateral: string - maxduration: number - windowsize: number - registryentriesleft: number - registryentriestotal: number - } - benchmarks: { - contract_time: number - upload_time: number - download_time: number - data_size: number - } - benchmarks_rhp2?: { - contract_time: number - upload_time: number - download_time: number - data_size: number - } -} - -export type SiaCentralHostSettings = { - netaddress: string - version: string - accepting_contracts: boolean - max_download_batch_size: number - max_duration: number - max_revise_batch_size: number - remaining_storage: number - sector_size: number - total_storage: number - window_size: number - revision_number: number - base_rpc_price: string - collateral: string - max_collateral: string - contract_price: string - download_price: string - sector_access_price: string - storage_price: string - upload_price: string - ephemeral_account_expiry: number - max_ephemeral_account_balance: string - sia_mux_port: string -} - -export type SiaCentralHostPriceTable = { - uid: string - validity: number - hostblockheight: number - updatepricetablecost: string - accountbalancecost: string - fundaccountcost: string - latestrevisioncost: string - subscriptionmemorycost: string - subscriptionnotificationcost: string - initbasecost: string - memorytimecost: string - downloadbandwidthcost: string - uploadbandwidthcost: string - dropsectorsbasecost: string - dropsectorsunitcost: string - hassectorbasecost: string - readbasecost: string - readlengthcost: string - renewcontractcost: string - revisionbasecost: string - swapsectorcost: string - writebasecost: string - writelengthcost: string - writestorecost: string - txnfeeminrecommended: string - txnfeemaxrecommended: string - contractprice: string - collateralcost: string - maxcollateral: string - maxduration: number - windowsize: number - registryentriesleft: number - registryentriestotal: number -} - -export type SiaCentralHostBenchmark = { - contract_time: number - upload_time: number - download_time: number - data_size: number - last_attempt: string - last_successful: string - error?: string -} - -export type SiaCentralHost = { - net_address: string - public_key: string - version: string - estimated_uptime: number - online: boolean - first_seen_height: number - first_seen_timestamp: string - last_scan: string - last_success_scan: string - country_code: string - location: [number, number] - settings?: SiaCentralHostSettings - price_table?: SiaCentralHostPriceTable - benchmark?: SiaCentralHostBenchmark -} - -export type SiaCentralContract = { - id: string - transaction_id: string - merkle_root: string - unlock_hash: string - status: string - revision_number: number - negotiation_height: number - expiration_height: number - proof_deadline: number - proof_height: number - expiration_exchange_rate: { - currency: string - rate: string - } - payout: string - file_size: string - valid_proof_outputs: SiaCentralPartialSiacoinOutput[] - missed_proof_outputs: SiaCentralPartialSiacoinOutput[] - negotiation_timestamp: string - expiration_timestamp: string - proof_deadline_timestamp: string - proof_timestamp: string - proof_confirmed: boolean - payout_height: number - payout_timestamp: string - unused: boolean - previous_revisions: SiaCentralContract[] -} - -export type SiaCentralSiacoinInput = { - output_id: string - transaction_id: string - block_id: string - unlock_hash: string - block_height: number - source: string - value: string - unlock_conditions: { - timelock: number - required_signatures: number - public_keys: string[] - } -} - -export type SiaCentralPartialSiacoinOutput = { - output_id: string - source: string - unlock_hash: string - value: string -} - -export type SiaCentralSiacoinOutput = { - output_id: string - transaction_id: string - block_id: string - spent_transaction_id: string - unlock_hash: string - maturity_height: number - block_height: number - source: string - value: string -} - -export type SiaCentralSiafundInput = { - output_id: string - transaction_id: string - unlock_hash: string - block_height: number - value: string - claim_unlock_hash: string - claim_output_id: string - claim_value: string - unlock_conditions: { - timelock: number - required_signatures: number - public_keys: string[] - } -} - -export type SiaCentralSiafundOutput = { - output_id: string - transaction_id: string - block_id: string - spent_transaction_id?: string - unlock_hash: string - block_height: number - value: string - claim_start: string - claim_value: string -} - -export type SiaCentralTransactionSignature = { - parent_id: string - transaction_id: string - block_id: string - signature: string - public_key_index: 0 - covered_fields: { - whole_transaction: false - siacoin_inputs: number[] - siacoin_outputs: number[] - storage_contracts: number[] - storage_contract_revisions: number[] - storage_proofs: number[] - miner_fees: number[] - arbitrary_data: number[] - transaction_signatures: number[] - } -} - -export type SiaCentralStorageProof = { - contract_id: string - transaction_id: string - block_id: string - block_height: number - segment: number[] - hashset: string[] - timestamp: string -} - -export type SiaCentralHostAnnouncement = { - transaction_id: string - block_id: string - public_key: string - net_address: string - block_height: number - timestamp: string -} - -export type SiaCentralTransaction = { - id: string - block_id: string - block_height: number - confirmations: number - block_index: number - timestamp: string - size: string - fees: string - siacoin_inputs?: SiaCentralSiacoinInput[] - siacoin_outputs?: SiaCentralSiacoinOutput[] - siafund_inputs?: SiaCentralSiafundInput[] - siafund_outputs?: SiaCentralSiafundOutput[] - storage_contracts?: SiaCentralContract[] - contract_revisions?: SiaCentralContract[] - storage_proofs?: SiaCentralStorageProof[] - miner_fees: string[] - host_announcements?: SiaCentralHostAnnouncement[] - arbitrary_data: string[] - transaction_signatures: SiaCentralTransactionSignature[] - exchange_rate: { - currency: string - rate: string - } -} - -export type SiaCentralBlock = { - id: string - parent_id: string - height: number - nonce: number[] - size: string - transactions?: SiaCentralTransaction[] - siacoin_outputs?: SiaCentralSiacoinOutput[] - siafund_pool: string - timestamp: string -} - -export type SiaCentralUnlockHash = { - address: string - usage_type: string -} diff --git a/libs/sia-central-types/tsconfig.json b/libs/sia-central-types/tsconfig.json deleted file mode 100644 index 4c089585e..000000000 --- a/libs/sia-central-types/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/sia-central-types/tsconfig.lib.json b/libs/sia-central-types/tsconfig.lib.json deleted file mode 100644 index d73537814..000000000 --- a/libs/sia-central-types/tsconfig.lib.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": [ - "node", - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/libs/sia-central-types/tsconfig.spec.json b/libs/sia-central-types/tsconfig.spec.json deleted file mode 100644 index 503e9a83d..000000000 --- a/libs/sia-central-types/tsconfig.spec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/libs/walletd-mock/.babelrc b/libs/walletd-mock/.babelrc deleted file mode 100644 index 1ea870ead..000000000 --- a/libs/walletd-mock/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@nx/react/babel", - { - "runtime": "automatic", - "useBuiltIns": "usage" - } - ] - ], - "plugins": [] -} diff --git a/libs/walletd-mock/.eslintrc.json b/libs/walletd-mock/.eslintrc.json deleted file mode 100644 index 326c35b39..000000000 --- a/libs/walletd-mock/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": ["plugin:@nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": ["libs/walletd-mock/rollup.config.js"] - } - ] - }, - "overrides": [ - { - "files": ["*.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": "error" - } - } - ] -} diff --git a/libs/walletd-mock/CHANGELOG.md b/libs/walletd-mock/CHANGELOG.md deleted file mode 100644 index 7afb94d28..000000000 --- a/libs/walletd-mock/CHANGELOG.md +++ /dev/null @@ -1,149 +0,0 @@ -# @siafoundation/walletd-mock - -## 0.1.14 - -### Patch Changes - -- Updated dependencies [ef647e54] -- Updated dependencies [54570123] -- Updated dependencies [54570123] -- Updated dependencies [54570123] -- Updated dependencies [54570123] -- Updated dependencies [97727dac] - - @siafoundation/types@0.8.0 - - @siafoundation/walletd-types@0.6.0 - - @siafoundation/units@3.3.2 - -## 0.1.13 - -### Patch Changes - -- Updated dependencies [0d7fdf2e] - - @siafoundation/sia-central-mock@0.3.0 - - @siafoundation/units@3.3.1 - -## 0.1.12 - -### Patch Changes - -- Updated dependencies [b04c20e4] - - @siafoundation/units@3.3.0 - -## 0.1.11 - -### Patch Changes - -- Updated dependencies [36b55f89] - - @siafoundation/types@0.7.0 - - @siafoundation/units@3.2.1 - - @siafoundation/walletd-types@0.5.1 - -## 0.1.10 - -### Patch Changes - -- Updated dependencies [d794e604] - - @siafoundation/walletd-types@0.5.0 - -## 0.1.9 - -### Patch Changes - -- Updated dependencies [5c0df06e] -- Updated dependencies [5f34c9a6] -- Updated dependencies [8be86046] -- Updated dependencies [d5dc0f86] - - @siafoundation/units@3.2.0 - - @siafoundation/sia-central-mock@0.2.0 - -## 0.1.8 - -### Patch Changes - -- Updated dependencies [04b45f7d] - - @siafoundation/types@0.6.0 - - @siafoundation/units@3.1.1 - - @siafoundation/walletd-types@0.4.1 - -## 0.1.7 - -### Patch Changes - -- Updated dependencies [a64f40cc] -- Updated dependencies [a6c956ea] -- Updated dependencies [a64f40cc] -- Updated dependencies [a64f40cc] - - @siafoundation/types@0.5.0 - - @siafoundation/walletd-types@0.4.0 - - @siafoundation/units@3.1.0 - -## 0.1.6 - -### Patch Changes - -- Updated dependencies [24b47560] -- Updated dependencies [3fdf6655] - - @siafoundation/types@0.4.0 - - @siafoundation/units@3.0.3 - - @siafoundation/walletd-types@0.3.2 - -## 0.1.5 - -### Patch Changes - -- Updated dependencies [4806f299] - - @siafoundation/walletd-types@0.3.1 - -## 0.1.4 - -### Patch Changes - -- Updated dependencies [fff7febd] -- Updated dependencies [fff7febd] - - @siafoundation/types@0.3.0 - - @siafoundation/walletd-types@0.3.0 - -## 0.1.3 - -### Patch Changes - -- Updated dependencies [0e393885] - - @siafoundation/walletd-types@0.2.0 - -## 0.1.2 - -### Patch Changes - -- Updated dependencies - - @siafoundation/sia-central-mock@0.1.1 - - @siafoundation/units@3.0.2 - -## 0.1.1 - -### Patch Changes - -- Updated dependencies [8769bf7a] - - @siafoundation/walletd-types@0.1.1 - -## 0.1.0 - -### Minor Changes - -- 1b1952e5: Libraries now follow new naming scheme. - -### Patch Changes - -- Updated dependencies [1b1952e5] -- Updated dependencies [0456e4b0] - - @siafoundation/sia-central-mock@0.1.0 - - @siafoundation/walletd-types@0.1.0 - - @siafoundation/units@3.0.1 - -## 0.0.1 - -### Patch Changes - -- Updated dependencies [e2b8f950] -- Updated dependencies [e2b8f950] - - @siafoundation/types@0.2.0 - - @siafoundation/walletd-react@4.0.0 diff --git a/libs/walletd-mock/README.md b/libs/walletd-mock/README.md deleted file mode 100644 index 0c5f14eee..000000000 --- a/libs/walletd-mock/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# walletd-mock - -`walletd` data and API mock library for testing. diff --git a/libs/walletd-mock/jest.config.ts b/libs/walletd-mock/jest.config.ts deleted file mode 100644 index 9eddec3a8..000000000 --- a/libs/walletd-mock/jest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'walletd-mock', - preset: '../../jest.preset.js', - transform: { - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', - '^.+\\.[tj]sx?$': [ - 'babel-jest', - { - presets: ['@nx/next/babel'], - plugins: ['@babel/plugin-transform-private-methods'], - }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/walletd-mock', -} diff --git a/libs/walletd-mock/package.json b/libs/walletd-mock/package.json deleted file mode 100644 index 65b5990d6..000000000 --- a/libs/walletd-mock/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@siafoundation/walletd-mock", - "description": "walletd data and API mock library for testing.", - "version": "0.1.14", - "license": "MIT", - "dependencies": { - "@siafoundation/types": "0.8.0", - "@siafoundation/sia-central-mock": "0.3.0", - "@siafoundation/units": "3.3.2", - "playwright": "^1.49.1", - "@siafoundation/walletd-types": "0.6.0" - }, - "types": "./src/index.d.ts" -} diff --git a/libs/walletd-mock/project.json b/libs/walletd-mock/project.json deleted file mode 100644 index 9e4eac655..000000000 --- a/libs/walletd-mock/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "walletd-mock", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/walletd-mock/src", - "projectType": "library", - "tags": [], - "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/walletd-mock", - "tsConfig": "libs/walletd-mock/tsconfig.lib.json", - "project": "libs/walletd-mock/package.json", - "entryFile": "libs/walletd-mock/src/index.ts", - "external": ["react/jsx-runtime"], - "compiler": "tsc", - "outputFileName": "index.js", - "rollupConfig": "libs/walletd-mock/rollup.config.js", - "assets": [ - { - "glob": "libs/walletd-mock/*.md", - "input": ".", - "output": "." - } - ] - }, - "configurations": {} - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/libs/walletd-mock"], - "options": { - "jestConfig": "libs/walletd-mock/jest.config.ts" - } - } - } -} diff --git a/libs/walletd-mock/rollup.config.js b/libs/walletd-mock/rollup.config.js deleted file mode 100644 index 3f5e4e997..000000000 --- a/libs/walletd-mock/rollup.config.js +++ /dev/null @@ -1,18 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const preserveDirectives = require('rollup-plugin-preserve-directives') - -// https://github.com/rollup/rollup/issues/4699#issuecomment-1465302665 -function getRollupOptions(options) { - return { - ...options, - output: { - ...options.output, - preserveModules: true, - format: 'esm', - sourcemap: true, - }, - plugins: options.plugins.concat(preserveDirectives.default()), - } -} - -module.exports = getRollupOptions diff --git a/libs/walletd-mock/src/index.ts b/libs/walletd-mock/src/index.ts deleted file mode 100644 index 3b1d3542e..000000000 --- a/libs/walletd-mock/src/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -export * from './mocks/consensusNetwork' -export * from './mocks/consensusTip' -export * from './mocks/consensusTipState' -export * from './mocks/defaults' -export * from './mocks/peers' -export * from './mocks/txPoolBroadcast' -export * from './mocks/rescan' -export * from './mocks/wallet' -export * from './mocks/walletAddresses' -export * from './mocks/walletBalance' -export * from './mocks/walletEvents' -export * from './mocks/walletFundSiacoin' -export * from './mocks/walletOutputsSiacoin' -export * from './mocks/walletOutputsSiafund' -export * from './mocks/walletRelease' -export * from './mocks/wallets' -export * from './mocks/walletEventsUnconfirmed' - -export * from './scenarios/seedWallet' diff --git a/libs/walletd-mock/src/mocks/consensusNetwork.ts b/libs/walletd-mock/src/mocks/consensusNetwork.ts deleted file mode 100644 index 0e6071db3..000000000 --- a/libs/walletd-mock/src/mocks/consensusNetwork.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ConsensusNetwork } from '@siafoundation/types' -import { Page } from 'playwright' - -export function getMockConsensusNetworkResponse(): ConsensusNetwork { - return { - name: 'zen', - initialCoinbase: '300000000000000000000000000000', - minimumCoinbase: '300000000000000000000000000000', - initialTarget: - '0000000100000000000000000000000000000000000000000000000000000000', - hardforkDevAddr: { - height: 1, - oldAddress: - '000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69', - newAddress: - '000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69', - }, - hardforkTax: { - height: 2, - }, - hardforkStorageProof: { - height: 5, - }, - hardforkOak: { - height: 10, - fixHeight: 12, - genesisTimestamp: '2023-01-13T03:53:20-05:00', - }, - hardforkASIC: { - height: 20, - oakTime: 10000000000000, - oakTarget: - '0000000100000000000000000000000000000000000000000000000000000000', - }, - hardforkFoundation: { - height: 30, - primaryAddress: - '053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807', - failsafeAddress: - '000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69', - }, - hardforkV2: { - allowHeight: 100000, - requireHeight: 102000, - }, - } -} - -export async function mockApiConsensusNetwork({ page }: { page: Page }) { - const json = getMockConsensusNetworkResponse() - await page.route('**/api/consensus/network*', async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/consensusTip.ts b/libs/walletd-mock/src/mocks/consensusTip.ts deleted file mode 100644 index 396bfec84..000000000 --- a/libs/walletd-mock/src/mocks/consensusTip.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ConsensusTipResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockConsensusTipResponse(): ConsensusTipResponse { - return { - height: 61676, - id: '00000010d5da9002b9640d920d9eb9f7502c5c3b2a796ecf800a103920bea96f', - } -} - -export async function mockApiConsensusTip({ page }: { page: Page }) { - const json = getMockConsensusTipResponse() - await page.route('**/api/consensus/tip*', async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/consensusTipState.ts b/libs/walletd-mock/src/mocks/consensusTipState.ts deleted file mode 100644 index 8f4ddd351..000000000 --- a/libs/walletd-mock/src/mocks/consensusTipState.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { ConsensusState } from '@siafoundation/types' -import { Page } from 'playwright' - -export function getMockConsensusTipStateResponse(): ConsensusState { - return { - index: { - height: 61676, - id: '00000010d5da9002b9640d920d9eb9f7502c5c3b2a796ecf800a103920bea96f', - }, - prevTimestamps: [ - // This timestamp being recent is used to represent a "synced" state - new Date().toISOString(), - '2024-03-25T17:33:24-04:00', - '2024-03-25T17:18:32-04:00', - '2024-03-25T17:07:59-04:00', - '2024-03-25T17:04:15-04:00', - '2024-03-25T16:50:56-04:00', - '2024-03-25T16:38:22-04:00', - '2024-03-25T16:38:12-04:00', - '2024-03-25T16:36:56-04:00', - '2024-03-25T16:35:17-04:00', - '2024-03-25T16:33:59-04:00', - '2024-03-25T16:31:16-04:00', - ], - depth: '000000000001aa096ddebfbf467c56faba46eb4b3e53e72c775bf9ab202a4890', - childTarget: - '0000005a6c49bca6186415827e15b13371c3de541dd64b7cf36a519b5128b2f8', - siafundPool: '88386728360671853873752300000', - oakTime: 127103000000000, - oakTarget: - '0000000024d11bd550a6acf3718192825fa2cef5582314db8e92c4f4e5efbf4c', - foundationPrimaryAddress: - '053b2def3cbdd078c19d62ce2b4f0b1a3c5e0ffbeeff01280efb1f8969b2f5bb4fdc680f0807', - foundationFailsafeAddress: - '000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69', - totalWork: '169134658088983', - difficulty: '47498615', - oakWork: '29864374508', - elements: { - numLeaves: 304383, - trees: [ - '6d5fedd2f6d71cad5fc7bb35ef8bad6631c63e1323142e2a4825314b77f87d1e', - '16e0c70194d2e41a21fe070ff936551b2379df8054890b95bada3c6b6a0ed3f7', - '73defbf6af352d9401698492c407662b8feb62ba82e92028bf9bf0103f261844', - 'e22d4da6204096eef1eb0fc217c8900dce1040312cc721b9b6b3fc2be7a77da8', - '4a9860d3e3ccf6cf434ed94d485b4385c62c443fd18e539998bd817a3ebed772', - '6cd1e1d71a0796980193bcbb1adff069ef3f70fd12749d9e877b2bd0c8d561d1', - '7aa0bdb94da13c43abd9446f77638d3e6e2ae4c36c5224a76433044c56db906c', - '66c119cf5cb9ca3a174637c751988f03300e0375b43d22c82df7145841515d38', - 'ce8a94296e60887232915d6801a9246827661d329de47a08f25a6a3884809037', - '8aa7872a63ef37e1ca8e4211700daf96068ce2cc215d4e2ab45434b5ffcab818', - '3f0175c94ed31190e6da23e80d6167e2da619b460e27798750491163dbe5677b', - '9f120f6489c3e3a324cd51a6f8f9dd033930688095f4440dc5f8511692b4efc1', - ], - }, - attestations: 0, - } -} - -export async function mockApiConsensusTipState({ page }: { page: Page }) { - const json = getMockConsensusTipStateResponse() - await page.route('**/api/consensus/tipstate*', async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/defaults.ts b/libs/walletd-mock/src/mocks/defaults.ts deleted file mode 100644 index f098c6172..000000000 --- a/libs/walletd-mock/src/mocks/defaults.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Page } from 'playwright' -import { mockApiSiaCentralExchangeRates } from '@siafoundation/sia-central-mock' -import { mockApiSyncerPeers } from './peers' -import { mockApiConsensusTip } from './consensusTip' -import { mockApiConsensusTipState } from './consensusTipState' -import { mockApiConsensusNetwork } from './consensusNetwork' -import { mockApiWallets } from './wallets' -import { mockApiTxPoolBroadcast } from './txPoolBroadcast' -import { mockApiWallet } from './wallet' -import { mockApiRescan } from './rescan' -import { RescanResponse } from '@siafoundation/walletd-types' -import { mockApiState } from './state' - -type Responses = { - rescan?: RescanResponse -} - -export async function mockApiDefaults({ - page, - responses, -}: { - page: Page - responses?: Responses -}) { - await mockApiState({ page }) - await mockApiSiaCentralExchangeRates({ page }) - await mockApiSyncerPeers({ page }) - await mockApiConsensusTip({ page }) - await mockApiConsensusTipState({ page }) - await mockApiConsensusNetwork({ page }) - await mockApiTxPoolBroadcast({ page }) - await mockApiRescan({ page, response: responses?.rescan }) - const wallets = await mockApiWallets({ page }) - for (const wallet of wallets) { - await mockApiWallet({ page, wallet }) - } -} diff --git a/libs/walletd-mock/src/mocks/peers.ts b/libs/walletd-mock/src/mocks/peers.ts deleted file mode 100644 index a7d0207ae..000000000 --- a/libs/walletd-mock/src/mocks/peers.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { SyncerPeersResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockPeersResponse(): SyncerPeersResponse { - return [ - { - address: '51.81.242.140:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T17:14:43Z', - connectedSince: '2024-03-25T21:08:49Z', - syncDuration: 1321006459, - }, - { - address: '3.36.68.121:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T13:39:10Z', - connectedSince: '2024-03-25T21:08:50Z', - syncDuration: 4230014834, - }, - { - address: '185.200.116.131:9807', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T17:14:43Z', - connectedSince: '2024-03-25T21:08:51Z', - syncedBlocks: 2, - syncDuration: 6018991169, - }, - { - address: '62.30.63.90:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T13:39:10Z', - connectedSince: '2024-03-25T21:09:07Z', - syncDuration: 6341708209, - }, - { - address: '43.203.121.70:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T17:14:44Z', - connectedSince: '2024-03-25T21:09:08Z', - syncedBlocks: 3, - syncDuration: 6860545337, - }, - { - address: '23.239.8.40:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T13:39:10Z', - connectedSince: '2024-03-25T21:09:08Z', - syncDuration: 580416082, - }, - { - address: '141.94.161.198:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T13:39:10Z', - connectedSince: '2024-03-25T21:09:13Z', - syncedBlocks: 93, - syncDuration: 4894896166, - }, - { - address: '64.227.180.244:9881', - inbound: false, - version: '1.5.4', - firstSeen: '2024-03-20T13:39:25Z', - connectedSince: '2024-03-25T21:08:49Z', - syncedBlocks: 2, - syncDuration: 4687705000, - }, - ] -} - -export async function mockApiSyncerPeers({ page }: { page: Page }) { - const json = getMockPeersResponse() - await page.route('**/api/syncer/peers*', async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/rescan.ts b/libs/walletd-mock/src/mocks/rescan.ts deleted file mode 100644 index 770dddfb4..000000000 --- a/libs/walletd-mock/src/mocks/rescan.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { RescanResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockRescanResponse(): RescanResponse { - return { - startIndex: { - height: 61676, - id: '00000010d5da9002b9640d920d9eb9f7502c5c3b2a796ecf800a103920bea96f', - }, - index: { - height: 61676, - id: '00000010d5da9002b9640d920d9eb9f7502c5c3b2a796ecf800a103920bea96f', - }, - startTime: new Date().toISOString(), - error: undefined, - } -} - -export async function mockApiRescan({ - page, - response, -}: { - page: Page - response?: RescanResponse -}) { - const json = response || getMockRescanResponse() - await page.route('**/api/rescan*', async (route) => { - if (route.request().method() === 'POST') { - await route.fulfill() - } else { - await route.fulfill({ json }) - } - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/state.ts b/libs/walletd-mock/src/mocks/state.ts deleted file mode 100644 index c3a333200..000000000 --- a/libs/walletd-mock/src/mocks/state.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { StateResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockState(): StateResponse { - return { - buildTime: '2023-01-01T00:00:00Z', - commit: 'commit', - os: 'os', - startTime: '2023-01-01T00:00:00Z', - version: 'version', - } -} - -export async function mockApiState({ page }: { page: Page }) { - const json = getMockState() - await page.route('**/api/state*', async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/txPoolBroadcast.ts b/libs/walletd-mock/src/mocks/txPoolBroadcast.ts deleted file mode 100644 index f514346a0..000000000 --- a/libs/walletd-mock/src/mocks/txPoolBroadcast.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Page } from 'playwright' - -export async function mockApiTxPoolBroadcast({ page }: { page: Page }) { - await page.route(`**/api/txpool/broadcast*`, async (route) => { - await route.fulfill() - }) -} diff --git a/libs/walletd-mock/src/mocks/wallet.ts b/libs/walletd-mock/src/mocks/wallet.ts deleted file mode 100644 index 2bcd150cb..000000000 --- a/libs/walletd-mock/src/mocks/wallet.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Page } from 'playwright' -import { - Wallet, - WalletAddressesResponse, - WalletBalanceResponse, - WalletFundSiacoinResponse, - WalletOutputsSiacoinResponse, -} from '@siafoundation/walletd-types' -import { mockApiWalletBalance } from './walletBalance' -import { mockApiWalletAddresses } from './walletAddresses' -import { mockApiWalletEvents } from './walletEvents' -import { mockApiWalletEventsUnconfirmed } from './walletEventsUnconfirmed' -import { mockApiWalletOutputsSiacoin } from './walletOutputsSiacoin' -import { mockApiWalletOutputsSiafund } from './walletOutputsSiafund' -import { mockApiWalletFundSiacoin } from './walletFundSiacoin' -import { mockApiWalletRelease } from './walletRelease' -import { mockApiWalletFundSiafund } from './walletFundSiafund' - -export async function mockApiWallet({ - page, - wallet, - responses = {}, - expects = {}, -}: { - page: Page - wallet: Wallet - responses?: { - balance?: WalletBalanceResponse - outputsSiacoin?: WalletOutputsSiacoinResponse - fundSiacoin?: WalletFundSiacoinResponse - addresses?: WalletAddressesResponse - } - expects?: { - fundSiacoinPost?: (data: string | null) => void - } -}) { - await mockApiWalletBalance({ - page, - walletId: wallet.id, - response: responses.balance, - }) - await mockApiWalletAddresses({ - page, - walletId: wallet.id, - response: responses.addresses, - }) - await mockApiWalletEvents({ page, walletId: wallet.id }) - await mockApiWalletEventsUnconfirmed({ page, walletId: wallet.id }) - await mockApiWalletOutputsSiacoin({ - page, - walletId: wallet.id, - response: responses.outputsSiacoin, - }) - await mockApiWalletOutputsSiafund({ page, walletId: wallet.id }) - await mockApiWalletFundSiafund({ - page, - walletId: wallet.id, - }) - await mockApiWalletFundSiacoin({ - page, - walletId: wallet.id, - response: responses.fundSiacoin, - expectPost: expects.fundSiacoinPost, - }) - await mockApiWalletRelease({ - page, - walletId: wallet.id, - }) -} diff --git a/libs/walletd-mock/src/mocks/walletAddresses.ts b/libs/walletd-mock/src/mocks/walletAddresses.ts deleted file mode 100644 index b42462264..000000000 --- a/libs/walletd-mock/src/mocks/walletAddresses.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { - WalletAddress, - WalletAddressesResponse, -} from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletAddressesResponse(): WalletAddressesResponse { - return [ - { - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - description: '', - spendPolicy: { - type: 'uc', - policy: { - signaturesRequired: 1, - timelock: 0, - publicKeys: [ - 'ed25519:ee122b2169bdae5776b55609e384e0c58372cd5c529d4edc9b9918b26f8e5535', - ], - }, - }, - metadata: { - index: 0, - }, - }, - { - address: - '90c6057cdd2463eca61f83796e83152dbba28b6cb9a74831a043833051ec9f422726bfff2ee8', - description: '', - spendPolicy: { - type: 'uc', - policy: { - signaturesRequired: 1, - timelock: 0, - publicKeys: [ - 'ed25519:624d6d477a8f4ceac873e6dd9138740f9322cb34a24246f96f9d64c021172f43', - ], - }, - }, - metadata: { - index: 1, - }, - }, - { - address: - '170173c40ca0f39f9618da30af14c390c7ce70248a3662a7a5d3d5a8a31c9fbfa2071e9f6518', - description: '', - spendPolicy: { - type: 'uc', - policy: { - signaturesRequired: 1, - timelock: 0, - publicKeys: [ - 'ed25519:65cac661a4acf36847c0aa67cbc6956e3449fd82a7430cfd673ea7fedbfcf5fa', - ], - }, - }, - metadata: { - index: 2, - }, - }, - ] -} - -export async function mockApiWalletAddresses({ - page, - walletId, - response, -}: { - page: Page - walletId: string - response?: WalletAddress[] -}) { - const json = response || getMockWalletAddressesResponse() - await page.route(`**/api/wallets/${walletId}/addresses*`, async (route) => { - if (route.request().method() === 'PUT') { - const data = route.request().postData() - if (data) { - json.push(JSON.parse(data)) - } - await route.fulfill({ json }) - } else { - await route.fulfill({ json }) - } - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletBalance.ts b/libs/walletd-mock/src/mocks/walletBalance.ts deleted file mode 100644 index b49827d00..000000000 --- a/libs/walletd-mock/src/mocks/walletBalance.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { WalletBalanceResponse } from '@siafoundation/walletd-types' -import { toHastings } from '@siafoundation/units' -import { Page } from 'playwright' - -export function getMockWalletBalanceResponse(): WalletBalanceResponse { - return { - siacoins: toHastings('100').toString(), - immatureSiacoins: toHastings('10').toString(), - siafunds: 10, - } -} - -export async function mockApiWalletBalance({ - page, - walletId, - response, -}: { - page: Page - walletId: string - response?: WalletBalanceResponse -}) { - const json = response || getMockWalletBalanceResponse() - await page.route(`**/api/wallets/${walletId}/balance*`, async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletEvents.ts b/libs/walletd-mock/src/mocks/walletEvents.ts deleted file mode 100644 index 7d3c445e6..000000000 --- a/libs/walletd-mock/src/mocks/walletEvents.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WalletEventsResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletEventsResponse(): WalletEventsResponse { - return [] -} - -export async function mockApiWalletEvents({ - page, - walletId, -}: { - page: Page - walletId: string -}) { - const json = getMockWalletEventsResponse() - await page.route(`**/api/wallets/${walletId}/events*`, async (route) => { - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletEventsUnconfirmed.ts b/libs/walletd-mock/src/mocks/walletEventsUnconfirmed.ts deleted file mode 100644 index aea8d1473..000000000 --- a/libs/walletd-mock/src/mocks/walletEventsUnconfirmed.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - WalletEventsUnconfirmedResponse, - walletsIdEventsUnconfirmedRoute, -} from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletEventsUnconfirmedResponse(): WalletEventsUnconfirmedResponse { - return [] -} - -export async function mockApiWalletEventsUnconfirmed({ - page, - walletId, -}: { - page: Page - walletId: string -}) { - const json = getMockWalletEventsUnconfirmedResponse() - await page.route( - `**/api${walletsIdEventsUnconfirmedRoute.replace(':id', walletId)}**`, - async (route) => { - await route.fulfill({ json }) - } - ) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletFundSiacoin.ts b/libs/walletd-mock/src/mocks/walletFundSiacoin.ts deleted file mode 100644 index ad3b5e43f..000000000 --- a/libs/walletd-mock/src/mocks/walletFundSiacoin.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { WalletFundSiacoinResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletFundSiacoinResponse(): WalletFundSiacoinResponse { - return { - basis: { - id: '0', - height: 100000, - }, - transaction: { - siacoinInputs: [ - { - parentID: - 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - unlockConditions: { - timelock: 0, - publicKeys: null, - signaturesRequired: 0, - }, - }, - { - parentID: - '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - unlockConditions: { - timelock: 0, - publicKeys: null, - signaturesRequired: 0, - }, - }, - ], - siacoinOutputs: [ - { - value: '1000000000000000000000000', - address: - '90c6057cdd2463eca61f83796e83152dbba28b6cb9a74831a043833051ec9f422726bfff2ee8', - }, - { - value: '97984280000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - ], - minerFees: ['3930000000000000000000'], - }, - toSign: [ - 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - ], - dependsOn: null, - } -} - -export async function mockApiWalletFundSiacoin({ - page, - walletId, - response, - expectPost, -}: { - page: Page - walletId: string - response?: WalletFundSiacoinResponse - expectPost?: (data: string | null) => void -}) { - const json = response || getMockWalletFundSiacoinResponse() - await page.route(`**/api/wallets/${walletId}/fund*`, async (route) => { - if (expectPost) { - expectPost(route.request().postData()) - } - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletFundSiafund.ts b/libs/walletd-mock/src/mocks/walletFundSiafund.ts deleted file mode 100644 index faa5434c7..000000000 --- a/libs/walletd-mock/src/mocks/walletFundSiafund.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { WalletFundSiafundResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletFundSiafundResponse(): WalletFundSiafundResponse { - return { - basis: { - id: '0', - height: 100000, - }, - transaction: { - minerFees: ['3930000000000000000000'], - }, - toSign: [], - dependsOn: null, - } -} - -export async function mockApiWalletFundSiafund({ - page, - walletId, - response, - expectPost, -}: { - page: Page - walletId: string - response?: WalletFundSiafundResponse - expectPost?: (data: string | null) => void -}) { - const json = response || getMockWalletFundSiafundResponse() - await page.route(`**/api/wallets/${walletId}/fundsf*`, async (route) => { - if (expectPost) { - expectPost(route.request().postData()) - } - await route.fulfill({ json }) - }) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletOutputsSiacoin.ts b/libs/walletd-mock/src/mocks/walletOutputsSiacoin.ts deleted file mode 100644 index f2e54160c..000000000 --- a/libs/walletd-mock/src/mocks/walletOutputsSiacoin.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { WalletOutputsSiacoinResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletOutputsSiacoinResponse(): WalletOutputsSiacoinResponse { - return { - basis: { - id: 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - height: 1000000, - }, - outputs: [ - { - id: 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - leafIndex: 304248, - merkleProof: [ - '0a7a4c392f78899e3c38c5cd9e6a673b2c7afec97930af539af9c8e20209aa78', - 'a1e074dc48634a234b7366a0d7ab19cd05e3e698e1d44bf07e24d75ae0c65b3c', - '44d107342962e2068d289ce090c87b7bf0c847f734bdfad10db5546e402c3ad7', - '64ea3e65ecd5ebc1c0ce014673148060855ce550571208b6303b8e2a83e33451', - '19e37bf7747c6d8c7b87d2474dbbd3a8f5b26d89642f8e1af4b9b02abdfb2ea6', - '1fc2ac9f70211a3be6f334db14feb8b327458aee49d3539770640cbdec9b4a5f', - 'defbbc18c64349f11e75537955861ececce0fadf10baec456f6c74b024820af1', - '87d27ff868ca3b1dce59ae754eaec48239718e81e2e6f3b7b418f5a00362bcf7', - '93d823c55fbd09de462a8e355921433b3693d63de58ea8e2780a2c2ffabd0fee', - 'a68820d6b79b2735b15c69d0fc26b11252bb27f22b9088559ed13f9420f5dda1', - '1bbcead690290291ea9628214a121ef783411693975171803bf5716a3a6ff19b', - ], - siacoinOutput: { - value: '1000000000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - maturityHeight: 0, - }, - { - id: '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - leafIndex: 305723, - merkleProof: [ - '8c02aeec48de589ce497ebe72fb8b527cfe022ef513fcfdc56745c84832f00ec', - '1bf63b9959e60272fd7a48a8cecd4120a852c0e14557ea27ccad6ea2071e70b3', - '21b7e1606e9fd677059c58a1a687682182f71ce09e071431dcaff823a3a5d49e', - 'e81ac37d3b4db6166dc1bb10ebfa49f57cbf99aababd36ee4e3e5e12082dc6dc', - 'ecc307c6c3e505d97ccf821938e5e5702ef0130d33c991ca95735f7d9706a4b8', - '9560060ee399793f102e092afdfdbdd33692706256955e8390af552de0addfc0', - ], - siacoinOutput: { - value: '97988210000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - maturityHeight: 0, - }, - ], - } -} - -export async function mockApiWalletOutputsSiacoin({ - page, - walletId, - response, -}: { - page: Page - walletId: string - response?: WalletOutputsSiacoinResponse -}) { - const json = response || getMockWalletOutputsSiacoinResponse() - await page.route( - `**/api/wallets/${walletId}/outputs/siacoin*`, - async (route) => { - await route.fulfill({ json }) - } - ) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletOutputsSiafund.ts b/libs/walletd-mock/src/mocks/walletOutputsSiafund.ts deleted file mode 100644 index a4b0cdb40..000000000 --- a/libs/walletd-mock/src/mocks/walletOutputsSiafund.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { WalletOutputsSiafundResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletOutputsSiafundResponse(): WalletOutputsSiafundResponse { - return { - basis: { - id: 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - height: 1000000, - }, - outputs: [], - } -} - -export async function mockApiWalletOutputsSiafund({ - page, - walletId, -}: { - page: Page - walletId: string -}) { - const json = getMockWalletOutputsSiafundResponse() - await page.route( - `**/api/wallets/${walletId}/outputs/siafund*`, - async (route) => { - await route.fulfill({ json }) - } - ) - return json -} diff --git a/libs/walletd-mock/src/mocks/walletRelease.ts b/libs/walletd-mock/src/mocks/walletRelease.ts deleted file mode 100644 index a8b723858..000000000 --- a/libs/walletd-mock/src/mocks/walletRelease.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { WalletReleaseResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export async function mockApiWalletRelease({ - page, - walletId, -}: { - page: Page - walletId: string - response?: WalletReleaseResponse -}) { - await page.route(`**/api/wallets/${walletId}/release*`, async (route) => { - await route.fulfill() - }) -} diff --git a/libs/walletd-mock/src/mocks/wallets.ts b/libs/walletd-mock/src/mocks/wallets.ts deleted file mode 100644 index 5da89ea34..000000000 --- a/libs/walletd-mock/src/mocks/wallets.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Wallet, WalletsResponse } from '@siafoundation/walletd-types' -import { Page } from 'playwright' - -export function getMockWalletsResponse(): WalletsResponse { - return [ - { - id: '1', - name: '1', - description: '1', - dateCreated: '2024-03-20T18:49:01Z', - lastUpdated: '2024-03-20T18:49:01Z', - metadata: { - type: 'seed', - mnemonicHash: - '302626ee851d3712c19007c6141fc7f3a229ae64e6df71403a31b3ad131ac53657cf3dcae9405d9203e57204eb0084a7899224880e8d8beb4e103949255d861e', - }, - }, - { - id: '2', - name: '2', - description: '2', - dateCreated: '2024-03-20T18:49:50Z', - lastUpdated: '2024-03-20T19:30:04Z', - metadata: { - type: 'seed', - mnemonicHash: - '302626ee851d3712c19007c6141fc7f3a229ae64e6df71403a31b3ad131ac53657cf3dcae9405d9203e57204eb0084a7899224880e8d8beb4e103949255d861e', - }, - }, - { - id: '3', - name: '3', - description: '3', - dateCreated: '2024-03-20T18:53:27Z', - lastUpdated: '2024-03-20T18:53:27Z', - metadata: { - type: 'watch', - }, - }, - ] -} - -export async function mockApiWallets({ - page, - createWallet, -}: { - page: Page - createWallet?: Wallet -}) { - const json = getMockWalletsResponse() - await page.route('**/api/wallets*', async (route) => { - if (route.request().method() === 'POST') { - await route.fulfill({ json: createWallet }) - } else { - await route.fulfill({ json }) - } - }) - return json -} diff --git a/libs/walletd-mock/src/scenarios/seedWallet.ts b/libs/walletd-mock/src/scenarios/seedWallet.ts deleted file mode 100644 index 4a576cd39..000000000 --- a/libs/walletd-mock/src/scenarios/seedWallet.ts +++ /dev/null @@ -1,300 +0,0 @@ -import { - Wallet, - WalletAddress, - WalletBalanceResponse, - WalletConstructV2TransactionResponse, - WalletFundSiacoinResponse, - WalletOutputsSiacoinResponse, - WalletOutputsSiafundResponse, -} from '@siafoundation/walletd-types' -import { toHastings } from '@siafoundation/units' -import { getMockConsensusNetworkResponse } from '../mocks/consensusNetwork' -import { getMockConsensusTipStateResponse } from '../mocks/consensusTipState' - -export function getMockScenarioSeedWallet() { - const mnemonic = - 'ridge business wish transfer home glove office salt wealth baby journey diary' - - const receiveAddress = - '5739945c21e60afd70eaf97ccd33ea27836e0219212449f39e4b38acaa8b3119aa4150a9ef0f' - const changeAddress = - '170173c40ca0f39f9618da30af14c390c7ce70248a3662a7a5d3d5a8a31c9fbfa2071e9f6518' - - const newWallet: Wallet = { - id: '100', - name: 'test send wallet', - description: 'wallet description', - dateCreated: new Date().toISOString(), - lastUpdated: new Date().toISOString(), - metadata: { - type: 'seed', - mnemonicHash: - '251cc9d01333287e9c9f39fc4749095a28a3970348a6106244848d2c414a908bc81ae4982911435a045a407fb305b69e51d05ce6f9b47ef1750c1e74ca299a48', - }, - } - - const walletBalanceResponse: WalletBalanceResponse = { - siacoins: toHastings('100').toString(), - immatureSiacoins: toHastings('10').toString(), - siafunds: 10, - } - - const walletOutputsSiacoinResponse: WalletOutputsSiacoinResponse = { - basis: { - height: 0, - id: '0', - }, - outputs: [ - { - id: 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - leafIndex: 304248, - merkleProof: [ - '0a7a4c392f78899e3c38c5cd9e6a673b2c7afec97930af539af9c8e20209aa78', - 'a1e074dc48634a234b7366a0d7ab19cd05e3e698e1d44bf07e24d75ae0c65b3c', - '44d107342962e2068d289ce090c87b7bf0c847f734bdfad10db5546e402c3ad7', - '64ea3e65ecd5ebc1c0ce014673148060855ce550571208b6303b8e2a83e33451', - '19e37bf7747c6d8c7b87d2474dbbd3a8f5b26d89642f8e1af4b9b02abdfb2ea6', - '1fc2ac9f70211a3be6f334db14feb8b327458aee49d3539770640cbdec9b4a5f', - 'defbbc18c64349f11e75537955861ececce0fadf10baec456f6c74b024820af1', - '87d27ff868ca3b1dce59ae754eaec48239718e81e2e6f3b7b418f5a00362bcf7', - '93d823c55fbd09de462a8e355921433b3693d63de58ea8e2780a2c2ffabd0fee', - 'a68820d6b79b2735b15c69d0fc26b11252bb27f22b9088559ed13f9420f5dda1', - '1bbcead690290291ea9628214a121ef783411693975171803bf5716a3a6ff19b', - ], - siacoinOutput: { - value: '1000000000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - maturityHeight: 0, - }, - { - id: '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - leafIndex: 305723, - merkleProof: [ - '8c02aeec48de589ce497ebe72fb8b527cfe022ef513fcfdc56745c84832f00ec', - '1bf63b9959e60272fd7a48a8cecd4120a852c0e14557ea27ccad6ea2071e70b3', - '21b7e1606e9fd677059c58a1a687682182f71ce09e071431dcaff823a3a5d49e', - 'e81ac37d3b4db6166dc1bb10ebfa49f57cbf99aababd36ee4e3e5e12082dc6dc', - 'ecc307c6c3e505d97ccf821938e5e5702ef0130d33c991ca95735f7d9706a4b8', - '9560060ee399793f102e092afdfdbdd33692706256955e8390af552de0addfc0', - ], - siacoinOutput: { - value: '97988210000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - maturityHeight: 0, - }, - ], - } - - const walletOutputsSiafundResponse: WalletOutputsSiafundResponse = { - basis: { - height: 0, - id: '0', - }, - outputs: [], - } - - const walletFundResponse: WalletFundSiacoinResponse = { - basis: { - height: 0, - id: '0', - }, - transaction: { - siacoinInputs: [ - { - parentID: - 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - unlockConditions: { - timelock: 0, - publicKeys: null, - signaturesRequired: 1, - }, - }, - { - parentID: - '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - unlockConditions: { - timelock: 0, - publicKeys: null, - signaturesRequired: 1, - }, - }, - ], - siacoinOutputs: [ - { - value: '1000000000000000000000000', - address: - '90c6057cdd2463eca61f83796e83152dbba28b6cb9a74831a043833051ec9f422726bfff2ee8', - }, - { - value: '97984280000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - ], - minerFees: ['3930000000000000000000'], - }, - toSign: [ - 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - ], - dependsOn: null, - } - - const walletConstructV2Response: WalletConstructV2TransactionResponse = { - id: '0', - basis: { - height: 0, - id: '0', - }, - transaction: { - siacoinInputs: [ - { - parent: { - id: 'aa3e781330c9b3991e0141807df1327fadf114ca6c37acb9e58004f942d91dfb', - maturityHeight: 0, - siacoinOutput: { - value: '1000000000000000000000000', - address: - '90c6057cdd2463eca61f83796e83152dbba28b6cb9a74831a043833051ec9f422726bfff2ee8', - }, - leafIndex: 304248, - merkleProof: [ - '0a7a4c392f78899e3c38c5cd9e6a673b2c7afec97930af539af9c8e20209aa78', - 'a1e074dc48634a234b7366a0d7ab19cd05e3e698e1d44bf07e24d75ae0c65b3c', - ], - }, - satisfiedPolicy: { - policy: { - type: 'uc', - policy: { - timelock: 0, - publicKeys: [ - 'ed25519:ee122b2169bdae5776b55609e384e0c58372cd5c529d4edc9b9918b26f8e5535', - ], - signaturesRequired: 1, - }, - }, - }, - }, - { - parent: { - id: '32e430158591b4073a6834e9f4c4b67162e348844f569f4e472896bb72efb724', - maturityHeight: 0, - siacoinOutput: { - value: '97984280000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - leafIndex: 305723, - merkleProof: [ - '8c02aeec48de589ce497ebe72fb8b527cfe022ef513fcfdc56745c84832f00ec', - '1bf63b9959e60272fd7a48a8cecd4120a852c0e14557ea27ccad6ea2071e70b3', - ], - }, - satisfiedPolicy: { - policy: { - type: 'uc', - policy: { - timelock: 0, - publicKeys: [ - 'ed25519:ee122b2169bdae5776b55609e384e0c58372cd5c529d4edc9b9918b26f8e5535', - ], - signaturesRequired: 1, - }, - }, - }, - }, - ], - siacoinOutputs: [ - { - value: '1000000000000000000000000', - address: - '90c6057cdd2463eca61f83796e83152dbba28b6cb9a74831a043833051ec9f422726bfff2ee8', - }, - { - value: '97984280000000000000000000', - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - }, - ], - minerFee: '3930000000000000000000', - }, - estimatedFee: '0', - } - - const walletAddressesResponse: WalletAddress[] = [ - { - address: - 'f2dbf56b5b0c698d7fbf43f646c76169d84e597e8b37fada97348beeecaa812d400ac4ce7981', - description: '', - spendPolicy: { - type: 'uc', - policy: { - timelock: 0, - signaturesRequired: 1, - publicKeys: [ - 'ed25519:ee122b2169bdae5776b55609e384e0c58372cd5c529d4edc9b9918b26f8e5535', - ], - }, - }, - metadata: { - index: 0, - }, - }, - { - address: - '90c6057cdd2463eca61f83796e83152dbba28b6cb9a74831a043833051ec9f422726bfff2ee8', - description: '', - spendPolicy: { - type: 'uc', - policy: { - timelock: 0, - signaturesRequired: 1, - publicKeys: [ - 'ed25519:624d6d477a8f4ceac873e6dd9138740f9322cb34a24246f96f9d64c021172f43', - ], - }, - }, - metadata: { - index: 1, - }, - }, - { - address: - '170173c40ca0f39f9618da30af14c390c7ce70248a3662a7a5d3d5a8a31c9fbfa2071e9f6518', - description: '', - spendPolicy: { - type: 'uc', - policy: { - timelock: 0, - signaturesRequired: 1, - publicKeys: [ - 'ed25519:65cac661a4acf36847c0aa67cbc6956e3449fd82a7430cfd673ea7fedbfcf5fa', - ], - }, - }, - metadata: { - index: 2, - }, - }, - ] - - return { - consensusState: getMockConsensusTipStateResponse(), - consensusNetwork: getMockConsensusNetworkResponse(), - mnemonic, - receiveAddress, - changeAddress, - newWallet, - walletBalanceResponse, - walletOutputsSiacoinResponse, - walletOutputsSiafundResponse, - walletFundResponse, - walletConstructV2Response, - walletAddressesResponse, - } -} diff --git a/libs/walletd-mock/tsconfig.json b/libs/walletd-mock/tsconfig.json deleted file mode 100644 index 4c089585e..000000000 --- a/libs/walletd-mock/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/walletd-mock/tsconfig.lib.json b/libs/walletd-mock/tsconfig.lib.json deleted file mode 100644 index d73537814..000000000 --- a/libs/walletd-mock/tsconfig.lib.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": [ - "node", - "@nx/react/typings/cssmodule.d.ts", - "@nx/react/typings/image.d.ts" - ] - }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx" - ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] -} diff --git a/libs/walletd-mock/tsconfig.spec.json b/libs/walletd-mock/tsconfig.spec.json deleted file mode 100644 index 503e9a83d..000000000 --- a/libs/walletd-mock/tsconfig.spec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] -} diff --git a/tsconfig.base.json b/tsconfig.base.json index 5e5b8ddc2..ab208242d 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -37,15 +37,7 @@ // "buildLibsFromSource": false does not work with the next executor // this is a very annoying workaround "@siafoundation/sdk": ["dist/libs/sdk/index.esm.js"], - "@siafoundation/sia-central-types": [ - "libs/sia-central-types/src/index.ts" - ], - "@siafoundation/sia-central-js": ["libs/sia-central-js/src/index.ts"], - "@siafoundation/sia-central-react": [ - "libs/sia-central-react/src/index.ts" - ], "@siafoundation/e2e": ["libs/e2e/src/index.ts"], - "@siafoundation/sia-central-mock": ["libs/sia-central-mock/src/index.ts"], "@siafoundation/types": ["libs/types/src/index.ts"], "@siafoundation/units": ["libs/units/src/index.ts"], "@siafoundation/clusterd": ["libs/clusterd/src/index.ts"]