-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: define cardano in its own module
Signed-off-by: Stéphane Prohaszka <[email protected]>
- Loading branch information
1 parent
5d18b4f
commit 00de9c9
Showing
82 changed files
with
1,448 additions
and
1,207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
.../ledger-live-desktop/src/renderer/families/cardano/DelegationFlowModal/LedgerPoolIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...dger-live-desktop/src/renderer/families/cardano/DelegationFlowModal/ScrollLoadingList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/ledger-live-mobile/src/families/cardano/DelegationFlow/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/ledger-live-mobile/src/families/cardano/shared/PoolRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"entry": [ | ||
"src/bridge/js.ts" | ||
], | ||
"ignoreUnimported": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testPathIgnorePatterns: ["lib/", "lib-es/"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"name": "@ledgerhq/coin-cardano", | ||
"version": "0.0.1", | ||
"description": "Ledger Cardano Coin integration", | ||
"keywords": [ | ||
"Ledger", | ||
"LedgerWallet", | ||
"ada", | ||
"Cardano", | ||
"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-cardano", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"lib/*": [ | ||
"lib/*" | ||
], | ||
"lib-es/*": [ | ||
"lib-es/*" | ||
], | ||
"*": [ | ||
"lib/*" | ||
] | ||
} | ||
}, | ||
"exports": { | ||
"./lib/*": "./lib/*.js", | ||
"./lib-es/*": "./lib-es/*.js", | ||
"./*": { | ||
"require": "./lib/*.js", | ||
"default": "./lib-es/*.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@ledgerhq/coin-framework": "workspace:^", | ||
"@ledgerhq/cryptoassets": "workspace:^", | ||
"@ledgerhq/devices": "workspace:^", | ||
"@ledgerhq/errors": "workspace:^", | ||
"@ledgerhq/live-config": "workspace:^", | ||
"@ledgerhq/live-env": "workspace:^", | ||
"@ledgerhq/live-network": "workspace:^", | ||
"@ledgerhq/live-promise": "workspace:^", | ||
"@ledgerhq/logs": "workspace:^", | ||
"@ledgerhq/types-cryptoassets": "workspace:^", | ||
"@ledgerhq/types-live": "workspace:^", | ||
"@stricahq/bip32ed25519": "^1.0.3", | ||
"@stricahq/typhonjs": "^1.2.6", | ||
"bech32": "^1.1.3", | ||
"bignumber.js": "^9.1.2", | ||
"expect": "^27.4.6", | ||
"invariant": "^2.2.2", | ||
"lodash": "^4.17.21", | ||
"rxjs": "^7.8.1" | ||
}, | ||
"devDependencies": { | ||
"@types/invariant": "^2.2.2", | ||
"@types/jest": "^29.5.10", | ||
"@types/lodash": "^4.14.191", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf lib lib-es", | ||
"build": "tsc && tsc -m ES6 --outDir lib-es", | ||
"prewatch": "pnpm build", | ||
"watch": "tsc --watch", | ||
"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", | ||
"unimported": "unimported" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...ve-common/src/families/cardano/account.ts → .../coin-modules/coin-cardano/src/account.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
114 changes: 114 additions & 0 deletions
114
libs/coin-modules/coin-cardano/src/bridge.integration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import "../../__tests__/test-helpers/setup"; | ||
import BigNumber from "bignumber.js"; | ||
import { cardanoRawAccount1 } from "./datasets/rawAccount.1"; | ||
import { cardanoScanAccounts } from "./datasets/scanAccounts"; | ||
import { CardanoInvalidPoolId, CardanoMinAmountError } from "./errors"; | ||
import { fromTransactionRaw } from "./transaction"; | ||
import type { Transaction } from "./types"; | ||
import type { DatasetTest } from "@ledgerhq/types-live"; | ||
|
||
export const dataset: DatasetTest<Transaction> = { | ||
implementations: ["js"], | ||
currencies: { | ||
cardano_testnet: { | ||
scanAccounts: cardanoScanAccounts, | ||
accounts: [ | ||
{ | ||
raw: cardanoRawAccount1, | ||
transactions: [ | ||
{ | ||
name: "amount less then minimum", | ||
transaction: fromTransactionRaw({ | ||
family: "cardano", | ||
recipient: | ||
"addr_test1qpl90kc2jl5kr9tev0s7vays9yhwcdnq8nlylyk4dqsdq3g466elxnxwrzwq72pvp5akenj30t5s9et7frfvrxxx8xcsxrzs87", | ||
amount: "0.1", | ||
mode: "send", | ||
poolId: undefined, | ||
}), | ||
expectedStatus: { | ||
amount: new BigNumber("0.1"), | ||
errors: { | ||
amount: new CardanoMinAmountError(), | ||
}, | ||
}, | ||
}, | ||
/* // FIXME broken test | ||
{ | ||
name: "token amount more than balance", | ||
transaction: fromTransactionRaw({ | ||
family: "cardano", | ||
recipient: | ||
"addr_test1qpl90kc2jl5kr9tev0s7vays9yhwcdnq8nlylyk4dqsdq3g466elxnxwrzwq72pvp5akenj30t5s9et7frfvrxxx8xcsxrzs87", | ||
amount: "101", | ||
subAccountId: | ||
"js:2:cardano_testnet:806499588e0c4a58f4119f7e6e096bf42c3f774a528d2acec9e82ceebf87d1ceb3d4f3622dd2c77c65cc89c123f79337db22cf8a69f122e36dab1bf5083bf82d:cardano+cardano_testnet%2Fnative%2F47be64fcc8a7fe5321b976282ce4e43e4d29015f6613cfabcea28eab54657374", | ||
mode: "send", | ||
poolId: undefined, | ||
}), | ||
expectedStatus: { | ||
amount: new BigNumber("101"), | ||
errors: { | ||
amount: new NotEnoughBalance(), | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "send max token", | ||
transaction: fromTransactionRaw({ | ||
family: "cardano", | ||
recipient: | ||
"addr_test1qpl90kc2jl5kr9tev0s7vays9yhwcdnq8nlylyk4dqsdq3g466elxnxwrzwq72pvp5akenj30t5s9et7frfvrxxx8xcsxrzs87", | ||
amount: "0", | ||
subAccountId: | ||
"js:2:cardano_testnet:806499588e0c4a58f4119f7e6e096bf42c3f774a528d2acec9e82ceebf87d1ceb3d4f3622dd2c77c65cc89c123f79337db22cf8a69f122e36dab1bf5083bf82d:cardano+cardano_testnet%2Fnative%2F47be64fcc8a7fe5321b976282ce4e43e4d29015f6613cfabcea28eab54657374", | ||
mode: "send", | ||
useAllAmount: true, | ||
poolId: undefined, | ||
}), | ||
expectedStatus: { | ||
amount: new BigNumber("100"), | ||
totalSpent: new BigNumber("100"), | ||
errors: {}, | ||
warnings: {}, | ||
}, | ||
}, | ||
*/ | ||
{ | ||
name: "delegate to invalid poolId", | ||
transaction: fromTransactionRaw({ | ||
family: "cardano", | ||
recipient: "", | ||
amount: "0", | ||
mode: "delegate", | ||
poolId: "efae72c07a26e4542ba55ef59d35ad45ffaaac312865e3a758ede", | ||
}), | ||
expectedStatus: { | ||
errors: { | ||
poolId: new CardanoInvalidPoolId(), | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "delegate valid poolId", | ||
transaction: fromTransactionRaw({ | ||
family: "cardano", | ||
recipient: "", | ||
amount: "0", | ||
mode: "delegate", | ||
poolId: "efae72c07a26e4542ba55ef59d35ad45ffaaac312865e3a758ede997", | ||
}), | ||
expectedStatus: {}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
describe("Cardano bridge", () => { | ||
test.todo( | ||
"This is an empty test to make jest command pass. Remove it once there is a real test.", | ||
); | ||
}); |
Oops, something went wrong.