@cardano-sdk/dapp-connector 0.6.0-nightly.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 (128) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.md +9 -0
  4. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.d.ts +19 -0
  5. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.d.ts.map +1 -0
  6. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.js +85 -0
  7. package/dist/cjs/AuthenticatorApi/PersistentAuthenticator.js.map +1 -0
  8. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts +8 -0
  9. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts.map +1 -0
  10. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.js +16 -0
  11. package/dist/cjs/AuthenticatorApi/PersistentAuthenticatorStorage.js.map +1 -0
  12. package/dist/cjs/AuthenticatorApi/index.d.ts +4 -0
  13. package/dist/cjs/AuthenticatorApi/index.d.ts.map +1 -0
  14. package/dist/cjs/AuthenticatorApi/index.js +20 -0
  15. package/dist/cjs/AuthenticatorApi/index.js.map +1 -0
  16. package/dist/cjs/AuthenticatorApi/types.d.ts +20 -0
  17. package/dist/cjs/AuthenticatorApi/types.d.ts.map +1 -0
  18. package/dist/cjs/AuthenticatorApi/types.js +3 -0
  19. package/dist/cjs/AuthenticatorApi/types.js.map +1 -0
  20. package/dist/cjs/WalletApi/Cip30Wallet.d.ts +26 -0
  21. package/dist/cjs/WalletApi/Cip30Wallet.d.ts.map +1 -0
  22. package/dist/cjs/WalletApi/Cip30Wallet.js +58 -0
  23. package/dist/cjs/WalletApi/Cip30Wallet.js.map +1 -0
  24. package/dist/cjs/WalletApi/index.d.ts +3 -0
  25. package/dist/cjs/WalletApi/index.d.ts.map +1 -0
  26. package/dist/cjs/WalletApi/index.js +19 -0
  27. package/dist/cjs/WalletApi/index.js.map +1 -0
  28. package/dist/cjs/WalletApi/types.d.ts +42 -0
  29. package/dist/cjs/WalletApi/types.d.ts.map +1 -0
  30. package/dist/cjs/WalletApi/types.js +3 -0
  31. package/dist/cjs/WalletApi/types.js.map +1 -0
  32. package/dist/cjs/errors/ApiError.d.ts +12 -0
  33. package/dist/cjs/errors/ApiError.d.ts.map +1 -0
  34. package/dist/cjs/errors/ApiError.js +19 -0
  35. package/dist/cjs/errors/ApiError.js.map +1 -0
  36. package/dist/cjs/errors/DataSignError.d.ts +13 -0
  37. package/dist/cjs/errors/DataSignError.d.ts.map +1 -0
  38. package/dist/cjs/errors/DataSignError.js +20 -0
  39. package/dist/cjs/errors/DataSignError.js.map +1 -0
  40. package/dist/cjs/errors/PaginateError.d.ts +6 -0
  41. package/dist/cjs/errors/PaginateError.d.ts.map +1 -0
  42. package/dist/cjs/errors/PaginateError.js +13 -0
  43. package/dist/cjs/errors/PaginateError.js.map +1 -0
  44. package/dist/cjs/errors/TxSendError.d.ts +11 -0
  45. package/dist/cjs/errors/TxSendError.d.ts.map +1 -0
  46. package/dist/cjs/errors/TxSendError.js +18 -0
  47. package/dist/cjs/errors/TxSendError.js.map +1 -0
  48. package/dist/cjs/errors/TxSignError.d.ts +11 -0
  49. package/dist/cjs/errors/TxSignError.d.ts.map +1 -0
  50. package/dist/cjs/errors/TxSignError.js +18 -0
  51. package/dist/cjs/errors/TxSignError.js.map +1 -0
  52. package/dist/cjs/errors/index.d.ts +6 -0
  53. package/dist/cjs/errors/index.d.ts.map +1 -0
  54. package/dist/cjs/errors/index.js +22 -0
  55. package/dist/cjs/errors/index.js.map +1 -0
  56. package/dist/cjs/index.d.ts +5 -0
  57. package/dist/cjs/index.d.ts.map +1 -0
  58. package/dist/cjs/index.js +21 -0
  59. package/dist/cjs/index.js.map +1 -0
  60. package/dist/cjs/injectGlobal.d.ts +9 -0
  61. package/dist/cjs/injectGlobal.d.ts.map +1 -0
  62. package/dist/cjs/injectGlobal.js +26 -0
  63. package/dist/cjs/injectGlobal.js.map +1 -0
  64. package/dist/cjs/package.json +3 -0
  65. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  66. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.d.ts +19 -0
  67. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.d.ts.map +1 -0
  68. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.js +81 -0
  69. package/dist/esm/AuthenticatorApi/PersistentAuthenticator.js.map +1 -0
  70. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts +8 -0
  71. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.d.ts.map +1 -0
  72. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.js +12 -0
  73. package/dist/esm/AuthenticatorApi/PersistentAuthenticatorStorage.js.map +1 -0
  74. package/dist/esm/AuthenticatorApi/index.d.ts +4 -0
  75. package/dist/esm/AuthenticatorApi/index.d.ts.map +1 -0
  76. package/dist/esm/AuthenticatorApi/index.js +4 -0
  77. package/dist/esm/AuthenticatorApi/index.js.map +1 -0
  78. package/dist/esm/AuthenticatorApi/types.d.ts +20 -0
  79. package/dist/esm/AuthenticatorApi/types.d.ts.map +1 -0
  80. package/dist/esm/AuthenticatorApi/types.js +2 -0
  81. package/dist/esm/AuthenticatorApi/types.js.map +1 -0
  82. package/dist/esm/WalletApi/Cip30Wallet.d.ts +26 -0
  83. package/dist/esm/WalletApi/Cip30Wallet.d.ts.map +1 -0
  84. package/dist/esm/WalletApi/Cip30Wallet.js +54 -0
  85. package/dist/esm/WalletApi/Cip30Wallet.js.map +1 -0
  86. package/dist/esm/WalletApi/index.d.ts +3 -0
  87. package/dist/esm/WalletApi/index.d.ts.map +1 -0
  88. package/dist/esm/WalletApi/index.js +3 -0
  89. package/dist/esm/WalletApi/index.js.map +1 -0
  90. package/dist/esm/WalletApi/types.d.ts +42 -0
  91. package/dist/esm/WalletApi/types.d.ts.map +1 -0
  92. package/dist/esm/WalletApi/types.js +2 -0
  93. package/dist/esm/WalletApi/types.js.map +1 -0
  94. package/dist/esm/errors/ApiError.d.ts +12 -0
  95. package/dist/esm/errors/ApiError.d.ts.map +1 -0
  96. package/dist/esm/errors/ApiError.js +15 -0
  97. package/dist/esm/errors/ApiError.js.map +1 -0
  98. package/dist/esm/errors/DataSignError.d.ts +13 -0
  99. package/dist/esm/errors/DataSignError.d.ts.map +1 -0
  100. package/dist/esm/errors/DataSignError.js +16 -0
  101. package/dist/esm/errors/DataSignError.js.map +1 -0
  102. package/dist/esm/errors/PaginateError.d.ts +6 -0
  103. package/dist/esm/errors/PaginateError.d.ts.map +1 -0
  104. package/dist/esm/errors/PaginateError.js +9 -0
  105. package/dist/esm/errors/PaginateError.js.map +1 -0
  106. package/dist/esm/errors/TxSendError.d.ts +11 -0
  107. package/dist/esm/errors/TxSendError.d.ts.map +1 -0
  108. package/dist/esm/errors/TxSendError.js +14 -0
  109. package/dist/esm/errors/TxSendError.js.map +1 -0
  110. package/dist/esm/errors/TxSignError.d.ts +11 -0
  111. package/dist/esm/errors/TxSignError.d.ts.map +1 -0
  112. package/dist/esm/errors/TxSignError.js +14 -0
  113. package/dist/esm/errors/TxSignError.js.map +1 -0
  114. package/dist/esm/errors/index.d.ts +6 -0
  115. package/dist/esm/errors/index.d.ts.map +1 -0
  116. package/dist/esm/errors/index.js +6 -0
  117. package/dist/esm/errors/index.js.map +1 -0
  118. package/dist/esm/index.d.ts +5 -0
  119. package/dist/esm/index.d.ts.map +1 -0
  120. package/dist/esm/index.js +5 -0
  121. package/dist/esm/index.js.map +1 -0
  122. package/dist/esm/injectGlobal.d.ts +9 -0
  123. package/dist/esm/injectGlobal.d.ts.map +1 -0
  124. package/dist/esm/injectGlobal.js +22 -0
  125. package/dist/esm/injectGlobal.js.map +1 -0
  126. package/dist/esm/package.json +3 -0
  127. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  128. package/package.json +79 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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 © 2021 IOHK
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.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ Copyright 2021 IOHK
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License”). You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.txt
4
+
5
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # Cardano JS SDK | Dapp Connector | CIP30
2
+ This package implements concepts from the draft specification being developed in [CIP-0030]. The
3
+ package defines TypeScript types and interfaces, as well as utilities to implement allow list
4
+ persistence and set up web extension messaging.
5
+
6
+ See [example web extension].
7
+
8
+ [example web extension]: ../web-extension/e2e/extension
9
+ [CIP-0030]: https://github.com/cardano-foundation/CIPs/pull/88
@@ -0,0 +1,19 @@
1
+ import { AuthenticatorApi, Origin, RequestAccess } from './types';
2
+ import { Logger } from 'ts-log';
3
+ import { PersistentAuthenticatorStorage } from './PersistentAuthenticatorStorage';
4
+ export interface PersistentAuhenticatorOptions {
5
+ requestAccess: RequestAccess;
6
+ }
7
+ export interface PersistentAuthenticatorDependencies {
8
+ storage: PersistentAuthenticatorStorage;
9
+ logger: Logger;
10
+ }
11
+ export declare class PersistentAuthenticator implements AuthenticatorApi {
12
+ #private;
13
+ constructor({ requestAccess }: PersistentAuhenticatorOptions, { logger, storage }: PersistentAuthenticatorDependencies);
14
+ requestAccess(origin: Origin): Promise<boolean>;
15
+ revokeAccess(origin: Origin): Promise<boolean>;
16
+ haveAccess(origin: Origin): Promise<boolean>;
17
+ clear(): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=PersistentAuthenticator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentAuthenticator.d.ts","sourceRoot":"","sources":["../../../src/AuthenticatorApi/PersistentAuthenticator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,MAAM,WAAW,6BAA6B;IAC5C,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,mCAAmC;IAClD,OAAO,EAAE,8BAA8B,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,uBAAwB,YAAW,gBAAgB;;gBAY5D,EAAE,aAAa,EAAE,EAAE,6BAA6B,EAChD,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mCAAmC;IAQpD,aAAa,CAAC,MAAM,EAAE,MAAM;IAoB5B,YAAY,CAAC,MAAM,EAAE,MAAM;IAe3B,UAAU,CAAC,MAAM,EAAE,MAAM;IAMzB,KAAK;CAcZ"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _PersistentAuthenticator_instances, _PersistentAuthenticator_requestAccess, _PersistentAuthenticator_storage, _PersistentAuthenticator_logger, _PersistentAuthenticator_originsReady, _PersistentAuthenticator_store;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PersistentAuthenticator = void 0;
16
+ class PersistentAuthenticator {
17
+ constructor({ requestAccess }, { logger, storage }) {
18
+ _PersistentAuthenticator_instances.add(this);
19
+ _PersistentAuthenticator_requestAccess.set(this, void 0);
20
+ _PersistentAuthenticator_storage.set(this, void 0);
21
+ _PersistentAuthenticator_logger.set(this, void 0);
22
+ _PersistentAuthenticator_originsReady.set(this, void 0);
23
+ __classPrivateFieldSet(this, _PersistentAuthenticator_requestAccess, requestAccess, "f");
24
+ __classPrivateFieldSet(this, _PersistentAuthenticator_storage, storage, "f");
25
+ __classPrivateFieldSet(this, _PersistentAuthenticator_logger, logger, "f");
26
+ __classPrivateFieldSet(this, _PersistentAuthenticator_originsReady, storage.get(), "f");
27
+ }
28
+ async requestAccess(origin) {
29
+ const origins = await __classPrivateFieldGet(this, _PersistentAuthenticator_originsReady, "f");
30
+ if (origins.includes(origin)) {
31
+ return true;
32
+ }
33
+ try {
34
+ const accessGranted = await __classPrivateFieldGet(this, _PersistentAuthenticator_requestAccess, "f").call(this, origin);
35
+ if (accessGranted) {
36
+ const newOrigins = [...origins, origin];
37
+ if (await __classPrivateFieldGet(this, _PersistentAuthenticator_instances, "m", _PersistentAuthenticator_store).call(this, newOrigins)) {
38
+ __classPrivateFieldGet(this, _PersistentAuthenticator_logger, "f").info('[Authenticator] added', origin);
39
+ return true;
40
+ }
41
+ }
42
+ }
43
+ catch (error) {
44
+ __classPrivateFieldGet(this, _PersistentAuthenticator_logger, "f").error('[Authenticator] requestAccess failed', error);
45
+ }
46
+ return false;
47
+ }
48
+ async revokeAccess(origin) {
49
+ const origins = await __classPrivateFieldGet(this, _PersistentAuthenticator_originsReady, "f");
50
+ const idx = origins.indexOf(origin);
51
+ if (idx >= 0) {
52
+ const newOrigins = [...origins.slice(0, idx), ...origins.slice(idx + 1)];
53
+ if (await __classPrivateFieldGet(this, _PersistentAuthenticator_instances, "m", _PersistentAuthenticator_store).call(this, newOrigins)) {
54
+ __classPrivateFieldGet(this, _PersistentAuthenticator_logger, "f").info('[Authenticator] revoked access for', origin);
55
+ return true;
56
+ }
57
+ }
58
+ else {
59
+ __classPrivateFieldGet(this, _PersistentAuthenticator_logger, "f").warn('[Authenticator] attempted to revoke access for unknown origin', origin);
60
+ }
61
+ return false;
62
+ }
63
+ async haveAccess(origin) {
64
+ if (!origin)
65
+ return false;
66
+ const origins = await __classPrivateFieldGet(this, _PersistentAuthenticator_originsReady, "f");
67
+ return origins.includes(origin);
68
+ }
69
+ async clear() {
70
+ await __classPrivateFieldGet(this, _PersistentAuthenticator_instances, "m", _PersistentAuthenticator_store).call(this, []);
71
+ }
72
+ }
73
+ exports.PersistentAuthenticator = PersistentAuthenticator;
74
+ _PersistentAuthenticator_requestAccess = new WeakMap(), _PersistentAuthenticator_storage = new WeakMap(), _PersistentAuthenticator_logger = new WeakMap(), _PersistentAuthenticator_originsReady = new WeakMap(), _PersistentAuthenticator_instances = new WeakSet(), _PersistentAuthenticator_store = async function _PersistentAuthenticator_store(origins) {
75
+ try {
76
+ await __classPrivateFieldGet(this, _PersistentAuthenticator_storage, "f").set(origins);
77
+ __classPrivateFieldSet(this, _PersistentAuthenticator_originsReady, Promise.resolve(origins), "f");
78
+ return true;
79
+ }
80
+ catch (error) {
81
+ __classPrivateFieldGet(this, _PersistentAuthenticator_logger, "f").error('[Authenticator] storage.set failed', error);
82
+ return false;
83
+ }
84
+ };
85
+ //# sourceMappingURL=PersistentAuthenticator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentAuthenticator.js","sourceRoot":"","sources":["../../../src/AuthenticatorApi/PersistentAuthenticator.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ import { Origin } from './types';
2
+ import { Storage } from 'webextension-polyfill';
3
+ export declare type PersistentAuthenticatorStorage = {
4
+ get(): Promise<Origin[]>;
5
+ set(origins: Origin[]): Promise<void>;
6
+ };
7
+ export declare const createPersistentAuthenticatorStorage: (storageKey: string, store: Storage.StorageArea) => PersistentAuthenticatorStorage;
8
+ //# sourceMappingURL=PersistentAuthenticatorStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentAuthenticatorStorage.d.ts","sourceRoot":"","sources":["../../../src/AuthenticatorApi/PersistentAuthenticatorStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,oBAAY,8BAA8B,GAAG;IAC3C,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACzB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,oCAAoC,eACnC,MAAM,SACX,QAAQ,WAAW,KACzB,8BAUD,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPersistentAuthenticatorStorage = void 0;
4
+ const createPersistentAuthenticatorStorage = (storageKey, store) => ({
5
+ async get() {
6
+ const objects = await store.get(storageKey);
7
+ return objects?.[storageKey] || [];
8
+ },
9
+ async set(origins) {
10
+ await store.set({
11
+ [storageKey]: origins
12
+ });
13
+ }
14
+ });
15
+ exports.createPersistentAuthenticatorStorage = createPersistentAuthenticatorStorage;
16
+ //# sourceMappingURL=PersistentAuthenticatorStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentAuthenticatorStorage.js","sourceRoot":"","sources":["../../../src/AuthenticatorApi/PersistentAuthenticatorStorage.ts"],"names":[],"mappings":";;;AAQO,MAAM,oCAAoC,GAAG,CAClD,UAAkB,EAClB,KAA0B,EACM,EAAE,CAAC,CAAC;IACpC,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACrC,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,OAAiB;QACzB,MAAM,KAAK,CAAC,GAAG,CAAC;YACd,CAAC,UAAU,CAAC,EAAE,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAbU,QAAA,oCAAoC,wCAa9C"}
@@ -0,0 +1,4 @@
1
+ export * from './PersistentAuthenticator';
2
+ export * from './PersistentAuthenticatorStorage';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AuthenticatorApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./PersistentAuthenticator"), exports);
18
+ __exportStar(require("./PersistentAuthenticatorStorage"), exports);
19
+ __exportStar(require("./types"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/AuthenticatorApi/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,mEAAiD;AACjD,0CAAwB"}
@@ -0,0 +1,20 @@
1
+ export declare type Origin = string;
2
+ export declare type RequestAccess = (origin: Origin) => Promise<boolean>;
3
+ export declare type RevokeAccess = RequestAccess;
4
+ export declare type HaveAccess = RequestAccess;
5
+ export interface AuthenticatorApi {
6
+ requestAccess: RequestAccess;
7
+ revokeAccess: RevokeAccess;
8
+ haveAccess: HaveAccess;
9
+ }
10
+ declare type RemoteRequestAccess = () => Promise<boolean>;
11
+ declare type RemoteRevokeAccess = RemoteRequestAccess;
12
+ declare type RemoteHaveAccess = RemoteRequestAccess;
13
+ export interface RemoteAuthenticator {
14
+ requestAccess: RemoteRequestAccess;
15
+ revokeAccess: RemoteRevokeAccess;
16
+ haveAccess: RemoteHaveAccess;
17
+ }
18
+ export declare type RemoteAuthenticatorMethod = keyof RemoteAuthenticator;
19
+ export {};
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/AuthenticatorApi/types.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM,GAAG,MAAM,CAAC;AAO5B,oBAAY,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AACjE,oBAAY,YAAY,GAAG,aAAa,CAAC;AACzC,oBAAY,UAAU,GAAG,aAAa,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,aAAK,mBAAmB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAClD,aAAK,kBAAkB,GAAG,mBAAmB,CAAC;AAC9C,aAAK,gBAAgB,GAAG,mBAAmB,CAAC;AAQ5C,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED,oBAAY,yBAAyB,GAAG,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/AuthenticatorApi/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { Logger } from 'ts-log';
2
+ import { RemoteAuthenticator } from '../AuthenticatorApi';
3
+ import { WalletApi } from './types';
4
+ export declare type ApiVersion = string;
5
+ export declare type WalletName = string;
6
+ export declare type WalletIcon = string;
7
+ export declare type WalletProperties = {
8
+ icon: WalletIcon;
9
+ walletName: WalletName;
10
+ };
11
+ export declare type WalletDependencies = {
12
+ logger: Logger;
13
+ authenticator: RemoteAuthenticator;
14
+ api: WalletApi;
15
+ };
16
+ export declare class Cip30Wallet {
17
+ #private;
18
+ readonly apiVersion: ApiVersion;
19
+ readonly name: WalletName;
20
+ readonly icon: WalletIcon;
21
+ constructor(properties: WalletProperties, { api, authenticator, logger }: WalletDependencies);
22
+ isEnabled(): Promise<Boolean>;
23
+ enable(): Promise<WalletApi>;
24
+ }
25
+ export declare const WalletApiMethodNames: (keyof WalletApi)[];
26
+ //# sourceMappingURL=Cip30Wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cip30Wallet.d.ts","sourceRoot":"","sources":["../../../src/WalletApi/Cip30Wallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKpC,oBAAY,UAAU,GAAG,MAAM,CAAC;AAKhC,oBAAY,UAAU,GAAG,MAAM,CAAC;AAOhC,oBAAY,UAAU,GAAG,MAAM,CAAC;AAEhC,oBAAY,gBAAgB,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAE5E,oBAAY,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,mBAAmB,CAAC;IACnC,GAAG,EAAE,SAAS,CAAC;CAChB,CAAC;AAKF,qBAAa,WAAW;;IACtB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAW;IAC1C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;gBAMd,UAAU,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,kBAAkB;IAmB/E,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAmB7B,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC;CAS1C;AAED,eAAO,MAAM,oBAAoB,EAAE,CAAC,MAAM,SAAS,CAAC,EAYnD,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _Cip30Wallet_logger, _Cip30Wallet_api, _Cip30Wallet_authenticator;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.WalletApiMethodNames = exports.Cip30Wallet = void 0;
16
+ const errors_1 = require("../errors");
17
+ class Cip30Wallet {
18
+ constructor(properties, { api, authenticator, logger }) {
19
+ this.apiVersion = '0.1.0';
20
+ _Cip30Wallet_logger.set(this, void 0);
21
+ _Cip30Wallet_api.set(this, void 0);
22
+ _Cip30Wallet_authenticator.set(this, void 0);
23
+ this.enable = this.enable.bind(this);
24
+ this.icon = properties.icon;
25
+ this.isEnabled = this.isEnabled.bind(this);
26
+ this.name = properties.walletName;
27
+ __classPrivateFieldSet(this, _Cip30Wallet_api, api, "f");
28
+ __classPrivateFieldSet(this, _Cip30Wallet_logger, logger, "f");
29
+ __classPrivateFieldSet(this, _Cip30Wallet_authenticator, authenticator, "f");
30
+ }
31
+ async isEnabled() {
32
+ return __classPrivateFieldGet(this, _Cip30Wallet_authenticator, "f").haveAccess();
33
+ }
34
+ async enable() {
35
+ if (await __classPrivateFieldGet(this, _Cip30Wallet_authenticator, "f").requestAccess()) {
36
+ __classPrivateFieldGet(this, _Cip30Wallet_logger, "f").debug(`${location.origin} has been granted access to wallet api`);
37
+ return __classPrivateFieldGet(this, _Cip30Wallet_api, "f");
38
+ }
39
+ __classPrivateFieldGet(this, _Cip30Wallet_logger, "f").debug(`${location.origin} not authorized to access wallet api`);
40
+ throw new errors_1.ApiError(errors_1.APIErrorCode.Refused, 'wallet not authorized.');
41
+ }
42
+ }
43
+ exports.Cip30Wallet = Cip30Wallet;
44
+ _Cip30Wallet_logger = new WeakMap(), _Cip30Wallet_api = new WeakMap(), _Cip30Wallet_authenticator = new WeakMap();
45
+ exports.WalletApiMethodNames = [
46
+ 'getNetworkId',
47
+ 'getUtxos',
48
+ 'getCollateral',
49
+ 'getBalance',
50
+ 'getUsedAddresses',
51
+ 'getUnusedAddresses',
52
+ 'getChangeAddress',
53
+ 'getRewardAddresses',
54
+ 'signTx',
55
+ 'signData',
56
+ 'submitTx'
57
+ ];
58
+ //# sourceMappingURL=Cip30Wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cip30Wallet.js","sourceRoot":"","sources":["../../../src/WalletApi/Cip30Wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAmD;AAiCnD,MAAa,WAAW;IAStB,YAAY,UAA4B,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAsB;QARnF,eAAU,GAAe,OAAO,CAAC;QAI1C,sCAAyB;QACzB,mCAAyB;QACzB,6CAA6C;QAG3C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC;QAClC,uBAAA,IAAI,oBAAQ,GAAG,MAAA,CAAC;QAChB,uBAAA,IAAI,uBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,8BAAkB,aAAa,MAAA,CAAC;IACtC,CAAC;IAWM,KAAK,CAAC,SAAS;QACpB,OAAO,uBAAA,IAAI,kCAAe,CAAC,UAAU,EAAE,CAAC;IAC1C,CAAC;IAiBM,KAAK,CAAC,MAAM;QACjB,IAAI,MAAM,uBAAA,IAAI,kCAAe,CAAC,aAAa,EAAE,EAAE;YAC7C,uBAAA,IAAI,2BAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,wCAAwC,CAAC,CAAC;YAC/E,OAAO,uBAAA,IAAI,wBAAK,CAAC;SAClB;QAED,uBAAA,IAAI,2BAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,sCAAsC,CAAC,CAAC;QAC7E,MAAM,IAAI,iBAAQ,CAAC,qBAAY,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;IACrE,CAAC;CACF;AAxDD,kCAwDC;;AAEY,QAAA,oBAAoB,GAAwB;IACvD,cAAc;IACd,UAAU;IACV,eAAe;IACf,YAAY;IACZ,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;IAClB,oBAAoB;IACpB,QAAQ;IACR,UAAU;IACV,UAAU;CACX,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './Cip30Wallet';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/WalletApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Cip30Wallet"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/WalletApi/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,0CAAwB"}
@@ -0,0 +1,42 @@
1
+ import { Cardano } from '@cardano-sdk/core';
2
+ export declare type Bytes = string;
3
+ export declare type Cbor = string;
4
+ export declare type Paginate = {
5
+ page: number;
6
+ limit: number;
7
+ };
8
+ declare type CoseSign1CborHex = Cardano.util.HexBlob;
9
+ declare type CoseKeyCborHex = Cardano.util.HexBlob;
10
+ export interface Cip30DataSignature {
11
+ key: CoseKeyCborHex;
12
+ signature: CoseSign1CborHex;
13
+ }
14
+ export declare type GetNetworkId = () => Promise<Cardano.NetworkId>;
15
+ export declare type GetUtxos = (amount?: Cbor, paginate?: Paginate) => Promise<Cbor[] | undefined>;
16
+ export declare type GetCollateral = (params?: {
17
+ amount?: Cbor;
18
+ }) => Promise<Cbor[] | null>;
19
+ export declare type GetBalance = () => Promise<Cbor>;
20
+ export declare type GetUsedAddresses = (paginate?: Paginate) => Promise<Cbor[]>;
21
+ export declare type GetUnusedAddresses = () => Promise<Cbor[]>;
22
+ export declare type GetChangeAddress = () => Promise<Cbor>;
23
+ export declare type GetRewardAddresses = () => Promise<Cbor[]>;
24
+ export declare type SignTx = (tx: Cbor, partialSign?: Boolean) => Promise<Cbor>;
25
+ export declare type SignData = (addr: Cardano.Address, payload: Bytes) => Promise<Cip30DataSignature>;
26
+ export declare type SubmitTx = (tx: Cbor) => Promise<string>;
27
+ export interface WalletApi {
28
+ getNetworkId: GetNetworkId;
29
+ getUtxos: GetUtxos;
30
+ getBalance: GetBalance;
31
+ getCollateral: GetCollateral;
32
+ getUsedAddresses: GetUsedAddresses;
33
+ getUnusedAddresses: GetUnusedAddresses;
34
+ getChangeAddress: GetChangeAddress;
35
+ getRewardAddresses: GetRewardAddresses;
36
+ signTx: SignTx;
37
+ signData: SignData;
38
+ submitTx: SubmitTx;
39
+ }
40
+ export declare type WalletMethod = keyof WalletApi;
41
+ export {};
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/WalletApi/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C,oBAAY,KAAK,GAAG,MAAM,CAAC;AAO3B,oBAAY,IAAI,GAAG,MAAM,CAAC;AAO1B,oBAAY,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAMvD,aAAK,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AAC7C,aAAK,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,cAAc,CAAC;IACpB,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAWD,oBAAY,YAAY,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAc5D,oBAAY,QAAQ,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC;AAS3F,oBAAY,aAAa,GAAG,CAAC,MAAM,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAWnF,oBAAY,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAU7C,oBAAY,gBAAgB,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAOxE,oBAAY,kBAAkB,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAUvD,oBAAY,gBAAgB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAOnD,oBAAY,kBAAkB,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAqBvD,oBAAY,MAAM,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAcxE,oBAAY,QAAQ,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAa9F,oBAAY,QAAQ,GAAG,CAAC,EAAE,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,YAAY,CAAC;IAE3B,QAAQ,EAAE,QAAQ,CAAC;IAEnB,UAAU,EAAE,UAAU,CAAC;IAEvB,aAAa,EAAE,aAAa,CAAC;IAE7B,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,QAAQ,CAAC;IAEnB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,oBAAY,YAAY,GAAG,MAAM,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/WalletApi/types.ts"],"names":[],"mappings":""}