@nockchain/rose 0.1.4-nightly.5

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 (205) hide show
  1. package/.github/workflows/artifacts.yml +33 -0
  2. package/.github/workflows/ci.yml +68 -0
  3. package/.github/workflows/publish-sdk.yml +35 -0
  4. package/.nvmrc +1 -0
  5. package/.prettierignore +5 -0
  6. package/.prettierrc +8 -0
  7. package/LICENSE +22 -0
  8. package/README.md +117 -0
  9. package/extension/background/index.ts +1500 -0
  10. package/extension/content/index.ts +59 -0
  11. package/extension/icons/rose.svg +27 -0
  12. package/extension/icons/rose128.png +0 -0
  13. package/extension/icons/rose16.png +0 -0
  14. package/extension/icons/rose256.png +0 -0
  15. package/extension/icons/rose32.png +0 -0
  16. package/extension/icons/rose48.png +0 -0
  17. package/extension/icons/rose512.png +0 -0
  18. package/extension/inpage/index.ts +86 -0
  19. package/extension/manifest.json +48 -0
  20. package/extension/popup/Popup.tsx +94 -0
  21. package/extension/popup/Router.tsx +121 -0
  22. package/extension/popup/assets/arrow-down-icon.svg +3 -0
  23. package/extension/popup/assets/arrow-left-icon.svg +3 -0
  24. package/extension/popup/assets/arrow-right-icon.svg +3 -0
  25. package/extension/popup/assets/arrow-up-icon.svg +3 -0
  26. package/extension/popup/assets/arrow-up-right-icon.svg +3 -0
  27. package/extension/popup/assets/checkmark-icon.svg +3 -0
  28. package/extension/popup/assets/checkmark-pencil-icon.svg +3 -0
  29. package/extension/popup/assets/checkmark-success-icon.svg +3 -0
  30. package/extension/popup/assets/clock-icon.svg +3 -0
  31. package/extension/popup/assets/close-x-icon.svg +3 -0
  32. package/extension/popup/assets/copy-icon.svg +6 -0
  33. package/extension/popup/assets/explorer-icon.svg +3 -0
  34. package/extension/popup/assets/eye-off-icon.svg +3 -0
  35. package/extension/popup/assets/eye-open-icon.svg +4 -0
  36. package/extension/popup/assets/feedback-icon.svg +3 -0
  37. package/extension/popup/assets/green-status-dot.svg +3 -0
  38. package/extension/popup/assets/info-icon.svg +3 -0
  39. package/extension/popup/assets/iris-logo-40.svg +27 -0
  40. package/extension/popup/assets/iris-logo-96.svg +27 -0
  41. package/extension/popup/assets/iris-logo-blue.svg +27 -0
  42. package/extension/popup/assets/iris-logo-no-eye.svg +27 -0
  43. package/extension/popup/assets/iris-logo-orange.svg +27 -0
  44. package/extension/popup/assets/iris-logo.svg +27 -0
  45. package/extension/popup/assets/key-icon.svg +3 -0
  46. package/extension/popup/assets/lock-icon-yellow.svg +3 -0
  47. package/extension/popup/assets/lock-icon.svg +3 -0
  48. package/extension/popup/assets/pencil-edit-icon.svg +3 -0
  49. package/extension/popup/assets/permissions-icon.svg +3 -0
  50. package/extension/popup/assets/receipt-icon.svg +5 -0
  51. package/extension/popup/assets/refresh-icon.svg +3 -0
  52. package/extension/popup/assets/settings-gear-icon.svg +8 -0
  53. package/extension/popup/assets/settings-icon.svg +3 -0
  54. package/extension/popup/assets/theme-icon.svg +3 -0
  55. package/extension/popup/assets/trash-bin-icon.svg +3 -0
  56. package/extension/popup/assets/trend-down-arrow.svg +5 -0
  57. package/extension/popup/assets/trend-up-arrow.svg +5 -0
  58. package/extension/popup/assets/user-account-icon.svg +3 -0
  59. package/extension/popup/assets/vector-bottom-left.svg +9 -0
  60. package/extension/popup/assets/vector-left.svg +9 -0
  61. package/extension/popup/assets/vector-right.svg +9 -0
  62. package/extension/popup/assets/vector-top-right-rotated.svg +8 -0
  63. package/extension/popup/assets/vector-top-right.svg +9 -0
  64. package/extension/popup/assets/wallet-dropdown-arrow.svg +5 -0
  65. package/extension/popup/assets/wallet-icon-style-1.svg +6 -0
  66. package/extension/popup/assets/wallet-icon-style-10.svg +8 -0
  67. package/extension/popup/assets/wallet-icon-style-11.svg +8 -0
  68. package/extension/popup/assets/wallet-icon-style-12.svg +8 -0
  69. package/extension/popup/assets/wallet-icon-style-13.svg +8 -0
  70. package/extension/popup/assets/wallet-icon-style-14.svg +8 -0
  71. package/extension/popup/assets/wallet-icon-style-15.svg +8 -0
  72. package/extension/popup/assets/wallet-icon-style-2.svg +8 -0
  73. package/extension/popup/assets/wallet-icon-style-3.svg +8 -0
  74. package/extension/popup/assets/wallet-icon-style-4.svg +8 -0
  75. package/extension/popup/assets/wallet-icon-style-5.svg +8 -0
  76. package/extension/popup/assets/wallet-icon-style-6.svg +8 -0
  77. package/extension/popup/assets/wallet-icon-style-7.svg +8 -0
  78. package/extension/popup/assets/wallet-icon-style-8.svg +8 -0
  79. package/extension/popup/assets/wallet-icon-style-9.svg +8 -0
  80. package/extension/popup/components/AccountIcon.tsx +78 -0
  81. package/extension/popup/components/AccountSelector.tsx +246 -0
  82. package/extension/popup/components/Alert.tsx +48 -0
  83. package/extension/popup/components/ConfirmModal.tsx +81 -0
  84. package/extension/popup/components/PasswordInput.tsx +49 -0
  85. package/extension/popup/components/ScreenContainer.tsx +17 -0
  86. package/extension/popup/components/SiteIcon.tsx +60 -0
  87. package/extension/popup/components/ThemeToggle.tsx +44 -0
  88. package/extension/popup/components/icons/ArrowDownLeftIcon.tsx +20 -0
  89. package/extension/popup/components/icons/ArrowUpRightIcon.tsx +20 -0
  90. package/extension/popup/components/icons/CheckIcon.tsx +20 -0
  91. package/extension/popup/components/icons/ChevronDownIcon.tsx +15 -0
  92. package/extension/popup/components/icons/ChevronLeftIcon.tsx +15 -0
  93. package/extension/popup/components/icons/ChevronRightIcon.tsx +15 -0
  94. package/extension/popup/components/icons/ChevronUpIcon.tsx +15 -0
  95. package/extension/popup/components/icons/CloseIcon.tsx +26 -0
  96. package/extension/popup/components/icons/CopyIcon.tsx +20 -0
  97. package/extension/popup/components/icons/EditIcon.tsx +20 -0
  98. package/extension/popup/components/icons/EyeIcon.tsx +13 -0
  99. package/extension/popup/components/icons/EyeOffIcon.tsx +13 -0
  100. package/extension/popup/components/icons/InfoIcon.tsx +20 -0
  101. package/extension/popup/components/icons/LockIcon.tsx +20 -0
  102. package/extension/popup/components/icons/PlusIcon.tsx +15 -0
  103. package/extension/popup/components/icons/ReceiveArrowIcon.tsx +14 -0
  104. package/extension/popup/components/icons/ReceiveCircleIcon.tsx +20 -0
  105. package/extension/popup/components/icons/SendPaperPlaneIcon.tsx +18 -0
  106. package/extension/popup/components/icons/SentArrowIcon.tsx +21 -0
  107. package/extension/popup/components/icons/SettingsIcon.tsx +26 -0
  108. package/extension/popup/components/icons/ShieldIcon.tsx +20 -0
  109. package/extension/popup/components/icons/UploadIcon.tsx +20 -0
  110. package/extension/popup/components/icons/WalletIcon.tsx +20 -0
  111. package/extension/popup/contexts/ThemeContext.tsx +105 -0
  112. package/extension/popup/hooks/useApprovalDetection.ts +128 -0
  113. package/extension/popup/hooks/useAutoFocus.ts +36 -0
  114. package/extension/popup/hooks/useAutoRejectOnClose.ts +25 -0
  115. package/extension/popup/hooks/useClickOutside.ts +33 -0
  116. package/extension/popup/hooks/useCopyToClipboard.ts +33 -0
  117. package/extension/popup/hooks/useFavicon.ts +64 -0
  118. package/extension/popup/hooks/useNumericInput.ts +93 -0
  119. package/extension/popup/index.html +13 -0
  120. package/extension/popup/index.tsx +24 -0
  121. package/extension/popup/screens/AboutScreen.tsx +118 -0
  122. package/extension/popup/screens/HomeScreen.tailwind.css +85 -0
  123. package/extension/popup/screens/HomeScreen.tsx +902 -0
  124. package/extension/popup/screens/KeySettingsPasswordScreen.tsx +164 -0
  125. package/extension/popup/screens/LockTimeScreen.tsx +155 -0
  126. package/extension/popup/screens/ReceiveScreen.tsx +149 -0
  127. package/extension/popup/screens/RecoveryPhraseScreen.tsx +183 -0
  128. package/extension/popup/screens/SendReviewScreen.tsx +308 -0
  129. package/extension/popup/screens/SendScreen.tsx +825 -0
  130. package/extension/popup/screens/SendSubmittedScreen.tsx +193 -0
  131. package/extension/popup/screens/SettingsScreen.tsx +116 -0
  132. package/extension/popup/screens/ThemeSettingsScreen.tsx +107 -0
  133. package/extension/popup/screens/TransactionDetailsScreen.tsx +346 -0
  134. package/extension/popup/screens/ViewSecretPhraseScreen.tsx +212 -0
  135. package/extension/popup/screens/WalletPermissionsScreen.tsx +123 -0
  136. package/extension/popup/screens/WalletSettingsScreen.tsx +381 -0
  137. package/extension/popup/screens/WalletStylingScreen.tsx +306 -0
  138. package/extension/popup/screens/approvals/ConnectApprovalScreen.tsx +136 -0
  139. package/extension/popup/screens/approvals/SignMessageScreen.tsx +140 -0
  140. package/extension/popup/screens/approvals/SignRawTxScreen.tsx +320 -0
  141. package/extension/popup/screens/approvals/TransactionApprovalScreen.tsx +167 -0
  142. package/extension/popup/screens/onboarding/BackupScreen.tsx +254 -0
  143. package/extension/popup/screens/onboarding/CreateScreen.tsx +273 -0
  144. package/extension/popup/screens/onboarding/ImportScreen.tsx +676 -0
  145. package/extension/popup/screens/onboarding/ImportScreenV0.tsx +678 -0
  146. package/extension/popup/screens/onboarding/ImportSuccessScreen.tsx +236 -0
  147. package/extension/popup/screens/onboarding/ResumeBackupScreen.tsx +166 -0
  148. package/extension/popup/screens/onboarding/StartScreen.tsx +142 -0
  149. package/extension/popup/screens/onboarding/SuccessScreen.tsx +193 -0
  150. package/extension/popup/screens/onboarding/VerifyScreen.tsx +220 -0
  151. package/extension/popup/screens/system/LockedScreen.tsx +288 -0
  152. package/extension/popup/screens/transactions/ReceiveScreen.tsx +84 -0
  153. package/extension/popup/screens/transactions/SentScreen.tsx +138 -0
  154. package/extension/popup/store.ts +482 -0
  155. package/extension/popup/styles.css +246 -0
  156. package/extension/popup/utils/format.ts +58 -0
  157. package/extension/popup/utils/formatWalletError.ts +36 -0
  158. package/extension/popup/utils/memo.ts +299 -0
  159. package/extension/popup/utils/messaging.ts +16 -0
  160. package/extension/shared/address-encoding.ts +69 -0
  161. package/extension/shared/balance-query.ts +123 -0
  162. package/extension/shared/constants.ts +386 -0
  163. package/extension/shared/currency.ts +128 -0
  164. package/extension/shared/first-name-derivation.ts +128 -0
  165. package/extension/shared/keyfile.ts +58 -0
  166. package/extension/shared/onboarding.ts +78 -0
  167. package/extension/shared/price-api.ts +79 -0
  168. package/extension/shared/rpc-client-browser.ts +315 -0
  169. package/extension/shared/transaction-builder.ts +443 -0
  170. package/extension/shared/types.ts +450 -0
  171. package/extension/shared/utxo-diff.ts +212 -0
  172. package/extension/shared/utxo-store.ts +548 -0
  173. package/extension/shared/utxo-sync.ts +343 -0
  174. package/extension/shared/validators.ts +26 -0
  175. package/extension/shared/vault.ts +1580 -0
  176. package/extension/shared/wallet-crypto.ts +77 -0
  177. package/extension/shared/wasm-utils.ts +76 -0
  178. package/extension/shared/webcrypto.ts +67 -0
  179. package/extension/types/wasm.d.ts +13 -0
  180. package/package.json +39 -0
  181. package/postcss.config.js +6 -0
  182. package/rose-extension-dist.zip +0 -0
  183. package/sdk/README.md +88 -0
  184. package/sdk/examples/app.ts +166 -0
  185. package/sdk/examples/index.html +51 -0
  186. package/sdk/examples/tsconfig.json +15 -0
  187. package/sdk/examples/tx-builder.html +532 -0
  188. package/sdk/examples/tx-builder.ts +1766 -0
  189. package/sdk/package-lock.json +424 -0
  190. package/sdk/package.json +68 -0
  191. package/sdk/src/constants.ts +28 -0
  192. package/sdk/src/errors.ts +74 -0
  193. package/sdk/src/hooks/index.ts +1 -0
  194. package/sdk/src/hooks/use-rose.ts +94 -0
  195. package/sdk/src/index.ts +12 -0
  196. package/sdk/src/provider.ts +396 -0
  197. package/sdk/src/transaction.ts +163 -0
  198. package/sdk/src/types/rose-wasm.d.ts +14 -0
  199. package/sdk/src/types.ts +97 -0
  200. package/sdk/src/wasm.ts +13 -0
  201. package/sdk/tsconfig.json +20 -0
  202. package/sdk/vite.config.examples.ts +32 -0
  203. package/tailwind.config.ts +38 -0
  204. package/tsconfig.json +20 -0
  205. package/vite.config.ts +60 -0
@@ -0,0 +1,424 @@
1
+ {
2
+ "name": "@nockchain/sdk",
3
+ "version": "0.1.4-nightly.5",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "@nockchain/sdk",
9
+ "version": "0.1.4-nightly.5",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "@nockchain/rose-wasm": "^0.1.4-nightly.17.1.a460619",
13
+ "@scure/base": "2.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/react": "19.2.7",
17
+ "prettier": "3.7.4",
18
+ "react": "19.2.3",
19
+ "typescript": "5.9.3",
20
+ "vite": "7.3.0"
21
+ },
22
+ "peerDependencies": {
23
+ "react": ">=18"
24
+ }
25
+ },
26
+ "node_modules/@esbuild/darwin-arm64": {
27
+ "version": "0.27.2",
28
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz",
29
+ "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==",
30
+ "cpu": [
31
+ "arm64"
32
+ ],
33
+ "dev": true,
34
+ "license": "MIT",
35
+ "optional": true,
36
+ "os": [
37
+ "darwin"
38
+ ],
39
+ "engines": {
40
+ "node": ">=18"
41
+ }
42
+ },
43
+ "node_modules/@nockchain/rose-wasm": {
44
+ "version": "0.1.4-nightly.17.1.a460619",
45
+ "resolved": "https://registry.npmjs.org/@nockchain/rose-wasm/-/rose-wasm-0.1.4-nightly.17.1.a460619.tgz",
46
+ "integrity": "sha512-hKXugCXtGwVAYDnftt+Hqeu2GONsHMJFf1k79UeU3IDsZfvZL0B8+bHuFTlsBG+gfexvpXMuccBlWy1UVGFTaQ==",
47
+ "license": "MIT"
48
+ },
49
+ "node_modules/@rollup/rollup-darwin-arm64": {
50
+ "version": "4.54.0",
51
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.54.0.tgz",
52
+ "integrity": "sha512-k43D4qta/+6Fq+nCDhhv9yP2HdeKeP56QrUUTW7E6PhZP1US6NDqpJj4MY0jBHlJivVJD5P8NxrjuobZBJTCRw==",
53
+ "cpu": [
54
+ "arm64"
55
+ ],
56
+ "dev": true,
57
+ "license": "MIT",
58
+ "optional": true,
59
+ "os": [
60
+ "darwin"
61
+ ]
62
+ },
63
+ "node_modules/@scure/base": {
64
+ "version": "2.0.0",
65
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-2.0.0.tgz",
66
+ "integrity": "sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w==",
67
+ "license": "MIT",
68
+ "funding": {
69
+ "url": "https://paulmillr.com/funding/"
70
+ }
71
+ },
72
+ "node_modules/@types/estree": {
73
+ "version": "1.0.8",
74
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
75
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
76
+ "dev": true,
77
+ "license": "MIT"
78
+ },
79
+ "node_modules/@types/react": {
80
+ "version": "19.2.7",
81
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz",
82
+ "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
83
+ "dev": true,
84
+ "license": "MIT",
85
+ "dependencies": {
86
+ "csstype": "^3.2.2"
87
+ }
88
+ },
89
+ "node_modules/csstype": {
90
+ "version": "3.2.3",
91
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
92
+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
93
+ "dev": true,
94
+ "license": "MIT"
95
+ },
96
+ "node_modules/esbuild": {
97
+ "version": "0.27.2",
98
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz",
99
+ "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==",
100
+ "dev": true,
101
+ "hasInstallScript": true,
102
+ "license": "MIT",
103
+ "bin": {
104
+ "esbuild": "bin/esbuild"
105
+ },
106
+ "engines": {
107
+ "node": ">=18"
108
+ },
109
+ "optionalDependencies": {
110
+ "@esbuild/aix-ppc64": "0.27.2",
111
+ "@esbuild/android-arm": "0.27.2",
112
+ "@esbuild/android-arm64": "0.27.2",
113
+ "@esbuild/android-x64": "0.27.2",
114
+ "@esbuild/darwin-arm64": "0.27.2",
115
+ "@esbuild/darwin-x64": "0.27.2",
116
+ "@esbuild/freebsd-arm64": "0.27.2",
117
+ "@esbuild/freebsd-x64": "0.27.2",
118
+ "@esbuild/linux-arm": "0.27.2",
119
+ "@esbuild/linux-arm64": "0.27.2",
120
+ "@esbuild/linux-ia32": "0.27.2",
121
+ "@esbuild/linux-loong64": "0.27.2",
122
+ "@esbuild/linux-mips64el": "0.27.2",
123
+ "@esbuild/linux-ppc64": "0.27.2",
124
+ "@esbuild/linux-riscv64": "0.27.2",
125
+ "@esbuild/linux-s390x": "0.27.2",
126
+ "@esbuild/linux-x64": "0.27.2",
127
+ "@esbuild/netbsd-arm64": "0.27.2",
128
+ "@esbuild/netbsd-x64": "0.27.2",
129
+ "@esbuild/openbsd-arm64": "0.27.2",
130
+ "@esbuild/openbsd-x64": "0.27.2",
131
+ "@esbuild/openharmony-arm64": "0.27.2",
132
+ "@esbuild/sunos-x64": "0.27.2",
133
+ "@esbuild/win32-arm64": "0.27.2",
134
+ "@esbuild/win32-ia32": "0.27.2",
135
+ "@esbuild/win32-x64": "0.27.2"
136
+ }
137
+ },
138
+ "node_modules/fdir": {
139
+ "version": "6.5.0",
140
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
141
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
142
+ "dev": true,
143
+ "license": "MIT",
144
+ "engines": {
145
+ "node": ">=12.0.0"
146
+ },
147
+ "peerDependencies": {
148
+ "picomatch": "^3 || ^4"
149
+ },
150
+ "peerDependenciesMeta": {
151
+ "picomatch": {
152
+ "optional": true
153
+ }
154
+ }
155
+ },
156
+ "node_modules/fsevents": {
157
+ "version": "2.3.3",
158
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
159
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
160
+ "dev": true,
161
+ "hasInstallScript": true,
162
+ "license": "MIT",
163
+ "optional": true,
164
+ "os": [
165
+ "darwin"
166
+ ],
167
+ "engines": {
168
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
169
+ }
170
+ },
171
+ "node_modules/nanoid": {
172
+ "version": "3.3.11",
173
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
174
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
175
+ "dev": true,
176
+ "funding": [
177
+ {
178
+ "type": "github",
179
+ "url": "https://github.com/sponsors/ai"
180
+ }
181
+ ],
182
+ "license": "MIT",
183
+ "bin": {
184
+ "nanoid": "bin/nanoid.cjs"
185
+ },
186
+ "engines": {
187
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
188
+ }
189
+ },
190
+ "node_modules/picocolors": {
191
+ "version": "1.1.1",
192
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
193
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
194
+ "dev": true,
195
+ "license": "ISC"
196
+ },
197
+ "node_modules/picomatch": {
198
+ "version": "4.0.3",
199
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
200
+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
201
+ "dev": true,
202
+ "license": "MIT",
203
+ "engines": {
204
+ "node": ">=12"
205
+ },
206
+ "funding": {
207
+ "url": "https://github.com/sponsors/jonschlinkert"
208
+ }
209
+ },
210
+ "node_modules/postcss": {
211
+ "version": "8.5.6",
212
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
213
+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
214
+ "dev": true,
215
+ "funding": [
216
+ {
217
+ "type": "opencollective",
218
+ "url": "https://opencollective.com/postcss/"
219
+ },
220
+ {
221
+ "type": "tidelift",
222
+ "url": "https://tidelift.com/funding/github/npm/postcss"
223
+ },
224
+ {
225
+ "type": "github",
226
+ "url": "https://github.com/sponsors/ai"
227
+ }
228
+ ],
229
+ "license": "MIT",
230
+ "dependencies": {
231
+ "nanoid": "^3.3.11",
232
+ "picocolors": "^1.1.1",
233
+ "source-map-js": "^1.2.1"
234
+ },
235
+ "engines": {
236
+ "node": "^10 || ^12 || >=14"
237
+ }
238
+ },
239
+ "node_modules/prettier": {
240
+ "version": "3.7.4",
241
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz",
242
+ "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==",
243
+ "dev": true,
244
+ "license": "MIT",
245
+ "bin": {
246
+ "prettier": "bin/prettier.cjs"
247
+ },
248
+ "engines": {
249
+ "node": ">=14"
250
+ },
251
+ "funding": {
252
+ "url": "https://github.com/prettier/prettier?sponsor=1"
253
+ }
254
+ },
255
+ "node_modules/react": {
256
+ "version": "19.2.3",
257
+ "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
258
+ "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
259
+ "dev": true,
260
+ "license": "MIT",
261
+ "engines": {
262
+ "node": ">=0.10.0"
263
+ }
264
+ },
265
+ "node_modules/rollup": {
266
+ "version": "4.54.0",
267
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.54.0.tgz",
268
+ "integrity": "sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==",
269
+ "dev": true,
270
+ "license": "MIT",
271
+ "dependencies": {
272
+ "@types/estree": "1.0.8"
273
+ },
274
+ "bin": {
275
+ "rollup": "dist/bin/rollup"
276
+ },
277
+ "engines": {
278
+ "node": ">=18.0.0",
279
+ "npm": ">=8.0.0"
280
+ },
281
+ "optionalDependencies": {
282
+ "@rollup/rollup-android-arm-eabi": "4.54.0",
283
+ "@rollup/rollup-android-arm64": "4.54.0",
284
+ "@rollup/rollup-darwin-arm64": "4.54.0",
285
+ "@rollup/rollup-darwin-x64": "4.54.0",
286
+ "@rollup/rollup-freebsd-arm64": "4.54.0",
287
+ "@rollup/rollup-freebsd-x64": "4.54.0",
288
+ "@rollup/rollup-linux-arm-gnueabihf": "4.54.0",
289
+ "@rollup/rollup-linux-arm-musleabihf": "4.54.0",
290
+ "@rollup/rollup-linux-arm64-gnu": "4.54.0",
291
+ "@rollup/rollup-linux-arm64-musl": "4.54.0",
292
+ "@rollup/rollup-linux-loong64-gnu": "4.54.0",
293
+ "@rollup/rollup-linux-ppc64-gnu": "4.54.0",
294
+ "@rollup/rollup-linux-riscv64-gnu": "4.54.0",
295
+ "@rollup/rollup-linux-riscv64-musl": "4.54.0",
296
+ "@rollup/rollup-linux-s390x-gnu": "4.54.0",
297
+ "@rollup/rollup-linux-x64-gnu": "4.54.0",
298
+ "@rollup/rollup-linux-x64-musl": "4.54.0",
299
+ "@rollup/rollup-openharmony-arm64": "4.54.0",
300
+ "@rollup/rollup-win32-arm64-msvc": "4.54.0",
301
+ "@rollup/rollup-win32-ia32-msvc": "4.54.0",
302
+ "@rollup/rollup-win32-x64-gnu": "4.54.0",
303
+ "@rollup/rollup-win32-x64-msvc": "4.54.0",
304
+ "fsevents": "~2.3.2"
305
+ }
306
+ },
307
+ "node_modules/source-map-js": {
308
+ "version": "1.2.1",
309
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
310
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
311
+ "dev": true,
312
+ "license": "BSD-3-Clause",
313
+ "engines": {
314
+ "node": ">=0.10.0"
315
+ }
316
+ },
317
+ "node_modules/tinyglobby": {
318
+ "version": "0.2.15",
319
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
320
+ "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
321
+ "dev": true,
322
+ "license": "MIT",
323
+ "dependencies": {
324
+ "fdir": "^6.5.0",
325
+ "picomatch": "^4.0.3"
326
+ },
327
+ "engines": {
328
+ "node": ">=12.0.0"
329
+ },
330
+ "funding": {
331
+ "url": "https://github.com/sponsors/SuperchupuDev"
332
+ }
333
+ },
334
+ "node_modules/typescript": {
335
+ "version": "5.9.3",
336
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
337
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
338
+ "dev": true,
339
+ "license": "Apache-2.0",
340
+ "bin": {
341
+ "tsc": "bin/tsc",
342
+ "tsserver": "bin/tsserver"
343
+ },
344
+ "engines": {
345
+ "node": ">=14.17"
346
+ }
347
+ },
348
+ "node_modules/vite": {
349
+ "version": "7.3.0",
350
+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz",
351
+ "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==",
352
+ "dev": true,
353
+ "license": "MIT",
354
+ "dependencies": {
355
+ "esbuild": "^0.27.0",
356
+ "fdir": "^6.5.0",
357
+ "picomatch": "^4.0.3",
358
+ "postcss": "^8.5.6",
359
+ "rollup": "^4.43.0",
360
+ "tinyglobby": "^0.2.15"
361
+ },
362
+ "bin": {
363
+ "vite": "bin/vite.js"
364
+ },
365
+ "engines": {
366
+ "node": "^20.19.0 || >=22.12.0"
367
+ },
368
+ "funding": {
369
+ "url": "https://github.com/vitejs/vite?sponsor=1"
370
+ },
371
+ "optionalDependencies": {
372
+ "fsevents": "~2.3.3"
373
+ },
374
+ "peerDependencies": {
375
+ "@types/node": "^20.19.0 || >=22.12.0",
376
+ "jiti": ">=1.21.0",
377
+ "less": "^4.0.0",
378
+ "lightningcss": "^1.21.0",
379
+ "sass": "^1.70.0",
380
+ "sass-embedded": "^1.70.0",
381
+ "stylus": ">=0.54.8",
382
+ "sugarss": "^5.0.0",
383
+ "terser": "^5.16.0",
384
+ "tsx": "^4.8.1",
385
+ "yaml": "^2.4.2"
386
+ },
387
+ "peerDependenciesMeta": {
388
+ "@types/node": {
389
+ "optional": true
390
+ },
391
+ "jiti": {
392
+ "optional": true
393
+ },
394
+ "less": {
395
+ "optional": true
396
+ },
397
+ "lightningcss": {
398
+ "optional": true
399
+ },
400
+ "sass": {
401
+ "optional": true
402
+ },
403
+ "sass-embedded": {
404
+ "optional": true
405
+ },
406
+ "stylus": {
407
+ "optional": true
408
+ },
409
+ "sugarss": {
410
+ "optional": true
411
+ },
412
+ "terser": {
413
+ "optional": true
414
+ },
415
+ "tsx": {
416
+ "optional": true
417
+ },
418
+ "yaml": {
419
+ "optional": true
420
+ }
421
+ }
422
+ }
423
+ }
424
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@nockchain/sdk",
3
+ "version": "0.1.4-nightly.5",
4
+ "description": "TypeScript SDK for interacting with Nockchain wallet extensions",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./wasm": {
14
+ "types": "./dist/wasm.d.ts",
15
+ "import": "./dist/wasm.js"
16
+ },
17
+ "./hooks": {
18
+ "types": "./dist/hooks/index.d.ts",
19
+ "import": "./dist/hooks/index.js"
20
+ },
21
+ "./hooks/use-rose": {
22
+ "types": "./dist/hooks/use-rose.d.ts",
23
+ "import": "./dist/hooks/use-rose.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "keywords": [
31
+ "nockchain",
32
+ "wallet",
33
+ "web3",
34
+ "blockchain",
35
+ "schnorr"
36
+ ],
37
+ "author": "Nockchain.net LLC",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/nocktoshi/rose.git",
42
+ "directory": "sdk"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc",
46
+ "build-example": "npm run build && tsc --project examples/tsconfig.json && vite build --config vite.config.examples.ts",
47
+ "dev": "tsc --watch",
48
+ "dev-example": "vite --config vite.config.examples.ts",
49
+ "format": "prettier --write .",
50
+ "format:check": "prettier --check .",
51
+ "typecheck": "tsc --noEmit",
52
+ "prepublishOnly": "npm run build"
53
+ },
54
+ "dependencies": {
55
+ "@nockchain/rose-wasm": "^0.1.4-nightly.17.1.a460619",
56
+ "@scure/base": "2.0.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/react": "19.2.7",
60
+ "prettier": "3.7.4",
61
+ "react": "19.2.3",
62
+ "typescript": "5.9.3",
63
+ "vite": "7.3.0"
64
+ },
65
+ "peerDependencies": {
66
+ "react": ">=18"
67
+ }
68
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Provider method constants for Nockchain wallet
3
+ * These methods can be called by dApps via window.nockchain
4
+ */
5
+ export const PROVIDER_METHODS = {
6
+ /** Connect to the wallet and request access */
7
+ CONNECT: 'nock_connect',
8
+
9
+ /** Sign an arbitrary message */
10
+ SIGN_MESSAGE: 'nock_signMessage',
11
+
12
+ /** Sign and send a transaction */
13
+ SEND_TRANSACTION: 'nock_sendTransaction',
14
+
15
+ /** Get wallet information (PKH + gRPC endpoint) */
16
+ GET_WALLET_INFO: 'nock_getWalletInfo',
17
+
18
+ /** Sign a raw transaction */
19
+ SIGN_RAW_TX: 'nock_signRawTx',
20
+
21
+ /** v0 migration: check if v0 seed is stored */
22
+ MIGRATE_V0_GET_STATUS: 'nock_migrateV0GetStatus',
23
+
24
+ /** v0 migration: sign a raw tx with stored v0 key */
25
+ MIGRATE_V0_SIGN_RAW_TX: 'nock_migrateV0SignRawTx',
26
+ } as const;
27
+
28
+ export type ProviderMethod = (typeof PROVIDER_METHODS)[keyof typeof PROVIDER_METHODS];
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Custom error classes for Rose SDK
3
+ */
4
+
5
+ /**
6
+ * Thrown when the Rose wallet extension is not installed
7
+ */
8
+ export class WalletNotInstalledError extends Error {
9
+ constructor() {
10
+ super('Rose wallet extension not installed. Please install it from the Chrome Web Store.');
11
+ this.name = 'WalletNotInstalledError';
12
+ Object.setPrototypeOf(this, WalletNotInstalledError.prototype);
13
+ }
14
+ }
15
+
16
+ /**
17
+ * Thrown when the user rejects a transaction or request
18
+ */
19
+ export class UserRejectedError extends Error {
20
+ constructor(message = 'User rejected the request') {
21
+ super(message);
22
+ this.name = 'UserRejectedError';
23
+ Object.setPrototypeOf(this, UserRejectedError.prototype);
24
+ }
25
+ }
26
+
27
+ /**
28
+ * Thrown when an invalid Nockchain address is provided
29
+ */
30
+ export class InvalidAddressError extends Error {
31
+ constructor(address: string) {
32
+ super(`Invalid Nockchain address: ${address}`);
33
+ this.name = 'InvalidAddressError';
34
+ Object.setPrototypeOf(this, InvalidAddressError.prototype);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Thrown when transaction building fails due to missing or invalid fields
40
+ */
41
+ export class InvalidTransactionError extends Error {
42
+ constructor(message: string) {
43
+ super(message);
44
+ this.name = 'InvalidTransactionError';
45
+ Object.setPrototypeOf(this, InvalidTransactionError.prototype);
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Thrown when a method is called that requires an account, but no account is connected
51
+ */
52
+ export class NoAccountError extends Error {
53
+ constructor() {
54
+ super('No account connected. Call requestAccounts() first.');
55
+ this.name = 'NoAccountError';
56
+ Object.setPrototypeOf(this, NoAccountError.prototype);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Thrown when the RPC request to the extension fails
62
+ */
63
+ export class RpcError extends Error {
64
+ public code: number;
65
+ public data?: unknown;
66
+
67
+ constructor(code: number, message: string, data?: unknown) {
68
+ super(message);
69
+ this.name = 'RpcError';
70
+ this.code = code;
71
+ this.data = data;
72
+ Object.setPrototypeOf(this, RpcError.prototype);
73
+ }
74
+ }
@@ -0,0 +1 @@
1
+ export * from './use-rose.js';
@@ -0,0 +1,94 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ import { NockchainProvider } from '../provider.js';
3
+ import initWasm from '@nockchain/sdk/wasm';
4
+ import * as wasm from '@nockchain/sdk/wasm';
5
+
6
+ const ROSE_SDK_WASM_INIT_KEY = '__nockchain_rose_sdk_wasm_init_promise__';
7
+ const ROSE_SDK_PROVIDER_KEY = '__nockchain_rose_sdk_provider__';
8
+
9
+ /**
10
+ * Initialize Rose WASM once per page load.
11
+ * Uses globalThis so React StrictMode + Vite HMR won't accidentally re-init.
12
+ */
13
+ type WasmInit = ReturnType<typeof initWasm>;
14
+
15
+ function ensureWasmInitializedOnce(): WasmInit {
16
+ const g = globalThis as typeof globalThis & Record<string, unknown>;
17
+
18
+ const existing = g[ROSE_SDK_WASM_INIT_KEY];
19
+ if (existing && existing instanceof Promise) {
20
+ return (existing as WasmInit).catch((err: unknown) => {
21
+ if (g[ROSE_SDK_WASM_INIT_KEY] === existing) {
22
+ delete g[ROSE_SDK_WASM_INIT_KEY];
23
+ }
24
+ throw err;
25
+ }) as WasmInit;
26
+ }
27
+
28
+ const p = initWasm().catch((err: unknown) => {
29
+ if (g[ROSE_SDK_WASM_INIT_KEY] === p) {
30
+ delete g[ROSE_SDK_WASM_INIT_KEY];
31
+ }
32
+ throw err;
33
+ }) as WasmInit;
34
+
35
+ g[ROSE_SDK_WASM_INIT_KEY] = p;
36
+ return p;
37
+ }
38
+
39
+ function getProviderOnce(): NockchainProvider {
40
+ const g = globalThis as typeof globalThis & Record<string, unknown>;
41
+ const existing = g[ROSE_SDK_PROVIDER_KEY];
42
+ if (existing instanceof NockchainProvider) return existing;
43
+
44
+ const provider = new NockchainProvider();
45
+ g[ROSE_SDK_PROVIDER_KEY] = provider;
46
+ return provider;
47
+ }
48
+
49
+ export type UseRoseStatus = 'idle' | 'loading' | 'ready' | 'error';
50
+
51
+ export function useRose({ rpcUrl = 'https://rpc.nockbox.org' }: { rpcUrl?: string } = {}) {
52
+ const [provider, setProvider] = useState<NockchainProvider | null>(null);
53
+ const [rpcClient, setRpcClient] = useState<unknown>(null);
54
+ const [status, setStatus] = useState<UseRoseStatus>('idle');
55
+ const [error, setError] = useState<unknown>(null);
56
+
57
+ const options = useMemo(() => ({ rpcUrl }), [rpcUrl]);
58
+
59
+ useEffect(() => {
60
+ let cancelled = false;
61
+ setStatus('loading');
62
+ setError(null);
63
+
64
+ ensureWasmInitializedOnce()
65
+ .then(() => {
66
+ if (cancelled) return;
67
+ setProvider(getProviderOnce());
68
+ // The wasm package's type surface may lag runtime exports; keep this resilient.
69
+ const GrpcClientCtor = (wasm as any).GrpcClient as
70
+ | (new (rpcUrl: string) => unknown)
71
+ | undefined;
72
+ setRpcClient(GrpcClientCtor ? new GrpcClientCtor(options.rpcUrl) : null);
73
+ setStatus('ready');
74
+ })
75
+ .catch((err: unknown) => {
76
+ if (cancelled) return;
77
+ setError(err);
78
+ setStatus('error');
79
+ });
80
+
81
+ return () => {
82
+ cancelled = true;
83
+ };
84
+ }, [options]);
85
+
86
+ return {
87
+ provider,
88
+ rpcClient,
89
+ wasm: initWasm,
90
+ status,
91
+ error,
92
+ isReady: status === 'ready',
93
+ };
94
+ }