diff --git a/libs/coin-modules/coin-aptos/.env.integ.test.example b/libs/coin-modules/coin-aptos/.env.integ.test.example deleted file mode 100644 index 5acdd1b43843..000000000000 --- a/libs/coin-modules/coin-aptos/.env.integ.test.example +++ /dev/null @@ -1,2 +0,0 @@ -PUB_KEY = "XPUB" -SECRET_KEY = "SECRET" diff --git a/libs/coin-modules/coin-aptos/.eslintrc.js b/libs/coin-modules/coin-aptos/.eslintrc.js deleted file mode 100644 index 8f6848a860b9..000000000000 --- a/libs/coin-modules/coin-aptos/.eslintrc.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - env: { - browser: true, - es6: true, - }, - overrides: [ - { - files: ["src/**/*.test.{ts,tsx}"], - env: { - "jest/globals": true, - }, - plugins: ["jest"], - }, - ], - rules: { - "no-console": ["error", { allow: ["warn", "error"] }], - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-explicit-any": "warn", - }, -}; diff --git a/libs/coin-modules/coin-aptos/.gitignore b/libs/coin-modules/coin-aptos/.gitignore deleted file mode 100644 index 0dc34b64922c..000000000000 --- a/libs/coin-modules/coin-aptos/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.env.integ.test diff --git a/libs/coin-modules/coin-aptos/.unimportedrc.json b/libs/coin-modules/coin-aptos/.unimportedrc.json deleted file mode 100644 index ed6cedfecead..000000000000 --- a/libs/coin-modules/coin-aptos/.unimportedrc.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "entry": [ - "src/api/index.ts", - "src/bridge/index.ts", - "src/bridge/deviceTransactionConfig.ts", - "src/datasets/dataset-1.ts", - "src/signer/index.ts", - "src/test/index.ts", - "src/index.ts" - ], - "ignorePatterns": [ - "**/node_modules/**", - "**/*.fixture.ts", - "**/*.mock.ts", - "**/*.test.{js,jsx,ts,tsx}" - ], - "ignoreUnresolved": [ - "jest-get-type", - "jest-matcher-utils", - "jest-message-util" - ], - "ignoreUnimported": [], - "ignoreUnused": [] -} \ No newline at end of file diff --git a/libs/coin-modules/coin-aptos/CHANGELOG.md b/libs/coin-modules/coin-aptos/CHANGELOG.md deleted file mode 100644 index 998da4adbc1d..000000000000 --- a/libs/coin-modules/coin-aptos/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ -# @ledgerhq/coin-aptos diff --git a/libs/coin-modules/coin-aptos/jest.config.js b/libs/coin-modules/coin-aptos/jest.config.js deleted file mode 100644 index 5a008c9e0912..000000000000 --- a/libs/coin-modules/coin-aptos/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ -// `workerThreads: true` is required for validating object with `bigint` values -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - testPathIgnorePatterns: ["lib/", "lib-es/", ".*\\.integ\\.test\\.[tj]s"], - workerThreads: true, -}; diff --git a/libs/coin-modules/coin-aptos/jest.integ.config.js b/libs/coin-modules/coin-aptos/jest.integ.config.js deleted file mode 100644 index 41ad009607bb..000000000000 --- a/libs/coin-modules/coin-aptos/jest.integ.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ -module.exports = { - preset: "ts-jest", - testEnvironment: "node", - testRegex: ".integ.test.ts$", - testPathIgnorePatterns: ["lib/", "lib-es/"], - setupFiles: ["dotenv/config"], -}; diff --git a/libs/coin-modules/coin-aptos/package.json b/libs/coin-modules/coin-aptos/package.json deleted file mode 100644 index 9cb6012fe6ba..000000000000 --- a/libs/coin-modules/coin-aptos/package.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "name": "@ledgerhq/coin-aptos", - "version": "0.0.1", - "description": "Ledger Aptos Coin integration", - "keywords": [ - "Ledger", - "LedgerWallet", - "Aptos", - "apt", - "Hardware Wallet" - ], - "repository": { - "type": "git", - "url": "https://github.com/LedgerHQ/ledger-live.git" - }, - "bugs": { - "url": "https://github.com/LedgerHQ/ledger-live/issues" - }, - "homepage": "https://github.com/LedgerHQ/ledger-live/tree/develop/libs/coin-modules/coin-aptos", - "publishConfig": { - "access": "public" - }, - "typesVersions": { - "*": { - "lib/*": [ - "lib/*" - ], - "lib-es/*": [ - "lib-es/*" - ], - "api": [ - "lib/api/index" - ], - "deviceTransactionConfig": [ - "lib/bridge/deviceTransactionConfig" - ], - "logic": [ - "lib/logic/index" - ], - "specs": [ - "lib/test/bot-specs" - ], - "transaction": [ - "lib/bridge/transaction" - ], - "types": [ - "lib/types/index" - ], - "*": [ - "lib/*", - "lib/bridge/*", - "lib/logic/*", - "lib/signer/*", - "lib/test/*", - "lib/types/*" - ] - } - }, - "exports": { - "./lib/*": "./lib/*.js", - "./lib-es/*": "./lib-es/*.js", - "./api": { - "require": "./lib/api/index.js", - "default": "./lib-es/api/index.js" - }, - "./deviceTransactionConfig": { - "require": "./lib/bridge/deviceTransactionConfig.js", - "default": "./lib-es/bridge/deviceTransactionConfig.js" - }, - "./logic": { - "require": "./lib/logic/index.js", - "default": "./lib-es/logic/index.js" - }, - "./signer": { - "require": "./lib/signer/index.js", - "default": "./lib-es/signer/index.js" - }, - "./specs": { - "require": "./lib/test/bot-specs.js", - "default": "./lib-es/test/bot-specs.js" - }, - "./transaction": { - "require": "./lib/bridge/transaction.js", - "default": "./lib-es/bridge/transaction.js" - }, - "./types": { - "require": "./lib/types/index.js", - "default": "./lib-es/types/index.js" - }, - "./*": { - "require": "./lib/*.js", - "default": "./lib-es/*.js" - }, - ".": { - "require": "./lib/index.js", - "default": "./lib-es/index.js" - }, - "./package.json": "./package.json" - }, - "license": "Apache-2.0", - "dependencies": { - "@ledgerhq/coin-framework": "workspace:^", - "@ledgerhq/cryptoassets": "workspace:^", - "@ledgerhq/devices": "workspace:*", - "@ledgerhq/types-live": "workspace:^", - "bignumber.js": "^9.1.2", - "invariant": "^2.2.4" - }, - "devDependencies": { - "@faker-js/faker": "^8.4.1", - "@ledgerhq/types-cryptoassets": "workspace:^", - "@types/invariant": "^2.2.37", - "@types/jest": "^29.5.12", - "dotenv": "^16.4.5", - "expect": "^27.4.6", - "jest": "^29.7.0", - "ts-jest": "^29.1.1", - "typescript": "^5.4.5" - }, - "scripts": { - "clean": "rimraf lib lib-es", - "build": "tsc && tsc -m ES6 --outDir lib-es", - "coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-aptos.json", - "prewatch": "pnpm build", - "watch": "tsc --watch", - "watch:es": "tsc --watch -m ES6 --outDir lib-es", - "doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts", - "lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache", - "lint:fix": "pnpm lint --fix", - "test": "jest", - "test-integ": "DOTENV_CONFIG_PATH=.env.integ.test jest --config=jest.integ.config.js", - "typecheck": "tsc --noEmit", - "unimported": "unimported" - } -} diff --git a/libs/coin-modules/coin-aptos/src/config.ts b/libs/coin-modules/coin-aptos/src/config.ts deleted file mode 100644 index 70339fdc0177..000000000000 --- a/libs/coin-modules/coin-aptos/src/config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import buildConConfig, { type CurrencyConfig } from "@ledgerhq/coin-framework/config"; - -export type Config = { - node: string; -}; - -export type CoinConfig = CurrencyConfig & Config; - -const coinConfig = buildConConfig(); - -export default coinConfig; diff --git a/libs/coin-modules/coin-aptos/src/index.ts b/libs/coin-modules/coin-aptos/src/index.ts deleted file mode 100644 index 378a95d30a5c..000000000000 --- a/libs/coin-modules/coin-aptos/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./types"; - -export type { CoinConfig } from "./config"; diff --git a/libs/coin-modules/coin-aptos/src/test/cli.ts b/libs/coin-modules/coin-aptos/src/test/cli.ts deleted file mode 100644 index ec50545699c6..000000000000 --- a/libs/coin-modules/coin-aptos/src/test/cli.ts +++ /dev/null @@ -1,44 +0,0 @@ -import invariant from "invariant"; -import type { AccountLike } from "@ledgerhq/types-live"; -import type { Transaction } from "../types"; -import BigNumber from "bignumber.js"; - -const options = [ - { - name: "fee", - type: String, - desc: "how much fee", - }, - { - name: "tag", - type: Number, - desc: "aptos tag", - }, -]; - -function inferTransactions( - transactions: Array<{ - account: AccountLike; - transaction: Transaction; - }>, - opts: { tag?: number | null | undefined; fee?: string }, - { - inferAmount, - }: { inferAmount: (account: AccountLike, fee?: string) => BigNumber | null | undefined }, -): Transaction[] { - return transactions.flatMap(({ transaction, account }) => { - invariant(transaction.family === "aptos", "Aptos family"); - return { - ...transaction, - fee: inferAmount(account, opts.fee || "0.001aptos"), - tag: opts.tag, - }; - }); -} - -export default function makeCliTools() { - return { - options, - inferTransactions, - }; -} diff --git a/libs/coin-modules/coin-aptos/src/test/index.ts b/libs/coin-modules/coin-aptos/src/test/index.ts deleted file mode 100644 index 633b4d4ba881..000000000000 --- a/libs/coin-modules/coin-aptos/src/test/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import makeCliTools from "./cli"; - -export { makeCliTools }; -export * from "./bot-specs"; -export * from "./bot-deviceActions"; diff --git a/libs/coin-modules/coin-aptos/src/types/bridge.ts b/libs/coin-modules/coin-aptos/src/types/bridge.ts deleted file mode 100644 index aa5be9d83f56..000000000000 --- a/libs/coin-modules/coin-aptos/src/types/bridge.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { BigNumber } from "bignumber.js"; -import type { Unit } from "@ledgerhq/types-cryptoassets"; -import type { - TransactionCommon, - TransactionCommonRaw, - TransactionStatusCommon, - TransactionStatusCommonRaw, -} from "@ledgerhq/types-live"; - -export type NetworkInfo = { - family: "aptos"; - serverFee: BigNumber; - baseReserve: BigNumber; -}; - -export type NetworkInfoRaw = { - family: "aptos"; - serverFee: string; - baseReserve: string; -}; - -export type Transaction = TransactionCommon & { - family: "aptos"; - fee: BigNumber | null | undefined; - networkInfo: NetworkInfo | null | undefined; - tag: number | null | undefined; - feeCustomUnit: Unit | null | undefined; -}; - -export type TransactionRaw = TransactionCommonRaw & { - family: "aptos"; - fee: string | null | undefined; - networkInfo: NetworkInfoRaw | null | undefined; - tag: number | null | undefined; - feeCustomUnit: Unit | null | undefined; -}; - -export type TransactionStatus = TransactionStatusCommon; -export type TransactionStatusRaw = TransactionStatusCommonRaw; diff --git a/libs/coin-modules/coin-aptos/src/types/index.ts b/libs/coin-modules/coin-aptos/src/types/index.ts deleted file mode 100644 index a88679f56c31..000000000000 --- a/libs/coin-modules/coin-aptos/src/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./bridge"; diff --git a/libs/coin-modules/coin-aptos/tsconfig.json b/libs/coin-modules/coin-aptos/tsconfig.json deleted file mode 100644 index f56b01ccd35e..000000000000 --- a/libs/coin-modules/coin-aptos/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../../tsconfig.base", - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "module": "commonjs", - "downlevelIteration": true, - "lib": ["es2020", "dom"], - "outDir": "lib", - "exactOptionalPropertyTypes": true - }, - "include": ["src/**/*"] -} diff --git a/libs/coin-modules/coin-aptos/src/test/bot-deviceActions.ts b/libs/ledger-live-common/src/families/aptos/bot-deviceActions.ts similarity index 100% rename from libs/coin-modules/coin-aptos/src/test/bot-deviceActions.ts rename to libs/ledger-live-common/src/families/aptos/bot-deviceActions.ts diff --git a/libs/coin-modules/coin-aptos/src/test/bot-specs.ts b/libs/ledger-live-common/src/families/aptos/bot-specs.ts similarity index 98% rename from libs/coin-modules/coin-aptos/src/test/bot-specs.ts rename to libs/ledger-live-common/src/families/aptos/bot-specs.ts index 2cad03bab276..1e6c7dd83165 100644 --- a/libs/coin-modules/coin-aptos/src/test/bot-specs.ts +++ b/libs/ledger-live-common/src/families/aptos/bot-specs.ts @@ -6,7 +6,7 @@ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies"; import { parseCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index"; import { botTest, genericTestDestination, pickSiblings } from "@ledgerhq/coin-framework/bot/specs"; import { acceptTransaction } from "./bot-deviceActions"; -import type { Transaction } from "../types"; +import type { Transaction } from "./types"; import BigNumber from "bignumber.js"; import { isAccountEmpty } from "@ledgerhq/coin-framework/account"; import { AccountLike } from "@ledgerhq/types-live"; diff --git a/libs/ledger-live-common/src/generated/specs.ts b/libs/ledger-live-common/src/generated/specs.ts index 5c6868beb8c9..3473a4c8e4f9 100644 --- a/libs/ledger-live-common/src/generated/specs.ts +++ b/libs/ledger-live-common/src/generated/specs.ts @@ -1,3 +1,4 @@ +import aptos from "../families/aptos/bot-specs"; import casper from "../families/casper/specs"; import celo from "../families/celo/specs"; import crypto_org from "../families/crypto_org/specs"; @@ -23,6 +24,7 @@ import tron from "@ledgerhq/coin-tron/specs"; import xrp from "@ledgerhq/coin-xrp/specs"; export default { + aptos, casper, celo, crypto_org,