@ledgerhq/hw-app-eth 6.28.2 → 6.29.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.
Files changed (106) hide show
  1. package/.turbo/turbo-build.log +5 -2
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +58 -16
  4. package/jest.config.ts +6 -0
  5. package/lib/Eth.d.ts +37 -0
  6. package/lib/Eth.d.ts.map +1 -1
  7. package/lib/Eth.js +66 -72
  8. package/lib/Eth.js.map +1 -1
  9. package/lib/modules/EIP712/EIP712.types.d.ts +44 -0
  10. package/lib/modules/EIP712/EIP712.types.d.ts.map +1 -0
  11. package/lib/modules/EIP712/EIP712.types.js +3 -0
  12. package/lib/modules/EIP712/EIP712.types.js.map +1 -0
  13. package/lib/modules/EIP712/EIP712.utils.d.ts +65 -0
  14. package/lib/modules/EIP712/EIP712.utils.d.ts.map +1 -0
  15. package/lib/modules/EIP712/EIP712.utils.js +217 -0
  16. package/lib/modules/EIP712/EIP712.utils.js.map +1 -0
  17. package/lib/modules/EIP712/index.d.ts +60 -0
  18. package/lib/modules/EIP712/index.d.ts.map +1 -0
  19. package/lib/modules/EIP712/index.js +554 -0
  20. package/lib/modules/EIP712/index.js.map +1 -0
  21. package/lib/utils.d.ts +15 -1
  22. package/lib/utils.d.ts.map +1 -1
  23. package/lib/utils.js +43 -3
  24. package/lib/utils.js.map +1 -1
  25. package/lib-es/Eth.d.ts +37 -0
  26. package/lib-es/Eth.d.ts.map +1 -1
  27. package/lib-es/Eth.js +42 -48
  28. package/lib-es/Eth.js.map +1 -1
  29. package/lib-es/modules/EIP712/EIP712.types.d.ts +44 -0
  30. package/lib-es/modules/EIP712/EIP712.types.d.ts.map +1 -0
  31. package/lib-es/modules/EIP712/EIP712.types.js +2 -0
  32. package/lib-es/modules/EIP712/EIP712.types.js.map +1 -0
  33. package/lib-es/modules/EIP712/EIP712.utils.d.ts +65 -0
  34. package/lib-es/modules/EIP712/EIP712.utils.d.ts.map +1 -0
  35. package/lib-es/modules/EIP712/EIP712.utils.js +211 -0
  36. package/lib-es/modules/EIP712/EIP712.utils.js.map +1 -0
  37. package/lib-es/modules/EIP712/index.d.ts +60 -0
  38. package/lib-es/modules/EIP712/index.d.ts.map +1 -0
  39. package/lib-es/modules/EIP712/index.js +549 -0
  40. package/lib-es/modules/EIP712/index.js.map +1 -0
  41. package/lib-es/services/ledger/contracts.d.ts +0 -0
  42. package/lib-es/services/ledger/contracts.d.ts.map +0 -0
  43. package/lib-es/services/ledger/contracts.js +0 -0
  44. package/lib-es/services/ledger/contracts.js.map +0 -0
  45. package/lib-es/services/ledger/erc20.d.ts +0 -0
  46. package/lib-es/services/ledger/erc20.d.ts.map +0 -0
  47. package/lib-es/services/ledger/erc20.js +0 -0
  48. package/lib-es/services/ledger/erc20.js.map +0 -0
  49. package/lib-es/services/ledger/index.d.ts +0 -0
  50. package/lib-es/services/ledger/index.d.ts.map +0 -0
  51. package/lib-es/services/ledger/index.js +0 -0
  52. package/lib-es/services/ledger/index.js.map +0 -0
  53. package/lib-es/services/ledger/loadConfig.d.ts +0 -0
  54. package/lib-es/services/ledger/loadConfig.d.ts.map +0 -0
  55. package/lib-es/services/ledger/loadConfig.js +0 -0
  56. package/lib-es/services/ledger/loadConfig.js.map +0 -0
  57. package/lib-es/services/ledger/nfts.d.ts +0 -0
  58. package/lib-es/services/ledger/nfts.d.ts.map +0 -0
  59. package/lib-es/services/ledger/nfts.js +0 -0
  60. package/lib-es/services/ledger/nfts.js.map +0 -0
  61. package/lib-es/services/types.d.ts +0 -0
  62. package/lib-es/services/types.d.ts.map +0 -0
  63. package/lib-es/services/types.js +0 -0
  64. package/lib-es/services/types.js.map +0 -0
  65. package/lib-es/utils.d.ts +15 -1
  66. package/lib-es/utils.d.ts.map +1 -1
  67. package/lib-es/utils.js +38 -2
  68. package/lib-es/utils.js.map +1 -1
  69. package/package.json +13 -8
  70. package/src/Eth.ts +59 -56
  71. package/src/modules/EIP712/EIP712.types.ts +54 -0
  72. package/src/modules/EIP712/EIP712.utils.ts +251 -0
  73. package/src/modules/EIP712/index.ts +409 -0
  74. package/src/utils.ts +42 -2
  75. package/tests/EIP712.unit.test.ts +760 -0
  76. package/tests/sample-messages/0.apdus +58 -0
  77. package/tests/sample-messages/0.json +44 -0
  78. package/tests/sample-messages/1.apdus +66 -0
  79. package/tests/sample-messages/1.json +50 -0
  80. package/tests/sample-messages/10.apdus +30 -0
  81. package/tests/sample-messages/10.json +23 -0
  82. package/tests/sample-messages/2.apdus +126 -0
  83. package/tests/sample-messages/2.json +153 -0
  84. package/tests/sample-messages/3.apdus +42 -0
  85. package/tests/sample-messages/3.json +31 -0
  86. package/tests/sample-messages/4.apdus +84 -0
  87. package/tests/sample-messages/4.json +110 -0
  88. package/tests/sample-messages/5.apdus +112 -0
  89. package/tests/sample-messages/5.json +92 -0
  90. package/tests/sample-messages/6.apdus +94 -0
  91. package/tests/sample-messages/6.json +78 -0
  92. package/tests/sample-messages/7.apdus +70 -0
  93. package/tests/sample-messages/7.json +55 -0
  94. package/tests/sample-messages/8.apdus +68 -0
  95. package/tests/sample-messages/8.json +50 -0
  96. package/tests/sample-messages/9.apdus +68 -0
  97. package/tests/sample-messages/9.json +50 -0
  98. package/LICENSE +0 -202
  99. package/lib-es/contracts.d.ts +0 -17
  100. package/lib-es/contracts.d.ts.map +0 -1
  101. package/lib-es/contracts.js +0 -103
  102. package/lib-es/contracts.js.map +0 -1
  103. package/lib-es/erc20.d.ts +0 -22
  104. package/lib-es/erc20.d.ts.map +0 -1
  105. package/lib-es/erc20.js +0 -64
  106. package/lib-es/erc20.js.map +0 -1
@@ -0,0 +1,68 @@
1
+ => e01a00000c454950373132446f6d61696e
2
+ <= 9000
3
+ => e01a00ff0605046e616d65
4
+ <= 9000
5
+ => e01a00ff09050776657273696f6e
6
+ <= 9000
7
+ => e01a00ff0a422007636861696e4964
8
+ <= 9000
9
+ => e01a00ff130311766572696679696e67436f6e7472616374
10
+ <= 9000
11
+ => e01a00000547726f7570
12
+ <= 9000
13
+ => e01a00ff0605046e616d65
14
+ <= 9000
15
+ => e01a00ff128006506572736f6e0100076d656d62657273
16
+ <= 9000
17
+ => e01a0000044d61696c
18
+ <= 9000
19
+ => e01a00ff0d0006506572736f6e0466726f6d
20
+ <= 9000
21
+ => e01a00ff0d8006506572736f6e010002746f
22
+ <= 9000
23
+ => e01a00ff0a0508636f6e74656e7473
24
+ <= 9000
25
+ => e01a000006506572736f6e
26
+ <= 9000
27
+ => e01a00ff0605046e616d65
28
+ <= 9000
29
+ => e01a00ff0b8301000777616c6c657473
30
+ <= 9000
31
+ => e01c00000c454950373132446f6d61696e
32
+ <= 9000
33
+ => e01c00ff0c000a4574686572204d61696c
34
+ <= 9000
35
+ => e01c00ff03000131
36
+ <= 9000
37
+ => e01c00ff03000105
38
+ <= 9000
39
+ => e01c00ff160014cccccccccccccccccccccccccccccccccccccccc
40
+ <= 9000
41
+ => e01c0000044d61696c
42
+ <= 9000
43
+ => e01c00ff050003436f77
44
+ <= 9000
45
+ => e01c000f0102
46
+ <= 9000
47
+ => e01c00ff160014cd2a3d9f938e13cd947ec05abc7fe734df8dd826
48
+ <= 9000
49
+ => e01c00ff160014deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
50
+ <= 9000
51
+ => e01c000f0101
52
+ <= 9000
53
+ => e01c00ff050003426f62
54
+ <= 9000
55
+ => e01c000f0103
56
+ <= 9000
57
+ => e01c00ff160014bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
58
+ <= 9000
59
+ => e01c00ff160014b0bdabea57b0bdabea57b0bdabea57b0bdabea57
60
+ <= 9000
61
+ => e01c00ff160014b0b0b0b0b0b0b000000000000000000000000000
62
+ <= 9000
63
+ => e01c01ffff014248656c6c6f2c20426f62212030313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536373830313233343536
64
+ <= 9000
65
+ => e01c00ff45373830313233343536373830313233343536373830313233343536373839393939393939393939393939393939393939393939393939393939393930313233343536373839
66
+ <= 9000
67
+ => e00c000115058000002c8000003c800000000000000000000000
68
+ <= 1cd6de64452d9a826ba639b736117d2a91ae04539577cb5a2a2445361ee9158034246339bfeba70f9dc2a9167b0da5169acc598797897d64cee52b3dbb998122cb9000
@@ -0,0 +1,50 @@
1
+ {
2
+ "domain": {
3
+ "chainId": 5,
4
+ "name": "Ether Mail",
5
+ "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
6
+ "version": "1"
7
+ },
8
+ "message": {
9
+ "contents": "Hello, Bob! 0123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456780123456789999999999999999999999999999990123456789",
10
+ "from": {
11
+ "name": "Cow",
12
+ "wallets": [
13
+ "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
14
+ "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"
15
+ ]
16
+ },
17
+ "to": [
18
+ {
19
+ "name": "Bob",
20
+ "wallets": [
21
+ "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
22
+ "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57",
23
+ "0xB0B0b0b0b0b0B000000000000000000000000000"
24
+ ]
25
+ }
26
+ ]
27
+ },
28
+ "primaryType": "Mail",
29
+ "types": {
30
+ "EIP712Domain": [
31
+ { "name": "name", "type": "string" },
32
+ { "name": "version", "type": "string" },
33
+ { "name": "chainId", "type": "uint256" },
34
+ { "name": "verifyingContract", "type": "address" }
35
+ ],
36
+ "Group": [
37
+ { "name": "name", "type": "string" },
38
+ { "name": "members", "type": "Person[]" }
39
+ ],
40
+ "Mail": [
41
+ { "name": "from", "type": "Person" },
42
+ { "name": "to", "type": "Person[]" },
43
+ { "name": "contents", "type": "string" }
44
+ ],
45
+ "Person": [
46
+ { "name": "name", "type": "string" },
47
+ { "name": "wallets", "type": "address[]" }
48
+ ]
49
+ }
50
+ }
@@ -0,0 +1,68 @@
1
+ => e01a00000c454950373132446f6d61696e
2
+ <= 9000
3
+ => e01a00ff0605046e616d65
4
+ <= 9000
5
+ => e01a00ff09050776657273696f6e
6
+ <= 9000
7
+ => e01a00ff0a422007636861696e4964
8
+ <= 9000
9
+ => e01a00ff130311766572696679696e67436f6e7472616374
10
+ <= 9000
11
+ => e01a00000547726f7570
12
+ <= 9000
13
+ => e01a00ff0605046e616d65
14
+ <= 9000
15
+ => e01a00ff128006506572736f6e0100076d656d62657273
16
+ <= 9000
17
+ => e01a0000044d61696c
18
+ <= 9000
19
+ => e01a00ff0d0006506572736f6e0466726f6d
20
+ <= 9000
21
+ => e01a00ff0d8006506572736f6e010002746f
22
+ <= 9000
23
+ => e01a00ff0a0708636f6e74656e7473
24
+ <= 9000
25
+ => e01a000006506572736f6e
26
+ <= 9000
27
+ => e01a00ff0605046e616d65
28
+ <= 9000
29
+ => e01a00ff0b8301000777616c6c657473
30
+ <= 9000
31
+ => e01c00000c454950373132446f6d61696e
32
+ <= 9000
33
+ => e01c00ff0c000a4574686572204d61696c
34
+ <= 9000
35
+ => e01c00ff03000131
36
+ <= 9000
37
+ => e01c00ff03000105
38
+ <= 9000
39
+ => e01c00ff160014cccccccccccccccccccccccccccccccccccccccc
40
+ <= 9000
41
+ => e01c0000044d61696c
42
+ <= 9000
43
+ => e01c00ff050003436f77
44
+ <= 9000
45
+ => e01c000f0102
46
+ <= 9000
47
+ => e01c00ff160014cd2a3d9f938e13cd947ec05abc7fe734df8dd826
48
+ <= 9000
49
+ => e01c00ff160014deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
50
+ <= 9000
51
+ => e01c000f0101
52
+ <= 9000
53
+ => e01c00ff050003426f62
54
+ <= 9000
55
+ => e01c000f0103
56
+ <= 9000
57
+ => e01c00ff160014bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
58
+ <= 9000
59
+ => e01c00ff160014b0bdabea57b0bdabea57b0bdabea57b0bdabea57
60
+ <= 9000
61
+ => e01c00ff160014b0b0b0b0b0b0b000000000000000000000000000
62
+ <= 9000
63
+ => e01c01ffff01a411234567891234567891234536789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789912345678923456789912345678923456789912345678923456789912345678923456789912345678923456789123456789234567891123456789123456789123453678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678991234567892345678991234567892345678991234567892345678
64
+ <= 9000
65
+ => e01c00ffa79912345678923456789912345678923456789123456789234567891123456789123456789123453678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678991234567892345678991234567892345678991234567892345678991234567892345678991234567892345678912345678923456789
66
+ <= 9000
67
+ => e00c000115058000002c8000003c800000000000000000000000
68
+ <= 1c6f5490a5f227b0a77eb59ebc9b51dad97759930a71692bb868b0b796245c57dd177634a3bada7e155beb1f79dc68bce7daf1a7931642a08aa2e82eb35c9546ec9000
@@ -0,0 +1,50 @@
1
+ {
2
+ "domain": {
3
+ "chainId": 5,
4
+ "name": "Ether Mail",
5
+ "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
6
+ "version": "1"
7
+ },
8
+ "message": {
9
+ "contents": "0x112345678912345678912345367891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567899123456789234567899123456789234567899123456789234567899123456789234567899123456789234567891234567892345678911234567891234567891234536789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789912345678923456789912345678923456789912345678923456789912345678923456789912345678923456789123456789234567891123456789123456789123453678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678991234567892345678991234567892345678991234567892345678991234567892345678991234567892345678912345678923456789",
10
+ "from": {
11
+ "name": "Cow",
12
+ "wallets": [
13
+ "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
14
+ "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"
15
+ ]
16
+ },
17
+ "to": [
18
+ {
19
+ "name": "Bob",
20
+ "wallets": [
21
+ "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
22
+ "0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57",
23
+ "0xB0B0b0b0b0b0B000000000000000000000000000"
24
+ ]
25
+ }
26
+ ]
27
+ },
28
+ "primaryType": "Mail",
29
+ "types": {
30
+ "EIP712Domain": [
31
+ { "name": "name", "type": "string" },
32
+ { "name": "version", "type": "string" },
33
+ { "name": "chainId", "type": "uint256" },
34
+ { "name": "verifyingContract", "type": "address" }
35
+ ],
36
+ "Group": [
37
+ { "name": "name", "type": "string" },
38
+ { "name": "members", "type": "Person[]" }
39
+ ],
40
+ "Mail": [
41
+ { "name": "from", "type": "Person" },
42
+ { "name": "to", "type": "Person[]" },
43
+ { "name": "contents", "type": "bytes" }
44
+ ],
45
+ "Person": [
46
+ { "name": "name", "type": "string" },
47
+ { "name": "wallets", "type": "address[]" }
48
+ ]
49
+ }
50
+ }
package/LICENSE DELETED
@@ -1,202 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "{}"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright {yyyy} {name of copyright owner}
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
202
-
@@ -1,17 +0,0 @@
1
- declare type ContractMethod = {
2
- payload: string;
3
- signature: string;
4
- plugin: string;
5
- erc20OfInterest: string[];
6
- abi: any;
7
- };
8
- export declare type PluginsLoadConfig = {
9
- baseURL?: string | null;
10
- extraPlugins?: any | null;
11
- };
12
- /**
13
- * Retrieve the metadatas a given contract address and a method selector
14
- */
15
- export declare const loadInfosForContractMethod: (contractAddress: string, selector: string, chainId: number, userPluginsLoadConfig: PluginsLoadConfig) => Promise<ContractMethod | undefined>;
16
- export {};
17
- //# sourceMappingURL=contracts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAEA,aAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAGF,oBAAY,iBAAiB,GAAG;IAG9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxB,YAAY,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3B,CAAC;AAOF;;GAEG;AACH,eAAO,MAAM,0BAA0B,oBACpB,MAAM,YACb,MAAM,WACP,MAAM,yBACQ,iBAAiB,KACvC,QAAQ,cAAc,GAAG,SAAS,CA2CpC,CAAC"}
@@ -1,103 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import axios from "axios";
49
- var defaultPluginsLoadConfig = {
50
- baseURL: "https://cdn.live.ledger.com",
51
- extraPlugins: null
52
- };
53
- /**
54
- * Retrieve the metadatas a given contract address and a method selector
55
- */
56
- export var loadInfosForContractMethod = function (contractAddress, selector, chainId, userPluginsLoadConfig) { return __awaiter(void 0, void 0, void 0, function () {
57
- var _a, baseURL, extraPlugins, data, _b, lcSelector, lcContractAddress, contractSelectors;
58
- return __generator(this, function (_c) {
59
- switch (_c.label) {
60
- case 0:
61
- _a = __assign(__assign({}, defaultPluginsLoadConfig), userPluginsLoadConfig), baseURL = _a.baseURL, extraPlugins = _a.extraPlugins;
62
- if (!!baseURL) return [3 /*break*/, 1];
63
- _b = {};
64
- return [3 /*break*/, 3];
65
- case 1: return [4 /*yield*/, axios
66
- .get(baseURL + "/plugins/ethereum.json")
67
- .then(function (r) { return r.data; })["catch"](function (e) {
68
- if (e.response &&
69
- 400 <= e.response.status &&
70
- e.response.status < 500) {
71
- return null; // not found cases can be ignored to allow future changes in endpoint without failing a signature to be done.
72
- }
73
- throw e;
74
- })];
75
- case 2:
76
- _b = _c.sent();
77
- _c.label = 3;
78
- case 3:
79
- data = _b;
80
- if (extraPlugins) {
81
- data = __assign(__assign({}, data), extraPlugins);
82
- }
83
- if (!data)
84
- return [2 /*return*/];
85
- lcSelector = selector.toLowerCase();
86
- lcContractAddress = contractAddress.toLowerCase();
87
- if (lcContractAddress in data) {
88
- contractSelectors = data[lcContractAddress];
89
- if (lcSelector in contractSelectors) {
90
- return [2 /*return*/, {
91
- payload: contractSelectors[lcSelector]["serialized_data"],
92
- signature: contractSelectors[lcSelector]["signature"],
93
- plugin: contractSelectors[lcSelector]["plugin"],
94
- erc20OfInterest: contractSelectors[lcSelector]["erc20OfInterest"],
95
- abi: contractSelectors["abi"]
96
- }];
97
- }
98
- }
99
- return [2 /*return*/];
100
- }
101
- });
102
- }); };
103
- //# sourceMappingURL=contracts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,IAAM,wBAAwB,GAAG;IAC/B,OAAO,EAAE,6BAA6B;IACtC,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,0BAA0B,GAAG,UACxC,eAAuB,EACvB,QAAgB,EAChB,OAAe,EACf,qBAAwC;;;;;gBAElC,2BACD,wBAAwB,GACxB,qBAAqB,CACzB,EAHO,OAAO,aAAA,EAAE,YAAY,kBAAA,CAG3B;qBACS,CAAC,OAAO,EAAR,wBAAQ;gBACf,KAAA,EAAE,CAAA;;oBACF,qBAAM,KAAK;qBACR,GAAG,CAAI,OAAO,2BAAwB,CAAC;qBACvC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,CACnB,OAAK,CAAA,CAAC,UAAC,CAAC;oBACP,IACE,CAAC,CAAC,QAAQ;wBACV,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM;wBACxB,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,EACvB;wBACA,OAAO,IAAI,CAAC,CAAC,6GAA6G;qBAC3H;oBACD,MAAM,CAAC,CAAC;gBACV,CAAC,CAAC,EAAA;;gBAZJ,KAAA,SAYI,CAAA;;;gBAdJ,IAAI,KAcA;gBAER,IAAI,YAAY,EAAE;oBAChB,IAAI,yBAAQ,IAAI,GAAK,YAAY,CAAE,CAAC;iBACrC;gBAED,IAAI,CAAC,IAAI;oBAAE,sBAAO;gBAEZ,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACpC,iBAAiB,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;gBAExD,IAAI,iBAAiB,IAAI,IAAI,EAAE;oBACvB,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC;oBAElD,IAAI,UAAU,IAAI,iBAAiB,EAAE;wBACnC,sBAAO;gCACL,OAAO,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC;gCACzD,SAAS,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC;gCACrD,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC;gCAC/C,eAAe,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC;gCACjE,GAAG,EAAE,iBAAiB,CAAC,KAAK,CAAC;6BAC9B,EAAC;qBACH;iBACF;;;;KACF,CAAC"}
package/lib-es/erc20.d.ts DELETED
@@ -1,22 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * Retrieve the token information by a given contract address if any
4
- */
5
- export declare const byContractAddressAndChainId: (contract: string, chainId: number) => TokenInfo | null | undefined;
6
- /**
7
- * list all the ERC20 tokens informations
8
- */
9
- export declare const list: () => TokenInfo[];
10
- export declare type TokenInfo = {
11
- contractAddress: string;
12
- ticker: string;
13
- decimals: number;
14
- chainId: number;
15
- signature: Buffer;
16
- data: Buffer;
17
- };
18
- export declare type API = {
19
- byContractAndChainId: (addr: string, id: number) => TokenInfo | null | undefined;
20
- list: () => TokenInfo[];
21
- };
22
- //# sourceMappingURL=erc20.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../src/erc20.ts"],"names":[],"mappings":";AAEA;;GAEG;AACH,eAAO,MAAM,2BAA2B,aAC5B,MAAM,WACP,MAAM,KACd,SAAS,GAAG,IAAI,GAAG,SAC4C,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,IAAI,QAAO,SAAS,EAAkB,CAAC;AACpD,oBAAY,SAAS,GAAG;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,oBAAY,GAAG,GAAG;IAChB,oBAAoB,EAAE,CACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,MAAM,SAAS,EAAE,CAAC;CACzB,CAAC"}
package/lib-es/erc20.js DELETED
@@ -1,64 +0,0 @@
1
- import blob from "@ledgerhq/cryptoassets/data/erc20-signatures";
2
- /**
3
- * Retrieve the token information by a given contract address if any
4
- */
5
- export var byContractAddressAndChainId = function (contract, chainId) {
6
- return get().byContractAndChainId(asContractAddress(contract), chainId);
7
- };
8
- /**
9
- * list all the ERC20 tokens informations
10
- */
11
- export var list = function () { return get().list(); };
12
- var asContractAddress = function (addr) {
13
- var a = addr.toLowerCase();
14
- return a.startsWith("0x") ? a : "0x" + a;
15
- };
16
- // this internal get() will lazy load and cache the data from the erc20 data blob
17
- var get = (function () {
18
- var cache;
19
- return function () {
20
- if (cache)
21
- return cache;
22
- var buf = Buffer.from(blob, "base64");
23
- var map = {};
24
- var entries = [];
25
- var i = 0;
26
- while (i < buf.length) {
27
- var length_1 = buf.readUInt32BE(i);
28
- i += 4;
29
- var item = buf.slice(i, i + length_1);
30
- var j = 0;
31
- var tickerLength = item.readUInt8(j);
32
- j += 1;
33
- var ticker = item.slice(j, j + tickerLength).toString("ascii");
34
- j += tickerLength;
35
- var contractAddress = asContractAddress(item.slice(j, j + 20).toString("hex"));
36
- j += 20;
37
- var decimals = item.readUInt32BE(j);
38
- j += 4;
39
- var chainId = item.readUInt32BE(j);
40
- j += 4;
41
- var signature = item.slice(j);
42
- var entry = {
43
- ticker: ticker,
44
- contractAddress: contractAddress,
45
- decimals: decimals,
46
- chainId: chainId,
47
- signature: signature,
48
- data: item
49
- };
50
- entries.push(entry);
51
- map[String(chainId) + ":" + contractAddress] = entry;
52
- i += length_1;
53
- }
54
- var api = {
55
- list: function () { return entries; },
56
- byContractAndChainId: function (contractAddress, chainId) {
57
- return map[String(chainId) + ":" + contractAddress];
58
- }
59
- };
60
- cache = api;
61
- return api;
62
- };
63
- })();
64
- //# sourceMappingURL=erc20.js.map