@exodus/hw-ledger 3.3.1 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.4.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.4.0...@exodus/hw-ledger@3.4.1) (2024-10-30)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump bip322 to latest ([#10231](https://github.com/ExodusMovement/exodus-hydra/issues/10231)) ([4aacf39](https://github.com/ExodusMovement/exodus-hydra/commit/4aacf399a1e8679d99f08574920463bcab6f07fa))
11
+
12
+ ## [3.4.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.3.1...@exodus/hw-ledger@3.4.0) (2024-10-30)
13
+
14
+ ### Features
15
+
16
+ - add Tron support to ledger ([#10108](https://github.com/ExodusMovement/exodus-hydra/issues/10108)) ([ce6cace](https://github.com/ExodusMovement/exodus-hydra/commit/ce6cace76803c08841976cfa7fc2f8e2ea346923))
17
+ - drop unused exports from bip322 ([#10142](https://github.com/ExodusMovement/exodus-hydra/issues/10142)) ([6c1a268](https://github.com/ExodusMovement/exodus-hydra/commit/6c1a2687130bdf88ff78c38a599c950c84ae8f60))
18
+
6
19
  ## [3.3.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.3.0...@exodus/hw-ledger@3.3.1) (2024-10-24)
7
20
 
8
21
  ### Bug Fixes
@@ -19,5 +19,10 @@ declare const applications: {
19
19
  supportedVersions: string;
20
20
  primaryAssetName: string;
21
21
  };
22
+ Tron: {
23
+ applicationName: string;
24
+ supportedVersions: string;
25
+ primaryAssetName: string;
26
+ };
22
27
  };
23
28
  export default applications;
@@ -18,10 +18,16 @@ const Polygon = {
18
18
  supportedVersions: '^1.10.0',
19
19
  primaryAssetName: 'matic',
20
20
  };
21
+ const Tron = {
22
+ applicationName: 'Tron',
23
+ supportedVersions: '^0.7.0',
24
+ primaryAssetName: 'tronmainnet',
25
+ };
21
26
  const applications = {
22
27
  Bitcoin,
23
28
  Solana,
24
29
  Ethereum,
25
30
  Polygon,
31
+ Tron,
26
32
  };
27
33
  export default applications;
@@ -3,6 +3,7 @@ import basemainnet from './basemainnet';
3
3
  import ethereum from './ethereum';
4
4
  import matic from './matic';
5
5
  import solana from './solana';
6
+ import tronmainnet from './tronmainnet';
6
7
  import applications from './applications';
7
8
  export const assetApplications = {
8
9
  basemainnet,
@@ -13,6 +14,7 @@ export const assetApplications = {
13
14
  solana,
14
15
  ethereum,
15
16
  ethereumsepolia: ethereum,
17
+ tronmainnet,
16
18
  };
17
19
  export const supportedBaseAssetNames = Object.keys(assetApplications);
18
20
  export const applicationNameToBaseAssetNames = Object.entries(assetApplications).reduce((mapping, [assetName, metadata]) => {
@@ -0,0 +1,19 @@
1
+ import type Transport from '@ledgerhq/hw-transport';
2
+ import type { Bytes, HardwareWalletAssetHandler } from '@exodus/hw-common';
3
+ export interface TronMessage {
4
+ rawMessage?: Bytes;
5
+ TIP712Message?: {
6
+ address: string;
7
+ message: Bytes;
8
+ };
9
+ }
10
+ declare function createHandler(transport: Transport): Promise<HardwareWalletAssetHandler<TronMessage>>;
11
+ declare const metadata: {
12
+ applications: {
13
+ applicationName: string;
14
+ supportedVersions: string;
15
+ primaryAssetName: string;
16
+ }[];
17
+ handler: typeof createHandler;
18
+ };
19
+ export default metadata;
@@ -0,0 +1,60 @@
1
+ import AppTron from '@ledgerhq/hw-app-trx';
2
+ import assert from 'minimalistic-assert';
3
+ import { XPubUnsupportedError } from '@exodus/hw-common';
4
+ import * as secp256k1 from '@exodus/crypto/secp256k1';
5
+ import applications from './applications';
6
+ async function createHandler(transport) {
7
+ const app = new AppTron(transport);
8
+ const getAddress = async (params) => {
9
+ const { address } = await app.getAddress(params.derivationPath.replace('m/', ''));
10
+ return address;
11
+ };
12
+ const getXPub = async (params) => {
13
+ throw new XPubUnsupportedError();
14
+ };
15
+ const getPublicKey = async (params) => {
16
+ const { publicKey } = await app.getAddress(params.derivationPath.replace('m/', ''));
17
+ return secp256k1.publicKeyConvert({
18
+ publicKey: Buffer.from(publicKey, 'hex'),
19
+ compressed: true,
20
+ format: 'buffer',
21
+ });
22
+ };
23
+ const signTransaction = async (params) => {
24
+ assert(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
25
+ if (!Buffer.isBuffer(params.signableTransaction)) {
26
+ throw new TypeError(`signableTransaction must be Buffer or serializable to a Buffer.`);
27
+ }
28
+ const signature = await app.signTransaction(params.derivationPaths[0].replace('m/', ''), params.signableTransaction.toString('hex'), []);
29
+ return [
30
+ {
31
+ signature: Buffer.from(signature, 'hex'),
32
+ },
33
+ ];
34
+ };
35
+ const signMessage = async (params) => {
36
+ if (params.message.rawMessage) {
37
+ assert(Buffer.isBuffer(params.message.rawMessage), 'rawMessage must be a buffer');
38
+ const signature = await app.signPersonalMessage(params.derivationPath.replace('m/', ''), params.message.rawMessage.toString('hex'));
39
+ return Buffer.from(signature, 'hex');
40
+ }
41
+ if (params.message.TIP712Message) {
42
+ throw new Error('TIP712 messages are not yet supported');
43
+ }
44
+ else {
45
+ assert(false, 'rawMessage or TIP712Message must be specified');
46
+ }
47
+ };
48
+ return {
49
+ getAddress,
50
+ getPublicKey,
51
+ getXPub,
52
+ signTransaction,
53
+ signMessage,
54
+ };
55
+ }
56
+ const metadata = {
57
+ applications: [applications.Tron],
58
+ handler: createHandler,
59
+ };
60
+ export default metadata;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/hw-ledger",
3
- "version": "3.3.1",
3
+ "version": "3.4.1",
4
4
  "description": "The ledger module",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@exodus/atoms": "^9.0.0",
34
- "@exodus/bip322-js": "^1.2.1",
34
+ "@exodus/bip322-js": "^2.0.0",
35
35
  "@exodus/bitcoinjs": "^1.1.0",
36
36
  "@exodus/crypto": "^1.0.0-rc.14",
37
37
  "@exodus/ethersproject-transactions": "^5.4.2-exodus.0",
@@ -41,6 +41,7 @@
41
41
  "@exodus/ledgerhq-hw-app-eth": "^6.33.7-exodus.8",
42
42
  "@exodus/redux-dependency-injection": "^4.0.0",
43
43
  "@ledgerhq/hw-app-solana": "^7.0.10",
44
+ "@ledgerhq/hw-app-trx": "^6.29.4",
44
45
  "@ledgerhq/hw-transport": "^6.28.5",
45
46
  "@metamask/eth-sig-util": "^4.0.1",
46
47
  "bs58": "^4.0.0",
@@ -64,5 +65,5 @@
64
65
  "redux": "^4.2.1",
65
66
  "tiny-secp256k1": "^2.2.3"
66
67
  },
67
- "gitHead": "75c0ccc137017dbd6fea08e2c42f6b46e2e85f9c"
68
+ "gitHead": "dc618f601bca671c7b778c4c9eb91edfb669e9a2"
68
69
  }