@ledgerhq/hw-app-sui 1.1.0-next.0

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.
@@ -0,0 +1,4 @@
1
+
2
+ > @ledgerhq/hw-app-sui@1.0.0 build /home/runner/work/ledger-live/ledger-live/libs/ledgerjs/packages/hw-app-sui
3
+ > tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
4
+
@@ -0,0 +1,3 @@
1
+ {
2
+ "entry": ["src/Sui.ts"]
3
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @ledgerhq/hw-app-sui
2
+
3
+ ## 1.1.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#9611](https://github.com/LedgerHQ/ledger-live/pull/9611) [`a656e47`](https://github.com/LedgerHQ/ledger-live/commit/a656e47c1dc3ac8b578debf9cf80eab370c7086f) Thanks [@hedi-edelbloute](https://github.com/hedi-edelbloute)! - Add SUI coin send and receive abilities
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017-present Ledger https://www.ledger.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ <img src="https://user-images.githubusercontent.com/4631227/191834116-59cf590e-25cc-4956-ae5c-812ea464f324.png" height="100" />
2
+
3
+ [GitHub](https://github.com/LedgerHQ/ledger-live/),
4
+ [Ledger Devs Discord](https://developers.ledger.com/discord-pro),
5
+ [Developer Portal](https://developers.ledger.com/)
6
+
7
+ ## @ledgerhq/hw-app-sui
8
+
9
+ Ledger Hardware Wallet Sui JavaScript bindings.
10
+
11
+ ***
12
+
13
+ ## Are you adding Ledger support to your software wallet?
14
+
15
+ You may be using this package to communicate with the Sui Nano App.
16
+
17
+ For a smooth and quick integration:
18
+
19
+ * See the developers’ documentation on the [Developer Portal](https://developers.ledger.com/docs/transport/overview/) and
20
+ * Go on [Discord](https://developers.ledger.com/discord-pro/) to chat with developer support and the developer community.
21
+
22
+ ***
23
+
24
+ ## Dependecies
25
+
26
+ This package extends [@mysten/ledgerjs-hw-app-sui](https://www.npmjs.com/package/@mysten/ledgerjs-hw-app-sui)
27
+
28
+ ## API
29
+
30
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
31
+
32
+ #### Table of Contents
33
+
34
+ * [Sui](#sui)
35
+ * [Examples](#examples)
36
+
37
+ ### Sui
38
+
39
+ **Extends SuiAPI**
40
+
41
+ Sui App API
42
+
43
+ #### Examples
44
+
45
+ ```javascript
46
+ import Sui from "@ledgerhq/hw-app-sui";
47
+ const sui = new Sui(transport)
48
+ ```
package/jest.config.ts ADDED
@@ -0,0 +1,6 @@
1
+ import baseConfig from "../../jest.config";
2
+
3
+ export default {
4
+ ...baseConfig,
5
+ rootDir: __dirname,
6
+ };
package/lib/Sui.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import SuiAPI from "@mysten/ledgerjs-hw-app-sui";
2
+ /**
3
+ * Sui App API
4
+ *
5
+ * @example
6
+ * import Sui from "@ledgerhq/hw-app-sui";
7
+ * const sui = new Sui(transport)
8
+ */
9
+ export default class Sui extends SuiAPI {
10
+ }
11
+ //# sourceMappingURL=Sui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sui.d.ts","sourceRoot":"","sources":["../src/Sui.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,MAAM;CAAG"}
package/lib/Sui.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ledgerjs_hw_app_sui_1 = __importDefault(require("@mysten/ledgerjs-hw-app-sui"));
7
+ /**
8
+ * Sui App API
9
+ *
10
+ * @example
11
+ * import Sui from "@ledgerhq/hw-app-sui";
12
+ * const sui = new Sui(transport)
13
+ */
14
+ class Sui extends ledgerjs_hw_app_sui_1.default {
15
+ }
16
+ exports.default = Sui;
17
+ //# sourceMappingURL=Sui.js.map
package/lib/Sui.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sui.js","sourceRoot":"","sources":["../src/Sui.ts"],"names":[],"mappings":";;;;;AAAA,sFAAiD;AAEjD;;;;;;GAMG;AACH,MAAqB,GAAI,SAAQ,6BAAM;CAAG;AAA1C,sBAA0C"}
@@ -0,0 +1,11 @@
1
+ import SuiAPI from "@mysten/ledgerjs-hw-app-sui";
2
+ /**
3
+ * Sui App API
4
+ *
5
+ * @example
6
+ * import Sui from "@ledgerhq/hw-app-sui";
7
+ * const sui = new Sui(transport)
8
+ */
9
+ export default class Sui extends SuiAPI {
10
+ }
11
+ //# sourceMappingURL=Sui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sui.d.ts","sourceRoot":"","sources":["../src/Sui.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,MAAM;CAAG"}
package/lib-es/Sui.js ADDED
@@ -0,0 +1,11 @@
1
+ import SuiAPI from "@mysten/ledgerjs-hw-app-sui";
2
+ /**
3
+ * Sui App API
4
+ *
5
+ * @example
6
+ * import Sui from "@ledgerhq/hw-app-sui";
7
+ * const sui = new Sui(transport)
8
+ */
9
+ export default class Sui extends SuiAPI {
10
+ }
11
+ //# sourceMappingURL=Sui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sui.js","sourceRoot":"","sources":["../src/Sui.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,6BAA6B,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,MAAM;CAAG"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@ledgerhq/hw-app-sui",
3
+ "version": "1.1.0-next.0",
4
+ "description": "Ledger Hardware Wallet Sui Application API",
5
+ "keywords": [
6
+ "Ledger",
7
+ "LedgerWallet",
8
+ "Sui",
9
+ "NanoS",
10
+ "Blue",
11
+ "Hardware Wallet"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/LedgerHQ/ledger-live.git"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/LedgerHQ/ledger-live/issues"
19
+ },
20
+ "homepage": "https://github.com/LedgerHQ/ledger-live/tree/develop/libs/ledgerjs/packages/hw-app-sui",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "main": "lib/Sui.js",
25
+ "module": "lib-es/Sui.js",
26
+ "types": "lib/Sui.d.ts",
27
+ "license": "Apache-2.0",
28
+ "dependencies": {
29
+ "@mysten/ledgerjs-hw-app-sui": "0.4.2"
30
+ },
31
+ "devDependencies": {
32
+ "@types/jest": "^29.5.10",
33
+ "@types/node": "^20.8.10",
34
+ "documentation": "14.0.2",
35
+ "jest": "^29.7.0",
36
+ "rimraf": "^4.4.1",
37
+ "source-map-support": "^0.5.21",
38
+ "ts-jest": "^29.1.1",
39
+ "ts-node": "^10.4.0",
40
+ "@ledgerhq/hw-transport-mocker": "^6.29.4"
41
+ },
42
+ "gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
43
+ "scripts": {
44
+ "clean": "rimraf lib lib-es",
45
+ "build": "tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es",
46
+ "prewatch": "pnpm build",
47
+ "watch": "tsc --watch",
48
+ "watch:es": "tsc --watch -m esnext --moduleResolution bundler --outDir lib-es",
49
+ "doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
50
+ "lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
51
+ "lint:fix": "pnpm lint --fix",
52
+ "test": "jest",
53
+ "unimported": "unimported"
54
+ }
55
+ }
package/src/Sui.ts ADDED
@@ -0,0 +1,10 @@
1
+ import SuiAPI from "@mysten/ledgerjs-hw-app-sui";
2
+
3
+ /**
4
+ * Sui App API
5
+ *
6
+ * @example
7
+ * import Sui from "@ledgerhq/hw-app-sui";
8
+ * const sui = new Sui(transport)
9
+ */
10
+ export default class Sui extends SuiAPI {}
@@ -0,0 +1,50 @@
1
+ import { openTransportReplayer, RecordStore } from "@ledgerhq/hw-transport-mocker";
2
+ import Sui from "../src/Sui";
3
+
4
+ test("Sui init", async () => {
5
+ const transport = await openTransportReplayer(RecordStore.fromString(""));
6
+ const sui = new Sui(transport);
7
+ expect(sui).not.toBe(undefined);
8
+ });
9
+
10
+ test("getVersion", async () => {
11
+ const transport = await openTransportReplayer(
12
+ RecordStore.fromString(`
13
+ => 0000000021007f9c9e31ac8256ca2f258583df262dbc7d6f68f2a03043d5c99a4ae5a7396ce9
14
+ <= 010002029000
15
+ `),
16
+ );
17
+ const sui = new Sui(transport);
18
+ const version = await sui.getVersion();
19
+ expect(version).toEqual({ major: 0, minor: 2, patch: 2 });
20
+ });
21
+
22
+ test("getPublicKey", async () => {
23
+ const transport = await openTransportReplayer(
24
+ RecordStore.fromString(`
25
+ => 0002000021007cfea3aa1e07cc4b500c237a8bf8dcb31d5cb855f29dfdeb92f9e4df9493a6cd
26
+ <= 012041f928e1faf1343ae9805aa2b965001f9a05acbf9eb4645333df6f21bf74fca6206e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f09000
27
+ `),
28
+ );
29
+ const sui = new Sui(transport);
30
+ const { address, publicKey } = await sui.getPublicKey("44'/784'/0'/0'/0'", false);
31
+ expect(Buffer.from(address).toString("hex")).toEqual(
32
+ "6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0",
33
+ );
34
+ expect(Buffer.from(publicKey).toString("hex")).toEqual(
35
+ "41f928e1faf1343ae9805aa2b965001f9a05acbf9eb4645333df6f21bf74fca6",
36
+ );
37
+ });
38
+
39
+ test("getPublicKey (rejected by user)", async () => {
40
+ const transport = await openTransportReplayer(
41
+ RecordStore.fromString(`
42
+ => 0002000021007cfea3aa1e07cc4b500c237a8bf8dcb31d5cb855f29dfdeb92f9e4df9493a6cd
43
+ <= 6985
44
+ `),
45
+ );
46
+ const sui = new Sui(transport);
47
+ await expect(sui.getPublicKey("44'/784'/0'/0'/0'", false)).rejects.toThrow(
48
+ new Error("Ledger device: Condition of use not satisfied (denied by the user?) (0x6985)"),
49
+ );
50
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "lib"
5
+ },
6
+ "include": ["src/**/*"]
7
+ }