@ledgerhq/device-signer-kit-solana 1.0.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 (348) hide show
  1. package/LICENSE.MD +202 -0
  2. package/README.md +513 -0
  3. package/lib/cjs/api/SignerSolana.js +2 -0
  4. package/lib/cjs/api/SignerSolana.js.map +7 -0
  5. package/lib/cjs/api/SignerSolanaBuilder.js +2 -0
  6. package/lib/cjs/api/SignerSolanaBuilder.js.map +7 -0
  7. package/lib/cjs/api/app-binder/GetAddressDeviceActionTypes.js +2 -0
  8. package/lib/cjs/api/app-binder/GetAddressDeviceActionTypes.js.map +7 -0
  9. package/lib/cjs/api/app-binder/GetAppConfigurationDeviceActionTypes.js +2 -0
  10. package/lib/cjs/api/app-binder/GetAppConfigurationDeviceActionTypes.js.map +7 -0
  11. package/lib/cjs/api/app-binder/SignMessageDeviceActionTypes.js +2 -0
  12. package/lib/cjs/api/app-binder/SignMessageDeviceActionTypes.js.map +7 -0
  13. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js +2 -0
  14. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js.map +7 -0
  15. package/lib/cjs/api/index.js +2 -0
  16. package/lib/cjs/api/index.js.map +7 -0
  17. package/lib/cjs/api/model/AddressOption.js +2 -0
  18. package/lib/cjs/api/model/AddressOption.js.map +7 -0
  19. package/lib/cjs/api/model/AppConfiguration.js +2 -0
  20. package/lib/cjs/api/model/AppConfiguration.js.map +7 -0
  21. package/lib/cjs/api/model/PublicKey.js +2 -0
  22. package/lib/cjs/api/model/PublicKey.js.map +7 -0
  23. package/lib/cjs/api/model/PublicKeyDisplayMode.js +2 -0
  24. package/lib/cjs/api/model/PublicKeyDisplayMode.js.map +7 -0
  25. package/lib/cjs/api/model/Signature.js +2 -0
  26. package/lib/cjs/api/model/Signature.js.map +7 -0
  27. package/lib/cjs/api/model/Transaction.js +2 -0
  28. package/lib/cjs/api/model/Transaction.js.map +7 -0
  29. package/lib/cjs/api/model/TransactionOptions.js +2 -0
  30. package/lib/cjs/api/model/TransactionOptions.js.map +7 -0
  31. package/lib/cjs/index.js +2 -0
  32. package/lib/cjs/index.js.map +7 -0
  33. package/lib/cjs/internal/DefaultSignerSolana.js +2 -0
  34. package/lib/cjs/internal/DefaultSignerSolana.js.map +7 -0
  35. package/lib/cjs/internal/DefaultSignerSolana.test.js +2 -0
  36. package/lib/cjs/internal/DefaultSignerSolana.test.js.map +7 -0
  37. package/lib/cjs/internal/app-binder/SolanaAppBinder.js +2 -0
  38. package/lib/cjs/internal/app-binder/SolanaAppBinder.js.map +7 -0
  39. package/lib/cjs/internal/app-binder/SolanaAppBinder.test.js +2 -0
  40. package/lib/cjs/internal/app-binder/SolanaAppBinder.test.js.map +7 -0
  41. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.js +2 -0
  42. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.js.map +7 -0
  43. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.test.js +2 -0
  44. package/lib/cjs/internal/app-binder/command/GetAppConfigurationCommand.test.js.map +7 -0
  45. package/lib/cjs/internal/app-binder/command/GetPubKeyCommand.js +2 -0
  46. package/lib/cjs/internal/app-binder/command/GetPubKeyCommand.js.map +7 -0
  47. package/lib/cjs/internal/app-binder/command/GetPubKeyCommand.test.js +2 -0
  48. package/lib/cjs/internal/app-binder/command/GetPubKeyCommand.test.js.map +7 -0
  49. package/lib/cjs/internal/app-binder/command/SignOffChainMessageCommand.js +2 -0
  50. package/lib/cjs/internal/app-binder/command/SignOffChainMessageCommand.js.map +7 -0
  51. package/lib/cjs/internal/app-binder/command/SignOffChainMessageCommand.test.js +2 -0
  52. package/lib/cjs/internal/app-binder/command/SignOffChainMessageCommand.test.js.map +7 -0
  53. package/lib/cjs/internal/app-binder/command/SignTransactionCommand.js +2 -0
  54. package/lib/cjs/internal/app-binder/command/SignTransactionCommand.js.map +7 -0
  55. package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js +2 -0
  56. package/lib/cjs/internal/app-binder/command/SignTransactionCommand.test.js.map +7 -0
  57. package/lib/cjs/internal/app-binder/command/utils/solanaAppError.test.js +2 -0
  58. package/lib/cjs/internal/app-binder/command/utils/solanaAppError.test.js.map +7 -0
  59. package/lib/cjs/internal/app-binder/command/utils/solanaAppErrors.js +2 -0
  60. package/lib/cjs/internal/app-binder/command/utils/solanaAppErrors.js.map +7 -0
  61. package/lib/cjs/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.js +2 -0
  62. package/lib/cjs/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.js.map +7 -0
  63. package/lib/cjs/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.test.js +2 -0
  64. package/lib/cjs/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.test.js.map +7 -0
  65. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.js +2 -0
  66. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.js.map +7 -0
  67. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.test.js +2 -0
  68. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.test.js.map +7 -0
  69. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +2 -0
  70. package/lib/cjs/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +7 -0
  71. package/lib/cjs/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js +2 -0
  72. package/lib/cjs/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js.map +7 -0
  73. package/lib/cjs/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js +2 -0
  74. package/lib/cjs/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js.map +7 -0
  75. package/lib/cjs/internal/app-binder/di/appBinderModule.js +2 -0
  76. package/lib/cjs/internal/app-binder/di/appBinderModule.js.map +7 -0
  77. package/lib/cjs/internal/app-binder/di/appBinderModule.test.js +2 -0
  78. package/lib/cjs/internal/app-binder/di/appBinderModule.test.js.map +7 -0
  79. package/lib/cjs/internal/app-binder/di/appBinderTypes.js +2 -0
  80. package/lib/cjs/internal/app-binder/di/appBinderTypes.js.map +7 -0
  81. package/lib/cjs/internal/app-binder/task/SendCommandInChunksTask.js +2 -0
  82. package/lib/cjs/internal/app-binder/task/SendCommandInChunksTask.js.map +7 -0
  83. package/lib/cjs/internal/app-binder/task/SendSignDataTask.js +2 -0
  84. package/lib/cjs/internal/app-binder/task/SendSignDataTask.js.map +7 -0
  85. package/lib/cjs/internal/app-binder/task/SendSignDataTask.test.js +2 -0
  86. package/lib/cjs/internal/app-binder/task/SendSignDataTask.test.js.map +7 -0
  87. package/lib/cjs/internal/app-binder/task/SendSignMessageTask.js +2 -0
  88. package/lib/cjs/internal/app-binder/task/SendSignMessageTask.js.map +7 -0
  89. package/lib/cjs/internal/app-binder/task/SendSignMessageTask.test.js +2 -0
  90. package/lib/cjs/internal/app-binder/task/SendSignMessageTask.test.js.map +7 -0
  91. package/lib/cjs/internal/di.js +2 -0
  92. package/lib/cjs/internal/di.js.map +7 -0
  93. package/lib/cjs/internal/externalTypes.js +2 -0
  94. package/lib/cjs/internal/externalTypes.js.map +7 -0
  95. package/lib/cjs/internal/use-cases/address/GetAddressUseCase.js +2 -0
  96. package/lib/cjs/internal/use-cases/address/GetAddressUseCase.js.map +7 -0
  97. package/lib/cjs/internal/use-cases/address/GetAddressUseCase.test.js +2 -0
  98. package/lib/cjs/internal/use-cases/address/GetAddressUseCase.test.js.map +7 -0
  99. package/lib/cjs/internal/use-cases/app-configuration/GetAppConfiguration.test.js +2 -0
  100. package/lib/cjs/internal/use-cases/app-configuration/GetAppConfiguration.test.js.map +7 -0
  101. package/lib/cjs/internal/use-cases/app-configuration/GetAppConfigurationUseCase.js +2 -0
  102. package/lib/cjs/internal/use-cases/app-configuration/GetAppConfigurationUseCase.js.map +7 -0
  103. package/lib/cjs/internal/use-cases/di/useCasesModule.js +2 -0
  104. package/lib/cjs/internal/use-cases/di/useCasesModule.js.map +7 -0
  105. package/lib/cjs/internal/use-cases/di/useCasesModule.test.js +2 -0
  106. package/lib/cjs/internal/use-cases/di/useCasesModule.test.js.map +7 -0
  107. package/lib/cjs/internal/use-cases/di/useCasesTypes.js +2 -0
  108. package/lib/cjs/internal/use-cases/di/useCasesTypes.js.map +7 -0
  109. package/lib/cjs/internal/use-cases/message/SignMessageUseCase.js +2 -0
  110. package/lib/cjs/internal/use-cases/message/SignMessageUseCase.js.map +7 -0
  111. package/lib/cjs/internal/use-cases/message/SignMessageUseCase.test.js +2 -0
  112. package/lib/cjs/internal/use-cases/message/SignMessageUseCase.test.js.map +7 -0
  113. package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.js +2 -0
  114. package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.js.map +7 -0
  115. package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.test.js +2 -0
  116. package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.test.js.map +7 -0
  117. package/lib/cjs/package.json +58 -0
  118. package/lib/esm/api/SignerSolana.js +1 -0
  119. package/lib/esm/api/SignerSolana.js.map +7 -0
  120. package/lib/esm/api/SignerSolanaBuilder.js +2 -0
  121. package/lib/esm/api/SignerSolanaBuilder.js.map +7 -0
  122. package/lib/esm/api/app-binder/GetAddressDeviceActionTypes.js +1 -0
  123. package/lib/esm/api/app-binder/GetAddressDeviceActionTypes.js.map +7 -0
  124. package/lib/esm/api/app-binder/GetAppConfigurationDeviceActionTypes.js +1 -0
  125. package/lib/esm/api/app-binder/GetAppConfigurationDeviceActionTypes.js.map +7 -0
  126. package/lib/esm/api/app-binder/SignMessageDeviceActionTypes.js +1 -0
  127. package/lib/esm/api/app-binder/SignMessageDeviceActionTypes.js.map +7 -0
  128. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js +1 -0
  129. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js.map +7 -0
  130. package/lib/esm/api/index.js +2 -0
  131. package/lib/esm/api/index.js.map +7 -0
  132. package/lib/esm/api/model/AddressOption.js +1 -0
  133. package/lib/esm/api/model/AddressOption.js.map +7 -0
  134. package/lib/esm/api/model/AppConfiguration.js +1 -0
  135. package/lib/esm/api/model/AppConfiguration.js.map +7 -0
  136. package/lib/esm/api/model/PublicKey.js +1 -0
  137. package/lib/esm/api/model/PublicKey.js.map +7 -0
  138. package/lib/esm/api/model/PublicKeyDisplayMode.js +2 -0
  139. package/lib/esm/api/model/PublicKeyDisplayMode.js.map +7 -0
  140. package/lib/esm/api/model/Signature.js +1 -0
  141. package/lib/esm/api/model/Signature.js.map +7 -0
  142. package/lib/esm/api/model/Transaction.js +1 -0
  143. package/lib/esm/api/model/Transaction.js.map +7 -0
  144. package/lib/esm/api/model/TransactionOptions.js +1 -0
  145. package/lib/esm/api/model/TransactionOptions.js.map +7 -0
  146. package/lib/esm/index.js +2 -0
  147. package/lib/esm/index.js.map +7 -0
  148. package/lib/esm/internal/DefaultSignerSolana.js +2 -0
  149. package/lib/esm/internal/DefaultSignerSolana.js.map +7 -0
  150. package/lib/esm/internal/DefaultSignerSolana.test.js +2 -0
  151. package/lib/esm/internal/DefaultSignerSolana.test.js.map +7 -0
  152. package/lib/esm/internal/app-binder/SolanaAppBinder.js +2 -0
  153. package/lib/esm/internal/app-binder/SolanaAppBinder.js.map +7 -0
  154. package/lib/esm/internal/app-binder/SolanaAppBinder.test.js +2 -0
  155. package/lib/esm/internal/app-binder/SolanaAppBinder.test.js.map +7 -0
  156. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.js +2 -0
  157. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.js.map +7 -0
  158. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.test.js +2 -0
  159. package/lib/esm/internal/app-binder/command/GetAppConfigurationCommand.test.js.map +7 -0
  160. package/lib/esm/internal/app-binder/command/GetPubKeyCommand.js +2 -0
  161. package/lib/esm/internal/app-binder/command/GetPubKeyCommand.js.map +7 -0
  162. package/lib/esm/internal/app-binder/command/GetPubKeyCommand.test.js +2 -0
  163. package/lib/esm/internal/app-binder/command/GetPubKeyCommand.test.js.map +7 -0
  164. package/lib/esm/internal/app-binder/command/SignOffChainMessageCommand.js +2 -0
  165. package/lib/esm/internal/app-binder/command/SignOffChainMessageCommand.js.map +7 -0
  166. package/lib/esm/internal/app-binder/command/SignOffChainMessageCommand.test.js +2 -0
  167. package/lib/esm/internal/app-binder/command/SignOffChainMessageCommand.test.js.map +7 -0
  168. package/lib/esm/internal/app-binder/command/SignTransactionCommand.js +2 -0
  169. package/lib/esm/internal/app-binder/command/SignTransactionCommand.js.map +7 -0
  170. package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js +2 -0
  171. package/lib/esm/internal/app-binder/command/SignTransactionCommand.test.js.map +7 -0
  172. package/lib/esm/internal/app-binder/command/utils/solanaAppError.test.js +2 -0
  173. package/lib/esm/internal/app-binder/command/utils/solanaAppError.test.js.map +7 -0
  174. package/lib/esm/internal/app-binder/command/utils/solanaAppErrors.js +2 -0
  175. package/lib/esm/internal/app-binder/command/utils/solanaAppErrors.js.map +7 -0
  176. package/lib/esm/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.js +2 -0
  177. package/lib/esm/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.js.map +7 -0
  178. package/lib/esm/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.test.js +2 -0
  179. package/lib/esm/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.test.js.map +7 -0
  180. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.js +2 -0
  181. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.js.map +7 -0
  182. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.test.js +2 -0
  183. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.test.js.map +7 -0
  184. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js +2 -0
  185. package/lib/esm/internal/app-binder/device-action/__test-utils__/makeInternalApi.js.map +7 -0
  186. package/lib/esm/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js +2 -0
  187. package/lib/esm/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.js.map +7 -0
  188. package/lib/esm/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js +2 -0
  189. package/lib/esm/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.js.map +7 -0
  190. package/lib/esm/internal/app-binder/di/appBinderModule.js +2 -0
  191. package/lib/esm/internal/app-binder/di/appBinderModule.js.map +7 -0
  192. package/lib/esm/internal/app-binder/di/appBinderModule.test.js +2 -0
  193. package/lib/esm/internal/app-binder/di/appBinderModule.test.js.map +7 -0
  194. package/lib/esm/internal/app-binder/di/appBinderTypes.js +2 -0
  195. package/lib/esm/internal/app-binder/di/appBinderTypes.js.map +7 -0
  196. package/lib/esm/internal/app-binder/task/SendCommandInChunksTask.js +2 -0
  197. package/lib/esm/internal/app-binder/task/SendCommandInChunksTask.js.map +7 -0
  198. package/lib/esm/internal/app-binder/task/SendSignDataTask.js +2 -0
  199. package/lib/esm/internal/app-binder/task/SendSignDataTask.js.map +7 -0
  200. package/lib/esm/internal/app-binder/task/SendSignDataTask.test.js +2 -0
  201. package/lib/esm/internal/app-binder/task/SendSignDataTask.test.js.map +7 -0
  202. package/lib/esm/internal/app-binder/task/SendSignMessageTask.js +2 -0
  203. package/lib/esm/internal/app-binder/task/SendSignMessageTask.js.map +7 -0
  204. package/lib/esm/internal/app-binder/task/SendSignMessageTask.test.js +2 -0
  205. package/lib/esm/internal/app-binder/task/SendSignMessageTask.test.js.map +7 -0
  206. package/lib/esm/internal/di.js +2 -0
  207. package/lib/esm/internal/di.js.map +7 -0
  208. package/lib/esm/internal/externalTypes.js +2 -0
  209. package/lib/esm/internal/externalTypes.js.map +7 -0
  210. package/lib/esm/internal/use-cases/address/GetAddressUseCase.js +2 -0
  211. package/lib/esm/internal/use-cases/address/GetAddressUseCase.js.map +7 -0
  212. package/lib/esm/internal/use-cases/address/GetAddressUseCase.test.js +2 -0
  213. package/lib/esm/internal/use-cases/address/GetAddressUseCase.test.js.map +7 -0
  214. package/lib/esm/internal/use-cases/app-configuration/GetAppConfiguration.test.js +2 -0
  215. package/lib/esm/internal/use-cases/app-configuration/GetAppConfiguration.test.js.map +7 -0
  216. package/lib/esm/internal/use-cases/app-configuration/GetAppConfigurationUseCase.js +2 -0
  217. package/lib/esm/internal/use-cases/app-configuration/GetAppConfigurationUseCase.js.map +7 -0
  218. package/lib/esm/internal/use-cases/di/useCasesModule.js +2 -0
  219. package/lib/esm/internal/use-cases/di/useCasesModule.js.map +7 -0
  220. package/lib/esm/internal/use-cases/di/useCasesModule.test.js +2 -0
  221. package/lib/esm/internal/use-cases/di/useCasesModule.test.js.map +7 -0
  222. package/lib/esm/internal/use-cases/di/useCasesTypes.js +2 -0
  223. package/lib/esm/internal/use-cases/di/useCasesTypes.js.map +7 -0
  224. package/lib/esm/internal/use-cases/message/SignMessageUseCase.js +2 -0
  225. package/lib/esm/internal/use-cases/message/SignMessageUseCase.js.map +7 -0
  226. package/lib/esm/internal/use-cases/message/SignMessageUseCase.test.js +2 -0
  227. package/lib/esm/internal/use-cases/message/SignMessageUseCase.test.js.map +7 -0
  228. package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.js +2 -0
  229. package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.js.map +7 -0
  230. package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.test.js +2 -0
  231. package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.test.js.map +7 -0
  232. package/lib/esm/package.json +58 -0
  233. package/lib/types/api/SignerSolana.d.ts +14 -0
  234. package/lib/types/api/SignerSolana.d.ts.map +1 -0
  235. package/lib/types/api/SignerSolanaBuilder.d.ts +28 -0
  236. package/lib/types/api/SignerSolanaBuilder.d.ts.map +1 -0
  237. package/lib/types/api/app-binder/GetAddressDeviceActionTypes.d.ts +9 -0
  238. package/lib/types/api/app-binder/GetAddressDeviceActionTypes.d.ts.map +1 -0
  239. package/lib/types/api/app-binder/GetAppConfigurationDeviceActionTypes.d.ts +7 -0
  240. package/lib/types/api/app-binder/GetAppConfigurationDeviceActionTypes.d.ts.map +1 -0
  241. package/lib/types/api/app-binder/SignMessageDeviceActionTypes.d.ts +20 -0
  242. package/lib/types/api/app-binder/SignMessageDeviceActionTypes.d.ts.map +1 -0
  243. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts +23 -0
  244. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts.map +1 -0
  245. package/lib/types/api/index.d.ts +10 -0
  246. package/lib/types/api/index.d.ts.map +1 -0
  247. package/lib/types/api/model/AddressOption.d.ts +4 -0
  248. package/lib/types/api/model/AddressOption.d.ts.map +1 -0
  249. package/lib/types/api/model/AppConfiguration.d.ts +7 -0
  250. package/lib/types/api/model/AppConfiguration.d.ts.map +1 -0
  251. package/lib/types/api/model/PublicKey.d.ts +2 -0
  252. package/lib/types/api/model/PublicKey.d.ts.map +1 -0
  253. package/lib/types/api/model/PublicKeyDisplayMode.d.ts +5 -0
  254. package/lib/types/api/model/PublicKeyDisplayMode.d.ts.map +1 -0
  255. package/lib/types/api/model/Signature.d.ts +2 -0
  256. package/lib/types/api/model/Signature.d.ts.map +1 -0
  257. package/lib/types/api/model/Transaction.d.ts +2 -0
  258. package/lib/types/api/model/Transaction.d.ts.map +1 -0
  259. package/lib/types/api/model/TransactionOptions.d.ts +2 -0
  260. package/lib/types/api/model/TransactionOptions.d.ts.map +1 -0
  261. package/lib/types/index.d.ts +3 -0
  262. package/lib/types/index.d.ts.map +1 -0
  263. package/lib/types/internal/DefaultSignerSolana.d.ts +22 -0
  264. package/lib/types/internal/DefaultSignerSolana.d.ts.map +1 -0
  265. package/lib/types/internal/DefaultSignerSolana.test.d.ts +2 -0
  266. package/lib/types/internal/DefaultSignerSolana.test.d.ts.map +1 -0
  267. package/lib/types/internal/app-binder/SolanaAppBinder.d.ts +27 -0
  268. package/lib/types/internal/app-binder/SolanaAppBinder.d.ts.map +1 -0
  269. package/lib/types/internal/app-binder/SolanaAppBinder.test.d.ts +2 -0
  270. package/lib/types/internal/app-binder/SolanaAppBinder.test.d.ts.map +1 -0
  271. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.d.ts +11 -0
  272. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.d.ts.map +1 -0
  273. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.test.d.ts +2 -0
  274. package/lib/types/internal/app-binder/command/GetAppConfigurationCommand.test.d.ts.map +1 -0
  275. package/lib/types/internal/app-binder/command/GetPubKeyCommand.d.ts +15 -0
  276. package/lib/types/internal/app-binder/command/GetPubKeyCommand.d.ts.map +1 -0
  277. package/lib/types/internal/app-binder/command/GetPubKeyCommand.test.d.ts +2 -0
  278. package/lib/types/internal/app-binder/command/GetPubKeyCommand.test.d.ts.map +1 -0
  279. package/lib/types/internal/app-binder/command/SignOffChainMessageCommand.d.ts +14 -0
  280. package/lib/types/internal/app-binder/command/SignOffChainMessageCommand.d.ts.map +1 -0
  281. package/lib/types/internal/app-binder/command/SignOffChainMessageCommand.test.d.ts +2 -0
  282. package/lib/types/internal/app-binder/command/SignOffChainMessageCommand.test.d.ts.map +1 -0
  283. package/lib/types/internal/app-binder/command/SignTransactionCommand.d.ts +19 -0
  284. package/lib/types/internal/app-binder/command/SignTransactionCommand.d.ts.map +1 -0
  285. package/lib/types/internal/app-binder/command/SignTransactionCommand.test.d.ts +2 -0
  286. package/lib/types/internal/app-binder/command/SignTransactionCommand.test.d.ts.map +1 -0
  287. package/lib/types/internal/app-binder/command/utils/solanaAppError.test.d.ts +2 -0
  288. package/lib/types/internal/app-binder/command/utils/solanaAppError.test.d.ts.map +1 -0
  289. package/lib/types/internal/app-binder/command/utils/solanaAppErrors.d.ts +8 -0
  290. package/lib/types/internal/app-binder/command/utils/solanaAppErrors.d.ts.map +1 -0
  291. package/lib/types/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.d.ts +15 -0
  292. package/lib/types/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.d.ts.map +1 -0
  293. package/lib/types/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.test.d.ts +2 -0
  294. package/lib/types/internal/app-binder/device-action/SignMessage/SignMessageDeviceAction.test.d.ts.map +1 -0
  295. package/lib/types/internal/app-binder/device-action/SignTransactionDeviceAction.d.ts +17 -0
  296. package/lib/types/internal/app-binder/device-action/SignTransactionDeviceAction.d.ts.map +1 -0
  297. package/lib/types/internal/app-binder/device-action/SignTransactionDeviceAction.test.d.ts +2 -0
  298. package/lib/types/internal/app-binder/device-action/SignTransactionDeviceAction.test.d.ts.map +1 -0
  299. package/lib/types/internal/app-binder/device-action/__test-utils__/makeInternalApi.d.ts +3 -0
  300. package/lib/types/internal/app-binder/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -0
  301. package/lib/types/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.d.ts +2 -0
  302. package/lib/types/internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock.d.ts.map +1 -0
  303. package/lib/types/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.d.ts +12 -0
  304. package/lib/types/internal/app-binder/device-action/__test-utils__/testDeviceActionStates.d.ts.map +1 -0
  305. package/lib/types/internal/app-binder/di/appBinderModule.d.ts +3 -0
  306. package/lib/types/internal/app-binder/di/appBinderModule.d.ts.map +1 -0
  307. package/lib/types/internal/app-binder/di/appBinderModule.test.d.ts +2 -0
  308. package/lib/types/internal/app-binder/di/appBinderModule.test.d.ts.map +1 -0
  309. package/lib/types/internal/app-binder/di/appBinderTypes.d.ts +4 -0
  310. package/lib/types/internal/app-binder/di/appBinderTypes.d.ts.map +1 -0
  311. package/lib/types/internal/app-binder/task/SendCommandInChunksTask.d.ts +18 -0
  312. package/lib/types/internal/app-binder/task/SendCommandInChunksTask.d.ts.map +1 -0
  313. package/lib/types/internal/app-binder/task/SendSignDataTask.d.ts +17 -0
  314. package/lib/types/internal/app-binder/task/SendSignDataTask.d.ts.map +1 -0
  315. package/lib/types/internal/app-binder/task/SendSignDataTask.test.d.ts +2 -0
  316. package/lib/types/internal/app-binder/task/SendSignDataTask.test.d.ts.map +1 -0
  317. package/lib/types/internal/app-binder/task/SendSignMessageTask.d.ts +15 -0
  318. package/lib/types/internal/app-binder/task/SendSignMessageTask.d.ts.map +1 -0
  319. package/lib/types/internal/app-binder/task/SendSignMessageTask.test.d.ts +2 -0
  320. package/lib/types/internal/app-binder/task/SendSignMessageTask.test.d.ts.map +1 -0
  321. package/lib/types/internal/di.d.ts +8 -0
  322. package/lib/types/internal/di.d.ts.map +1 -0
  323. package/lib/types/internal/externalTypes.d.ts +5 -0
  324. package/lib/types/internal/externalTypes.d.ts.map +1 -0
  325. package/lib/types/internal/use-cases/address/GetAddressUseCase.d.ts +9 -0
  326. package/lib/types/internal/use-cases/address/GetAddressUseCase.d.ts.map +1 -0
  327. package/lib/types/internal/use-cases/address/GetAddressUseCase.test.d.ts +2 -0
  328. package/lib/types/internal/use-cases/address/GetAddressUseCase.test.d.ts.map +1 -0
  329. package/lib/types/internal/use-cases/app-configuration/GetAppConfiguration.test.d.ts +2 -0
  330. package/lib/types/internal/use-cases/app-configuration/GetAppConfiguration.test.d.ts.map +1 -0
  331. package/lib/types/internal/use-cases/app-configuration/GetAppConfigurationUseCase.d.ts +8 -0
  332. package/lib/types/internal/use-cases/app-configuration/GetAppConfigurationUseCase.d.ts.map +1 -0
  333. package/lib/types/internal/use-cases/di/useCasesModule.d.ts +3 -0
  334. package/lib/types/internal/use-cases/di/useCasesModule.d.ts.map +1 -0
  335. package/lib/types/internal/use-cases/di/useCasesModule.test.d.ts +2 -0
  336. package/lib/types/internal/use-cases/di/useCasesModule.test.d.ts.map +1 -0
  337. package/lib/types/internal/use-cases/di/useCasesTypes.d.ts +7 -0
  338. package/lib/types/internal/use-cases/di/useCasesTypes.d.ts.map +1 -0
  339. package/lib/types/internal/use-cases/message/SignMessageUseCase.d.ts +8 -0
  340. package/lib/types/internal/use-cases/message/SignMessageUseCase.d.ts.map +1 -0
  341. package/lib/types/internal/use-cases/message/SignMessageUseCase.test.d.ts +2 -0
  342. package/lib/types/internal/use-cases/message/SignMessageUseCase.test.d.ts.map +1 -0
  343. package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.d.ts +10 -0
  344. package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.d.ts.map +1 -0
  345. package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.test.d.ts +2 -0
  346. package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.test.d.ts.map +1 -0
  347. package/lib/types/tsconfig.prod.tsbuildinfo +1 -0
  348. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,513 @@
1
+ # Ledger Solana Signer Implementation
2
+
3
+ ## Introduction
4
+
5
+ This module provides the implementation of the Ledger Solana signer of the Device Management Kit. It enables interaction with the Solana application on a Ledger device including:
6
+
7
+ - Retrieving the Solana address using a given derivation path;
8
+ - Signing a Solana transaction;
9
+ - Signing an offchain message displayed on a Ledger device;
10
+ - Retreiving the app configuration;
11
+
12
+ ### How it works
13
+
14
+ The Ledger Solana Signer utilizes the advanced capabilities of the Ledger device to provide secure operations for end users. It takes advantage of the interface provided by the Device Management Kit to establish communication with the Ledger device and execute various operations. The communication with the Ledger device is performed using [APDU](https://en.wikipedia.org/wiki/Smart_card_application_protocol_data_unit)s (Application Protocol Data Units), which are encapsulated within the `Command` object. These commands are then organized into tasks, allowing for the execution of complex operations with one or more APDUs. The tasks are further encapsulated within `DeviceAction` objects to handle different real-world scenarios. Finally, the Signer exposes dedicated and independent use cases that can be directly utilized by end users.
15
+
16
+ ### Installation
17
+
18
+ > **Note:** This module is not standalone; it depends on the [@ledgerhq/device-management-kit](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/device-management-kit) package, so you need to install it first.
19
+
20
+ To install the `device-signer-kit-solana` package, run the following command:
21
+
22
+ ```sh
23
+ npm install @ledgerhq/device-signer-kit-solana
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ ### Setting up
29
+
30
+ To initialize a Sonala signer instance, you need a Ledger Device Management Kit instance and the ID of the session of the connected device. Use the `SignerSolanaBuilder` along with the [Context Module](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/packages/signer/context-module) by default developed by Ledger:
31
+
32
+ ```typescript
33
+ // Initialize a Solana signer instance
34
+ const signerSolana = new SignerSolanaBuilder({ sdk, sessionId }).build();
35
+ ```
36
+
37
+ ### Use Cases
38
+
39
+ The `SignerSolanaBuilder.build()` method will return a `SignerSolana` instance that exposes 4 dedicated methods, each of which calls an independent use case. Each use case will return an object that contains an observable and a method called `cancel`.
40
+
41
+ #### Use Case 1: Get Address
42
+
43
+ This method allows users to retrieve the Solana address according to given `derivationPath`.
44
+
45
+ ```typescript
46
+ const { observable, cancel } = signerSolana.getAddress(derivationPath, options);
47
+ ```
48
+
49
+ **Parameters**
50
+
51
+ - `derivationPath`
52
+
53
+ - **Required**
54
+ - **Type:** `string` (e.g., `"44'/501'/0'"`)
55
+ - The derivation path used for the Solana address. See [here](https://www.ledger.com/blog/understanding-crypto-addresses-and-derivation-paths) for more information.
56
+
57
+ - `options`
58
+
59
+ - Optional
60
+ - Type: `AddressOptions`
61
+
62
+ ```typescript
63
+ type AddressOptions = {
64
+ checkOnDevice?: boolean;
65
+ };
66
+ ```
67
+
68
+ - `checkOnDevice`: An optional boolean indicating whether user confirmation on the device is required (`true`) or not (`false`).
69
+
70
+ **Returns**
71
+
72
+ - `observable`
73
+
74
+ - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance, which reprensents the operation's state. For example:
75
+
76
+ ```typescript
77
+ observable.subscribe({
78
+ next: (state: DeviceActionState) => {
79
+ switch (state.status) {
80
+ case DeviceActionStatus.NotStarted: {
81
+ console.log("The action is not started yet.");
82
+ break;
83
+ }
84
+ case DeviceActionStatus.Pending: {
85
+ const {
86
+ intermediateValue: { requiredUserInteraction },
87
+ } = state;
88
+ // Access the intermediate value here, explained below
89
+ console.log(
90
+ "The action is pending and the intermediate value is: ",
91
+ intermediateValue,
92
+ );
93
+ break;
94
+ }
95
+ case DeviceActionStatus.Stopped: {
96
+ console.log("The action has been stopped.");
97
+ break;
98
+ }
99
+ case DeviceActionStatus.Completed: {
100
+ const { output } = state;
101
+ // Access the output of the completed action here
102
+ console.log("The action has been completed: ", output);
103
+ break;
104
+ }
105
+ case DeviceActionStatus.Error: {
106
+ const { error } = state;
107
+ // Access the error here if occured
108
+ console.log("An error occured during the action: ", error);
109
+ break;
110
+ }
111
+ }
112
+ },
113
+ });
114
+ ```
115
+
116
+ - When the action status is `DeviceActionStatus.Pending`, the state will include an `intermediateValue` object that provides useful information for interaction:
117
+
118
+ ```typescript
119
+ const { requiredUserInteraction } = intermediateValue;
120
+
121
+ switch (requiredUserInteraction) {
122
+ case UserInteractionRequired.VerifyAddress: {
123
+ // User needs to verify the address displayed on the device
124
+ console.log(
125
+ "User needs to verify the address displayed on the device.",
126
+ );
127
+ break;
128
+ }
129
+ case UserInteractionRequired.None: {
130
+ // No user action required
131
+ console.log("No user action needed.");
132
+ break;
133
+ }
134
+ case UserInteractionRequired.UnlockDevice: {
135
+ // User needs to unlock the device
136
+ console.log("The user needs to unlock the device.");
137
+ break;
138
+ }
139
+ case UserInteractionRequired.ConfirmOpenApp: {
140
+ // User needs to confirm on the device to open the app
141
+ console.log("The user needs to confirm on the device to open the app.");
142
+ break;
143
+ }
144
+ default:
145
+ // Type guard to ensure all cases are handled
146
+ const uncaughtUserInteraction: never = requiredUserInteraction;
147
+ console.error(
148
+ "Unhandled user interaction case:",
149
+ uncaughtUserInteraction,
150
+ );
151
+ }
152
+ ```
153
+
154
+ - When the action status is `DeviceActionStatus.Completed`, the execution result can be accessed through the `output` property in the state. The `output` property is of type `PublicKey` in `base58`.
155
+
156
+ ```typescript
157
+ type PublicKey = string; // address in base58 format
158
+ ```
159
+
160
+ - `cancel`
161
+ - The function without a return value to cancel the action on the Ledger device.
162
+
163
+ #### Use Case 2: Sign Transaction
164
+
165
+ This method enables users to securely sign transactions using clear signing on Ledger devices.
166
+
167
+ ```typescript
168
+ const { observable, cancel } = signerSolana.signTransaction(
169
+ derivationPath,
170
+ transaction,
171
+ options,
172
+ );
173
+ ```
174
+
175
+ **Parameters**
176
+
177
+ - `derivationPath`
178
+
179
+ - **Required**
180
+ - **Type:** `string` (e.g., `"44'/501'/0'"`)
181
+ - The derivation path used in the transaction. See [here](https://www.ledger.com/blog/understanding-crypto-addresses-and-derivation-paths) for more information.
182
+
183
+ - `transaction`
184
+
185
+ - **Required**
186
+ - **Type:** `Uint8Array`
187
+ - The transaction object that needs to be signed.
188
+
189
+ - `options`
190
+
191
+ - **Optional**
192
+ - **Type:** `TBD`
193
+ - No option defined yet, but will be used for clear signing in a near future.
194
+
195
+ ```typescript
196
+ type TransactionOptions = {};
197
+ ```
198
+
199
+ **Returns**
200
+
201
+ - `observable`
202
+
203
+ - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example:
204
+
205
+ ```typescript
206
+ observable.subscribe({
207
+ next: (state: SignTransactionDAState) => {
208
+ switch (state.status) {
209
+ case DeviceActionStatus.NotStarted: {
210
+ console.log("The action is not started yet.");
211
+ break;
212
+ }
213
+ case DeviceActionStatus.Pending: {
214
+ const {
215
+ intermediateValue: { requiredUserInteraction },
216
+ } = state;
217
+ // Access the intermediate value here, explained below
218
+ console.log(
219
+ "The action is pending and the intermediate value is: ",
220
+ intermediateValue,
221
+ );
222
+ break;
223
+ }
224
+ case DeviceActionStatus.Stopped: {
225
+ console.log("The action has been stopped.");
226
+ break;
227
+ }
228
+ case DeviceActionStatus.Completed: {
229
+ const { output } = state;
230
+ // Access the output of the completed action here
231
+ console.log("The action has been completed: ", output);
232
+ break;
233
+ }
234
+ case DeviceActionStatus.Error: {
235
+ const { error } = state;
236
+ // Access the error here if occured
237
+ console.log("An error occured during the action: ", error);
238
+ break;
239
+ }
240
+ }
241
+ },
242
+ });
243
+ ```
244
+
245
+ - When the action status is `DeviceActionStatus.Pending`, the state will include an `intermediateValue` object that provides useful information for interaction:
246
+
247
+ ```typescript
248
+ const { requiredUserInteraction } = intermediateValue;
249
+
250
+ switch (requiredUserInteraction) {
251
+ case UserInteractionRequired.SignTransaction: {
252
+ // User needs to sign the transaction displayed on the device
253
+ console.log(
254
+ "User needs to sign the transaction displayed on the device.",
255
+ );
256
+ break;
257
+ }
258
+ case UserInteractionRequired.None: {
259
+ // No user action required
260
+ console.log("No user action needed.");
261
+ break;
262
+ }
263
+ case UserInteractionRequired.UnlockDevice: {
264
+ // User needs to unlock the device
265
+ console.log("The user needs to unlock the device.");
266
+ break;
267
+ }
268
+ case UserInteractionRequired.ConfirmOpenApp: {
269
+ // User needs to confirm on the device to open the app
270
+ console.log("The user needs to confirm on the device to open the app.");
271
+ break;
272
+ }
273
+ default:
274
+ // Type guard to ensure all cases are handled
275
+ const uncaughtUserInteraction: never = requiredUserInteraction;
276
+ console.error(
277
+ "Unhandled user interaction case:",
278
+ uncaughtUserInteraction,
279
+ );
280
+ }
281
+ ```
282
+
283
+ - When the action status is `DeviceActionStatus.Completed`, the execution result can be accessed through the `output` property in the state. This property is a `Signature` object with the following structure:
284
+
285
+ ```typescript
286
+ type Signature = Uint8Array;
287
+ ```
288
+
289
+ - `cancel`
290
+ - The function without a return value to cancel the action on the Ledger device.
291
+
292
+ #### Use Case 3: Sign Message
293
+
294
+ This method allows users to sign a text string that is displayed on Ledger devices.
295
+
296
+ ```typescript
297
+ const { observable, cancel } = signerSolana.signMessage(
298
+ derivationPath,
299
+ message,
300
+ );
301
+ ```
302
+
303
+ **Parameters**
304
+
305
+ - `derivationPath`
306
+
307
+ - **Required**
308
+ - **Type:** `string` (e.g., `"44'/501'/0'"`)
309
+ - The derivation path used by the Solana message. See [here](https://www.ledger.com/blog/understanding-crypto-addresses-and-derivation-paths) for more information.
310
+
311
+ - `message`
312
+
313
+ - **Required**
314
+ - **Type:** `string`
315
+ - The message to be signed, which will be displayed on the Ledger device.
316
+
317
+ **Returns**
318
+
319
+ - `observable`
320
+
321
+ - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example:
322
+
323
+ ```typescript
324
+ observable.subscribe({
325
+ next: (state: SignPersonalMessageDAState) => {
326
+ switch (state.status) {
327
+ case DeviceActionStatus.NotStarted: {
328
+ console.log("The action is not started yet.");
329
+ break;
330
+ }
331
+ case DeviceActionStatus.Pending: {
332
+ const {
333
+ intermediateValue: { requiredUserInteraction },
334
+ } = state;
335
+ // Access the intermediate value here, explained below
336
+ console.log(
337
+ "The action is pending and the intermediate value is: ",
338
+ intermediateValue,
339
+ );
340
+ break;
341
+ }
342
+ case DeviceActionStatus.Stopped: {
343
+ console.log("The action has been stopped.");
344
+ break;
345
+ }
346
+ case DeviceActionStatus.Completed: {
347
+ const { output } = state;
348
+ // Access the output of the completed action here
349
+ console.log("The action has been completed: ", output);
350
+ break;
351
+ }
352
+ case DeviceActionStatus.Error: {
353
+ const { error } = state;
354
+ // Access the error here if occured
355
+ console.log("An error occured during the action: ", error);
356
+ break;
357
+ }
358
+ }
359
+ },
360
+ });
361
+ ```
362
+
363
+ - When the action status is `DeviceActionStatus.Pending`, the state will include an `intermediateValue` object that provides useful information for interaction:
364
+
365
+ ```typescript
366
+ const { requiredUserInteraction } = intermediateValue;
367
+
368
+ switch (requiredUserInteraction) {
369
+ case UserInteractionRequired.SignPersonalMessage: {
370
+ // User needs to sign the message displayed on the device
371
+ console.log("User needs to sign the message displayed on the device.");
372
+ break;
373
+ }
374
+ case UserInteractionRequired.None: {
375
+ // No user action required
376
+ console.log("No user action needed.");
377
+ break;
378
+ }
379
+ case UserInteractionRequired.UnlockDevice: {
380
+ // User needs to unlock the device
381
+ console.log("The user needs to unlock the device.");
382
+ break;
383
+ }
384
+ case UserInteractionRequired.ConfirmOpenApp: {
385
+ // User needs to confirm on the device to open the app
386
+ console.log("The user needs to confirm on the device to open the app.");
387
+ break;
388
+ }
389
+ default:
390
+ // Type guard to ensure all cases are handled
391
+ const uncaughtUserInteraction: never = requiredUserInteraction;
392
+ console.error(
393
+ "Unhandled user interaction case:",
394
+ uncaughtUserInteraction,
395
+ );
396
+ }
397
+ ```
398
+
399
+ - When the action status is `DeviceActionStatus.Completed`, the execution result can be accessed through the `output` property in the state. This property is a `Signature` object with the following structure:
400
+
401
+ ```typescript
402
+ type Signature = Uint8Array;
403
+ ```
404
+
405
+ - `cancel`
406
+ - The function without a return value to cancel the action on the Ledger device.
407
+
408
+ #### Use Case 4: Get App Configuration
409
+
410
+ This method allow the user to fetch the current app configuration.
411
+
412
+ ```typescript
413
+ const { observable, cancel } = signerSolana.getAppConfiguration();
414
+ ```
415
+
416
+ **Returns**
417
+
418
+ - `observable`
419
+
420
+ - An [Observable](https://rxjs.dev/guide/observable) object that contains the [`DeviceActionState`](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/packages/device-management-kit/src/api/device-action/model/DeviceActionState.ts) derived instance which reprensents the operation's state. For example:
421
+
422
+ ```typescript
423
+ observable.subscribe({
424
+ next: (state: SignTypedDataDAState) => {
425
+ switch (state.status) {
426
+ case DeviceActionStatus.NotStarted: {
427
+ console.log("The action is not started yet.");
428
+ break;
429
+ }
430
+ case DeviceActionStatus.Pending: {
431
+ const { intermediateValue } = state;
432
+ // Access the intermediate value here, explained below
433
+ console.log(
434
+ "The action is pending and the intermediate value is: ",
435
+ requiredUserInteraction,
436
+ );
437
+ break;
438
+ }
439
+ case DeviceActionStatus.Stopped: {
440
+ console.log("The action has been stopped.");
441
+ break;
442
+ }
443
+ case DeviceActionStatus.Completed: {
444
+ const { output } = state;
445
+ // Access the output of the completed action here, explained below
446
+ console.log("The action has been completed: ", output);
447
+ break;
448
+ }
449
+ case DeviceActionStatus.Error: {
450
+ const { error } = state;
451
+ // Access the error here if occured
452
+ console.log("An error occured during the action: ", error);
453
+ break;
454
+ }
455
+ }
456
+ },
457
+ });
458
+ ```
459
+
460
+ - When the action status is `DeviceActionStatus.Pending`, the state will include an `intermediateValue` object that provides useful information for interaction:
461
+
462
+ ```typescript
463
+ const { requiredUserInteraction } = intermediateValue;
464
+
465
+ switch (requiredUserInteraction) {
466
+ case UserInteractionRequired.SignTypedData: {
467
+ // User needs to sign the typed data displayed on the device
468
+ console.log(
469
+ "User needs to sign the typed data displayed on the device.",
470
+ );
471
+ break;
472
+ }
473
+ case UserInteractionRequired.None: {
474
+ // No user action required
475
+ console.log("No user action needed.");
476
+ break;
477
+ }
478
+ case UserInteractionRequired.UnlockDevice: {
479
+ // User needs to unlock the device
480
+ console.log("The user needs to unlock the device.");
481
+ break;
482
+ }
483
+ case UserInteractionRequired.ConfirmOpenApp: {
484
+ // User needs to confirm on the device to open the app
485
+ console.log("The user needs to confirm on the device to open the app.");
486
+ break;
487
+ }
488
+ default:
489
+ // Type guard to ensure all cases are handled
490
+ const uncaughtUserInteraction: never = requiredUserInteraction;
491
+ console.error(
492
+ "Unhandled user interaction case:",
493
+ uncaughtUserInteraction,
494
+ );
495
+ }
496
+ ```
497
+
498
+ - When the action status is `DeviceActionStatus.Completed`, the execution result can be accessed through the `output` property in the state. This property is a `Signature` object with the following structure:
499
+
500
+ ```typescript
501
+ type AppConfiguration = {
502
+ blindSigningEnabled: boolean;
503
+ pubKeyDisplayMode: PublicKeyDisplayMode;
504
+ version: string;
505
+ };
506
+ ```
507
+
508
+ - `cancel`
509
+ - The function without a return value to cancel the action on the Ledger device.
510
+
511
+ ## Example
512
+
513
+ We encourage you to explore the Solana Signer by trying it out in our online [sample application](https://app.devicesdk.ledger-test.com/). Experience how it works and see its capabilities in action. Of course, you will need a Ledger device connected.
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var g=(n,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!a.call(n,e)&&e!==o&&i(n,e,{get:()=>t[e],enumerable:!(r=s(t,e))||r.enumerable});return n};var A=n=>g(i({},"__esModule",{value:!0}),n);var m={};module.exports=A(m);
2
+ //# sourceMappingURL=SignerSolana.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/SignerSolana.ts"],
4
+ "sourcesContent": ["import { type GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { type GetAppConfigurationDAReturnType } from \"@api/app-binder/GetAppConfigurationDeviceActionTypes\";\nimport { type SignMessageDAReturnType } from \"@api/app-binder/SignMessageDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type AddressOptions } from \"@api/model/AddressOption\";\nimport { type Transaction } from \"@api/model/Transaction\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\n\nexport interface SignerSolana {\n signTransaction: (\n derivationPath: string,\n transaction: Transaction,\n options?: TransactionOptions,\n ) => SignTransactionDAReturnType;\n signMessage: (\n derivationPath: string,\n message: string,\n ) => SignMessageDAReturnType;\n getAddress: (\n derivationPath: string,\n options?: AddressOptions,\n ) => GetAddressDAReturnType;\n getAppConfiguration: () => GetAppConfigurationDAReturnType;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SignerSolana_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var m=(i,e)=>{for(var s in e)t(i,s,{get:e[s],enumerable:!0})},l=(i,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!c.call(i,n)&&n!==s&&t(i,n,{get:()=>e[n],enumerable:!(r=a(e,n))||r.enumerable});return i};var S=i=>l(t({},"__esModule",{value:!0}),i);var g={};m(g,{SignerSolanaBuilder:()=>u});module.exports=S(g);var o=require("../internal/DefaultSignerSolana");class u{_dmk;_sessionId;constructor({dmk:e,sessionId:s}){this._dmk=e,this._sessionId=s}build(){return new o.DefaultSignerSolana({dmk:this._dmk,sessionId:this._sessionId})}}0&&(module.exports={SignerSolanaBuilder});
2
+ //# sourceMappingURL=SignerSolanaBuilder.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/SignerSolanaBuilder.ts"],
4
+ "sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { DefaultSignerSolana } from \"@internal/DefaultSignerSolana\";\n\ntype SignerSolanaBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\n/**\n * Builder for the `SignerSolana` class.\n *\n * @example\n * ```\n * const signer = new SignerSolanaBuilder({ dmk, sessionId })\n * .build();\n * ```\n */\nexport class SignerSolanaBuilder {\n private _dmk: DeviceManagementKit;\n private _sessionId: DeviceSessionId;\n\n constructor({ dmk, sessionId }: SignerSolanaBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n }\n\n /**\n * Build the solana signer\n *\n * @returns the solana signer\n */\n public build() {\n return new DefaultSignerSolana({\n dmk: this._dmk,\n sessionId: this._sessionId,\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAKA,IAAAI,EAAoC,yCAgB7B,MAAMF,CAAoB,CACvB,KACA,WAER,YAAY,CAAE,IAAAG,EAAK,UAAAC,CAAU,EAAuC,CAClE,KAAK,KAAOD,EACZ,KAAK,WAAaC,CACpB,CAOO,OAAQ,CACb,OAAO,IAAI,sBAAoB,CAC7B,IAAK,KAAK,KACV,UAAW,KAAK,UAClB,CAAC,CACH,CACF",
6
+ "names": ["SignerSolanaBuilder_exports", "__export", "SignerSolanaBuilder", "__toCommonJS", "import_DefaultSignerSolana", "dmk", "sessionId"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var u=(t,e,p,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of o(e))!s.call(t,r)&&r!==p&&n(t,r,{get:()=>e[r],enumerable:!(d=A(e,r))||d.enumerable});return t};var i=t=>u(n({},"__esModule",{value:!0}),t);var m={};module.exports=i(m);
2
+ //# sourceMappingURL=GetAddressDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/app-binder/GetAddressDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type ExecuteDeviceActionReturnType,\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type PublicKey } from \"@api/model/PublicKey\";\n\ntype GetAddressDAUserInteractionRequired =\n | UserInteractionRequired.None\n | UserInteractionRequired.VerifyAddress;\n\nexport type GetAddressDAOutput = SendCommandInAppDAOutput<PublicKey>;\nexport type GetAddressDAError = SendCommandInAppDAError<never>;\nexport type GetAddressDAIntermediateValue =\n SendCommandInAppDAIntermediateValue<GetAddressDAUserInteractionRequired>;\n\nexport type GetAddressDAReturnType = ExecuteDeviceActionReturnType<\n GetAddressDAOutput,\n GetAddressDAError,\n GetAddressDAIntermediateValue\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["GetAddressDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of A(e))!u.call(t,p)&&p!==o&&r(t,p,{get:()=>e[p],enumerable:!(n=i(e,p))||n.enumerable});return t};var m=t=>a(r({},"__esModule",{value:!0}),t);var d={};module.exports=m(d);
2
+ //# sourceMappingURL=GetAppConfigurationDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/app-binder/GetAppConfigurationDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type ExecuteDeviceActionReturnType,\n type SendCommandInAppDAError,\n type SendCommandInAppDAIntermediateValue,\n type SendCommandInAppDAOutput,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type AppConfiguration } from \"@api/model/AppConfiguration\";\n\nexport type GetAppConfigurationDAOutput =\n SendCommandInAppDAOutput<AppConfiguration>;\n\nexport type GetAppConfigurationDAError = SendCommandInAppDAError<never>;\n\nexport type GetAppConfigurationDAIntermediateValue =\n SendCommandInAppDAIntermediateValue<UserInteractionRequired.None>;\n\nexport type GetAppConfigurationDAReturnType = ExecuteDeviceActionReturnType<\n GetAppConfigurationDAOutput,\n GetAppConfigurationDAError,\n GetAppConfigurationDAIntermediateValue\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["GetAppConfigurationDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var o=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!g.call(t,r)&&r!==a&&i(t,r,{get:()=>e[r],enumerable:!(n=s(e,r))||n.enumerable});return t};var u=t=>o(i({},"__esModule",{value:!0}),t);var A={};module.exports=u(A);
2
+ //# sourceMappingURL=SignMessageDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/app-binder/SignMessageDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type CommandErrorResult,\n type DeviceActionState,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\n\nexport type SignMessageDAOutput = Signature;\n\nexport type SignMessageDAInput = {\n readonly derivationPath: string;\n readonly message: string;\n};\n\nexport type SignMessageDAError = OpenAppDAError | CommandErrorResult[\"error\"];\n\ntype SignMessageDARequiredInteraction =\n | OpenAppDARequiredInteraction\n | UserInteractionRequired.SignPersonalMessage;\n\nexport type SignMessageDAIntermediateValue = {\n requiredUserInteraction: SignMessageDARequiredInteraction;\n};\n\nexport type SignMessageDAState = DeviceActionState<\n SignMessageDAOutput,\n SignMessageDAError,\n SignMessageDAIntermediateValue\n>;\n\nexport type SignMessageDAInternalState = {\n readonly error: SignMessageDAError | null;\n readonly signature: Signature | null;\n};\n\nexport type SignMessageDAReturnType = ExecuteDeviceActionReturnType<\n SignMessageDAOutput,\n SignMessageDAError,\n SignMessageDAIntermediateValue\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SignMessageDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(t,n,a,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of p(n))!c.call(t,r)&&r!==a&&i(t,r,{get:()=>n[r],enumerable:!(e=o(n,r))||e.enumerable});return t};var u=t=>s(i({},"__esModule",{value:!0}),t);var A={};module.exports=u(A);
2
+ //# sourceMappingURL=SignTransactionDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/app-binder/SignTransactionDeviceActionTypes.ts"],
4
+ "sourcesContent": ["import {\n type CommandErrorResult,\n type DeviceActionState,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport { type Transaction } from \"@api/model/Transaction\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\n\nexport type SignTransactionDAOutput = Signature;\n\nexport type SignTransactionDAInput = {\n readonly derivationPath: string;\n readonly transaction: Transaction;\n readonly options: TransactionOptions;\n};\n\nexport type SignTransactionDAError =\n | OpenAppDAError\n | CommandErrorResult[\"error\"];\n\ntype SignTransactionDARequiredInteraction =\n | OpenAppDARequiredInteraction\n | UserInteractionRequired.SignTransaction;\n\nexport type SignTransactionDAIntermediateValue = {\n requiredUserInteraction: SignTransactionDARequiredInteraction;\n};\n\nexport type SignTransactionDAState = DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n\nexport type SignTransactionDAInternalState = {\n readonly error: SignTransactionDAError | null;\n readonly signature: Signature | null;\n};\n\nexport type SignTransactionDAReturnType = ExecuteDeviceActionReturnType<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["SignTransactionDeviceActionTypes_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},g=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!A.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(a=o(e,r))||a.enumerable});return t};var u=t=>g(i({},"__esModule",{value:!0}),t);var D={};d(D,{SignerSolanaBuilder:()=>p.SignerSolanaBuilder});module.exports=u(D);var p=require("./SignerSolanaBuilder");0&&(module.exports={SignerSolanaBuilder});
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/index.ts"],
4
+ "sourcesContent": ["export type {\n GetAddressDAError,\n GetAddressDAIntermediateValue,\n GetAddressDAOutput,\n GetAddressDAReturnType,\n} from \"@api/app-binder/GetAddressDeviceActionTypes\";\nexport type {\n GetAppConfigurationDAError,\n GetAppConfigurationDAIntermediateValue,\n GetAppConfigurationDAOutput,\n} from \"@api/app-binder/GetAppConfigurationDeviceActionTypes\";\nexport type {\n SignMessageDAError,\n SignMessageDAIntermediateValue,\n SignMessageDAOutput,\n} from \"@api/app-binder/SignMessageDeviceActionTypes\";\nexport type {\n SignTransactionDAError,\n SignTransactionDAIntermediateValue,\n SignTransactionDAOutput,\n SignTransactionDAReturnType,\n} from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nexport type { Signature } from \"@api/model/Signature\";\nexport type { Transaction } from \"@api/model/Transaction\";\nexport type { TransactionOptions } from \"@api/model/TransactionOptions\";\nexport type { SignerSolana } from \"@api/SignerSolana\";\nexport { SignerSolanaBuilder } from \"@api/SignerSolanaBuilder\";\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gEAAAE,EAAAF,GA0BA,IAAAG,EAAoC",
6
+ "names": ["api_exports", "__export", "__toCommonJS", "import_SignerSolanaBuilder"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var p=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var r=(o,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of d(e))!i.call(o,c)&&c!==s&&p(o,c,{get:()=>e[c],enumerable:!(n=t(e,c))||n.enumerable});return o};var O=o=>r(p({},"__esModule",{value:!0}),o);var a={};module.exports=O(a);
2
+ //# sourceMappingURL=AddressOption.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/model/AddressOption.ts"],
4
+ "sourcesContent": ["export type AddressOptions = {\n checkOnDevice?: boolean;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["AddressOption_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var r=(e,i,l,p)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of a(i))!b.call(e,o)&&o!==l&&n(e,o,{get:()=>i[o],enumerable:!(p=y(i,o))||p.enumerable});return e};var t=e=>r(n({},"__esModule",{value:!0}),e);var d={};module.exports=t(d);
2
+ //# sourceMappingURL=AppConfiguration.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/model/AppConfiguration.ts"],
4
+ "sourcesContent": ["import { type PublicKeyDisplayMode } from \"./PublicKeyDisplayMode\";\n\nexport type AppConfiguration = {\n blindSigningEnabled: boolean;\n pubKeyDisplayMode: PublicKeyDisplayMode;\n version: string;\n};\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["AppConfiguration_exports", "__toCommonJS"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(t,e,y,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!g.call(t,i)&&i!==y&&r(t,i,{get:()=>e[i],enumerable:!(p=b(e,i))||p.enumerable});return t};var n=t=>l(r({},"__esModule",{value:!0}),t);var o={};module.exports=n(o);
2
+ //# sourceMappingURL=PublicKey.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/api/model/PublicKey.ts"],
4
+ "sourcesContent": ["export type PublicKey = string;\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["PublicKey_exports", "__toCommonJS"]
7
+ }