@ledgerhq/device-signer-kit-bitcoin 0.0.0-20250119001136 → 0.0.0-signer-eth-20250122093657

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 (116) hide show
  1. package/README.md +363 -0
  2. package/lib/cjs/api/SignerBtc.js +1 -1
  3. package/lib/cjs/api/SignerBtc.js.map +1 -1
  4. package/lib/cjs/api/app-binder/GetWalletAddressDeviceActionTypes.js +2 -0
  5. package/lib/cjs/api/app-binder/GetWalletAddressDeviceActionTypes.js.map +7 -0
  6. package/lib/cjs/api/index.js +1 -1
  7. package/lib/cjs/api/index.js.map +2 -2
  8. package/lib/cjs/api/model/Wallet.js +1 -1
  9. package/lib/cjs/api/model/Wallet.js.map +1 -1
  10. package/lib/cjs/api/model/WalletAddressOptions.js +2 -0
  11. package/lib/cjs/api/model/WalletAddressOptions.js.map +7 -0
  12. package/lib/cjs/internal/DefaultSignerBtc.js +1 -1
  13. package/lib/cjs/internal/DefaultSignerBtc.js.map +3 -3
  14. package/lib/cjs/internal/app-binder/BtcAppBinder.js +1 -1
  15. package/lib/cjs/internal/app-binder/BtcAppBinder.js.map +3 -3
  16. package/lib/cjs/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js +1 -1
  17. package/lib/cjs/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js.map +2 -2
  18. package/lib/cjs/internal/app-binder/command/GetWalletAddressCommand.js +1 -1
  19. package/lib/cjs/internal/app-binder/command/GetWalletAddressCommand.js.map +3 -3
  20. package/lib/cjs/internal/app-binder/command/GetWalletAddressCommand.test.js +1 -1
  21. package/lib/cjs/internal/app-binder/command/GetWalletAddressCommand.test.js.map +3 -3
  22. package/lib/cjs/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js +2 -0
  23. package/lib/cjs/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js.map +7 -0
  24. package/lib/cjs/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.js +2 -0
  25. package/lib/cjs/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.js.map +7 -0
  26. package/lib/cjs/internal/app-binder/task/GetWalletAddressTask.js +2 -0
  27. package/lib/cjs/internal/app-binder/task/GetWalletAddressTask.js.map +7 -0
  28. package/lib/cjs/internal/app-binder/task/GetWalletAddressTask.test.js +2 -0
  29. package/lib/cjs/internal/app-binder/task/GetWalletAddressTask.test.js.map +7 -0
  30. package/lib/cjs/internal/use-cases/di/useCasesModule.js +1 -1
  31. package/lib/cjs/internal/use-cases/di/useCasesModule.js.map +3 -3
  32. package/lib/cjs/internal/use-cases/di/useCasesModule.test.js +1 -1
  33. package/lib/cjs/internal/use-cases/di/useCasesModule.test.js.map +2 -2
  34. package/lib/cjs/internal/use-cases/di/useCasesTypes.js +1 -1
  35. package/lib/cjs/internal/use-cases/di/useCasesTypes.js.map +2 -2
  36. package/lib/cjs/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.js +2 -0
  37. package/lib/cjs/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.js.map +7 -0
  38. package/lib/cjs/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.js +2 -0
  39. package/lib/cjs/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.js.map +7 -0
  40. package/lib/cjs/internal/utils/BtcCommandUtils.js +1 -1
  41. package/lib/cjs/internal/utils/BtcCommandUtils.js.map +3 -3
  42. package/lib/cjs/package.json +1 -1
  43. package/lib/esm/api/app-binder/GetWalletAddressDeviceActionTypes.js +1 -0
  44. package/lib/esm/api/app-binder/GetWalletAddressDeviceActionTypes.js.map +7 -0
  45. package/lib/esm/api/index.js +1 -1
  46. package/lib/esm/api/index.js.map +2 -2
  47. package/lib/esm/api/model/Wallet.js +1 -1
  48. package/lib/esm/api/model/Wallet.js.map +1 -1
  49. package/lib/esm/api/model/WalletAddressOptions.js +1 -0
  50. package/lib/esm/api/model/WalletAddressOptions.js.map +7 -0
  51. package/lib/esm/internal/DefaultSignerBtc.js +1 -1
  52. package/lib/esm/internal/DefaultSignerBtc.js.map +3 -3
  53. package/lib/esm/internal/app-binder/BtcAppBinder.js +1 -1
  54. package/lib/esm/internal/app-binder/BtcAppBinder.js.map +3 -3
  55. package/lib/esm/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js +1 -1
  56. package/lib/esm/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js.map +2 -2
  57. package/lib/esm/internal/app-binder/command/GetWalletAddressCommand.js +1 -1
  58. package/lib/esm/internal/app-binder/command/GetWalletAddressCommand.js.map +3 -3
  59. package/lib/esm/internal/app-binder/command/GetWalletAddressCommand.test.js +1 -1
  60. package/lib/esm/internal/app-binder/command/GetWalletAddressCommand.test.js.map +3 -3
  61. package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js +2 -0
  62. package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js.map +7 -0
  63. package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.js +2 -0
  64. package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.js.map +7 -0
  65. package/lib/esm/internal/app-binder/task/GetWalletAddressTask.js +2 -0
  66. package/lib/esm/internal/app-binder/task/GetWalletAddressTask.js.map +7 -0
  67. package/lib/esm/internal/app-binder/task/GetWalletAddressTask.test.js +2 -0
  68. package/lib/esm/internal/app-binder/task/GetWalletAddressTask.test.js.map +7 -0
  69. package/lib/esm/internal/use-cases/di/useCasesModule.js +1 -1
  70. package/lib/esm/internal/use-cases/di/useCasesModule.js.map +3 -3
  71. package/lib/esm/internal/use-cases/di/useCasesModule.test.js +1 -1
  72. package/lib/esm/internal/use-cases/di/useCasesModule.test.js.map +2 -2
  73. package/lib/esm/internal/use-cases/di/useCasesTypes.js +1 -1
  74. package/lib/esm/internal/use-cases/di/useCasesTypes.js.map +2 -2
  75. package/lib/esm/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.js +2 -0
  76. package/lib/esm/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.js.map +7 -0
  77. package/lib/esm/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.js +2 -0
  78. package/lib/esm/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.js.map +7 -0
  79. package/lib/esm/internal/utils/BtcCommandUtils.js +1 -1
  80. package/lib/esm/internal/utils/BtcCommandUtils.js.map +3 -3
  81. package/lib/esm/package.json +1 -1
  82. package/lib/types/api/SignerBtc.d.ts +3 -0
  83. package/lib/types/api/SignerBtc.d.ts.map +1 -1
  84. package/lib/types/api/app-binder/GetWalletAddressDeviceActionTypes.d.ts +32 -0
  85. package/lib/types/api/app-binder/GetWalletAddressDeviceActionTypes.d.ts.map +1 -0
  86. package/lib/types/api/index.d.ts +2 -1
  87. package/lib/types/api/index.d.ts.map +1 -1
  88. package/lib/types/api/model/Wallet.d.ts +3 -0
  89. package/lib/types/api/model/Wallet.d.ts.map +1 -1
  90. package/lib/types/api/model/WalletAddressOptions.d.ts +5 -0
  91. package/lib/types/api/model/WalletAddressOptions.d.ts.map +1 -0
  92. package/lib/types/internal/DefaultSignerBtc.d.ts +3 -1
  93. package/lib/types/internal/DefaultSignerBtc.d.ts.map +1 -1
  94. package/lib/types/internal/app-binder/BtcAppBinder.d.ts +7 -0
  95. package/lib/types/internal/app-binder/BtcAppBinder.d.ts.map +1 -1
  96. package/lib/types/internal/app-binder/command/GetWalletAddressCommand.d.ts +5 -7
  97. package/lib/types/internal/app-binder/command/GetWalletAddressCommand.d.ts.map +1 -1
  98. package/lib/types/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.d.ts +38 -0
  99. package/lib/types/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.d.ts.map +1 -0
  100. package/lib/types/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.d.ts +2 -0
  101. package/lib/types/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.d.ts.map +1 -0
  102. package/lib/types/internal/app-binder/task/GetWalletAddressTask.d.ts +27 -0
  103. package/lib/types/internal/app-binder/task/GetWalletAddressTask.d.ts.map +1 -0
  104. package/lib/types/internal/app-binder/task/GetWalletAddressTask.test.d.ts +2 -0
  105. package/lib/types/internal/app-binder/task/GetWalletAddressTask.test.d.ts.map +1 -0
  106. package/lib/types/internal/use-cases/di/useCasesModule.d.ts.map +1 -1
  107. package/lib/types/internal/use-cases/di/useCasesTypes.d.ts +1 -0
  108. package/lib/types/internal/use-cases/di/useCasesTypes.d.ts.map +1 -1
  109. package/lib/types/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.d.ts +9 -0
  110. package/lib/types/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.d.ts.map +1 -0
  111. package/lib/types/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.d.ts +2 -0
  112. package/lib/types/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.d.ts.map +1 -0
  113. package/lib/types/internal/utils/BtcCommandUtils.d.ts +2 -0
  114. package/lib/types/internal/utils/BtcCommandUtils.d.ts.map +1 -1
  115. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  116. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/GetExtendedPublicKeyCommand.test.ts"],
4
- "sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n} from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\n\nimport {\n GetExtendedPublicKeyCommand,\n type GetExtendedPublicKeyCommandArgs,\n} from \"./GetExtendedPublicKeyCommand\";\n\nconst GET_EXTENDED_PUBLIC_KEY_APDU_WITH_DISPLAY = new Uint8Array([\n 0xe1, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x03, 0x80, 0x00, 0x00, 0x54, 0x80, 0x00,\n 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,\n]);\n\nconst GET_EXTENDED_PUBLIC_KEY_APDU_WITHOUT_DISPLAY = new Uint8Array([\n 0xe1, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x80, 0x00, 0x00, 0x54, 0x80, 0x00,\n 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,\n]);\n\nconst GET_EXTENDED_PUBLIC_KEY_APDU_WITH_OTHER_DERIVATION_PATH = new Uint8Array([\n 0xe1, 0x00, 0x00, 0x00, 0x12, 0x01, 0x04, 0x80, 0x00, 0x00, 0x31, 0x80, 0x00,\n 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst GET_EXTENDED_PUBLIC_KEY_VALID_RESPONSE = new Uint8Array([\n 0x78, 0x70, 0x75, 0x62, 0x36, 0x44, 0x39, 0x50, 0x70, 0x34, 0x72, 0x46, 0x76,\n 0x77, 0x54, 0x47, 0x78, 0x38, 0x38, 0x59, 0x44, 0x34, 0x43, 0x44, 0x61, 0x31,\n 0x6e, 0x42, 0x45, 0x70, 0x63, 0x4b, 0x45, 0x5a, 0x54, 0x43, 0x4e, 0x46, 0x7a,\n 0x43, 0x46, 0x37, 0x67, 0x56, 0x50, 0x7a, 0x36, 0x54, 0x68, 0x39, 0x42, 0x61,\n 0x56, 0x68, 0x68, 0x50, 0x4a, 0x44, 0x75, 0x67, 0x39, 0x59, 0x59, 0x46, 0x50,\n 0x59, 0x6d, 0x6b, 0x53, 0x48, 0x4c, 0x66, 0x52, 0x31, 0x56, 0x51, 0x59, 0x6a,\n 0x35, 0x6a, 0x61, 0x79, 0x71, 0x77, 0x53, 0x59, 0x41, 0x52, 0x6e, 0x75, 0x42,\n 0x4a, 0x69, 0x50, 0x53, 0x44, 0x61, 0x62, 0x79, 0x79, 0x54, 0x69, 0x43, 0x44,\n 0x37, 0x42, 0x33, 0x63, 0x6a, 0x50, 0x71,\n]);\n\ndescribe(\"GetExtendedPublicKeyCommand\", () => {\n let command: GetExtendedPublicKeyCommand;\n const defaultArgs: GetExtendedPublicKeyCommandArgs = {\n checkOnDevice: true,\n derivationPath: \"84'/0'/0'\",\n };\n\n beforeEach(() => {});\n\n describe(\"getApdu\", () => {\n it(\"should return the correct APDU\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n\n // WHEN\n const apdu = command.getApdu();\n\n //THEN\n expect(apdu.getRawApdu()).toEqual(\n GET_EXTENDED_PUBLIC_KEY_APDU_WITH_DISPLAY,\n );\n });\n\n it(\"should return the correct APDU without display\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand({\n ...defaultArgs,\n checkOnDevice: false,\n });\n\n // WHEN\n const apdu = command.getApdu();\n\n //THEN\n expect(apdu.getRawApdu()).toEqual(\n GET_EXTENDED_PUBLIC_KEY_APDU_WITHOUT_DISPLAY,\n );\n });\n\n it(\"should return the correct APDU with different derivation path\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand({\n ...defaultArgs,\n derivationPath: \"49'/0'/0'/0\",\n });\n\n // WHEN\n const apdu = command.getApdu();\n\n //THEN\n expect(apdu.getRawApdu()).toEqual(\n GET_EXTENDED_PUBLIC_KEY_APDU_WITH_OTHER_DERIVATION_PATH,\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return the extended public key\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n const response = new ApduResponse({\n data: GET_EXTENDED_PUBLIC_KEY_VALID_RESPONSE,\n statusCode: new Uint8Array([0x90, 0x00]),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toEqual(\n CommandResultFactory({\n data: {\n extendedPublicKey:\n \"xpub6D9Pp4rFvwTGx88YD4CDa1nBEpcKEZTCNFzCF7gVPz6Th9BaVhhPJDug9YYFPYmkSHLfR1VQYj5jayqwSYARnuBJiPSDabyyTiCD7B3cjPq\",\n },\n }),\n );\n });\n\n it(\"should return an error if the response is not successful\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6d, 0x00]),\n data: new Uint8Array(0),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: BtcAppCommandErrorFactory({\n ...BTC_APP_ERRORS[\"6d00\"],\n errorCode: \"6d00\",\n }),\n }),\n );\n });\n\n it(\"should return an error if the response is too short\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n const response = new ApduResponse({\n data: Uint8Array.from([]),\n statusCode: new Uint8Array([0x90, 0x00]),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"Invalid response length\"),\n }),\n );\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAIO,2CAEPC,EAGO,+DAEPC,EAGO,yCAEP,MAAMC,EAA4C,IAAI,WAAW,CAC/D,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EACxE,EAAM,EAAM,IAAM,EAAM,EAAM,CAChC,CAAC,EAEKC,EAA+C,IAAI,WAAW,CAClE,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EACxE,EAAM,EAAM,IAAM,EAAM,EAAM,CAChC,CAAC,EAEKC,EAA0D,IAAI,WAAW,CAC7E,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EACxE,EAAM,EAAM,IAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,EAEKC,EAAyC,IAAI,WAAW,CAC5D,IAAM,IAAM,IAAM,GAAM,G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import {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n} from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\n\nimport {\n GetExtendedPublicKeyCommand,\n type GetExtendedPublicKeyCommandArgs,\n} from \"./GetExtendedPublicKeyCommand\";\n\nconst GET_EXTENDED_PUBLIC_KEY_APDU_WITH_DISPLAY = new Uint8Array([\n 0xe1, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x03, 0x80, 0x00, 0x00, 0x54, 0x80, 0x00,\n 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,\n]);\n\nconst GET_EXTENDED_PUBLIC_KEY_APDU_WITHOUT_DISPLAY = new Uint8Array([\n 0xe1, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x80, 0x00, 0x00, 0x54, 0x80, 0x00,\n 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,\n]);\n\nconst GET_EXTENDED_PUBLIC_KEY_APDU_WITH_OTHER_DERIVATION_PATH = new Uint8Array([\n 0xe1, 0x00, 0x00, 0x00, 0x12, 0x01, 0x04, 0x80, 0x00, 0x00, 0x31, 0x80, 0x00,\n 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n]);\n\nconst GET_EXTENDED_PUBLIC_KEY_VALID_RESPONSE = new Uint8Array([\n 0x78, 0x70, 0x75, 0x62, 0x36, 0x44, 0x39, 0x50, 0x70, 0x34, 0x72, 0x46, 0x76,\n 0x77, 0x54, 0x47, 0x78, 0x38, 0x38, 0x59, 0x44, 0x34, 0x43, 0x44, 0x61, 0x31,\n 0x6e, 0x42, 0x45, 0x70, 0x63, 0x4b, 0x45, 0x5a, 0x54, 0x43, 0x4e, 0x46, 0x7a,\n 0x43, 0x46, 0x37, 0x67, 0x56, 0x50, 0x7a, 0x36, 0x54, 0x68, 0x39, 0x42, 0x61,\n 0x56, 0x68, 0x68, 0x50, 0x4a, 0x44, 0x75, 0x67, 0x39, 0x59, 0x59, 0x46, 0x50,\n 0x59, 0x6d, 0x6b, 0x53, 0x48, 0x4c, 0x66, 0x52, 0x31, 0x56, 0x51, 0x59, 0x6a,\n 0x35, 0x6a, 0x61, 0x79, 0x71, 0x77, 0x53, 0x59, 0x41, 0x52, 0x6e, 0x75, 0x42,\n 0x4a, 0x69, 0x50, 0x53, 0x44, 0x61, 0x62, 0x79, 0x79, 0x54, 0x69, 0x43, 0x44,\n 0x37, 0x42, 0x33, 0x63, 0x6a, 0x50, 0x71,\n]);\n\ndescribe(\"GetExtendedPublicKeyCommand\", () => {\n let command: GetExtendedPublicKeyCommand;\n const defaultArgs: GetExtendedPublicKeyCommandArgs = {\n checkOnDevice: true,\n derivationPath: \"84'/0'/0'\",\n };\n\n beforeEach(() => {});\n\n describe(\"getApdu\", () => {\n it(\"should return the correct APDU\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n\n // WHEN\n const apdu = command.getApdu();\n\n //THEN\n expect(apdu.getRawApdu()).toEqual(\n GET_EXTENDED_PUBLIC_KEY_APDU_WITH_DISPLAY,\n );\n });\n\n it(\"should return the correct APDU without checkOnDevice\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand({\n ...defaultArgs,\n checkOnDevice: false,\n });\n\n // WHEN\n const apdu = command.getApdu();\n\n //THEN\n expect(apdu.getRawApdu()).toEqual(\n GET_EXTENDED_PUBLIC_KEY_APDU_WITHOUT_DISPLAY,\n );\n });\n\n it(\"should return the correct APDU with different derivation path\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand({\n ...defaultArgs,\n derivationPath: \"49'/0'/0'/0\",\n });\n\n // WHEN\n const apdu = command.getApdu();\n\n //THEN\n expect(apdu.getRawApdu()).toEqual(\n GET_EXTENDED_PUBLIC_KEY_APDU_WITH_OTHER_DERIVATION_PATH,\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return the extended public key\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n const response = new ApduResponse({\n data: GET_EXTENDED_PUBLIC_KEY_VALID_RESPONSE,\n statusCode: new Uint8Array([0x90, 0x00]),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toEqual(\n CommandResultFactory({\n data: {\n extendedPublicKey:\n \"xpub6D9Pp4rFvwTGx88YD4CDa1nBEpcKEZTCNFzCF7gVPz6Th9BaVhhPJDug9YYFPYmkSHLfR1VQYj5jayqwSYARnuBJiPSDabyyTiCD7B3cjPq\",\n },\n }),\n );\n });\n\n it(\"should return an error if the response is not successful\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6d, 0x00]),\n data: new Uint8Array(0),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: BtcAppCommandErrorFactory({\n ...BTC_APP_ERRORS[\"6d00\"],\n errorCode: \"6d00\",\n }),\n }),\n );\n });\n\n it(\"should return an error if the response is too short\", () => {\n // GIVEN\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n const response = new ApduResponse({\n data: Uint8Array.from([]),\n statusCode: new Uint8Array([0x90, 0x00]),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"Invalid response length\"),\n }),\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAIO,2CAEPC,EAGO,+DAEPC,EAGO,yCAEP,MAAMC,EAA4C,IAAI,WAAW,CAC/D,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EACxE,EAAM,EAAM,IAAM,EAAM,EAAM,CAChC,CAAC,EAEKC,EAA+C,IAAI,WAAW,CAClE,IAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,IAAM,EAAM,EAAM,GAAM,IAAM,EACxE,EAAM,EAAM,IAAM,EAAM,EAAM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KC,EAASJ,EAAQ,cAAcG,CAAQ,EAG7C,OAAOC,CAAM,EAAE,iBACb,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,yBAAyB,CAC7D,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_device_management_kit", "import_bitcoinAppErrors", "import_GetExtendedPublicKeyCommand", "GET_EXTENDED_PUBLIC_KEY_APDU_WITH_DISPLAY", "GET_EXTENDED_PUBLIC_KEY_APDU_WITHOUT_DISPLAY", "GET_EXTENDED_PUBLIC_KEY_APDU_WITH_OTHER_DERIVATION_PATH", "GET_EXTENDED_PUBLIC_KEY_VALID_RESPONSE", "command", "defaultArgs", "apdu", "response", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var c=(a,r)=>{for(var t in r)n(a,t,{get:r[t],enumerable:!0})},C=(a,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let d of y(r))!A.call(a,d)&&d!==t&&n(a,d,{get:()=>r[d],enumerable:!(o=u(r,d))||o.enumerable});return a};var f=a=>C(n({},"__esModule",{value:!0}),a);var R={};c(R,{GetWalletAddressCommand:()=>g});module.exports=f(R);var e=require("@ledgerhq/device-management-kit"),l=require("@ledgerhq/signer-utils"),m=require("purify-ts"),p=require("../../app-binder/command/utils/constants"),i=require("../../utils/BtcCommandUtils"),s=require("./utils/bitcoinAppErrors");class g{constructor(r,t=new l.CommandErrorHelper(s.BTC_APP_ERRORS,s.BtcAppCommandErrorFactory,i.BtcCommandUtils.isSuccessResponse)){this._args=r;this._errorHelper=t}getApdu(){return new e.ApduBuilder({cla:225,ins:3,p1:0,p2:p.PROTOCOL_VERSION}).addBufferToData(Uint8Array.from([this._args.display?1:0])).addBufferToData(this._args.walletId).addBufferToData(this._args.walletHmac).addBufferToData(Uint8Array.from([this._args.change?1:0])).add32BitUIntToData(this._args.addressIndex).build()}parseResponse(r){return m.Maybe.fromNullable(this._errorHelper.getError(r)).orDefaultLazy(()=>{const t=new e.ApduParser(r);if(r.data.length===0)return(0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("Failed to extract address from response")});const o=t.encodeToString(r.data);return(0,e.CommandResultFactory)({data:{address:o}})})}}0&&(module.exports={GetWalletAddressCommand});
1
+ "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var y=(r,e)=>{for(var a in e)s(r,a,{get:e[a],enumerable:!0})},C=(r,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!A.call(r,o)&&o!==a&&s(r,o,{get:()=>e[o],enumerable:!(n=c(e,o))||n.enumerable});return r};var f=r=>C(s({},"__esModule",{value:!0}),r);var g={};y(g,{GetWalletAddressCommand:()=>R});module.exports=f(g);var t=require("@ledgerhq/device-management-kit"),m=require("@ledgerhq/signer-utils"),l=require("purify-ts"),p=require("../../app-binder/command/utils/constants"),i=require("../../utils/BtcCommandUtils"),d=require("./utils/bitcoinAppErrors");class R{constructor(e,a=new m.CommandErrorHelper(d.BTC_APP_ERRORS,d.BtcAppCommandErrorFactory,i.BtcCommandUtils.isSuccessResponse)){this.args=e;this._errorHelper=a}getApdu(){return new t.ApduBuilder({cla:225,ins:3,p1:0,p2:p.PROTOCOL_VERSION}).addBufferToData(Uint8Array.from([this.args.checkOnDevice?1:0])).addBufferToData(this.args.walletId).addBufferToData(this.args.walletHmac).addBufferToData(Uint8Array.from([this.args.change?1:0])).add32BitUIntToData(this.args.addressIndex).build()}parseResponse(e){return l.Maybe.fromNullable(this._errorHelper.getError(e)).orDefault((0,t.CommandResultFactory)({data:e}))}}0&&(module.exports={GetWalletAddressCommand});
2
2
  //# sourceMappingURL=GetWalletAddressCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/GetWalletAddressCommand.ts"],
4
- "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport { PROTOCOL_VERSION } from \"@internal/app-binder/command/utils/constants\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\n\nimport {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n type BtcErrorCodes,\n} from \"./utils/bitcoinAppErrors\";\n\nexport type GetWalletAddressCommandResponse = {\n readonly address: string;\n};\n\nexport type GetWalletAddressCommandArgs = {\n readonly display: boolean;\n readonly walletId: Uint8Array;\n readonly walletHmac: Uint8Array;\n readonly change: boolean;\n readonly addressIndex: number;\n};\n\nexport class GetWalletAddressCommand\n implements\n Command<\n GetWalletAddressCommandResponse,\n GetWalletAddressCommandArgs,\n BtcErrorCodes\n >\n{\n constructor(\n private readonly _args: GetWalletAddressCommandArgs,\n private readonly _errorHelper = new CommandErrorHelper<\n GetWalletAddressCommandResponse,\n BtcErrorCodes\n >(\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n BtcCommandUtils.isSuccessResponse,\n ),\n ) {}\n\n getApdu(): Apdu {\n return new ApduBuilder({\n cla: 0xe1,\n ins: 0x03,\n p1: 0x00,\n p2: PROTOCOL_VERSION,\n })\n .addBufferToData(Uint8Array.from([this._args.display ? 1 : 0]))\n .addBufferToData(this._args.walletId)\n .addBufferToData(this._args.walletHmac)\n .addBufferToData(Uint8Array.from([this._args.change ? 1 : 0]))\n .add32BitUIntToData(this._args.addressIndex)\n .build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<GetWalletAddressCommandResponse, BtcErrorCodes> {\n return Maybe.fromNullable(\n this._errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n if (response.data.length === 0) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n \"Failed to extract address from response\",\n ),\n });\n }\n\n const address = parser.encodeToString(response.data);\n return CommandResultFactory({\n data: {\n address,\n },\n });\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EASO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAAiC,wDACjCC,EAAgC,2CAEhCC,EAIO,oCAcA,MAAMP,CAOb,CACE,YACmBQ,EACAC,EAAe,IAAI,qBAIlC,iBACA,4BACA,kBAAgB,iBAClB,EACA,CATiB,WAAAD,EACA,kBAAAC,CAQhB,CAEH,SAAgB,CACd,OAAO,IAAI,cAAY,CACrB,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAI,kBACN,CAAC,EACE,gBAAgB,WAAW,KAAK,CAAC,KAAK,MAAM,QAAU,EAAI,CAAC,CAAC,CAAC,EAC7D,gBAAgB,KAAK,MAAM,QAAQ,EACnC,gBAAgB,KAAK,MAAM,UAAU,EACrC,gBAAgB,WAAW,KAAK,CAAC,KAAK,MAAM,OAAS,EAAI,CAAC,CAAC,CAAC,EAC5D,mBAAmB,KAAK,MAAM,YAAY,EAC1C,MAAM,CACX,CAEA,cACEC,EAC+D,CAC/D,OAAO,QAAM,aACX,KAAK,aAAa,SAASA,CAAQ,CACrC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAI,aAAWD,CAAQ,EACtC,GAAIA,EAAS,KAAK,SAAW,EAC3B,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,yCACF,CACF,CAAC,EAGH,MAAME,EAAUD,EAAO,eAAeD,EAAS,IAAI,EACnD,SAAO,wBAAqB,CAC1B,KAAM,CACJ,QAAAE,CACF,CACF,CAAC,CACH,CAAC,CACH,CACF",
6
- "names": ["GetWalletAddressCommand_exports", "__export", "GetWalletAddressCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_constants", "import_BtcCommandUtils", "import_bitcoinAppErrors", "_args", "_errorHelper", "response", "parser", "address"]
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport { PROTOCOL_VERSION } from \"@internal/app-binder/command/utils/constants\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\n\nimport {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n type BtcErrorCodes,\n} from \"./utils/bitcoinAppErrors\";\n\nexport type GetWalletAddressCommandResponse = ApduResponse;\n\nexport type GetWalletAddressCommandArgs = {\n readonly checkOnDevice: boolean;\n readonly walletId: Uint8Array;\n readonly walletHmac: Uint8Array;\n readonly change: boolean;\n readonly addressIndex: number;\n};\n\nexport class GetWalletAddressCommand\n implements\n Command<\n GetWalletAddressCommandResponse,\n GetWalletAddressCommandArgs,\n BtcErrorCodes\n >\n{\n constructor(\n private readonly args: GetWalletAddressCommandArgs,\n private readonly _errorHelper = new CommandErrorHelper<\n GetWalletAddressCommandResponse,\n BtcErrorCodes\n >(\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n BtcCommandUtils.isSuccessResponse,\n ),\n ) {}\n\n getApdu(): Apdu {\n return new ApduBuilder({\n cla: 0xe1,\n ins: 0x03,\n p1: 0x00,\n p2: PROTOCOL_VERSION,\n })\n .addBufferToData(Uint8Array.from([this.args.checkOnDevice ? 1 : 0]))\n .addBufferToData(this.args.walletId)\n .addBufferToData(this.args.walletHmac)\n .addBufferToData(Uint8Array.from([this.args.change ? 1 : 0]))\n .add32BitUIntToData(this.args.addressIndex)\n .build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<ApduResponse, BtcErrorCodes> {\n return Maybe.fromNullable(this._errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: response }),\n );\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAOO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAAiC,wDACjCC,EAAgC,2CAEhCC,EAIO,oCAYA,MAAMP,CAOb,CACE,YACmBQ,EACAC,EAAe,IAAI,qBAIlC,iBACA,4BACA,kBAAgB,iBAClB,EACA,CATiB,UAAAD,EACA,kBAAAC,CAQhB,CAEH,SAAgB,CACd,OAAO,IAAI,cAAY,CACrB,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAI,kBACN,CAAC,EACE,gBAAgB,WAAW,KAAK,CAAC,KAAK,KAAK,cAAgB,EAAI,CAAC,CAAC,CAAC,EAClE,gBAAgB,KAAK,KAAK,QAAQ,EAClC,gBAAgB,KAAK,KAAK,UAAU,EACpC,gBAAgB,WAAW,KAAK,CAAC,KAAK,KAAK,OAAS,EAAI,CAAC,CAAC,CAAC,EAC3D,mBAAmB,KAAK,KAAK,YAAY,EACzC,MAAM,CACX,CAEA,cACEC,EAC4C,CAC5C,OAAO,QAAM,aAAa,KAAK,aAAa,SAASA,CAAQ,CAAC,EAAE,aAC9D,wBAAqB,CAAE,KAAMA,CAAS,CAAC,CACzC,CACF,CACF",
6
+ "names": ["GetWalletAddressCommand_exports", "__export", "GetWalletAddressCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_constants", "import_BtcCommandUtils", "import_bitcoinAppErrors", "args", "_errorHelper", "response"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=require("@ledgerhq/device-management-kit"),d=require("./utils/bitcoinAppErrors"),c=require("./GetWalletAddressCommand");describe("GetWalletAddressCommand",()=>{let o;const l={display:!0,walletId:Uint8Array.from("walletIdBuffer",e=>e.charCodeAt(0)),walletHmac:Uint8Array.from("walletHmacBuffer",e=>e.charCodeAt(0)),change:!1,addressIndex:0};beforeEach(()=>{o=new c.GetWalletAddressCommand(l),jest.clearAllMocks(),jest.requireActual("@ledgerhq/device-management-kit")}),describe("getApdu",()=>{it("should return correct APDU for default arguments",()=>{const e=o.getApdu(),t=Uint8Array.from([225,3,0,1,36,1,...Uint8Array.from("walletIdBuffer",r=>r.charCodeAt(0)),...Uint8Array.from("walletHmacBuffer",r=>r.charCodeAt(0)),0,0,0,0,0]);expect(e.getRawApdu()).toEqual(t)}),it("should return correct APDU for different arguments",()=>{const e={display:!1,walletId:Uint8Array.from("anotherWalletId",a=>a.charCodeAt(0)),walletHmac:Uint8Array.from("anotherWalletHmac",a=>a.charCodeAt(0)),change:!0,addressIndex:5};o=new c.GetWalletAddressCommand(e);const t=o.getApdu(),r=Uint8Array.from([225,3,0,1,38,0,...Uint8Array.from("anotherWalletId",a=>a.charCodeAt(0)),...Uint8Array.from("anotherWalletHmac",a=>a.charCodeAt(0)),1,0,0,0,5]);expect(t.getRawApdu()).toEqual(r)})}),describe("parseResponse",()=>{it("should parse the response and extract the address",()=>{const e=Uint8Array.from("myAddressData",a=>a.charCodeAt(0)),t=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:e}),r=o.parseResponse(t);expect(r).toStrictEqual((0,s.CommandResultFactory)({data:{address:new TextDecoder().decode(e)}}))}),it("should return an error if response status code is an error code",()=>{const e=Uint8Array.from([105,133]),t=new s.ApduResponse({statusCode:e,data:new Uint8Array}),r=o.parseResponse(t);if(expect((0,s.isSuccessCommandResult)(r)).toBe(!1),(0,s.isSuccessCommandResult)(r))fail("Expected error");else{expect(r.error).toBeInstanceOf(d.BtcAppCommandError);const a=r.error,n=d.BTC_APP_ERRORS[6985];expect(n).toBeDefined(),n&&expect(a.message).toBe(n.message)}}),it("should return an error if address cannot be extracted",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:new Uint8Array}),t=o.parseResponse(e);expect((0,s.isSuccessCommandResult)(t)).toBe(!1),(0,s.isSuccessCommandResult)(t)?fail("Expected error"):expect(t.error.originalError).toEqual(expect.objectContaining({message:"Failed to extract address from response"}))})})});
1
+ "use strict";var r=require("@ledgerhq/device-management-kit"),d=require("./utils/constants"),n=require("./GetWalletAddressCommand");const l=new Uint8Array([144,0]),A=new Uint8Array([105,133]);describe("GetWalletAddressCommand",()=>{let o;const c={checkOnDevice:!0,walletId:Uint8Array.from("walletIdBuffer",e=>e.charCodeAt(0)),walletHmac:Uint8Array.from("walletHmacBuffer",e=>e.charCodeAt(0)),change:!1,addressIndex:0};beforeEach(()=>{o=new n.GetWalletAddressCommand(c),jest.clearAllMocks(),jest.requireActual("@ledgerhq/device-management-kit")}),describe("getApdu",()=>{it("should return correct APDU for default arguments",()=>{const e=o.getApdu(),t=Uint8Array.from([225,3,0,1,36,1,...Uint8Array.from("walletIdBuffer",a=>a.charCodeAt(0)),...Uint8Array.from("walletHmacBuffer",a=>a.charCodeAt(0)),0,0,0,0,0]);expect(e.getRawApdu()).toEqual(t)}),it("should return correct APDU for different arguments",()=>{const e={checkOnDevice:!1,walletId:Uint8Array.from("anotherWalletId",s=>s.charCodeAt(0)),walletHmac:Uint8Array.from("anotherWalletHmac",s=>s.charCodeAt(0)),change:!0,addressIndex:5};o=new n.GetWalletAddressCommand(e);const t=o.getApdu(),a=Uint8Array.from([225,3,0,1,38,0,...Uint8Array.from("anotherWalletId",s=>s.charCodeAt(0)),...Uint8Array.from("anotherWalletHmac",s=>s.charCodeAt(0)),1,0,0,0,5]);expect(t.getRawApdu()).toEqual(a)})}),describe("parseResponse",()=>{it("should return the APDU response if it's a continue response",()=>{const e=new Uint8Array([1,2,3,4]),t=new r.ApduResponse({statusCode:d.SW_INTERRUPTED_EXECUTION,data:e}),a=o.parseResponse(t);expect(a).toStrictEqual((0,r.CommandResultFactory)({data:t}))}),it("should return an error if user denied the operation",()=>{const e=new r.ApduResponse({statusCode:A,data:new Uint8Array([])}),t=o.parseResponse(e);expect((0,r.isSuccessCommandResult)(t)).toBe(!1),(0,r.isSuccessCommandResult)(t)||expect(t.error).toBeDefined()}),it("should return correct data when response is not empty",()=>{const e=Uint8Array.from("addressData",s=>s.charCodeAt(0)),t=new r.ApduResponse({statusCode:l,data:e}),a=o.parseResponse(t);expect(a).toStrictEqual((0,r.CommandResultFactory)({data:t}))})})});
2
2
  //# sourceMappingURL=GetWalletAddressCommand.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/GetWalletAddressCommand.test.ts"],
4
- "sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { BTC_APP_ERRORS, BtcAppCommandError } from \"./utils/bitcoinAppErrors\";\nimport {\n GetWalletAddressCommand,\n type GetWalletAddressCommandArgs,\n} from \"./GetWalletAddressCommand\";\n\ndescribe(\"GetWalletAddressCommand\", () => {\n let command: GetWalletAddressCommand;\n const defaultArgs: GetWalletAddressCommandArgs = {\n display: true,\n walletId: Uint8Array.from(\"walletIdBuffer\", (c) => c.charCodeAt(0)),\n walletHmac: Uint8Array.from(\"walletHmacBuffer\", (c) => c.charCodeAt(0)),\n change: false,\n addressIndex: 0x00000000,\n };\n\n beforeEach(() => {\n command = new GetWalletAddressCommand(defaultArgs);\n jest.clearAllMocks();\n jest.requireActual(\"@ledgerhq/device-management-kit\");\n });\n\n describe(\"getApdu\", () => {\n it(\"should return correct APDU for default arguments\", () => {\n const apdu = command.getApdu();\n const expectedApdu = Uint8Array.from([\n 0xe1, // CLA\n 0x03, // INS\n 0x00, // P1\n 0x01, // P2\n 0x24, // Length of data: 36 bytes\n 0x01, // display: true\n ...Uint8Array.from(\"walletIdBuffer\", (c) => c.charCodeAt(0)),\n ...Uint8Array.from(\"walletHmacBuffer\", (c) => c.charCodeAt(0)),\n 0x00, // change: false\n 0x00,\n 0x00,\n 0x00,\n 0x00, // addressIndex: 0x00000000\n ]);\n expect(apdu.getRawApdu()).toEqual(expectedApdu);\n });\n\n it(\"should return correct APDU for different arguments\", () => {\n const args: GetWalletAddressCommandArgs = {\n display: false,\n walletId: Uint8Array.from(\"anotherWalletId\", (c) => c.charCodeAt(0)),\n walletHmac: Uint8Array.from(\"anotherWalletHmac\", (c) =>\n c.charCodeAt(0),\n ),\n change: true,\n addressIndex: 0x00000005,\n };\n command = new GetWalletAddressCommand(args);\n const apdu = command.getApdu();\n const expectedApdu = Uint8Array.from([\n 0xe1, // CLA\n 0x03, // INS\n 0x00, // P1\n 0x01, // P2\n 0x26, // Length of data\n 0x00, // display: false\n ...Uint8Array.from(\"anotherWalletId\", (c) => c.charCodeAt(0)),\n ...Uint8Array.from(\"anotherWalletHmac\", (c) => c.charCodeAt(0)),\n 0x01, // change: true\n 0x00,\n 0x00,\n 0x00,\n 0x05, // addressIndex: 0x00000005\n ]);\n expect(apdu.getRawApdu()).toEqual(expectedApdu);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should parse the response and extract the address\", () => {\n const responseData = Uint8Array.from(\"myAddressData\", (c) =>\n c.charCodeAt(0),\n );\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: responseData,\n });\n\n const result = command.parseResponse(response);\n\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: {\n address: new TextDecoder().decode(responseData),\n },\n }),\n );\n });\n\n it(\"should return an error if response status code is an error code\", () => {\n const errorStatusCode = Uint8Array.from([0x69, 0x85]);\n const response = new ApduResponse({\n statusCode: errorStatusCode,\n data: new Uint8Array(),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n expect(result.error).toBeInstanceOf(BtcAppCommandError);\n const error = result.error as BtcAppCommandError;\n const expectedErrorInfo = BTC_APP_ERRORS[\"6985\"];\n expect(expectedErrorInfo).toBeDefined();\n if (expectedErrorInfo) {\n expect(error.message).toBe(expectedErrorInfo.message);\n }\n } else {\n fail(\"Expected error\");\n }\n });\n\n it(\"should return an error if address cannot be extracted\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n expect(result.error.originalError).toEqual(\n expect.objectContaining({\n message: \"Failed to extract address from response\",\n }),\n );\n } else {\n fail(\"Expected error\");\n }\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAIO,2CAEPC,EAAmD,oCACnDC,EAGO,qCAEP,SAAS,0BAA2B,IAAM,CACxC,IAAIC,EACJ,MAAMC,EAA2C,CAC/C,QAAS,GACT,SAAU,WAAW,KAAK,iBAAmBC,GAAMA,EAAE,WAAW,CAAC,CAAC,EAClE,WAAY,WAAW,KAAK,mBAAqBA,GAAMA,EAAE,WAAW,CAAC,CAAC,EACtE,OAAQ,GACR,aAAc,CAChB,EAEA,WAAW,IAAM,CACfF,EAAU,IAAI,0BAAwBC,CAAW,EACjD,KAAK,cAAc,EACnB,KAAK,cAAc,iCAAiC,CACtD,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,mDAAoD,IAAM,CAC3D,MAAME,EAAOH,EAAQ,QAAQ,EACvBI,EAAe,WAAW,KAAK,CACnC,IACA,EACA,EACA,EACA,GACA,EACA,GAAG,WAAW,KAAK,iBAAmBF,GAAMA,EAAE,WAAW,CAAC,CAAC,EAC3D,GAAG,WAAW,KAAK,mBAAqBA,GAAMA,EAAE,WAAW,CAAC,CAAC,EAC7D,EACA,EACA,EACA,EACA,CACF,CAAC,EACD,OAAOC,EAAK,WAAW,CAAC,EAAE,QAAQC,CAAY,CAChD,CAAC,EAED,GAAG,qDAAsD,IAAM,CAC7D,MAAMC,EAAoC,CACxC,QAAS,GACT,SAAU,WAAW,KAAK,kBAAoBH,GAAMA,EAAE,WAAW,CAAC,CAAC,EACnE,WAAY,WAAW,KAAK,oBAAsBA,GAChDA,EAAE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ACF,OAAOD,EAAM,OAAO,EAAE,KAAKC,EAAkB,OAAO,CAExD,CAGF,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAMJ,EAAW,IAAI,eAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,UACZ,CAAC,EAEKC,EAASR,EAAQ,cAAcO,CAAQ,EAE7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,KAC5C,0BAAuBA,CAAM,EAOhC,KAAK,gBAAgB,EANrB,OAAOA,EAAO,MAAM,aAAa,EAAE,QACjC,OAAO,iBAAiB,CACtB,QAAS,yCACX,CAAC,CACH,CAIJ,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_bitcoinAppErrors", "import_GetWalletAddressCommand", "command", "defaultArgs", "c", "apdu", "expectedApdu", "args", "responseData", "response", "result", "errorStatusCode", "error", "expectedErrorInfo"]
4
+ "sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { SW_INTERRUPTED_EXECUTION } from \"./utils/constants\";\nimport {\n GetWalletAddressCommand,\n type GetWalletAddressCommandArgs,\n} from \"./GetWalletAddressCommand\";\n\nconst SUCCESS_STATUS = new Uint8Array([0x90, 0x00]);\nconst USER_DENIED_STATUS = new Uint8Array([0x69, 0x85]);\n\ndescribe(\"GetWalletAddressCommand\", () => {\n let command: GetWalletAddressCommand;\n const defaultArgs: GetWalletAddressCommandArgs = {\n checkOnDevice: true,\n walletId: Uint8Array.from(\"walletIdBuffer\", (c) => c.charCodeAt(0)),\n walletHmac: Uint8Array.from(\"walletHmacBuffer\", (c) => c.charCodeAt(0)),\n change: false,\n addressIndex: 0x00000000,\n };\n\n beforeEach(() => {\n command = new GetWalletAddressCommand(defaultArgs);\n jest.clearAllMocks();\n jest.requireActual(\"@ledgerhq/device-management-kit\");\n });\n\n describe(\"getApdu\", () => {\n it(\"should return correct APDU for default arguments\", () => {\n const apdu = command.getApdu();\n const expectedApdu = Uint8Array.from([\n 0xe1, // CLA\n 0x03, // INS\n 0x00, // P1\n 0x01, // P2\n 0x24, // Length of data: 36 bytes\n 0x01, // checkOnDevice: true\n ...Uint8Array.from(\"walletIdBuffer\", (c) => c.charCodeAt(0)),\n ...Uint8Array.from(\"walletHmacBuffer\", (c) => c.charCodeAt(0)),\n 0x00, // change: false\n 0x00,\n 0x00,\n 0x00,\n 0x00, // addressIndex: 0x00000000\n ]);\n expect(apdu.getRawApdu()).toEqual(expectedApdu);\n });\n\n it(\"should return correct APDU for different arguments\", () => {\n const args: GetWalletAddressCommandArgs = {\n checkOnDevice: false,\n walletId: Uint8Array.from(\"anotherWalletId\", (c) => c.charCodeAt(0)),\n walletHmac: Uint8Array.from(\"anotherWalletHmac\", (c) =>\n c.charCodeAt(0),\n ),\n change: true,\n addressIndex: 0x00000005,\n };\n command = new GetWalletAddressCommand(args);\n const apdu = command.getApdu();\n const expectedApdu = Uint8Array.from([\n 0xe1, // CLA\n 0x03, // INS\n 0x00, // P1\n 0x01, // P2\n 0x26, // Length of data\n 0x00, // checkOnDevice: false\n ...Uint8Array.from(\"anotherWalletId\", (c) => c.charCodeAt(0)),\n ...Uint8Array.from(\"anotherWalletHmac\", (c) => c.charCodeAt(0)),\n 0x01, // change: true\n 0x00,\n 0x00,\n 0x00,\n 0x05, // addressIndex: 0x00000005\n ]);\n expect(apdu.getRawApdu()).toEqual(expectedApdu);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return the APDU response if it's a continue response\", () => {\n // given\n const continueResponseData = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n\n const apduResponse = new ApduResponse({\n statusCode: SW_INTERRUPTED_EXECUTION,\n data: continueResponseData,\n });\n\n // when\n const response = command.parseResponse(apduResponse);\n\n // then\n expect(response).toStrictEqual(\n CommandResultFactory({\n data: apduResponse,\n }),\n );\n });\n\n it(\"should return an error if user denied the operation\", () => {\n // given\n const apduResponse = new ApduResponse({\n statusCode: USER_DENIED_STATUS,\n data: new Uint8Array([]),\n });\n\n // when\n const response = command.parseResponse(apduResponse);\n\n // then\n expect(isSuccessCommandResult(response)).toBe(false);\n if (!isSuccessCommandResult(response)) {\n expect(response.error).toBeDefined();\n }\n });\n\n it(\"should return correct data when response is not empty\", () => {\n // given\n const responseData = Uint8Array.from(\"addressData\", (c) =>\n c.charCodeAt(0),\n );\n\n const apduResponse = new ApduResponse({\n statusCode: SUCCESS_STATUS,\n data: responseData,\n });\n\n // when\n const response = command.parseResponse(apduResponse);\n\n // then\n expect(response).toStrictEqual(\n CommandResultFactory({ data: apduResponse }),\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAIO,2CAEPC,EAAyC,6BACzCC,EAGO,qCAEP,MAAMC,EAAiB,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EAC5CC,EAAqB,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EAEtD,SAAS,0BAA2B,IAAM,CACxC,IAAIC,EACJ,MAAMC,EAA2C,CAC/C,cAAe,GACf,SAAU,WAAW,KAAK,iBAAmBC,GAAMA,EAAE,WAAW,CAAC,CAAC,EAClE,WAAY,WAAW,KAAK,mBAAqBA,GAAMA,EAAE,WAAW,CAAC,CAAC,EACtE,OAAQ,GACR,aAAc,CAChB,EAEA,WAAW,IAAM,CACfF,EAAU,IAAI,0BAAwBC,CAAW,EACjD,KAAK,cAAc,EACnB,KAAK,cAAc,iCAAiC,CACtD,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,mDAAoD,IAAM,CAC3D,MAAME,EAAOH,EAAQ,QAAQ,EACvBI,EAAe,WAAW,KAAK,CACnC,IACA,EACA,EACA,EACA,GACA,EACA,GAAG,WAAW,KAAK,iBAAmBF,GAAMA,EAAE,WAAW,CAAC,CAAC,EAC3D,GAAG,WAAW,KAAK,mBAAqBA,GAAMA,EAAE,WAAW,CAAC,CAAC,EAC7D,EACA,EACA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AY,CAEvC,CAAC,EAED,GAAG,wDAAyD,IAAM,CAEhE,MAAMC,EAAe,WAAW,KAAK,cAAgBP,GACnDA,EAAE,WAAW,CAAC,CAChB,EAEMK,EAAe,IAAI,eAAa,CACpC,WAAYT,EACZ,KAAMW,CACR,CAAC,EAGKD,EAAWR,EAAQ,cAAcO,CAAY,EAGnD,OAAOC,CAAQ,EAAE,iBACf,wBAAqB,CAAE,KAAMD,CAAa,CAAC,CAC7C,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_constants", "import_GetWalletAddressCommand", "SUCCESS_STATUS", "USER_DENIED_STATUS", "command", "defaultArgs", "c", "apdu", "expectedApdu", "args", "continueResponseData", "apduResponse", "response", "responseData"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var I=(n,t)=>{for(var i in t)p(n,i,{get:t[i],enumerable:!0})},h=(n,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of y(t))!w.call(n,e)&&e!==i&&p(n,e,{get:()=>t[e],enumerable:!(s=D(t,e))||s.enumerable});return n};var g=n=>h(p({},"__esModule",{value:!0}),n);var v={};I(v,{GetWalletAddressDeviceAction:()=>G});module.exports=g(v);var r=require("@ledgerhq/device-management-kit"),o=require("purify-ts"),a=require("xstate"),c=require("../../../app-binder/task/GetWalletAddressTask"),u=require("../../../app-binder/task/PrepareWalletPolicyTask");class G extends r.XStateDeviceAction{constructor(t){super(t)}makeStateMachine(t){const{getWalletAddress:i,prepareWalletPolicy:s}=this.extractDependencies(t);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new r.OpenAppDeviceAction({input:{appName:"Bitcoin"}}).makeStateMachine(t),prepareWalletPolicy:(0,a.fromPromise)(s),getWalletAddress:(0,a.fromPromise)(i)},guards:{noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GetWalletAddressDeviceAction",initial:"OpenAppDeviceAction",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:r.UserInteractionRequired.None},_internalState:{error:null,wallet:null,walletAddress:null}}),states:{OpenAppDeviceAction:{exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:r.UserInteractionRequired.None}}),invoke:{id:"openAppStateMachine",input:{appName:"Bitcoin"},src:"openAppStateMachine",onSnapshot:{actions:(0,a.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,a.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:l=>({...e.context._internalState,error:l})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"PrepareWalletPolicy",guard:"noInternalError"},"Error"]},PrepareWalletPolicy:{invoke:{id:"prepareWalletPolicy",src:"prepareWalletPolicy",input:({context:e})=>({wallet:e.input.wallet,walletBuilder:e.input.walletBuilder}),onDone:{target:"PrepareWalletPolicyResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:l})=>(0,r.isSuccessCommandResult)(e.output)?{...l._internalState,wallet:e.output.data}:{...l._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},PrepareWalletPolicyResultCheck:{always:[{guard:"noInternalError",target:"GetWalletAddress"},{target:"Error"}]},GetWalletAddress:{entry:(0,a.assign)(({context:e})=>({intermediateValue:{requiredUserInteraction:e.input.checkOnDevice?r.UserInteractionRequired.VerifyAddress:r.UserInteractionRequired.None}})),exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:r.UserInteractionRequired.None}}),invoke:{id:"getWalletAddress",src:"getWalletAddress",input:({context:e})=>({checkOnDevice:e.input.checkOnDevice,wallet:e._internalState.wallet,change:e.input.change,addressIndex:e.input.addressIndex,dataStoreService:e.input.dataStoreService,walletSerializer:e.input.walletSerializer,walletBuilder:e.input.walletBuilder}),onDone:{target:"GetWalletAddressResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:l})=>(0,r.isSuccessCommandResult)(e.output)?{...l._internalState,walletAddress:e.output.data}:{...l._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetWalletAddressResultCheck:{always:[{guard:"noInternalError",target:"Success"},{target:"Error"}]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.walletAddress?(0,o.Right)(e._internalState.walletAddress):(0,o.Left)(e._internalState.error||new r.UnknownDAError("No error in final state"))})}extractDependencies(t){return{getWalletAddress:async e=>{const{checkOnDevice:l,wallet:d,change:A,addressIndex:W,walletSerializer:m,dataStoreService:S}=e.input;return await new c.GetWalletAddressTask(t,{checkOnDevice:l,wallet:d,change:A,addressIndex:W},m,S).run()},prepareWalletPolicy:async e=>{const{input:{walletBuilder:l,wallet:d}}=e;return await new u.PrepareWalletPolicyTask(t,{wallet:d},l).run()}}}}0&&(module.exports={GetWalletAddressDeviceAction});
2
+ //# sourceMappingURL=GetWalletAddressDeviceAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.ts"],
4
+ "sourcesContent": ["import {\n type CommandResult,\n type DeviceActionStateMachine,\n type InternalApi,\n isSuccessCommandResult,\n OpenAppDeviceAction,\n type StateMachineTypes,\n UnknownDAError,\n UserInteractionRequired,\n XStateDeviceAction,\n} from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type GetWalletAddressDAError,\n type GetWalletAddressDAInput,\n type GetWalletAddressDAIntermediateValue,\n type GetWalletAddressDAInternalState,\n type GetWalletAddressDAOutput,\n} from \"@api/app-binder/GetWalletAddressDeviceActionTypes\";\nimport { type WalletAddress } from \"@api/model/Wallet\";\nimport { type Wallet as ApiWallet } from \"@api/model/Wallet\";\nimport { type BtcErrorCodes } from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { GetWalletAddressTask } from \"@internal/app-binder/task/GetWalletAddressTask\";\nimport { PrepareWalletPolicyTask } from \"@internal/app-binder/task/PrepareWalletPolicyTask\";\nimport { type DataStoreService } from \"@internal/data-store/service/DataStoreService\";\nimport { type Wallet as InternalWallet } from \"@internal/wallet/model/Wallet\";\nimport { type WalletBuilder } from \"@internal/wallet/service/WalletBuilder\";\nimport { type WalletSerializer } from \"@internal/wallet/service/WalletSerializer\";\n\nexport type GetWalletAddressMachineDependencies = {\n readonly prepareWalletPolicy: (arg0: {\n input: {\n wallet: ApiWallet;\n walletBuilder: WalletBuilder;\n };\n }) => Promise<CommandResult<InternalWallet, BtcErrorCodes>>;\n readonly getWalletAddress: (arg0: {\n input: {\n checkOnDevice: boolean;\n change: boolean;\n addressIndex: number;\n wallet: InternalWallet;\n walletBuilder: WalletBuilder;\n walletSerializer: WalletSerializer;\n dataStoreService: DataStoreService;\n };\n }) => Promise<CommandResult<WalletAddress, BtcErrorCodes>>;\n};\n\nexport type ExtractGetWalletAddressMachineDependencies = (\n internalApi: InternalApi,\n) => GetWalletAddressMachineDependencies;\n\nexport class GetWalletAddressDeviceAction extends XStateDeviceAction<\n GetWalletAddressDAOutput,\n GetWalletAddressDAInput,\n GetWalletAddressDAError,\n GetWalletAddressDAIntermediateValue,\n GetWalletAddressDAInternalState\n> {\n constructor(args: { input: GetWalletAddressDAInput; inspect?: boolean }) {\n super(args);\n }\n\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n GetWalletAddressDAOutput,\n GetWalletAddressDAInput,\n GetWalletAddressDAError,\n GetWalletAddressDAIntermediateValue,\n GetWalletAddressDAInternalState\n > {\n type types = StateMachineTypes<\n GetWalletAddressDAOutput,\n GetWalletAddressDAInput,\n GetWalletAddressDAError,\n GetWalletAddressDAIntermediateValue,\n GetWalletAddressDAInternalState\n >;\n\n const { getWalletAddress, prepareWalletPolicy } =\n this.extractDependencies(internalApi);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n\n actors: {\n openAppStateMachine: new OpenAppDeviceAction({\n input: { appName: \"Bitcoin\" },\n }).makeStateMachine(internalApi),\n prepareWalletPolicy: fromPromise(prepareWalletPolicy),\n getWalletAddress: fromPromise(getWalletAddress),\n },\n guards: {\n noInternalError: ({ context }) => context._internalState.error === null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QGUCWUB2AFMAnWA9hgIYA2AsnLMTACJgBuqAxmAILMAuqRAdAPIAHMBjaDB9Jqw7ciAYghEwvVBgYEA1soLDR45J2Kcw5YswAWqsAG0ADAF1EoQQVipZGJyAAeiACwAzADsvACcABwAjKGRtuG2AGyRSX4ANCAAnoiRAEwArLy2uX6RQUGRpeHhfgC+NelomDj4RGSUsNR0jCzsXDwYvADC5mDMGkIiYhLd0n1EAEpwAK6knHJ2jkggLm4eXr4IoRG8eTlFOaWhQX45QaHpWQiRN4UBfu8JeaE3obY5OXUGuhsHhCCQKFQaGBJD0ZP0hiMxhM9NMpL0PItYCs1tZIptnK53P19ogjuETmdcpdrrd7pl-M8wnkgvkgvFbH48n4EkFASBGiCWuD2p1oTN0fCBc0wW1ITAFEoVGpNMo3E1Qa0IR0oRsvDsiUQSU88tVeOEktEEuE8m8cjcHqScicgokTXk8rZygFQgD6vzgdLNSKoTDZh5eFKNcK5WA5HhcARcLxBKQjAAzRMAW14asFMq1ot1W31ey2B0iJr8ZotoStNpu9vpCDtoTNHr8PoizyKvL9kaFsu1XTRcL4-fzwZgmOxw1GGnWDj1hNLoAOFwCBWC5u5RySEQdT1sra+OSt1wCAQuzICfPHQZjoYlY4DUcHounq1nY3WeKXu2JZaIOum5sgkO61tE4QHhWBS2HkCT-G8R5wc8N58hgBAQHAXh3tGQ5iiOcyeMWy4AauiAALQJAeVGFLY9EMYxDG9kC6oDgWIbiqOAzIlMj7cX+BrEeRCCNo8sS2CcRz-B6zIsnBaGsXm974fxREInOvHiGpGLLKsgkrj4iBnrwFwVgkCHfEeCQBNB3K8IEpxBO6ySep8in+mxE4Plx6m4W+UIGWRRlPJEVRmncOTmhyLI2QeUS8GFQRvPBXZRLWt4vuxk4EbCflZd5+EfpwX4aEFhqAU84RRYUpyXmBATJBeQTQZEARhKEG5Ne69GUplXkqaKOmSkszCsB05XCSFOSXgUyVshUdoJLYF7QYkvAXkUER3H45q1qE-XKXhQ2+eGACiuAJrgk1GjN+S8PNUTFMtq1Nrckl-O6wTct6KF5HUdRAA */\n id: \"GetWalletAddressDeviceAction\",\n initial: \"OpenAppDeviceAction\",\n context: ({ input }) => {\n return {\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n error: null,\n wallet: null,\n walletAddress: null,\n },\n };\n },\n states: {\n OpenAppDeviceAction: {\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"openAppStateMachine\",\n input: { appName: \"Bitcoin\" },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<GetWalletAddressDAInternalState>(\n {\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n },\n );\n },\n }),\n target: \"CheckOpenAppDeviceActionResult\",\n },\n },\n },\n CheckOpenAppDeviceActionResult: {\n always: [\n {\n target: \"PrepareWalletPolicy\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n PrepareWalletPolicy: {\n invoke: {\n id: \"prepareWalletPolicy\",\n src: \"prepareWalletPolicy\",\n input: ({ context }) => ({\n wallet: context.input.wallet,\n walletBuilder: context.input.walletBuilder,\n }),\n onDone: {\n target: \"PrepareWalletPolicyResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n wallet: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n PrepareWalletPolicyResultCheck: {\n always: [\n { guard: \"noInternalError\", target: \"GetWalletAddress\" },\n { target: \"Error\" },\n ],\n },\n GetWalletAddress: {\n entry: assign(({ context }) => ({\n intermediateValue: {\n requiredUserInteraction: context.input.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n },\n })),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"getWalletAddress\",\n src: \"getWalletAddress\",\n input: ({ context }) => ({\n checkOnDevice: context.input.checkOnDevice,\n wallet: context._internalState.wallet!,\n change: context.input.change,\n addressIndex: context.input.addressIndex,\n dataStoreService: context.input.dataStoreService,\n walletSerializer: context.input.walletSerializer,\n walletBuilder: context.input.walletBuilder,\n }),\n onDone: {\n target: \"GetWalletAddressResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n walletAddress: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n GetWalletAddressResultCheck: {\n always: [\n { guard: \"noInternalError\", target: \"Success\" },\n { target: \"Error\" },\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.walletAddress\n ? Right(context._internalState.walletAddress)\n : Left(\n context._internalState.error ||\n new UnknownDAError(\"No error in final state\"),\n ),\n });\n }\n\n extractDependencies(\n internalApi: InternalApi,\n ): GetWalletAddressMachineDependencies {\n const prepareWalletPolicy = async (arg0: {\n input: { wallet: ApiWallet; walletBuilder: WalletBuilder };\n }): Promise<CommandResult<InternalWallet, BtcErrorCodes>> => {\n const {\n input: { walletBuilder, wallet },\n } = arg0;\n return await new PrepareWalletPolicyTask(\n internalApi,\n { wallet },\n walletBuilder,\n ).run();\n };\n const getWalletAddress = async (arg0: {\n input: {\n checkOnDevice: boolean;\n change: boolean;\n addressIndex: number;\n wallet: InternalWallet;\n walletBuilder: WalletBuilder;\n walletSerializer: WalletSerializer;\n dataStoreService: DataStoreService;\n };\n }): Promise<CommandResult<WalletAddress, BtcErrorCodes>> => {\n const {\n checkOnDevice,\n wallet,\n change,\n addressIndex,\n walletSerializer,\n dataStoreService,\n } = arg0.input;\n\n return await new GetWalletAddressTask(\n internalApi,\n {\n checkOnDevice,\n wallet,\n change,\n addressIndex,\n },\n walletSerializer,\n dataStoreService,\n ).run();\n };\n return {\n getWalletAddress,\n prepareWalletPolicy,\n };\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAUO,2CACPC,EAA4B,qBAC5BC,EAA2C,kBAY3CC,EAAqC,0DACrCC,EAAwC,6DA8BjC,MAAMN,UAAqC,oBAMhD,CACA,YAAYO,EAA6D,CACvE,MAAMA,CAAI,CACZ,CAEA,iBACEC,EAOA,CASA,KAAM,CAAE,iBAAAC,EAAkB,oBAAAC,CAAoB,EAC5C,KAAK,oBAAoBF,CAAW,EAEtC,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CAAC,EACR,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EAEA,OAAQ,CACN,oBAAqB,IAAI,sBAAoB,CAC3C,MAAO,CAAE,QAAS,SAAU,CAC9B,CAAC,EAAE,iBAAiBA,CAAW,EAC/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MAAO,kBAAmB,OAAQ,SAAU,EAC9C,CAAE,OAAQ,OAAQ,CACpB,CACF,EACA,QAAS,CACP,KAAM,OACR,EACA,MAAO,CACL,KAAM,OACR,CACF,EACA,OAAQ,CAAC,CAAE,QAAAJ,CAAQ,IACjBA,EAAQ,eAAe,iBACnB,SAAMA,EAAQ,eAAe,aAAa,KAC1C,QACEA,EAAQ,eAAe,OACrB,IAAI,iBAAe,yBAAyB,CAChD,CACR,CAAC,CACH,CAEA,oBACEH,EACqC,CA6CrC,MAAO,CACL,iBAjCuB,MAAOQ,GAU4B,CAC1D,KAAM,CACJ,cAAAC,EACA,OAAAC,EACA,OAAAC,EACA,aAAAC,EACA,iBAAAC,EACA,iBAAAC,CACF,EAAIN,EAAK,MAET,OAAO,MAAM,IAAI,uBACfR,EACA,CACE,cAAAS,EACA,OAAAC,EACA,OAAAC,EACA,aAAAC,CACF,EACAC,EACAC,CACF,EAAE,IAAI,CACR,EAGE,oBA9C0B,MAAON,GAE0B,CAC3D,KAAM,CACJ,MAAO,CAAE,cAAAO,EAAe,OAAAL,CAAO,CACjC,EAAIF,EACJ,OAAO,MAAM,IAAI,0BACfR,EACA,CAAE,OAAAU,CAAO,EACTK,CACF,EAAE,IAAI,CACR,CAoCA,CACF,CACF",
6
+ "names": ["GetWalletAddressDeviceAction_exports", "__export", "GetWalletAddressDeviceAction", "__toCommonJS", "import_device_management_kit", "import_purify_ts", "import_xstate", "import_GetWalletAddressTask", "import_PrepareWalletPolicyTask", "args", "internalApi", "getWalletAddress", "prepareWalletPolicy", "context", "_", "input", "error", "event", "arg0", "checkOnDevice", "wallet", "change", "addressIndex", "walletSerializer", "dataStoreService", "walletBuilder"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),i=require("../../../app-binder/device-action/__test-utils__/makeInternalApi"),s=require("../../../app-binder/device-action/__test-utils__/setupOpenAppDAMock"),l=require("../../../app-binder/device-action/__test-utils__/testDeviceActionStates"),o=require("./GetWalletAddressDeviceAction");jest.mock("@ledgerhq/device-management-kit",()=>({...jest.requireActual("@ledgerhq/device-management-kit"),OpenAppDeviceAction:jest.fn(()=>({makeStateMachine:jest.fn()}))}));describe("GetWalletAddressDeviceAction",()=>{const d=jest.fn(),n=jest.fn();function c(){return{prepareWalletPolicy:d,getWalletAddress:n}}describe("Success case",()=>{it("should call external dependencies with the correct parameters",a=>{(0,s.setupOpenAppDAMock)();const t=new o.GetWalletAddressDeviceAction({input:{wallet:"ApiWallet",walletBuilder:"WalletBuilder",walletSerializer:"WalletSerializer",dataStoreService:"DataStoreService",checkOnDevice:!0,change:!1,addressIndex:1}});jest.spyOn(t,"extractDependencies").mockReturnValue(c()),d.mockResolvedValueOnce((0,e.CommandResultFactory)({data:"InternalWallet"})),n.mockResolvedValueOnce((0,e.CommandResultFactory)({data:"WalletAddress"}));const r=[{intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None},status:e.DeviceActionStatus.Pending},{intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress},status:e.DeviceActionStatus.Pending},{output:"WalletAddress",status:e.DeviceActionStatus.Completed}];(0,l.testDeviceActionStates)(t,r,(0,i.makeDeviceActionInternalApiMock)(),a)})}),describe("Error cases",()=>{beforeEach(()=>{jest.resetAllMocks()}),it("Error if open app fails",a=>{(0,s.setupOpenAppDAMock)(new e.UnknownDeviceExchangeError("Mocked error"));const t=[{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:e.DeviceActionStatus.Error,error:new e.UnknownDeviceExchangeError("Mocked error")}],r=new o.GetWalletAddressDeviceAction({input:{wallet:{},walletBuilder:{},walletSerializer:{},dataStoreService:{},checkOnDevice:!0,change:!1,addressIndex:1}});jest.spyOn(r,"extractDependencies").mockReturnValue(c()),(0,l.testDeviceActionStates)(r,t,(0,i.makeDeviceActionInternalApiMock)(),a),expect(n).not.toHaveBeenCalled()}),it("Error if prepareWalletPolicy fails",a=>{(0,s.setupOpenAppDAMock)();const t=new o.GetWalletAddressDeviceAction({input:{wallet:{},walletBuilder:{},walletSerializer:{},dataStoreService:{},checkOnDevice:!0,change:!1,addressIndex:1}});jest.spyOn(t,"extractDependencies").mockReturnValue(c()),d.mockResolvedValueOnce((0,e.CommandResultFactory)({error:new e.UnknownDeviceExchangeError("Mocked error")}));const r=[{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:e.DeviceActionStatus.Error,error:new e.UnknownDeviceExchangeError("Mocked error")}];(0,l.testDeviceActionStates)(t,r,(0,i.makeDeviceActionInternalApiMock)(),a),expect(n).not.toHaveBeenCalled()}),it("Error if getWalletAddress fails",a=>{(0,s.setupOpenAppDAMock)();const t=new o.GetWalletAddressDeviceAction({input:{wallet:{},walletBuilder:{},walletSerializer:{},dataStoreService:{},checkOnDevice:!0,change:!1,addressIndex:1}});jest.spyOn(t,"extractDependencies").mockReturnValue(c()),d.mockResolvedValueOnce((0,e.CommandResultFactory)({data:"InternalWallet"})),n.mockResolvedValueOnce((0,e.CommandResultFactory)({error:new e.UnknownDeviceExchangeError("Mocked error")}));const r=[{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.ConfirmOpenApp}},{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None}},{status:e.DeviceActionStatus.Pending,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.VerifyAddress}},{status:e.DeviceActionStatus.Error,error:new e.UnknownDeviceExchangeError("Mocked error")}];(0,l.testDeviceActionStates)(t,r,(0,i.makeDeviceActionInternalApiMock)(),a)})})});
2
+ //# sourceMappingURL=GetWalletAddressDeviceAction.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.test.ts"],
4
+ "sourcesContent": ["import {\n CommandResultFactory,\n DeviceActionStatus,\n UnknownDeviceExchangeError,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type GetWalletAddressDAState } from \"@api/app-binder/GetWalletAddressDeviceActionTypes\";\nimport { type RegisteredWallet, type WalletAddress } from \"@api/model/Wallet\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\nimport { setupOpenAppDAMock } from \"@internal/app-binder/device-action/__test-utils__/setupOpenAppDAMock\";\nimport { testDeviceActionStates } from \"@internal/app-binder/device-action/__test-utils__/testDeviceActionStates\";\nimport { type DataStoreService } from \"@internal/data-store/service/DataStoreService\";\nimport { type WalletBuilder } from \"@internal/wallet/service/WalletBuilder\";\nimport { type WalletSerializer } from \"@internal/wallet/service/WalletSerializer\";\n\nimport { GetWalletAddressDeviceAction } from \"./GetWalletAddressDeviceAction\";\n\njest.mock(\"@ledgerhq/device-management-kit\", () => ({\n ...jest.requireActual(\"@ledgerhq/device-management-kit\"),\n OpenAppDeviceAction: jest.fn(() => ({\n makeStateMachine: jest.fn(),\n })),\n}));\n\ndescribe(\"GetWalletAddressDeviceAction\", () => {\n const prepareWalletPolicyMock = jest.fn();\n const getWalletAddressMock = jest.fn();\n\n function extractDependenciesMock() {\n return {\n prepareWalletPolicy: prepareWalletPolicyMock,\n getWalletAddress: getWalletAddressMock,\n };\n }\n\n describe(\"Success case\", () => {\n it(\"should call external dependencies with the correct parameters\", (done) => {\n // given\n setupOpenAppDAMock();\n\n const deviceAction = new GetWalletAddressDeviceAction({\n input: {\n wallet: \"ApiWallet\" as unknown as RegisteredWallet,\n walletBuilder: \"WalletBuilder\" as unknown as WalletBuilder,\n walletSerializer: \"WalletSerializer\" as unknown as WalletSerializer,\n dataStoreService: \"DataStoreService\" as unknown as DataStoreService,\n checkOnDevice: true,\n change: false,\n addressIndex: 1,\n },\n });\n\n jest\n .spyOn(deviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n prepareWalletPolicyMock.mockResolvedValueOnce(\n CommandResultFactory({\n data: \"InternalWallet\",\n }),\n );\n getWalletAddressMock.mockResolvedValueOnce(\n CommandResultFactory({\n data: \"WalletAddress\",\n }),\n );\n\n const expectedStates: Array<GetWalletAddressDAState> = [\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n status: DeviceActionStatus.Pending,\n },\n {\n output: \"WalletAddress\" as unknown as WalletAddress,\n status: DeviceActionStatus.Completed,\n },\n ];\n\n // then\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n\n describe(\"Error cases\", () => {\n beforeEach(() => {\n jest.resetAllMocks();\n });\n\n it(\"Error if open app fails\", (done) => {\n // given\n setupOpenAppDAMock(new UnknownDeviceExchangeError(\"Mocked error\"));\n\n const expectedStates: Array<GetWalletAddressDAState> = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n const deviceAction = new GetWalletAddressDeviceAction({\n input: {\n wallet: {} as unknown as RegisteredWallet,\n walletBuilder: {} as WalletBuilder,\n walletSerializer: {} as WalletSerializer,\n dataStoreService: {} as DataStoreService,\n checkOnDevice: true,\n change: false,\n addressIndex: 1,\n },\n });\n\n jest\n .spyOn(deviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n\n // then\n expect(getWalletAddressMock).not.toHaveBeenCalled();\n });\n\n it(\"Error if prepareWalletPolicy fails\", (done) => {\n // given\n setupOpenAppDAMock();\n\n const deviceAction = new GetWalletAddressDeviceAction({\n input: {\n wallet: {} as unknown as RegisteredWallet,\n walletBuilder: {} as WalletBuilder,\n walletSerializer: {} as WalletSerializer,\n dataStoreService: {} as DataStoreService,\n checkOnDevice: true,\n change: false,\n addressIndex: 1,\n },\n });\n\n jest\n .spyOn(deviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n prepareWalletPolicyMock.mockResolvedValueOnce(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const expectedStates: Array<GetWalletAddressDAState> = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n // then\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n\n expect(getWalletAddressMock).not.toHaveBeenCalled();\n });\n\n it(\"Error if getWalletAddress fails\", (done) => {\n // given\n setupOpenAppDAMock();\n\n const deviceAction = new GetWalletAddressDeviceAction({\n input: {\n wallet: {} as unknown as RegisteredWallet,\n walletBuilder: {} as WalletBuilder,\n walletSerializer: {} as WalletSerializer,\n dataStoreService: {} as DataStoreService,\n checkOnDevice: true,\n change: false,\n addressIndex: 1,\n },\n });\n\n jest\n .spyOn(deviceAction, \"extractDependencies\")\n .mockReturnValue(extractDependenciesMock());\n prepareWalletPolicyMock.mockResolvedValueOnce(\n CommandResultFactory({\n data: \"InternalWallet\",\n }),\n );\n getWalletAddressMock.mockResolvedValueOnce(\n CommandResultFactory({\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n }),\n );\n\n const expectedStates: Array<GetWalletAddressDAState> = [\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.ConfirmOpenApp,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n },\n {\n status: DeviceActionStatus.Pending,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n },\n },\n {\n status: DeviceActionStatus.Error,\n error: new UnknownDeviceExchangeError(\"Mocked error\"),\n },\n ];\n\n // then\n testDeviceActionStates(\n deviceAction,\n expectedStates,\n makeDeviceActionInternalApiMock(),\n done,\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAKO,2CAIPC,EAAgD,6EAChDC,EAAmC,gFACnCC,EAAuC,oFAKvCC,EAA6C,0CAE7C,KAAK,KAAK,kCAAmC,KAAO,CAClD,GAAG,KAAK,cAAc,iCAA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A,0BACED,EACAC,KACA,mCAAgC,EAChCF,CACF,EAEA,OAAOF,CAAoB,EAAE,IAAI,iBAAiB,CACpD,CAAC,EAED,GAAG,kCAAoCE,GAAS,IAE9C,sBAAmB,EAEnB,MAAMC,EAAe,IAAI,+BAA6B,CACpD,MAAO,CACL,OAAQ,CAAC,EACT,cAAe,CAAC,EAChB,iBAAkB,CAAC,EACnB,iBAAkB,CAAC,EACnB,cAAe,GACf,OAAQ,GACR,aAAc,CAChB,CACF,CAAC,EAED,KACG,MAAMA,EAAc,qBAAqB,EACzC,gBAAgBF,EAAwB,CAAC,EAC5CF,EAAwB,yBACtB,wBAAqB,CACnB,KAAM,gBACR,CAAC,CACH,EACAC,EAAqB,yBACnB,wBAAqB,CACnB,MAAO,IAAI,6BAA2B,cAAc,CACtD,CAAC,CACH,EAEA,MAAMI,EAAiD,CACrD,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,cACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,IACnD,CACF,EACA,CACE,OAAQ,qBAAmB,QAC3B,kBAAmB,CACjB,wBAAyB,0BAAwB,aACnD,CACF,EACA,CACE,OAAQ,qBAAmB,MAC3B,MAAO,IAAI,6BAA2B,cAAc,CACtD,CACF,KAGA,0BACED,EACAC,KACA,mCAAgC,EAChCF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_makeInternalApi", "import_setupOpenAppDAMock", "import_testDeviceActionStates", "import_GetWalletAddressDeviceAction", "prepareWalletPolicyMock", "getWalletAddressMock", "extractDependenciesMock", "done", "deviceAction", "expectedStates"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var _=(r,e)=>{for(var a in e)i(r,a,{get:e[a],enumerable:!0})},f=(r,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!W.call(r,t)&&t!==a&&i(r,t,{get:()=>e[t],enumerable:!(o=A(e,t))||o.enumerable});return r};var h=r=>f(i({},"__esModule",{value:!0}),r);var g={};_(g,{GetWalletAddressTask:()=>v});module.exports=h(g);var m=require("@ledgerhq/device-management-kit"),p=require("../../app-binder/command/GetWalletAddressCommand"),c=require("../../data-store/model/DataStore"),S=require("../../utils/BtcCommandUtils"),y=require("./ContinueTask");class v{constructor(e,a,o,t,l=(n,s)=>new y.ContinueTask(n,s),d=S.BtcCommandUtils.getAddress){this._api=e;this._args=a;this._walletSerializer=o;this._dataStoreService=t;this._continueTaskFactory=l;this._getAddress=d}async run(){const{checkOnDevice:e,change:a,addressIndex:o,wallet:t}=this._args,l=new c.DataStore;this._dataStoreService.merklizeWallet(l,t);const d=this._walletSerializer.getId(t),n=await this._api.sendCommand(new p.GetWalletAddressCommand({checkOnDevice:e,walletId:d,walletHmac:t.hmac,change:a,addressIndex:o})),s=await this._continueTaskFactory(this._api,l).run(n);return(0,m.isSuccessCommandResult)(s)?this._getAddress(s):s}}0&&(module.exports={GetWalletAddressTask});
2
+ //# sourceMappingURL=GetWalletAddressTask.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/task/GetWalletAddressTask.ts"],
4
+ "sourcesContent": ["import {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { type InternalApi } from \"@ledgerhq/device-management-kit\";\n\nimport { type WalletAddress } from \"@api/model/Wallet\";\nimport { GetWalletAddressCommand } from \"@internal/app-binder/command/GetWalletAddressCommand\";\nimport { type BtcErrorCodes } from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { DataStore } from \"@internal/data-store/model/DataStore\";\nimport { type DataStoreService } from \"@internal/data-store/service/DataStoreService\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\nimport { type Wallet as InternalWallet } from \"@internal/wallet/model/Wallet\";\nimport { type WalletSerializer } from \"@internal/wallet/service/WalletSerializer\";\n\nimport { ContinueTask } from \"./ContinueTask\";\n\nexport type SendGetWalletAddressTaskArgs = {\n checkOnDevice: boolean;\n wallet: InternalWallet;\n change: boolean;\n addressIndex: number;\n};\n\nexport class GetWalletAddressTask {\n constructor(\n private readonly _api: InternalApi,\n private readonly _args: SendGetWalletAddressTaskArgs,\n private readonly _walletSerializer: WalletSerializer,\n private readonly _dataStoreService: DataStoreService,\n private readonly _continueTaskFactory = (\n api: InternalApi,\n dataStore: DataStore,\n ) => new ContinueTask(api, dataStore),\n private readonly _getAddress = BtcCommandUtils.getAddress,\n ) {}\n\n async run(): Promise<CommandResult<WalletAddress, BtcErrorCodes>> {\n const { checkOnDevice, change, addressIndex, wallet } = this._args;\n\n const dataStore = new DataStore();\n\n this._dataStoreService.merklizeWallet(dataStore, wallet);\n\n const walletId = this._walletSerializer.getId(wallet);\n\n const getWalletAddressInitialResponse = await this._api.sendCommand(\n new GetWalletAddressCommand({\n checkOnDevice,\n walletId,\n walletHmac: wallet.hmac,\n change,\n addressIndex,\n }),\n );\n\n const response = await this._continueTaskFactory(this._api, dataStore).run(\n getWalletAddressInitialResponse,\n );\n\n if (isSuccessCommandResult(response)) {\n return this._getAddress(response);\n }\n\n return response;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,2CAIPC,EAAwC,gEAExCC,EAA0B,gDAE1BC,EAAgC,2CAIhCC,EAA6B,0BAStB,MAAMN,CAAqB,CAChC,YACmBO,EACAC,EACAC,EACAC,EACAC,EAAuB,CACtCC,EACAC,IACG,IAAI,eAAaD,EAAKC,CAAS,EACnBC,EAAc,kBAAgB,WAC/C,CATiB,UAAAP,EACA,WAAAC,EACA,uBAAAC,EACA,uBAAAC,EACA,0BAAAC,EAIA,iBAAAG,CAChB,CAEH,MAAM,KAA4D,CAChE,KAAM,CAAE,cAAAC,EAAe,OAAAC,EAAQ,aAAAC,EAAc,OAAAC,CAAO,EAAI,KAAK,MAEvDL,EAAY,IAAI,YAEtB,KAAK,kBAAkB,eAAeA,EAAWK,CAAM,EAEvD,MAAMC,EAAW,KAAK,kBAAkB,MAAMD,CAAM,EAE9CE,EAAkC,MAAM,KAAK,KAAK,YACtD,IAAI,0BAAwB,CAC1B,cAAAL,EACA,SAAAI,EACA,WAAYD,EAAO,KACnB,OAAAF,EACA,aAAAC,CACF,CAAC,CACH,EAEMI,EAAW,MAAM,KAAK,qBAAqB,KAAK,KAAMR,CAAS,EAAE,IACrEO,CACF,EAEA,SAAI,0BAAuBC,CAAQ,EAC1B,KAAK,YAAYA,CAAQ,EAG3BA,CACT,CACF",
6
+ "names": ["GetWalletAddressTask_exports", "__export", "GetWalletAddressTask", "__toCommonJS", "import_device_management_kit", "import_GetWalletAddressCommand", "import_DataStore", "import_BtcCommandUtils", "import_ContinueTask", "_api", "_args", "_walletSerializer", "_dataStoreService", "_continueTaskFactory", "api", "dataStore", "_getAddress", "checkOnDevice", "change", "addressIndex", "wallet", "walletId", "getWalletAddressInitialResponse", "response"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@ledgerhq/device-management-kit"),l=require("./GetWalletAddressTask");describe("GetWalletAddressTask",()=>{describe("run",()=>{it("should return a wallet address successfully",async()=>{const t={sendCommand:jest.fn().mockResolvedValueOnce((0,e.CommandResultFactory)({data:Uint8Array.from([1,2,3])}))},a={hmac:Uint8Array.from([4])},n={getId:jest.fn().mockReturnValue(Uint8Array.from([5]))},r={merklizeWallet:jest.fn()},s=()=>({run:jest.fn().mockResolvedValue((0,e.CommandResultFactory)({data:{data:Uint8Array.from([52,86,120,154,188,222,241])}}))}),o=jest.fn().mockReturnValue((0,e.CommandResultFactory)({data:{address:"some address"}})),i=await new l.GetWalletAddressTask(t,{checkOnDevice:!0,wallet:a,change:!1,addressIndex:0},n,r,s,o).run();expect(n.getId).toHaveBeenCalledWith(a),expect(i).toStrictEqual((0,e.CommandResultFactory)({data:{address:"some address"}}))}),it("should fail if ContinueTask fails",async()=>{const t={sendCommand:jest.fn()},a={hmac:Uint8Array.from([4])},n={getId:jest.fn().mockReturnValue(Uint8Array.from([5]))},r={merklizeWallet:jest.fn()},s=()=>({run:jest.fn().mockResolvedValue((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("ContinueTask failed")}))}),o=await new l.GetWalletAddressTask(t,{checkOnDevice:!0,wallet:a,change:!1,addressIndex:0},n,r,s).run();expect(o).toStrictEqual((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("ContinueTask failed")}))}),it("should fail with an invalid device response",async()=>{const t={sendCommand:jest.fn().mockResolvedValueOnce((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("Invalid response from the device")}))},a={hmac:Uint8Array.from([4])},n={getId:jest.fn().mockReturnValue(Uint8Array.from([5]))},r={merklizeWallet:jest.fn()},s=()=>({run:jest.fn().mockResolvedValue((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("Invalid response from the device")}))}),o=await new l.GetWalletAddressTask(t,{checkOnDevice:!0,wallet:a,change:!1,addressIndex:0},n,r,s).run();expect(o).toStrictEqual((0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("Invalid response from the device")}))})})});
2
+ //# sourceMappingURL=GetWalletAddressTask.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/app-binder/task/GetWalletAddressTask.test.ts"],
4
+ "sourcesContent": ["import {\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type DataStoreService } from \"@internal/data-store/service/DataStoreService\";\nimport { type Wallet as InternalWallet } from \"@internal/wallet/model/Wallet\";\nimport { type WalletSerializer } from \"@internal/wallet/service/WalletSerializer\";\n\nimport { type ContinueTask } from \"./ContinueTask\";\nimport { GetWalletAddressTask } from \"./GetWalletAddressTask\";\n\ndescribe(\"GetWalletAddressTask\", () => {\n describe(\"run\", () => {\n it(\"should return a wallet address successfully\", async () => {\n // given\n const api = {\n sendCommand: jest.fn().mockResolvedValueOnce(\n CommandResultFactory({\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n }),\n ),\n } as unknown as InternalApi;\n\n const wallet = {\n hmac: Uint8Array.from([0x04]),\n } as unknown as InternalWallet;\n\n const walletSerializer = {\n getId: jest.fn().mockReturnValue(Uint8Array.from([0x05])),\n } as unknown as WalletSerializer;\n\n const dataStoreService = {\n merklizeWallet: jest.fn(),\n } as unknown as DataStoreService;\n\n const continueTaskFactory = () =>\n ({\n run: jest.fn().mockResolvedValue(\n CommandResultFactory({\n data: {\n data: Uint8Array.from([\n 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf1,\n ]),\n },\n }),\n ),\n }) as unknown as ContinueTask;\n\n const mockGetAddress = jest.fn().mockReturnValue(\n CommandResultFactory({\n data: { address: \"some address\" },\n }),\n );\n\n // when\n const result = await new GetWalletAddressTask(\n api,\n {\n checkOnDevice: true,\n wallet,\n change: false,\n addressIndex: 0,\n },\n walletSerializer,\n dataStoreService,\n continueTaskFactory,\n mockGetAddress,\n ).run();\n\n // then\n expect(walletSerializer.getId).toHaveBeenCalledWith(wallet);\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: {\n address: \"some address\",\n },\n }),\n );\n });\n\n it(\"should fail if ContinueTask fails\", async () => {\n // given\n const api = {\n sendCommand: jest.fn(),\n } as unknown as InternalApi;\n\n const wallet = {\n hmac: Uint8Array.from([0x04]),\n } as unknown as InternalWallet;\n\n const walletSerializer = {\n getId: jest.fn().mockReturnValue(Uint8Array.from([0x05])),\n } as unknown as WalletSerializer;\n\n const dataStoreService = {\n merklizeWallet: jest.fn(),\n } as unknown as DataStoreService;\n\n const continueTaskFactory = () =>\n ({\n run: jest.fn().mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"ContinueTask failed\"),\n }),\n ),\n }) as unknown as ContinueTask;\n\n // when\n const result = await new GetWalletAddressTask(\n api,\n {\n checkOnDevice: true,\n wallet,\n change: false,\n addressIndex: 0,\n },\n walletSerializer,\n dataStoreService,\n continueTaskFactory,\n ).run();\n\n // then\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"ContinueTask failed\"),\n }),\n );\n });\n\n it(\"should fail with an invalid device response\", async () => {\n // given\n const api = {\n sendCommand: jest.fn().mockResolvedValueOnce(\n CommandResultFactory({\n error: new InvalidStatusWordError(\n \"Invalid response from the device\",\n ),\n }),\n ),\n } as unknown as InternalApi;\n\n const wallet = {\n hmac: Uint8Array.from([0x04]),\n } as unknown as InternalWallet;\n\n const walletSerializer = {\n getId: jest.fn().mockReturnValue(Uint8Array.from([0x05])),\n } as unknown as WalletSerializer;\n\n const dataStoreService = {\n merklizeWallet: jest.fn(),\n } as unknown as DataStoreService;\n\n const continueTaskFactory = () =>\n ({\n run: jest.fn().mockResolvedValue(\n CommandResultFactory({\n error: new InvalidStatusWordError(\n \"Invalid response from the device\",\n ),\n }),\n ),\n }) as unknown as ContinueTask;\n\n // when\n const result = await new GetWalletAddressTask(\n api,\n {\n checkOnDevice: true,\n wallet,\n change: false,\n addressIndex: 0,\n },\n walletSerializer,\n dataStoreService,\n continueTaskFactory,\n ).run();\n\n // then\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"Invalid response from the device\"),\n }),\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAIO,2CAOPC,EAAqC,kCAErC,SAAS,uBAAwB,IAAM,CACrC,SAAS,MAAO,IAAM,CACpB,GAAG,8CAA+C,SAAY,CAE5D,MAAMC,EAAM,CACV,YAAa,KAAK,GAAG,EAAE,yBACrB,wBAAqB,CACnB,KAAM,WAAW,KAAK,CAA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vBN,EACA,CACE,cAAe,GACf,OAAAC,EACA,OAAQ,GACR,aAAc,CAChB,EACAC,EACAC,EACAC,CACF,EAAE,IAAI,EAGN,OAAOE,CAAM,EAAE,iBACb,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,qBAAqB,CACzD,CAAC,CACH,CACF,CAAC,EAED,GAAG,8CAA+C,SAAY,CAE5D,MAAMN,EAAM,CACV,YAAa,KAAK,GAAG,EAAE,yBACrB,wBAAqB,CACnB,MAAO,IAAI,yBACT,kCACF,CACF,CAAC,CACH,CACF,EAEMC,EAAS,CACb,KAAM,WAAW,KAAK,CAAC,CAAI,CAAC,CAC9B,EAEMC,EAAmB,CACvB,MAAO,KAAK,GAAG,EAAE,gBAAgB,WAAW,KAAK,CAAC,CAAI,CAAC,CAAC,CAC1D,EAEMC,EAAmB,CACvB,eAAgB,KAAK,GAAG,CAC1B,EAEMC,EAAsB,KACzB,CACC,IAAK,KAAK,GAAG,EAAE,qBACb,wBAAqB,CACnB,MAAO,IAAI,yBACT,kCACF,CACF,CAAC,CACH,CACF,GAGIE,EAAS,MAAM,IAAI,uBACvBN,EACA,CACE,cAAe,GACf,OAAAC,EACA,OAAQ,GACR,aAAc,CAChB,EACAC,EACAC,EACAC,CACF,EAAE,IAAI,EAGN,OAAOE,CAAM,EAAE,iBACb,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,kCAAkC,CACtE,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_GetWalletAddressTask", "api", "wallet", "walletSerializer", "dataStoreService", "continueTaskFactory", "mockGetAddress", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var d=(e,s)=>{for(var t in s)a(e,t,{get:s[t],enumerable:!0})},f=(e,s,t,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of p(s))!U.call(e,o)&&o!==t&&a(e,o,{get:()=>s[o],enumerable:!(i=g(s,o))||i.enumerable});return e};var S=e=>f(a({},"__esModule",{value:!0}),e);var y={};d(y,{useCasesModuleFactory:()=>_});module.exports=S(y);var r=require("inversify"),n=require("../../use-cases/di/useCasesTypes"),m=require("../../use-cases/get-extended-public-key/GetExtendedPublicKeyUseCase"),C=require("../../use-cases/sign-message/SignMessageUseCase"),c=require("../../use-cases/sign-psbt/SignPsbtUseCase"),u=require("../../use-cases/sign-transaction/SignTransactionUseCase");const _=()=>new r.ContainerModule((e,s,t,i,o,b,l)=>{e(n.useCasesTypes.GetExtendedPublicKeyUseCase).to(m.GetExtendedPublicKeyUseCase),e(n.useCasesTypes.SignMessageUseCase).to(C.SignMessageUseCase),e(n.useCasesTypes.SignPsbtUseCase).to(c.SignPsbtUseCase),e(n.useCasesTypes.SignTransactionUseCase).to(u.SignTransactionUseCase)});0&&(module.exports={useCasesModuleFactory});
1
+ "use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(e,s)=>{for(var a in s)i(e,a,{get:s[a],enumerable:!0})},f=(e,s,a,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of u(s))!g.call(e,o)&&o!==a&&i(e,o,{get:()=>s[o],enumerable:!(n=p(s,o))||n.enumerable});return e};var S=e=>f(i({},"__esModule",{value:!0}),e);var y={};l(y,{useCasesModuleFactory:()=>_});module.exports=S(y);var r=require("inversify"),t=require("../../use-cases/di/useCasesTypes"),m=require("../../use-cases/get-extended-public-key/GetExtendedPublicKeyUseCase"),C=require("../../use-cases/get-wallet-address/GetWalletAddressUseCase"),d=require("../../use-cases/sign-message/SignMessageUseCase"),U=require("../../use-cases/sign-psbt/SignPsbtUseCase"),c=require("../../use-cases/sign-transaction/SignTransactionUseCase");const _=()=>new r.ContainerModule((e,s,a,n,o,A,G)=>{e(t.useCasesTypes.GetExtendedPublicKeyUseCase).to(m.GetExtendedPublicKeyUseCase),e(t.useCasesTypes.SignMessageUseCase).to(d.SignMessageUseCase),e(t.useCasesTypes.SignPsbtUseCase).to(U.SignPsbtUseCase),e(t.useCasesTypes.SignTransactionUseCase).to(c.SignTransactionUseCase),e(t.useCasesTypes.GetWalletAddressUseCase).to(C.GetWalletAddressUseCase)});0&&(module.exports={useCasesModuleFactory});
2
2
  //# sourceMappingURL=useCasesModule.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/use-cases/di/useCasesModule.ts"],
4
- "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { useCasesTypes } from \"@internal/use-cases/di/useCasesTypes\";\nimport { GetExtendedPublicKeyUseCase } from \"@internal/use-cases/get-extended-public-key/GetExtendedPublicKeyUseCase\";\nimport { SignMessageUseCase } from \"@internal/use-cases/sign-message/SignMessageUseCase\";\nimport { SignPsbtUseCase } from \"@internal/use-cases/sign-psbt/SignPsbtUseCase\";\nimport { SignTransactionUseCase } from \"@internal/use-cases/sign-transaction/SignTransactionUseCase\";\n\nexport const useCasesModuleFactory = () =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n _rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(useCasesTypes.GetExtendedPublicKeyUseCase).to(\n GetExtendedPublicKeyUseCase,\n );\n bind(useCasesTypes.SignMessageUseCase).to(SignMessageUseCase);\n bind(useCasesTypes.SignPsbtUseCase).to(SignPsbtUseCase);\n bind(useCasesTypes.SignTransactionUseCase).to(SignTransactionUseCase);\n },\n );\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA8B,gDAC9BC,EAA4C,mFAC5CC,EAAmC,+DACnCC,EAAgC,yDAChCC,EAAuC,uEAEhC,MAAMP,EAAwB,IACnC,IAAI,kBACF,CACEQ,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,gBAAc,2BAA2B,EAAE,GAC9C,6BACF,EACAA,EAAK,gBAAc,kBAAkB,EAAE,GAAG,oBAAkB,EAC5DA,EAAK,gBAAc,eAAe,EAAE,GAAG,iBAAe,EACtDA,EAAK,gBAAc,sBAAsB,EAAE,GAAG,wBAAsB,CACtE,CACF",
6
- "names": ["useCasesModule_exports", "__export", "useCasesModuleFactory", "__toCommonJS", "import_inversify", "import_useCasesTypes", "import_GetExtendedPublicKeyUseCase", "import_SignMessageUseCase", "import_SignPsbtUseCase", "import_SignTransactionUseCase", "bind", "_unbind", "_isBound", "_rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
4
+ "sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { useCasesTypes } from \"@internal/use-cases/di/useCasesTypes\";\nimport { GetExtendedPublicKeyUseCase } from \"@internal/use-cases/get-extended-public-key/GetExtendedPublicKeyUseCase\";\nimport { GetWalletAddressUseCase } from \"@internal/use-cases/get-wallet-address/GetWalletAddressUseCase\";\nimport { SignMessageUseCase } from \"@internal/use-cases/sign-message/SignMessageUseCase\";\nimport { SignPsbtUseCase } from \"@internal/use-cases/sign-psbt/SignPsbtUseCase\";\nimport { SignTransactionUseCase } from \"@internal/use-cases/sign-transaction/SignTransactionUseCase\";\n\nexport const useCasesModuleFactory = () =>\n new ContainerModule(\n (\n bind,\n _unbind,\n _isBound,\n _rebind,\n _unbindAsync,\n _onActivation,\n _onDeactivation,\n ) => {\n bind(useCasesTypes.GetExtendedPublicKeyUseCase).to(\n GetExtendedPublicKeyUseCase,\n );\n bind(useCasesTypes.SignMessageUseCase).to(SignMessageUseCase);\n bind(useCasesTypes.SignPsbtUseCase).to(SignPsbtUseCase);\n bind(useCasesTypes.SignTransactionUseCase).to(SignTransactionUseCase);\n bind(useCasesTypes.GetWalletAddressUseCase).to(GetWalletAddressUseCase);\n },\n );\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA8B,gDAC9BC,EAA4C,mFAC5CC,EAAwC,0EACxCC,EAAmC,+DACnCC,EAAgC,yDAChCC,EAAuC,uEAEhC,MAAMR,EAAwB,IACnC,IAAI,kBACF,CACES,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,IACG,CACHN,EAAK,gBAAc,2BAA2B,EAAE,GAC9C,6BACF,EACAA,EAAK,gBAAc,kBAAkB,EAAE,GAAG,oBAAkB,EAC5DA,EAAK,gBAAc,eAAe,EAAE,GAAG,iBAAe,EACtDA,EAAK,gBAAc,sBAAsB,EAAE,GAAG,wBAAsB,EACpEA,EAAK,gBAAc,uBAAuB,EAAE,GAAG,yBAAuB,CACxE,CACF",
6
+ "names": ["useCasesModule_exports", "__export", "useCasesModuleFactory", "__toCommonJS", "import_inversify", "import_useCasesTypes", "import_GetExtendedPublicKeyUseCase", "import_GetWalletAddressUseCase", "import_SignMessageUseCase", "import_SignPsbtUseCase", "import_SignTransactionUseCase", "bind", "_unbind", "_isBound", "_rebind", "_unbindAsync", "_onActivation", "_onDeactivation"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("inversify"),d=require("./useCasesModule"),t=require("./useCasesTypes");describe("useCasesModuleFactory",()=>{describe("Default",()=>{let e,s;beforeEach(()=>{s=(0,d.useCasesModuleFactory)(),e=new o.Container,e.load(s)}),it("should return the address module",()=>{expect(s).toBeDefined()}),it("should bind GetExtendedPublicKeyUseCase",()=>{expect(e.isBound(t.useCasesTypes.GetExtendedPublicKeyUseCase)).toBeTruthy()}),it("should bind SignMessageUseCase",()=>{expect(e.isBound(t.useCasesTypes.SignMessageUseCase)).toBeTruthy()})})});
1
+ "use strict";var o=require("inversify"),d=require("./useCasesModule"),s=require("./useCasesTypes");describe("useCasesModuleFactory",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,d.useCasesModuleFactory)(),e=new o.Container,e.load(t)}),it("should return the address module",()=>{expect(t).toBeDefined()}),it("should bind GetExtendedPublicKeyUseCase",()=>{expect(e.isBound(s.useCasesTypes.GetExtendedPublicKeyUseCase)).toBeTruthy()}),it("should bind SignMessageUseCase",()=>{expect(e.isBound(s.useCasesTypes.SignMessageUseCase)).toBeTruthy()}),it("should bind GetWalletAddressUseCase",()=>{expect(e.isBound(s.useCasesTypes.GetWalletAddressUseCase)).toBeTruthy()})})});
2
2
  //# sourceMappingURL=useCasesModule.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/use-cases/di/useCasesModule.test.ts"],
4
- "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { useCasesModuleFactory } from \"./useCasesModule\";\nimport { useCasesTypes } from \"./useCasesTypes\";\n\ndescribe(\"useCasesModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof useCasesModuleFactory>;\n beforeEach(() => {\n mod = useCasesModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the address module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should bind GetExtendedPublicKeyUseCase\", () => {\n expect(\n container.isBound(useCasesTypes.GetExtendedPublicKeyUseCase),\n ).toBeTruthy();\n });\n\n it(\"should bind SignMessageUseCase\", () => {\n expect(container.isBound(useCasesTypes.SignMessageUseCase)).toBeTruthy();\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAsC,4BACtCC,EAA8B,2BAE9B,SAAS,wBAAyB,IAAM,CACtC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,yBAAsB,EAC5BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,0CAA2C,IAAM,CAClD,OACED,EAAU,QAAQ,gBAAc,2BAA2B,CAC7D,EAAE,WAAW,CACf,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OAAOA,EAAU,QAAQ,gBAAc,kBAAkB,CAAC,EAAE,WAAW,CACzE,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { Container } from \"inversify\";\n\nimport { useCasesModuleFactory } from \"./useCasesModule\";\nimport { useCasesTypes } from \"./useCasesTypes\";\n\ndescribe(\"useCasesModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof useCasesModuleFactory>;\n beforeEach(() => {\n mod = useCasesModuleFactory();\n container = new Container();\n container.load(mod);\n });\n\n it(\"should return the address module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should bind GetExtendedPublicKeyUseCase\", () => {\n expect(\n container.isBound(useCasesTypes.GetExtendedPublicKeyUseCase),\n ).toBeTruthy();\n });\n\n it(\"should bind SignMessageUseCase\", () => {\n expect(container.isBound(useCasesTypes.SignMessageUseCase)).toBeTruthy();\n });\n\n it(\"should bind GetWalletAddressUseCase\", () => {\n expect(\n container.isBound(useCasesTypes.GetWalletAddressUseCase),\n ).toBeTruthy();\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAsC,4BACtCC,EAA8B,2BAE9B,SAAS,wBAAyB,IAAM,CACtC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,yBAAsB,EAC5BD,EAAY,IAAI,YAChBA,EAAU,KAAKC,CAAG,CACpB,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,0CAA2C,IAAM,CAClD,OACED,EAAU,QAAQ,gBAAc,2BAA2B,CAC7D,EAAE,WAAW,CACf,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OAAOA,EAAU,QAAQ,gBAAc,kBAAkB,CAAC,EAAE,WAAW,CACzE,CAAC,EAED,GAAG,sCAAuC,IAAM,CAC9C,OACEA,EAAU,QAAQ,gBAAc,uBAAuB,CACzD,EAAE,WAAW,CACf,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_inversify", "import_useCasesModule", "import_useCasesTypes", "container", "mod"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(s,e)=>{for(var n in e)o(s,n,{get:e[n],enumerable:!0})},g=(s,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!C.call(s,a)&&a!==n&&o(s,a,{get:()=>e[a],enumerable:!(i=t(e,a))||i.enumerable});return s};var U=s=>g(o({},"__esModule",{value:!0}),s);var y={};b(y,{useCasesTypes:()=>r});module.exports=U(y);const r={GetExtendedPublicKeyUseCase:Symbol.for("GetExtendedPublicKeyUseCase"),SignMessageUseCase:Symbol.for("SignMessageUseCase"),SignPsbtUseCase:Symbol.for("SignPsbtUseCase"),SignTransactionUseCase:Symbol.for("SignTransactionUseCase")};0&&(module.exports={useCasesTypes});
1
+ "use strict";var t=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var i=(s,e)=>{for(var o in e)t(s,o,{get:e[o],enumerable:!0})},r=(s,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of C(e))!S.call(s,a)&&a!==o&&t(s,a,{get:()=>e[a],enumerable:!(n=l(e,a))||n.enumerable});return s};var U=s=>r(t({},"__esModule",{value:!0}),s);var d={};i(d,{useCasesTypes:()=>b});module.exports=U(d);const b={GetExtendedPublicKeyUseCase:Symbol.for("GetExtendedPublicKeyUseCase"),SignMessageUseCase:Symbol.for("SignMessageUseCase"),SignPsbtUseCase:Symbol.for("SignPsbtUseCase"),SignTransactionUseCase:Symbol.for("SignTransactionUseCase"),GetWalletAddressUseCase:Symbol.for("GetWalletAddressUseCase")};0&&(module.exports={useCasesTypes});
2
2
  //# sourceMappingURL=useCasesTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/use-cases/di/useCasesTypes.ts"],
4
- "sourcesContent": ["export const useCasesTypes = {\n GetExtendedPublicKeyUseCase: Symbol.for(\"GetExtendedPublicKeyUseCase\"),\n SignMessageUseCase: Symbol.for(\"SignMessageUseCase\"),\n SignPsbtUseCase: Symbol.for(\"SignPsbtUseCase\"),\n SignTransactionUseCase: Symbol.for(\"SignTransactionUseCase\"),\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAgB,CAC3B,4BAA6B,OAAO,IAAI,6BAA6B,EACrE,mBAAoB,OAAO,IAAI,oBAAoB,EACnD,gBAAiB,OAAO,IAAI,iBAAiB,EAC7C,uBAAwB,OAAO,IAAI,wBAAwB,CAC7D",
4
+ "sourcesContent": ["export const useCasesTypes = {\n GetExtendedPublicKeyUseCase: Symbol.for(\"GetExtendedPublicKeyUseCase\"),\n SignMessageUseCase: Symbol.for(\"SignMessageUseCase\"),\n SignPsbtUseCase: Symbol.for(\"SignPsbtUseCase\"),\n SignTransactionUseCase: Symbol.for(\"SignTransactionUseCase\"),\n GetWalletAddressUseCase: Symbol.for(\"GetWalletAddressUseCase\"),\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAgB,CAC3B,4BAA6B,OAAO,IAAI,6BAA6B,EACrE,mBAAoB,OAAO,IAAI,oBAAoB,EACnD,gBAAiB,OAAO,IAAI,iBAAiB,EAC7C,uBAAwB,OAAO,IAAI,wBAAwB,EAC3D,wBAAyB,OAAO,IAAI,yBAAyB,CAC/D",
6
6
  "names": ["useCasesTypes_exports", "__export", "useCasesTypes", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(t,r)=>{for(var e in r)o(t,e,{get:r[e],enumerable:!0})},y=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of A(r))!f.call(t,p)&&p!==e&&o(t,p,{get:()=>r[p],enumerable:!(i=a(r,p))||i.enumerable});return t};var T=t=>y(o({},"__esModule",{value:!0}),t),d=(t,r,e,i)=>{for(var p=i>1?void 0:i?a(r,e):r,B=t.length-1,c;B>=0;B--)(c=t[B])&&(p=(i?c(r,e,p):c(p))||p);return i&&p&&o(r,e,p),p},l=(t,r)=>(e,i)=>r(e,i,t);var _={};b(_,{GetWalletAddressUseCase:()=>n});module.exports=T(_);var m=require("inversify"),u=require("../../app-binder/di/appBinderTypes");let n=class{_appBinder;constructor(r){this._appBinder=r}execute(r,e,i,p){return this._appBinder.getWalletAddress({wallet:e,checkOnDevice:r,change:i,addressIndex:p})}};n=d([(0,m.injectable)(),l(0,(0,m.inject)(u.appBinderTypes.AppBinder))],n);0&&(module.exports={GetWalletAddressUseCase});
2
+ //# sourceMappingURL=GetWalletAddressUseCase.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.ts"],
4
+ "sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { GetWalletAddressDAReturnType } from \"@api/app-binder/GetWalletAddressDeviceActionTypes\";\nimport { Wallet } from \"@api/model/Wallet\";\nimport { BtcAppBinder } from \"@internal/app-binder/BtcAppBinder\";\nimport { appBinderTypes } from \"@internal/app-binder/di/appBinderTypes\";\n\n@injectable()\nexport class GetWalletAddressUseCase {\n private _appBinder: BtcAppBinder;\n\n constructor(\n @inject(appBinderTypes.AppBinder)\n appBinding: BtcAppBinder,\n ) {\n this._appBinder = appBinding;\n }\n\n execute(\n checkOnDevice: boolean,\n wallet: Wallet,\n change: boolean,\n addressIndex: number,\n ): GetWalletAddressDAReturnType {\n return this._appBinder.getWalletAddress({\n wallet,\n checkOnDevice,\n change,\n addressIndex,\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAKnCC,EAA+B,kDAGxB,IAAMC,EAAN,KAA8B,CAC3B,WAER,YAEEC,EACA,CACA,KAAK,WAAaA,CACpB,CAEA,QACEC,EACAC,EACAC,EACAC,EAC8B,CAC9B,OAAO,KAAK,WAAW,iBAAiB,CACtC,OAAAF,EACA,cAAAD,EACA,OAAAE,EACA,aAAAC,CACF,CAAC,CACH,CACF,EAvBaL,EAANM,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,iBAAe,SAAS,IAJvBP",
6
+ "names": ["GetWalletAddressUseCase_exports", "__export", "GetWalletAddressUseCase", "__toCommonJS", "import_inversify", "import_appBinderTypes", "GetWalletAddressUseCase", "appBinding", "checkOnDevice", "wallet", "change", "addressIndex", "__decorateClass", "__decorateParam"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var l=require("../../merkle-tree/model/Leaf"),n=require("../../merkle-tree/model/MerkleTree"),d=require("./GetWalletAddressUseCase");describe("GetWalletAddressUseCase",()=>{it("should call getWalletAddress on appBinder with the correct arguments",()=>{const e={name:"wallet-name",descriptorTemplate:"wpkh(@0/**)",keys:["key1","key2"],hmac:new Uint8Array(32).fill(42),keysTree:new n.MerkleTree(new l.Leaf(new Uint8Array,new Uint8Array(32).fill(7)),[]),descriptorBuffer:new Uint8Array(31).fill(16)},t=!1,s=!1,r=0,a={getWalletAddress:jest.fn()};new d.GetWalletAddressUseCase(a).execute(t,e,s,r),expect(a.getWalletAddress).toHaveBeenCalledWith({wallet:e,checkOnDevice:t,change:s,addressIndex:r})})});
2
+ //# sourceMappingURL=GetWalletAddressUseCase.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/internal/use-cases/get-wallet-address/GetWalletAddressUseCase.test.ts"],
4
+ "sourcesContent": ["import { type BtcAppBinder } from \"@internal/app-binder/BtcAppBinder\";\nimport { Leaf } from \"@internal/merkle-tree/model/Leaf\";\nimport { MerkleTree } from \"@internal/merkle-tree/model/MerkleTree\";\n\nimport { GetWalletAddressUseCase } from \"./GetWalletAddressUseCase\";\n\ndescribe(\"GetWalletAddressUseCase\", () => {\n it(\"should call getWalletAddress on appBinder with the correct arguments\", () => {\n // given\n const wallet = {\n name: \"wallet-name\",\n descriptorTemplate: \"wpkh(@0/**)\",\n keys: [\"key1\", \"key2\"],\n hmac: new Uint8Array(32).fill(42),\n keysTree: new MerkleTree(\n new Leaf(new Uint8Array(), new Uint8Array(32).fill(7)),\n [],\n ),\n descriptorBuffer: new Uint8Array(31).fill(16),\n };\n const checkOnDevice = false;\n const change = false;\n const addressIndex = 0;\n\n const appBinder = {\n getWalletAddress: jest.fn(),\n };\n const getWalletAddressUseCase = new GetWalletAddressUseCase(\n appBinder as unknown as BtcAppBinder,\n );\n\n // when\n getWalletAddressUseCase.execute(\n checkOnDevice,\n wallet,\n change,\n addressIndex,\n );\n\n // then\n expect(appBinder.getWalletAddress).toHaveBeenCalledWith({\n wallet,\n checkOnDevice,\n change,\n addressIndex,\n });\n });\n});\n"],
5
+ "mappings": "aACA,IAAAA,EAAqB,4CACrBC,EAA2B,kDAE3BC,EAAwC,qCAExC,SAAS,0BAA2B,IAAM,CACxC,GAAG,uEAAwE,IAAM,CAE/E,MAAMC,EAAS,CACb,KAAM,cACN,mBAAoB,cACpB,KAAM,CAAC,OAAQ,MAAM,EACrB,KAAM,IAAI,WAAW,EAAE,EAAE,KAAK,EAAE,EAChC,SAAU,IAAI,aACZ,IAAI,OAAK,IAAI,WAAc,IAAI,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC,EACrD,CAAC,CACH,EACA,iBAAkB,IAAI,WAAW,EAAE,EAAE,KAAK,EAAE,CAC9C,EACMC,EAAgB,GAChBC,EAAS,GACTC,EAAe,EAEfC,EAAY,CAChB,iBAAkB,KAAK,GAAG,CAC5B,EACgC,IAAI,0BAClCA,CACF,EAGwB,QACtBH,EACAD,EACAE,EACAC,CACF,EAGA,OAAOC,EAAU,gBAAgB,EAAE,qBAAqB,CACtD,OAAAJ,EACA,cAAAC,EACA,OAAAC,EACA,aAAAC,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_Leaf", "import_MerkleTree", "import_GetWalletAddressUseCase", "wallet", "checkOnDevice", "change", "addressIndex", "appBinder"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var R=(n,e)=>{for(var s in e)i(n,s,{get:e[s],enumerable:!0})},C=(n,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!p.call(n,r)&&r!==s&&i(n,r,{get:()=>e[r],enumerable:!(o=d(e,r))||o.enumerable});return n};var S=n=>C(i({},"__esModule",{value:!0}),n);var E={};R(E,{BtcCommandUtils:()=>u});module.exports=S(E);var t=require("@ledgerhq/device-management-kit"),a=require("../app-binder/command/utils/constants");const g=32,l=32;class u{static isContinueResponse(e){return e.statusCode[0]===a.SW_INTERRUPTED_EXECUTION[0]&&e.statusCode[1]===a.SW_INTERRUPTED_EXECUTION[1]}static isSuccessResponse(e){return t.CommandUtils.isSuccessResponse(e)||u.isContinueResponse(e)}static getSignature(e){const s=new t.ApduParser(e.data),o=s.extract8BitUInt();if(o===void 0)return(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("V is missing")});const r=s.encodeToHexaString(s.extractFieldByLength(g),!0);if(!r)return(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("R is missing")});const c=s.encodeToHexaString(s.extractFieldByLength(l),!0);return c?(0,t.CommandResultFactory)({data:{v:o,r,s:c}}):(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("S is missing")})}}0&&(module.exports={BtcCommandUtils});
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var R=(n,e)=>{for(var s in e)a(n,s,{get:e[s],enumerable:!0})},l=(n,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!p.call(n,r)&&r!==s&&a(n,r,{get:()=>e[r],enumerable:!(o=c(e,r))||o.enumerable});return n};var C=n=>l(a({},"__esModule",{value:!0}),n);var f={};R(f,{BtcCommandUtils:()=>i});module.exports=C(f);var t=require("@ledgerhq/device-management-kit"),d=require("../app-binder/command/utils/constants");const S=32,g=32;class i{static isContinueResponse(e){return e.statusCode[0]===d.SW_INTERRUPTED_EXECUTION[0]&&e.statusCode[1]===d.SW_INTERRUPTED_EXECUTION[1]}static isSuccessResponse(e){return t.CommandUtils.isSuccessResponse(e)||i.isContinueResponse(e)}static getSignature(e){const s=new t.ApduParser(e.data),o=s.extract8BitUInt();if(o===void 0)return(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("V is missing")});const r=s.encodeToHexaString(s.extractFieldByLength(S),!0);if(!r)return(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("R is missing")});const u=s.encodeToHexaString(s.extractFieldByLength(g),!0);return u?(0,t.CommandResultFactory)({data:{v:o,r,s:u}}):(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("S is missing")})}static getAddress(e){const s=new t.ApduParser(e.data);if(!e.data)return(0,t.CommandResultFactory)({error:new t.InvalidStatusWordError("Failed to extract address from response")});const o=s.encodeToString(e.data.data);return(0,t.CommandResultFactory)({data:{address:o}})}}0&&(module.exports={BtcCommandUtils});
2
2
  //# sourceMappingURL=BtcCommandUtils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/utils/BtcCommandUtils.ts"],
4
- "sourcesContent": ["import {\n ApduParser,\n type ApduResponse,\n type CommandResult,\n CommandResultFactory,\n type CommandSuccessResult,\n CommandUtils as DmkCommandUtils,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport { type BtcErrorCodes } from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { SW_INTERRUPTED_EXECUTION } from \"@internal/app-binder/command/utils/constants\";\n\nconst R_LENGTH = 32;\nconst S_LENGTH = 32;\n\nexport class BtcCommandUtils {\n static isContinueResponse(response: ApduResponse) {\n return (\n response.statusCode[0] === SW_INTERRUPTED_EXECUTION[0] &&\n response.statusCode[1] === SW_INTERRUPTED_EXECUTION[1]\n );\n }\n static isSuccessResponse(response: ApduResponse) {\n return (\n DmkCommandUtils.isSuccessResponse(response) ||\n BtcCommandUtils.isContinueResponse(response)\n );\n }\n\n static getSignature(\n result: CommandSuccessResult<ApduResponse>,\n ): CommandResult<Signature, BtcErrorCodes> {\n const parser = new ApduParser(result.data);\n\n const v = parser.extract8BitUInt();\n if (v === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"V is missing\"),\n });\n }\n\n const r = parser.encodeToHexaString(\n parser.extractFieldByLength(R_LENGTH),\n true,\n );\n if (!r) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"R is missing\"),\n });\n }\n\n const s = parser.encodeToHexaString(\n parser.extractFieldByLength(S_LENGTH),\n true,\n );\n if (!s) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"S is missing\"),\n });\n }\n\n return CommandResultFactory({\n data: {\n v,\n r,\n s,\n },\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CAIPC,EAAyC,wDAEzC,MAAMC,EAAW,GACXC,EAAW,GAEV,MAAML,CAAgB,CAC3B,OAAO,mBAAmBM,EAAwB,CAChD,OACEA,EAAS,WAAW,CAAC,IAAM,2BAAyB,CAAC,GACrDA,EAAS,WAAW,CAAC,IAAM,2BAAyB,CAAC,CAEzD,CACA,OAAO,kBAAkBA,EAAwB,CAC/C,OACE,EAAAC,aAAgB,kBAAkBD,CAAQ,GAC1CN,EAAgB,mBAAmBM,CAAQ,CAE/C,CAEA,OAAO,aACLE,EACyC,CACzC,MAAMC,EAAS,IAAI,aAAWD,EAAO,IAAI,EAEnCE,EAAID,EAAO,gBAAgB,EACjC,GAAIC,IAAM,OACR,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,cAAc,CAClD,CAAC,EAGH,MAAM,EAAID,EAAO,mBACfA,EAAO,qBAAqBL,CAAQ,EACpC,EACF,EACA,GAAI,CAAC,EACH,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,cAAc,CAClD,CAAC,EAGH,MAAMO,EAAIF,EAAO,mBACfA,EAAO,qBAAqBJ,CAAQ,EACpC,EACF,EACA,OAAKM,KAME,wBAAqB,CAC1B,KAAM,CACJ,EAAAD,EACA,EACA,EAAAC,CACF,CACF,CAAC,KAXQ,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,cAAc,CAClD,CAAC,CAUL,CACF",
6
- "names": ["BtcCommandUtils_exports", "__export", "BtcCommandUtils", "__toCommonJS", "import_device_management_kit", "import_constants", "R_LENGTH", "S_LENGTH", "response", "DmkCommandUtils", "result", "parser", "v", "s"]
4
+ "sourcesContent": ["import {\n ApduParser,\n type ApduResponse,\n type CommandResult,\n CommandResultFactory,\n type CommandSuccessResult,\n CommandUtils as DmkCommandUtils,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport { type WalletAddress } from \"@api/model/Wallet\";\nimport { type BtcErrorCodes } from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { SW_INTERRUPTED_EXECUTION } from \"@internal/app-binder/command/utils/constants\";\n\nconst R_LENGTH = 32;\nconst S_LENGTH = 32;\n\nexport class BtcCommandUtils {\n static isContinueResponse(response: ApduResponse) {\n return (\n response.statusCode[0] === SW_INTERRUPTED_EXECUTION[0] &&\n response.statusCode[1] === SW_INTERRUPTED_EXECUTION[1]\n );\n }\n static isSuccessResponse(response: ApduResponse) {\n return (\n DmkCommandUtils.isSuccessResponse(response) ||\n BtcCommandUtils.isContinueResponse(response)\n );\n }\n\n static getSignature(\n result: CommandSuccessResult<ApduResponse>,\n ): CommandResult<Signature, BtcErrorCodes> {\n const parser = new ApduParser(result.data);\n\n const v = parser.extract8BitUInt();\n if (v === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"V is missing\"),\n });\n }\n\n const r = parser.encodeToHexaString(\n parser.extractFieldByLength(R_LENGTH),\n true,\n );\n if (!r) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"R is missing\"),\n });\n }\n\n const s = parser.encodeToHexaString(\n parser.extractFieldByLength(S_LENGTH),\n true,\n );\n if (!s) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"S is missing\"),\n });\n }\n\n return CommandResultFactory({\n data: {\n v,\n r,\n s,\n },\n });\n }\n\n static getAddress(\n response: CommandSuccessResult<ApduResponse>,\n ): CommandResult<WalletAddress, BtcErrorCodes> {\n const parser = new ApduParser(response.data);\n if (!response.data) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n \"Failed to extract address from response\",\n ),\n });\n }\n\n const address = parser.encodeToString(response.data.data);\n return CommandResultFactory({\n data: {\n address,\n },\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CAKPC,EAAyC,wDAEzC,MAAMC,EAAW,GACXC,EAAW,GAEV,MAAML,CAAgB,CAC3B,OAAO,mBAAmBM,EAAwB,CAChD,OACEA,EAAS,WAAW,CAAC,IAAM,2BAAyB,CAAC,GACrDA,EAAS,WAAW,CAAC,IAAM,2BAAyB,CAAC,CAEzD,CACA,OAAO,kBAAkBA,EAAwB,CAC/C,OACE,EAAAC,aAAgB,kBAAkBD,CAAQ,GAC1CN,EAAgB,mBAAmBM,CAAQ,CAE/C,CAEA,OAAO,aACLE,EACyC,CACzC,MAAMC,EAAS,IAAI,aAAWD,EAAO,IAAI,EAEnCE,EAAID,EAAO,gBAAgB,EACjC,GAAIC,IAAM,OACR,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,cAAc,CAClD,CAAC,EAGH,MAAM,EAAID,EAAO,mBACfA,EAAO,qBAAqBL,CAAQ,EACpC,EACF,EACA,GAAI,CAAC,EACH,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,cAAc,CAClD,CAAC,EAGH,MAAMO,EAAIF,EAAO,mBACfA,EAAO,qBAAqBJ,CAAQ,EACpC,EACF,EACA,OAAKM,KAME,wBAAqB,CAC1B,KAAM,CACJ,EAAAD,EACA,EACA,EAAAC,CACF,CACF,CAAC,KAXQ,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,cAAc,CAClD,CAAC,CAUL,CAEA,OAAO,WACLL,EAC6C,CAC7C,MAAMG,EAAS,IAAI,aAAWH,EAAS,IAAI,EAC3C,GAAI,CAACA,EAAS,KACZ,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,yCACF,CACF,CAAC,EAGH,MAAMM,EAAUH,EAAO,eAAeH,EAAS,KAAK,IAAI,EACxD,SAAO,wBAAqB,CAC1B,KAAM,CACJ,QAAAM,CACF,CACF,CAAC,CACH,CACF",
6
+ "names": ["BtcCommandUtils_exports", "__export", "BtcCommandUtils", "__toCommonJS", "import_device_management_kit", "import_constants", "R_LENGTH", "S_LENGTH", "response", "DmkCommandUtils", "result", "parser", "v", "s", "address"]
7
7
  }
@@ -42,7 +42,7 @@
42
42
  "inversify-logger-middleware": "^3.1.0",
43
43
  "purify-ts": "^2.1.0",
44
44
  "reflect-metadata": "^0.2.2",
45
- "xstate": "^5.19.1"
45
+ "xstate": "^5.19.2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@ledgerhq/device-management-kit": "workspace:*",
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=GetWalletAddressDeviceActionTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- import{SignerBtcBuilder as t}from"./SignerBtcBuilder";export*from"./app-binder/GetExtendedPublicKeyDeviceActionTypes";export*from"./app-binder/SignPsbtDeviceActionTypes";export*from"./app-binder/SignTransactionDeviceActionTypes";import{DefaultDescriptorTemplate as g,DefaultWallet as s}from"./model/Wallet";export*from"./SignerBtc";export*from"./SignerBtcBuilder";export{g as DefaultDescriptorTemplate,s as DefaultWallet,t as SignerBtcBuilder};
1
+ import{SignerBtcBuilder as e}from"./SignerBtcBuilder";export*from"./app-binder/GetExtendedPublicKeyDeviceActionTypes";export*from"./app-binder/GetWalletAddressDeviceActionTypes";export*from"./app-binder/SignMessageDeviceActionTypes";export*from"./app-binder/SignPsbtDeviceActionTypes";export*from"./app-binder/SignTransactionDeviceActionTypes";import{DefaultDescriptorTemplate as a,DefaultWallet as i}from"./model/Wallet";export*from"./SignerBtc";export*from"./SignerBtcBuilder";export{a as DefaultDescriptorTemplate,i as DefaultWallet,e as SignerBtcBuilder};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/index.ts"],
4
- "sourcesContent": ["export { type SignerBtc } from \"./SignerBtc\";\nexport { SignerBtcBuilder } from \"./SignerBtcBuilder\";\nexport * from \"@api/app-binder/GetExtendedPublicKeyDeviceActionTypes\";\nexport type {\n SignMessageDAError,\n SignMessageDAInput,\n SignMessageDAIntermediateValue,\n SignMessageDAOutput,\n SignMessageDAState,\n} from \"@api/app-binder/SignMessageDeviceActionTypes\";\nexport * from \"@api/app-binder/SignPsbtDeviceActionTypes\";\nexport * from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nexport { DefaultDescriptorTemplate, DefaultWallet } from \"@api/model/Wallet\";\nexport * from \"@api/SignerBtc\";\nexport * from \"@api/SignerBtcBuilder\";\n"],
5
- "mappings": "AACA,OAAS,oBAAAA,MAAwB,qBACjC,WAAc,wDAQd,WAAc,4CACd,WAAc,mDACd,OAAS,6BAAAC,EAA2B,iBAAAC,MAAqB,oBACzD,WAAc,iBACd,WAAc",
4
+ "sourcesContent": ["export { type SignerBtc } from \"./SignerBtc\";\nexport { SignerBtcBuilder } from \"./SignerBtcBuilder\";\nexport * from \"@api/app-binder/GetExtendedPublicKeyDeviceActionTypes\";\nexport * from \"@api/app-binder/GetWalletAddressDeviceActionTypes\";\nexport * from \"@api/app-binder/SignMessageDeviceActionTypes\";\nexport * from \"@api/app-binder/SignPsbtDeviceActionTypes\";\nexport * from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nexport { DefaultDescriptorTemplate, DefaultWallet } from \"@api/model/Wallet\";\nexport * from \"@api/SignerBtc\";\nexport * from \"@api/SignerBtcBuilder\";\n"],
5
+ "mappings": "AACA,OAAS,oBAAAA,MAAwB,qBACjC,WAAc,wDACd,WAAc,oDACd,WAAc,+CACd,WAAc,4CACd,WAAc,mDACd,OAAS,6BAAAC,EAA2B,iBAAAC,MAAqB,oBACzD,WAAc,iBACd,WAAc",
6
6
  "names": ["SignerBtcBuilder", "DefaultDescriptorTemplate", "DefaultWallet"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var s=(t=>(t.LEGACY="pkh(@0/**)",t.NESTED_SEGWIT="sh(wpkh(@0/**))",t.NATIVE_SEGWIT="wpkh(@0/**)",t.TAPROOT="tr(@0/**)",t))(s||{});class c{constructor(e,r){this.derivationPath=e;this.template=r}}class p{constructor(e,r,i,t){this.name=e;this.descriptorTemplate=r;this.keys=i;this.hmac=t}}class n{constructor(e,r,i){this.name=e;this.descriptorTemplate=r;this.keys=i}}export{s as DefaultDescriptorTemplate,c as DefaultWallet,p as RegisteredWallet,n as WalletPolicy};
1
+ var i=(t=>(t.LEGACY="pkh(@0/**)",t.NESTED_SEGWIT="sh(wpkh(@0/**))",t.NATIVE_SEGWIT="wpkh(@0/**)",t.TAPROOT="tr(@0/**)",t))(i||{});class c{constructor(l,r){this.derivationPath=l;this.template=r}}class p{constructor(l,r,s,t){this.name=l;this.descriptorTemplate=r;this.keys=s;this.hmac=t}}class a{constructor(l,r,s){this.name=l;this.descriptorTemplate=r;this.keys=s}}export{i as DefaultDescriptorTemplate,c as DefaultWallet,p as RegisteredWallet,a as WalletPolicy};
2
2
  //# sourceMappingURL=Wallet.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/model/Wallet.ts"],
4
- "sourcesContent": ["export enum DefaultDescriptorTemplate {\n LEGACY = \"pkh(@0/**)\",\n NESTED_SEGWIT = \"sh(wpkh(@0/**))\",\n NATIVE_SEGWIT = \"wpkh(@0/**)\",\n TAPROOT = \"tr(@0/**)\",\n}\n\n/**\n * Default wallets that can be used without registration in the device.\n */\nexport class DefaultWallet {\n constructor(\n // Derivation path without master key respresentation.\n // Format example: /44'/0'/0'\n public derivationPath: string,\n public template: DefaultDescriptorTemplate,\n ) {}\n}\n\n/**\n * Custom wallet registered in the device.\n * It must be stored on client side after registration for further usages.\n */\nexport class RegisteredWallet {\n constructor(\n public name: string,\n public descriptorTemplate: string,\n public keys: string[],\n public hmac: Uint8Array,\n ) {}\n}\n\n/**\n * The Bitcon hardware app uses a descriptors-like thing to describe\n * how to construct output scripts from keys. A \"Wallet Policy\" consists\n * of a \"Descriptor Template\" and a list of \"keys\". A key is basically\n * a serialized BIP32 extended public key with some added derivation path\n * information. This is documented at\n * https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/wallet.md\n */\nexport class WalletPolicy {\n constructor(\n public name: string,\n public descriptorTemplate: string,\n public keys: string[],\n ) {}\n}\n\nexport type Wallet = DefaultWallet | RegisteredWallet;\n"],
4
+ "sourcesContent": ["export enum DefaultDescriptorTemplate {\n LEGACY = \"pkh(@0/**)\",\n NESTED_SEGWIT = \"sh(wpkh(@0/**))\",\n NATIVE_SEGWIT = \"wpkh(@0/**)\",\n TAPROOT = \"tr(@0/**)\",\n}\n\n/**\n * Default wallets that can be used without registration in the device.\n */\nexport class DefaultWallet {\n constructor(\n // Derivation path without master key respresentation.\n // Format example: /44'/0'/0'\n public derivationPath: string,\n public template: DefaultDescriptorTemplate,\n ) {}\n}\n\n/**\n * Custom wallet registered in the device.\n * It must be stored on client side after registration for further usages.\n */\nexport class RegisteredWallet {\n constructor(\n public name: string,\n public descriptorTemplate: string,\n public keys: string[],\n public hmac: Uint8Array,\n ) {}\n}\n\n/**\n * The Bitcon hardware app uses a descriptors-like thing to describe\n * how to construct output scripts from keys. A \"Wallet Policy\" consists\n * of a \"Descriptor Template\" and a list of \"keys\". A key is basically\n * a serialized BIP32 extended public key with some added derivation path\n * information. This is documented at\n * https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/wallet.md\n */\nexport class WalletPolicy {\n constructor(\n public name: string,\n public descriptorTemplate: string,\n public keys: string[],\n ) {}\n}\n\nexport type Wallet = DefaultWallet | RegisteredWallet;\n\nexport type WalletAddress = {\n address: string;\n};\n"],
5
5
  "mappings": "AAAO,IAAKA,OACVA,EAAA,OAAS,aACTA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,cAChBA,EAAA,QAAU,YAJAA,OAAA,IAUL,MAAMC,CAAc,CACzB,YAGSC,EACAC,EACP,CAFO,oBAAAD,EACA,cAAAC,CACN,CACL,CAMO,MAAMC,CAAiB,CAC5B,YACSC,EACAC,EACAC,EACAC,EACP,CAJO,UAAAH,EACA,wBAAAC,EACA,UAAAC,EACA,UAAAC,CACN,CACL,CAUO,MAAMC,CAAa,CACxB,YACSJ,EACAC,EACAC,EACP,CAHO,UAAAF,EACA,wBAAAC,EACA,UAAAC,CACN,CACL",
6
6
  "names": ["DefaultDescriptorTemplate", "DefaultWallet", "derivationPath", "template", "RegisteredWallet", "name", "descriptorTemplate", "keys", "hmac", "WalletPolicy"]
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=WalletAddressOptions.js.map