@ledgerhq/device-signer-kit-bitcoin 1.3.0 → 1.3.1
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.
- package/lib/cjs/internal/app-binder/BtcAppBinder.js +1 -1
- package/lib/cjs/internal/app-binder/BtcAppBinder.js.map +3 -3
- package/lib/cjs/internal/app-binder/BtcAppBinder.test.js +1 -1
- package/lib/cjs/internal/app-binder/BtcAppBinder.test.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ContinueCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/ContinueCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/ContinueCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/ContinueCommand.test.js.map +1 -1
- package/lib/cjs/internal/app-binder/command/GetExtendedPublicKeyCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetExtendedPublicKeyCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js.map +1 -1
- package/lib/cjs/internal/app-binder/command/GetMasterFingerprintCommand.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetMasterFingerprintCommand.js.map +3 -3
- package/lib/cjs/internal/app-binder/command/GetMasterFingerprintCommand.test.js +1 -1
- package/lib/cjs/internal/app-binder/command/GetMasterFingerprintCommand.test.js.map +1 -1
- package/lib/cjs/internal/app-binder/constants.js +2 -0
- package/lib/cjs/internal/app-binder/constants.js.map +7 -0
- package/lib/cjs/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js +1 -1
- package/lib/cjs/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js.map +3 -3
- package/lib/cjs/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.js +1 -1
- package/lib/cjs/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.js.map +3 -3
- package/lib/cjs/package.json +1 -1
- package/lib/esm/internal/app-binder/BtcAppBinder.js +1 -1
- package/lib/esm/internal/app-binder/BtcAppBinder.js.map +3 -3
- package/lib/esm/internal/app-binder/BtcAppBinder.test.js +1 -1
- package/lib/esm/internal/app-binder/BtcAppBinder.test.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ContinueCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/ContinueCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/ContinueCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/ContinueCommand.test.js.map +1 -1
- package/lib/esm/internal/app-binder/command/GetExtendedPublicKeyCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/GetExtendedPublicKeyCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/GetExtendedPublicKeyCommand.test.js.map +1 -1
- package/lib/esm/internal/app-binder/command/GetMasterFingerprintCommand.js +1 -1
- package/lib/esm/internal/app-binder/command/GetMasterFingerprintCommand.js.map +3 -3
- package/lib/esm/internal/app-binder/command/GetMasterFingerprintCommand.test.js +1 -1
- package/lib/esm/internal/app-binder/command/GetMasterFingerprintCommand.test.js.map +1 -1
- package/lib/esm/internal/app-binder/constants.js +2 -0
- package/lib/esm/internal/app-binder/constants.js.map +7 -0
- package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js +1 -1
- package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js.map +3 -3
- package/lib/esm/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.js +1 -1
- package/lib/esm/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.js.map +3 -3
- package/lib/esm/package.json +1 -1
- package/lib/types/internal/app-binder/BtcAppBinder.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/ContinueCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/GetExtendedPublicKeyCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/command/GetMasterFingerprintCommand.d.ts.map +1 -1
- package/lib/types/internal/app-binder/constants.d.ts +2 -0
- package/lib/types/internal/app-binder/constants.d.ts.map +1 -0
- package/lib/types/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.d.ts.map +1 -1
- package/lib/types/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts"],
|
|
4
|
-
"sourcesContent": ["// https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#get_extended_pubkey\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport {\n CommandErrorHelper,\n DerivationPathUtils,\n} from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n type BtcErrorCodes,\n} from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\n\nexport type GetExtendedPublicKeyCommandArgs = {\n checkOnDevice: boolean;\n derivationPath: string;\n};\n\nexport type GetExtendedPublicKeyCommandResponse = {\n extendedPublicKey: string;\n};\n\nexport class GetExtendedPublicKeyCommand\n implements\n Command<\n GetExtendedPublicKeyCommandResponse,\n GetExtendedPublicKeyCommandArgs,\n BtcErrorCodes\n >\n{\n readonly name = \"getExtendedPublicKey\";\n constructor(\n private readonly _args: GetExtendedPublicKeyCommandArgs,\n private readonly _errorHelper = new CommandErrorHelper<\n GetExtendedPublicKeyCommandResponse,\n BtcErrorCodes\n >(\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n BtcCommandUtils.isSuccessResponse,\n ),\n ) {}\n\n getApdu(): Apdu {\n const { checkOnDevice, derivationPath } = this._args;\n\n const getExtendedPublicKeyArgs: ApduBuilderArgs = {\n cla: 0xe1,\n ins: 0x00,\n p1: 0x00,\n p2:
|
|
5
|
-
"mappings": "AACA,OAEE,eAAAA,EAEA,cAAAC,EAIA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OACE,sBAAAC,EACA,uBAAAC,MACK,yBACP,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,sDACP,OAAS,mBAAAC,MAAuB,kCAWzB,MAAMC,CAOb,CAEE,YACmBC,EACAC,EAAe,
|
|
6
|
-
"names": ["ApduBuilder", "ApduParser", "CommandResultFactory", "InvalidStatusWordError", "CommandErrorHelper", "DerivationPathUtils", "Maybe", "BTC_APP_ERRORS", "BtcAppCommandErrorFactory", "BtcCommandUtils", "GetExtendedPublicKeyCommand", "_args", "_errorHelper", "checkOnDevice", "derivationPath", "getExtendedPublicKeyArgs", "builder", "path", "element", "response", "parser", "length", "extendedPublicKey"]
|
|
4
|
+
"sourcesContent": ["// https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#get_extended_pubkey\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n ApduParser,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n InvalidStatusWordError,\n} from \"@ledgerhq/device-management-kit\";\nimport {\n CommandErrorHelper,\n DerivationPathUtils,\n} from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n type BtcErrorCodes,\n} from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { PROTOCOL_VERSION } from \"@internal/app-binder/command/utils/constants\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\n\nexport type GetExtendedPublicKeyCommandArgs = {\n checkOnDevice: boolean;\n derivationPath: string;\n};\n\nexport type GetExtendedPublicKeyCommandResponse = {\n extendedPublicKey: string;\n};\n\nexport class GetExtendedPublicKeyCommand\n implements\n Command<\n GetExtendedPublicKeyCommandResponse,\n GetExtendedPublicKeyCommandArgs,\n BtcErrorCodes\n >\n{\n readonly name = \"getExtendedPublicKey\";\n constructor(\n private readonly _args: GetExtendedPublicKeyCommandArgs,\n private readonly _errorHelper = new CommandErrorHelper<\n GetExtendedPublicKeyCommandResponse,\n BtcErrorCodes\n >(\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n BtcCommandUtils.isSuccessResponse,\n ),\n ) {}\n\n getApdu(): Apdu {\n const { checkOnDevice, derivationPath } = this._args;\n\n const getExtendedPublicKeyArgs: ApduBuilderArgs = {\n cla: 0xe1,\n ins: 0x00,\n p1: 0x00,\n p2: PROTOCOL_VERSION,\n };\n const builder = new ApduBuilder(getExtendedPublicKeyArgs).add8BitUIntToData(\n checkOnDevice ? 0x01 : 0x00,\n );\n\n const path = DerivationPathUtils.splitPath(derivationPath);\n builder.add8BitUIntToData(path.length);\n path.forEach((element) => {\n builder.add32BitUIntToData(element);\n });\n\n return builder.build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<GetExtendedPublicKeyCommandResponse, BtcErrorCodes> {\n return Maybe.fromNullable(\n this._errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n const length = parser.getUnparsedRemainingLength();\n\n if (length <= 0) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Invalid response length\"),\n });\n }\n\n const extendedPublicKey = parser.encodeToString(\n parser.extractFieldByLength(length),\n );\n\n return CommandResultFactory({\n data: {\n extendedPublicKey,\n },\n });\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,OAEE,eAAAA,EAEA,cAAAC,EAIA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OACE,sBAAAC,EACA,uBAAAC,MACK,yBACP,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,sDACP,OAAS,oBAAAC,MAAwB,+CACjC,OAAS,mBAAAC,MAAuB,kCAWzB,MAAMC,CAOb,CAEE,YACmBC,EACAC,EAAe,IAAIT,EAIlCG,EACAC,EACAE,EAAgB,iBAClB,EACA,CATiB,WAAAE,EACA,kBAAAC,CAQhB,CAXM,KAAO,uBAahB,SAAgB,CACd,KAAM,CAAE,cAAAC,EAAe,eAAAC,CAAe,EAAI,KAAK,MAEzCC,EAA4C,CAChD,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAIP,CACN,EACMQ,EAAU,IAAIjB,EAAYgB,CAAwB,EAAE,kBACxDF,EAAgB,EAAO,CACzB,EAEMI,EAAOb,EAAoB,UAAUU,CAAc,EACzD,OAAAE,EAAQ,kBAAkBC,EAAK,MAAM,EACrCA,EAAK,QAASC,GAAY,CACxBF,EAAQ,mBAAmBE,CAAO,CACpC,CAAC,EAEMF,EAAQ,MAAM,CACvB,CAEA,cACEG,EACmE,CACnE,OAAOd,EAAM,aACX,KAAK,aAAa,SAASc,CAAQ,CACrC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAS,IAAIpB,EAAWmB,CAAQ,EAChCE,EAASD,EAAO,2BAA2B,EAEjD,GAAIC,GAAU,EACZ,OAAOpB,EAAqB,CAC1B,MAAO,IAAIC,EAAuB,yBAAyB,CAC7D,CAAC,EAGH,MAAMoB,EAAoBF,EAAO,eAC/BA,EAAO,qBAAqBC,CAAM,CACpC,EAEA,OAAOpB,EAAqB,CAC1B,KAAM,CACJ,kBAAAqB,CACF,CACF,CAAC,CACH,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["ApduBuilder", "ApduParser", "CommandResultFactory", "InvalidStatusWordError", "CommandErrorHelper", "DerivationPathUtils", "Maybe", "BTC_APP_ERRORS", "BtcAppCommandErrorFactory", "PROTOCOL_VERSION", "BtcCommandUtils", "GetExtendedPublicKeyCommand", "_args", "_errorHelper", "checkOnDevice", "derivationPath", "getExtendedPublicKeyArgs", "builder", "path", "element", "response", "parser", "length", "extendedPublicKey"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ApduResponse as o,CommandResultFactory as a,InvalidStatusWordError as s}from"@ledgerhq/device-management-kit";import{BTC_APP_ERRORS as d,BtcAppCommandErrorFactory as c}from"../../app-binder/command/utils/bitcoinAppErrors";import{GetExtendedPublicKeyCommand as r}from"./GetExtendedPublicKeyCommand";const u=new Uint8Array([225,0,0,
|
|
1
|
+
import{ApduResponse as o,CommandResultFactory as a,InvalidStatusWordError as s}from"@ledgerhq/device-management-kit";import{BTC_APP_ERRORS as d,BtcAppCommandErrorFactory as c}from"../../app-binder/command/utils/bitcoinAppErrors";import{GetExtendedPublicKeyCommand as r}from"./GetExtendedPublicKeyCommand";const u=new Uint8Array([225,0,0,1,14,1,3,128,0,0,84,128,0,0,0,128,0,0,0]),i=new Uint8Array([225,0,0,1,14,0,3,128,0,0,84,128,0,0,0,128,0,0,0]),p=new Uint8Array([225,0,0,1,18,1,4,128,0,0,49,128,0,0,0,128,0,0,0,0,0,0,0]),E=new Uint8Array([120,112,117,98,54,68,57,80,112,52,114,70,118,119,84,71,120,56,56,89,68,52,67,68,97,49,110,66,69,112,99,75,69,90,84,67,78,70,122,67,70,55,103,86,80,122,54,84,104,57,66,97,86,104,104,80,74,68,117,103,57,89,89,70,80,89,109,107,83,72,76,102,82,49,86,81,89,106,53,106,97,121,113,119,83,89,65,82,110,117,66,74,105,80,83,68,97,98,121,121,84,105,67,68,55,66,51,99,106,80,113]);describe("GetExtendedPublicKeyCommand",()=>{let x;const t={checkOnDevice:!0,derivationPath:"84'/0'/0'"};beforeEach(()=>{}),describe("name",()=>{it("should be 'getExtendedPublicKey'",()=>{x=new r(t),expect(x.name).toBe("getExtendedPublicKey")})}),describe("getApdu",()=>{it("should return the correct APDU",()=>{x=new r(t);const e=x.getApdu();expect(e.getRawApdu()).toEqual(u)}),it("should return the correct APDU without checkOnDevice",()=>{x=new r({...t,checkOnDevice:!1});const e=x.getApdu();expect(e.getRawApdu()).toEqual(i)}),it("should return the correct APDU with different derivation path",()=>{x=new r({...t,derivationPath:"49'/0'/0'/0"});const e=x.getApdu();expect(e.getRawApdu()).toEqual(p)})}),describe("parseResponse",()=>{it("should return the extended public key",()=>{x=new r(t);const e=new o({data:E,statusCode:new Uint8Array([144,0])}),n=x.parseResponse(e);expect(n).toEqual(a({data:{extendedPublicKey:"xpub6D9Pp4rFvwTGx88YD4CDa1nBEpcKEZTCNFzCF7gVPz6Th9BaVhhPJDug9YYFPYmkSHLfR1VQYj5jayqwSYARnuBJiPSDabyyTiCD7B3cjPq"}}))}),it("should return an error if the response is not successful",()=>{x=new r(t);const e=new o({statusCode:Uint8Array.from([109,0]),data:new Uint8Array(0)}),n=x.parseResponse(e);expect(n).toStrictEqual(a({error:c({...d["6d00"],errorCode:"6d00"})}))}),it("should return an error if the response is too short",()=>{x=new r(t);const e=new o({data:Uint8Array.from([]),statusCode:new Uint8Array([144,0])}),n=x.parseResponse(e);expect(n).toStrictEqual(a({error:new s("Invalid response length")}))})})});
|
|
2
2
|
//# sourceMappingURL=GetExtendedPublicKeyCommand.test.js.map
|
|
@@ -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,
|
|
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, 0x01, 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, 0x01, 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, 0x01, 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(\"name\", () => {\n it(\"should be 'getExtendedPublicKey'\", () => {\n command = new GetExtendedPublicKeyCommand(defaultArgs);\n expect(command.name).toBe(\"getExtendedPublicKey\");\n });\n });\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
5
|
"mappings": "AAAA,OACE,gBAAAA,EACA,wBAAAC,EACA,0BAAAC,MACK,kCAEP,OACE,kBAAA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,EAA4BM,CAAW,EACrD,MAAME,EAAW,IAAIb,EAAa,CAChC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,WAAW,CAAC,CACxB,CAAC,EAGKc,EAASJ,EAAQ,cAAcG,CAAQ,EAG7C,OAAOC,CAAM,EAAE,cACbb,EAAqB,CACnB,MAAOG,EAA0B,CAC/B,GAAGD,EAAe,MAAM,EACxB,UAAW,MACb,CAAC,CACH,CAAC,CACH,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9DO,EAAU,IAAIL,EAA4BM,CAAW,EACrD,MAAME,EAAW,IAAIb,EAAa,CAChC,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,CACzC,CAAC,EAGKc,EAASJ,EAAQ,cAAcG,CAAQ,EAG7C,OAAOC,CAAM,EAAE,cACbb,EAAqB,CACnB,MAAO,IAAIC,EAAuB,yBAAyB,CAC7D,CAAC,CACH,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
6
|
"names": ["ApduResponse", "CommandResultFactory", "InvalidStatusWordError", "BTC_APP_ERRORS", "BtcAppCommandErrorFactory", "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
|
-
import{ApduBuilder as n,ApduParser as o,CommandResultFactory as t,InvalidStatusWordError as s}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as p}from"@ledgerhq/signer-utils";import{Maybe as a}from"purify-ts";import{BTC_APP_ERRORS as
|
|
1
|
+
import{ApduBuilder as n,ApduParser as o,CommandResultFactory as t,InvalidStatusWordError as s}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as p}from"@ledgerhq/signer-utils";import{Maybe as a}from"purify-ts";import{BTC_APP_ERRORS as m,BtcAppCommandErrorFactory as i}from"../../app-binder/command/utils/bitcoinAppErrors";import{PROTOCOL_VERSION as d}from"../../app-binder/command/utils/constants";import{BtcCommandUtils as u}from"../../utils/BtcCommandUtils";const l=4;class B{constructor(r=new p(m,i,u.isSuccessResponse)){this._errorHelper=r}name="getMasterFingerprint";getApdu(){const r={cla:225,ins:5,p1:0,p2:d};return new n(r).build()}parseResponse(r){return a.fromNullable(this._errorHelper.getError(r)).orDefaultLazy(()=>{const e=new o(r).extractFieldByLength(l);return e?t({data:{masterFingerprint:e}}):t({error:new s("Master fingerprint is missing")})})}}export{B as GetMasterFingerprintCommand};
|
|
2
2
|
//# sourceMappingURL=GetMasterFingerprintCommand.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/GetMasterFingerprintCommand.ts"],
|
|
4
|
-
"sourcesContent": ["// https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#get_master_fingerprint\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\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 {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n type BtcErrorCodes,\n} from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\n\nconst MASTER_FINGERPRINT_LENGTH = 4;\n\ntype GetMasterFingerprintCommandResponse = {\n masterFingerprint: Uint8Array;\n};\n\nexport class GetMasterFingerprintCommand\n implements Command<GetMasterFingerprintCommandResponse, void, BtcErrorCodes>\n{\n readonly name = \"getMasterFingerprint\";\n constructor(\n private readonly _errorHelper = new CommandErrorHelper<\n GetMasterFingerprintCommandResponse,\n BtcErrorCodes\n >(\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n BtcCommandUtils.isSuccessResponse,\n ),\n ) {}\n getApdu(): Apdu {\n const getMasterFingerprintArgs: ApduBuilderArgs = {\n cla: 0xe1,\n ins: 0x05,\n p1: 0x00,\n p2:
|
|
5
|
-
"mappings": "AACA,OAEE,eAAAA,EAEA,cAAAC,EAIA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,sDACP,OAAS,mBAAAC,MAAuB,kCAEhC,MAAMC,EAA4B,EAM3B,MAAMC,CAEb,CAEE,YACmBC,EAAe,
|
|
6
|
-
"names": ["ApduBuilder", "ApduParser", "CommandResultFactory", "InvalidStatusWordError", "CommandErrorHelper", "Maybe", "BTC_APP_ERRORS", "BtcAppCommandErrorFactory", "BtcCommandUtils", "MASTER_FINGERPRINT_LENGTH", "GetMasterFingerprintCommand", "_errorHelper", "getMasterFingerprintArgs", "response", "masterFingerprint"]
|
|
4
|
+
"sourcesContent": ["// https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#get_master_fingerprint\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\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 {\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n type BtcErrorCodes,\n} from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { PROTOCOL_VERSION } from \"@internal/app-binder/command/utils/constants\";\nimport { BtcCommandUtils } from \"@internal/utils/BtcCommandUtils\";\n\nconst MASTER_FINGERPRINT_LENGTH = 4;\n\ntype GetMasterFingerprintCommandResponse = {\n masterFingerprint: Uint8Array;\n};\n\nexport class GetMasterFingerprintCommand\n implements Command<GetMasterFingerprintCommandResponse, void, BtcErrorCodes>\n{\n readonly name = \"getMasterFingerprint\";\n constructor(\n private readonly _errorHelper = new CommandErrorHelper<\n GetMasterFingerprintCommandResponse,\n BtcErrorCodes\n >(\n BTC_APP_ERRORS,\n BtcAppCommandErrorFactory,\n BtcCommandUtils.isSuccessResponse,\n ),\n ) {}\n getApdu(): Apdu {\n const getMasterFingerprintArgs: ApduBuilderArgs = {\n cla: 0xe1,\n ins: 0x05,\n p1: 0x00,\n p2: PROTOCOL_VERSION,\n };\n return new ApduBuilder(getMasterFingerprintArgs).build();\n }\n\n parseResponse(\n response: ApduResponse,\n ): CommandResult<GetMasterFingerprintCommandResponse, BtcErrorCodes> {\n return Maybe.fromNullable(\n this._errorHelper.getError(response),\n ).orDefaultLazy(() => {\n const parser = new ApduParser(response);\n\n const masterFingerprint = parser.extractFieldByLength(\n MASTER_FINGERPRINT_LENGTH,\n );\n if (!masterFingerprint) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Master fingerprint is missing\"),\n });\n }\n\n return CommandResultFactory({\n data: {\n masterFingerprint,\n },\n });\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,OAEE,eAAAA,EAEA,cAAAC,EAIA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,sDACP,OAAS,oBAAAC,MAAwB,+CACjC,OAAS,mBAAAC,MAAuB,kCAEhC,MAAMC,EAA4B,EAM3B,MAAMC,CAEb,CAEE,YACmBC,EAAe,IAAIR,EAIlCE,EACAC,EACAE,EAAgB,iBAClB,EACA,CARiB,kBAAAG,CAQhB,CAVM,KAAO,uBAWhB,SAAgB,CACd,MAAMC,EAA4C,CAChD,IAAK,IACL,IAAK,EACL,GAAI,EACJ,GAAIL,CACN,EACA,OAAO,IAAIR,EAAYa,CAAwB,EAAE,MAAM,CACzD,CAEA,cACEC,EACmE,CACnE,OAAOT,EAAM,aACX,KAAK,aAAa,SAASS,CAAQ,CACrC,EAAE,cAAc,IAAM,CAGpB,MAAMC,EAFS,IAAId,EAAWa,CAAQ,EAEL,qBAC/BJ,CACF,EACA,OAAKK,EAMEb,EAAqB,CAC1B,KAAM,CACJ,kBAAAa,CACF,CACF,CAAC,EATQb,EAAqB,CAC1B,MAAO,IAAIC,EAAuB,+BAA+B,CACnE,CAAC,CAQL,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["ApduBuilder", "ApduParser", "CommandResultFactory", "InvalidStatusWordError", "CommandErrorHelper", "Maybe", "BTC_APP_ERRORS", "BtcAppCommandErrorFactory", "PROTOCOL_VERSION", "BtcCommandUtils", "MASTER_FINGERPRINT_LENGTH", "GetMasterFingerprintCommand", "_errorHelper", "getMasterFingerprintArgs", "response", "masterFingerprint"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ApduResponse as s,CommandResultFactory as a,isSuccessCommandResult as n}from"@ledgerhq/device-management-kit";import{InvalidStatusWordError as i}from"@ledgerhq/device-management-kit";import{GetMasterFingerprintCommand as p}from"./GetMasterFingerprintCommand";const c=new Uint8Array([225,5,0,
|
|
1
|
+
import{ApduResponse as s,CommandResultFactory as a,isSuccessCommandResult as n}from"@ledgerhq/device-management-kit";import{InvalidStatusWordError as i}from"@ledgerhq/device-management-kit";import{GetMasterFingerprintCommand as p}from"./GetMasterFingerprintCommand";const c=new Uint8Array([225,5,0,1,0]),o=new Uint8Array([130,141,194,243]);describe("GetMasterFingerprintCommand",()=>{let t;beforeEach(()=>{t=new p}),describe("name",()=>{it("should be 'getMasterFingerprint'",()=>{expect(t.name).toBe("getMasterFingerprint")})}),describe("getApdu",()=>{it("returns the correct APDU",()=>{const e=t.getApdu();expect(e.getRawApdu()).toEqual(c)})}),describe("parseResponse",()=>{it("should return the master fingerprint",()=>{const e=new s({data:o,statusCode:new Uint8Array([144,0])}),r=t.parseResponse(e);expect(r).toEqual(a({data:{masterFingerprint:Uint8Array.from([130,141,194,243])}}))}),it("should return an error if the response is not successful",()=>{const e=new s({statusCode:Uint8Array.from([109,0]),data:new Uint8Array(0)}),r=t.parseResponse(e);expect(n(r)).toBe(!1)}),it("should return an error if the response is too short",()=>{const e=new s({data:o.slice(0,2),statusCode:new Uint8Array([144,0])}),r=t.parseResponse(e);n(r)?assert.fail("Expected an error, but the result was successful"):expect(r.error).toEqual(new i("Master fingerprint is missing"))})})});
|
|
2
2
|
//# sourceMappingURL=GetMasterFingerprintCommand.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/app-binder/command/GetMasterFingerprintCommand.test.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { InvalidStatusWordError } from \"@ledgerhq/device-management-kit\";\n\nimport { GetMasterFingerprintCommand } from \"./GetMasterFingerprintCommand\";\n\nconst GET_MASTER_FINGERPRINT_APDU = new Uint8Array([\n 0xe1, 0x05, 0x00,
|
|
4
|
+
"sourcesContent": ["import {\n ApduResponse,\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\nimport { InvalidStatusWordError } from \"@ledgerhq/device-management-kit\";\n\nimport { GetMasterFingerprintCommand } from \"./GetMasterFingerprintCommand\";\n\nconst GET_MASTER_FINGERPRINT_APDU = new Uint8Array([\n 0xe1, 0x05, 0x00, 0x01, 0x00,\n]);\n\nconst GET_MASTER_FINGERPRINT_RESPONSE = new Uint8Array([\n 0x82, 0x8d, 0xc2, 0xf3,\n]);\n\ndescribe(\"GetMasterFingerprintCommand\", () => {\n let command: GetMasterFingerprintCommand;\n\n beforeEach(() => {\n command = new GetMasterFingerprintCommand();\n });\n\n describe(\"name\", () => {\n it(\"should be 'getMasterFingerprint'\", () => {\n expect(command.name).toBe(\"getMasterFingerprint\");\n });\n });\n\n describe(\"getApdu\", () => {\n it(\"returns the correct APDU\", () => {\n // WHEN\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toEqual(GET_MASTER_FINGERPRINT_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return the master fingerprint\", () => {\n // GIVEN\n const response = new ApduResponse({\n data: GET_MASTER_FINGERPRINT_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 masterFingerprint: Uint8Array.from([0x82, 0x8d, 0xc2, 0xf3]),\n },\n }),\n );\n });\n\n it(\"should return an error if the response is not successful\", () => {\n // GIVEN\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(isSuccessCommandResult(result)).toBe(false);\n });\n\n it(\"should return an error if the response is too short\", () => {\n // GIVEN\n const response = new ApduResponse({\n data: GET_MASTER_FINGERPRINT_RESPONSE.slice(0, 2),\n statusCode: new Uint8Array([0x90, 0x00]),\n });\n\n // WHEN\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n expect(result.error).toEqual(\n new InvalidStatusWordError(\"Master fingerprint is missing\"),\n );\n } else {\n assert.fail(\"Expected an error, but the result was successful\");\n }\n });\n });\n});\n"],
|
|
5
5
|
"mappings": "AAAA,OACE,gBAAAA,EACA,wBAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,0BAAAC,MAA8B,kCAEvC,OAAS,+BAAAC,MAAmC,gCAE5C,MAAMC,EAA8B,IAAI,W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AC,EAGKI,EAASH,EAAQ,cAAcE,CAAQ,EAGxCP,EAAuBQ,CAAM,EAKhC,OAAO,KAAK,kDAAkD,EAJ9D,OAAOA,EAAO,KAAK,EAAE,QACnB,IAAIP,EAAuB,+BAA+B,CAC5D,CAIJ,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
6
|
"names": ["ApduResponse", "CommandResultFactory", "isSuccessCommandResult", "InvalidStatusWordError", "GetMasterFingerprintCommand", "GET_MASTER_FINGERPRINT_APDU", "GET_MASTER_FINGERPRINT_RESPONSE", "command", "apdu", "response", "result"]
|
|
7
7
|
}
|
package/lib/esm/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isSuccessCommandResult as d,OpenAppDeviceAction as
|
|
1
|
+
import{isSuccessCommandResult as d,OpenAppDeviceAction as m,UnknownDAError as D,UserInteractionRequired as a,XStateDeviceAction as y}from"@ledgerhq/device-management-kit";import{Left as E,Right as w}from"purify-ts";import{assign as r,fromPromise as p,setup as I}from"xstate";import{getWalletAddressDAStateSteps as l}from"../../../../api/app-binder/GetWalletAddressDeviceActionTypes";import{APP_NAME as c}from"../../../app-binder/constants";import{GetWalletAddressTask as P}from"../../../app-binder/task/GetWalletAddressTask";import{PrepareWalletPolicyTask as g}from"../../../app-binder/task/PrepareWalletPolicyTask";class R extends y{makeStateMachine(n){const{getWalletAddress:s,prepareWalletPolicy:o}=this.extractDependencies(n);return I({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new m({input:{appName:c}}).makeStateMachine(n),prepareWalletPolicy:p(o),getWalletAddress:p(s)},guards:{noInternalError:({context:e})=>e._internalState.error===null,skipOpenApp:({context:e})=>e.input.skipOpenApp},actions:{assignErrorFromEvent:r({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GetWalletAddressDeviceAction",initial:"InitialState",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:a.None,step:l.OPEN_APP},_internalState:{error:null,wallet:null,walletAddress:null}}),states:{InitialState:{always:[{target:"PrepareWalletPolicy",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{entry:r({intermediateValue:()=>({requiredUserInteraction:a.None,step:l.OPEN_APP})}),invoke:{id:"openAppStateMachine",input:{appName:c},src:"openAppStateMachine",onSnapshot:{actions:r({intermediateValue:({event:e})=>({...e.snapshot.context.intermediateValue,step:l.OPEN_APP})})},onDone:{actions:r({_internalState:({event:e,context:t})=>e.output.caseOf({Right:()=>t._internalState,Left:i=>({...t._internalState,error:i})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"PrepareWalletPolicy",guard:"noInternalError"},"Error"]},PrepareWalletPolicy:{entry:r({intermediateValue:()=>({requiredUserInteraction:a.None,step:l.PREPARE_WALLET_POLICY})}),invoke:{id:"prepareWalletPolicy",src:"prepareWalletPolicy",input:({context:e})=>({wallet:e.input.wallet,walletBuilder:e.input.walletBuilder}),onDone:{target:"PrepareWalletPolicyResultCheck",actions:r({_internalState:({event:e,context:t})=>d(e.output)?{...t._internalState,wallet:e.output.data}:{...t._internalState,error:e.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},PrepareWalletPolicyResultCheck:{always:[{guard:"noInternalError",target:"GetWalletAddress"},{target:"Error"}]},GetWalletAddress:{entry:r(({context:e})=>({intermediateValue:{requiredUserInteraction:e.input.checkOnDevice?a.VerifyAddress:a.None,step:l.GET_WALLET_ADDRESS}})),exit:r({intermediateValue:{requiredUserInteraction:a.None,step:l.GET_WALLET_ADDRESS}}),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:r({_internalState:({event:e,context:t})=>d(e.output)?{...t._internalState,walletAddress:e.output.data}:{...t._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?w(e._internalState.walletAddress):E(e._internalState.error||new D("No error in final state"))})}extractDependencies(n){return{getWalletAddress:async e=>{const{checkOnDevice:t,wallet:i,change:u,addressIndex:A,walletSerializer:W,dataStoreService:S}=e.input;return await new P(n,{checkOnDevice:t,wallet:i,change:u,addressIndex:A},W,S).run()},prepareWalletPolicy:async e=>{const{input:{walletBuilder:t,wallet:i}}=e;return await new g(n,{wallet:i},t).run()}}}}export{R as GetWalletAddressDeviceAction};
|
|
2
2
|
//# sourceMappingURL=GetWalletAddressDeviceAction.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 getWalletAddressDAStateSteps,\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 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 skipOpenApp: ({ context }) => context.input.skipOpenApp,\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: \"InitialState\",\n context: ({ input }) => ({\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.OPEN_APP,\n },\n _internalState: {\n error: null,\n wallet: null,\n walletAddress: null,\n },\n }),\n states: {\n InitialState: {\n always: [\n {\n target: \"PrepareWalletPolicy\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.OPEN_APP,\n }),\n }),\n invoke: {\n id: \"openAppStateMachine\",\n input: { appName: \"Bitcoin\" },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: ({ event }) => ({\n ...event.snapshot.context.intermediateValue,\n step: getWalletAddressDAStateSteps.OPEN_APP,\n }),\n }),\n },\n onDone: {\n actions: assign({\n _internalState: ({ event, context }) =>\n event.output.caseOf({\n Right: () => context._internalState,\n Left: (error) => ({\n ...context._internalState,\n error,\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\n PrepareWalletPolicy: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.PREPARE_WALLET_POLICY,\n }),\n }),\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: 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 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 step: getWalletAddressDAStateSteps.GET_WALLET_ADDRESS,\n },\n })),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.GET_WALLET_ADDRESS,\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: 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 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": "AAAA,OAIE,0BAAAA,EACA,uBAAAC,EAEA,kBAAAC,EACA,2BAAAC,EACA,sBAAAC,MACK,kCACP,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAME,gCAAAC,MACK,oDAIP,OAAS,wBAAAC,MAA4B,iDACrC,OAAS,2BAAAC,MAA+B,oDA8BjC,MAAMC,
|
|
6
|
-
"names": ["isSuccessCommandResult", "OpenAppDeviceAction", "UnknownDAError", "UserInteractionRequired", "XStateDeviceAction", "Left", "Right", "assign", "fromPromise", "setup", "getWalletAddressDAStateSteps", "GetWalletAddressTask", "PrepareWalletPolicyTask", "GetWalletAddressDeviceAction", "internalApi", "getWalletAddress", "prepareWalletPolicy", "context", "_", "input", "event", "error", "arg0", "checkOnDevice", "wallet", "change", "addressIndex", "walletSerializer", "dataStoreService", "walletBuilder"]
|
|
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 getWalletAddressDAStateSteps,\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 { APP_NAME } from \"@internal/app-binder/constants\";\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 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: APP_NAME },\n }).makeStateMachine(internalApi),\n prepareWalletPolicy: fromPromise(prepareWalletPolicy),\n getWalletAddress: fromPromise(getWalletAddress),\n },\n guards: {\n noInternalError: ({ context }) => context._internalState.error === null,\n skipOpenApp: ({ context }) => context.input.skipOpenApp,\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 N4IgpgJg5mDOIC5QGUCWUB2AFMAnWA9hgIYA2A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RAA */\n id: \"GetWalletAddressDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => ({\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.OPEN_APP,\n },\n _internalState: {\n error: null,\n wallet: null,\n walletAddress: null,\n },\n }),\n states: {\n InitialState: {\n always: [\n {\n target: \"PrepareWalletPolicy\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.OPEN_APP,\n }),\n }),\n invoke: {\n id: \"openAppStateMachine\",\n input: { appName: APP_NAME },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: ({ event }) => ({\n ...event.snapshot.context.intermediateValue,\n step: getWalletAddressDAStateSteps.OPEN_APP,\n }),\n }),\n },\n onDone: {\n actions: assign({\n _internalState: ({ event, context }) =>\n event.output.caseOf({\n Right: () => context._internalState,\n Left: (error) => ({\n ...context._internalState,\n error,\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\n PrepareWalletPolicy: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.PREPARE_WALLET_POLICY,\n }),\n }),\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: 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 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 step: getWalletAddressDAStateSteps.GET_WALLET_ADDRESS,\n },\n })),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: getWalletAddressDAStateSteps.GET_WALLET_ADDRESS,\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: 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 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": "AAAA,OAIE,0BAAAA,EACA,uBAAAC,EAEA,kBAAAC,EACA,2BAAAC,EACA,sBAAAC,MACK,kCACP,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAME,gCAAAC,MACK,oDAIP,OAAS,YAAAC,MAAgB,iCACzB,OAAS,wBAAAC,MAA4B,iDACrC,OAAS,2BAAAC,MAA+B,oDA8BjC,MAAMC,UAAqCV,CAMhD,CACA,iBACEW,EAOA,CASA,KAAM,CAAE,iBAAAC,EAAkB,oBAAAC,CAAoB,EAC5C,KAAK,oBAAoBF,CAAW,EAEtC,OAAON,EAAM,CACX,MAAO,CACL,MAAO,CAAC,EACR,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EAEA,OAAQ,CACN,oBAAqB,IAAIR,EAAoB,CAC3C,MAAO,CAAE,QAASU,CAAS,CAC7B,CAAC,EAAE,iBAAiBI,CAAW,EAC/B,oBAAqBP,EAAYS,CAAmB,EACpD,iBAAkBT,EAAYQ,CAAgB,CAChD,EACA,OA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OAAQ,8BACR,QAASX,EAAO,CACd,eAAgB,CAAC,CAAE,MAAAc,EAAO,QAAAH,CAAQ,IAC5BlB,EAAuBqB,EAAM,MAAM,EAC9B,CACL,GAAGH,EAAQ,eACX,cAAeG,EAAM,OAAO,IAC9B,EAEK,CACL,GAAGH,EAAQ,eACX,MAAOG,EAAM,OAAO,KACtB,CAEJ,CAAC,CACH,EACA,QAAS,CACP,OAAQ,QACR,QAAS,sBACX,CACF,CACF,EACA,4BAA6B,CAC3B,OAAQ,CACN,CAAE,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,QAAAH,CAAQ,IACjBA,EAAQ,eAAe,cACnBZ,EAAMY,EAAQ,eAAe,aAAa,EAC1Cb,EACEa,EAAQ,eAAe,OACrB,IAAIhB,EAAe,yBAAyB,CAChD,CACR,CAAC,CACH,CAEA,oBACEa,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,IAAIX,EACfG,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,IAAIV,EACfE,EACA,CAAE,OAAAU,CAAO,EACTK,CACF,EAAE,IAAI,CACR,CAoCA,CACF,CACF",
|
|
6
|
+
"names": ["isSuccessCommandResult", "OpenAppDeviceAction", "UnknownDAError", "UserInteractionRequired", "XStateDeviceAction", "Left", "Right", "assign", "fromPromise", "setup", "getWalletAddressDAStateSteps", "APP_NAME", "GetWalletAddressTask", "PrepareWalletPolicyTask", "GetWalletAddressDeviceAction", "internalApi", "getWalletAddress", "prepareWalletPolicy", "context", "_", "input", "event", "error", "arg0", "checkOnDevice", "wallet", "change", "addressIndex", "walletSerializer", "dataStoreService", "walletBuilder"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isSuccessCommandResult as
|
|
1
|
+
import{isSuccessCommandResult as o,OpenAppDeviceAction as d,UnknownDAError as m,UserInteractionRequired as n,XStateDeviceAction as g}from"@ledgerhq/device-management-kit";import{Left as y,Right as A}from"purify-ts";import{assign as r,fromPromise as u,setup as D}from"xstate";import{signPsbtDAStateSteps as a}from"../../../../api/app-binder/SignPsbtDeviceActionTypes";import{APP_NAME as b}from"../../../app-binder/constants";import{BuildPsbtTask as E}from"../../../app-binder/task/BuildPsbtTask";import{PrepareWalletPolicyTask as I}from"../../../app-binder/task/PrepareWalletPolicyTask";import{SignPsbtTask as w}from"../../../app-binder/task/SignPsbtTask";class M extends g{makeStateMachine(i){const{signPsbt:P,prepareWalletPolicy:c,buildPsbt:S}=this.extractDependencies(i);return D({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new d({input:{appName:b}}).makeStateMachine(i),prepareWalletPolicy:u(c),buildPsbt:u(S),signPsbt:u(P)},guards:{noInternalError:({context:t})=>t._internalState.error===null,skipOpenApp:({context:t})=>t.input.skipOpenApp},actions:{assignErrorFromEvent:r({_internalState:t=>({...t.context._internalState,error:t.event.error})})}}).createMachine({id:"SignPsbtDeviceAction",initial:"InitialState",context:({input:t})=>({input:t,intermediateValue:{requiredUserInteraction:n.None,step:a.OPEN_APP},_internalState:{error:null,wallet:null,buildPsbtResult:null,signatures:null,signedPsbt:null}}),states:{InitialState:{always:[{target:"PrepareWalletPolicy",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{entry:r({intermediateValue:()=>({requiredUserInteraction:n.None,step:a.OPEN_APP})}),invoke:{id:"openAppStateMachine",input:{appName:b},src:"openAppStateMachine",onSnapshot:{actions:r({intermediateValue:({event:t})=>({...t.snapshot.context.intermediateValue,step:a.OPEN_APP})})},onDone:{actions:r({_internalState:t=>t.event.output.caseOf({Right:()=>t.context._internalState,Left:e=>({...t.context._internalState,error:e})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"PrepareWalletPolicy",guard:"noInternalError"},"Error"]},PrepareWalletPolicy:{entry:r({intermediateValue:()=>({requiredUserInteraction:n.None,step:a.PREPARE_WALLET_POLICY})}),invoke:{id:"prepareWalletPolicy",src:"prepareWalletPolicy",input:({context:t})=>({wallet:t.input.wallet,walletBuilder:t.input.walletBuilder}),onDone:{target:"PrepareWalletPolicyResultCheck",actions:r({_internalState:({event:t,context:e})=>o(t.output)?{...e._internalState,wallet:t.output.data}:{...e._internalState,error:t.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},PrepareWalletPolicyResultCheck:{always:[{guard:"noInternalError",target:"BuildPsbt"},{target:"Error"}]},BuildPsbt:{entry:r({intermediateValue:()=>({requiredUserInteraction:n.None,step:a.BUILD_PSBT})}),invoke:{id:"buildPsbt",src:"buildPsbt",input:({context:t})=>({psbt:t.input.psbt,wallet:t._internalState.wallet,dataStoreService:t.input.dataStoreService,psbtMapper:t.input.psbtMapper}),onDone:{target:"BuildPsbtResultCheck",actions:r({_internalState:({event:t,context:e})=>o(t.output)?{...e._internalState,buildPsbtResult:t.output.data}:{...e._internalState,error:t.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},BuildPsbtResultCheck:{always:[{guard:"noInternalError",target:"SignPsbt"},{target:"Error"}]},SignPsbt:{entry:r({intermediateValue:{requiredUserInteraction:n.SignTransaction,step:a.SIGN_PSBT}}),exit:r({intermediateValue:{requiredUserInteraction:n.None,step:a.SIGN_PSBT}}),invoke:{id:"signPsbt",src:"signPsbt",input:({context:t})=>({walletSerializer:t.input.walletSerializer,valueParser:t.input.valueParser,buildPsbtResult:t._internalState.buildPsbtResult,wallet:t._internalState.wallet}),onDone:{target:"SignPsbtResultCheck",actions:r({_internalState:({event:t,context:e})=>o(t.output)?{...e._internalState,signatures:t.output.data}:{...e._internalState,error:t.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},SignPsbtResultCheck:{always:[{guard:"noInternalError",target:"Success"},{target:"Error"}]},Success:{type:"final"},Error:{type:"final"}},output:({context:{_internalState:{signatures:t,error:e}}})=>t?A(t):y(e||new m("No error in final state"))})}extractDependencies(i){return{prepareWalletPolicy:async t=>{const{input:{walletBuilder:e,wallet:l}}=t;return await new I(i,{wallet:l},e).run()},buildPsbt:async t=>{const{input:{psbt:e,wallet:l,dataStoreService:s,psbtMapper:p}}=t;return new E({psbt:e,wallet:l},s,p).run()},signPsbt:async t=>{const{input:{wallet:e,buildPsbtResult:l,walletSerializer:s,valueParser:p}}=t;return await new w(i,{wallet:e,...l},s,p).run()}}}}export{M as SignPsbtDeviceAction};
|
|
2
2
|
//# sourceMappingURL=SignPsbtDeviceAction.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.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 SignPsbtDAError,\n type SignPsbtDAInput,\n type SignPsbtDAIntermediateValue,\n type SignPsbtDAInternalState,\n type SignPsbtDAOutput,\n signPsbtDAStateSteps,\n} from \"@api/app-binder/SignPsbtDeviceActionTypes\";\nimport { type Psbt as ApiPsbt } from \"@api/model/Psbt\";\nimport { type PsbtSignature } from \"@api/model/Signature\";\nimport { type Wallet as ApiWallet } from \"@api/model/Wallet\";\nimport { type BtcErrorCodes } from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport {\n BuildPsbtTask,\n type BuildPsbtTaskResult,\n} from \"@internal/app-binder/task/BuildPsbtTask\";\nimport { PrepareWalletPolicyTask } from \"@internal/app-binder/task/PrepareWalletPolicyTask\";\nimport { SignPsbtTask } from \"@internal/app-binder/task/SignPsbtTask\";\nimport type { DataStoreService } from \"@internal/data-store/service/DataStoreService\";\nimport type { PsbtMapper } from \"@internal/psbt/service/psbt/PsbtMapper\";\nimport type { ValueParser } from \"@internal/psbt/service/value/ValueParser\";\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 MachineDependencies = {\n readonly prepareWalletPolicy: (arg0: {\n input: {\n wallet: ApiWallet;\n walletBuilder: WalletBuilder;\n };\n }) => Promise<CommandResult<InternalWallet, BtcErrorCodes>>;\n readonly buildPsbt: (arg0: {\n input: {\n psbt: ApiPsbt;\n wallet: InternalWallet;\n dataStoreService: DataStoreService;\n psbtMapper: PsbtMapper;\n };\n }) => Promise<CommandResult<BuildPsbtTaskResult, BtcErrorCodes>>;\n readonly signPsbt: (arg0: {\n input: {\n wallet: InternalWallet;\n buildPsbtResult: BuildPsbtTaskResult;\n walletSerializer: WalletSerializer;\n valueParser: ValueParser;\n };\n }) => Promise<CommandResult<PsbtSignature[], BtcErrorCodes>>;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class SignPsbtDeviceAction extends XStateDeviceAction<\n SignPsbtDAOutput,\n SignPsbtDAInput,\n SignPsbtDAError,\n SignPsbtDAIntermediateValue,\n SignPsbtDAInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n SignPsbtDAOutput,\n SignPsbtDAInput,\n SignPsbtDAError,\n SignPsbtDAIntermediateValue,\n SignPsbtDAInternalState\n > {\n type types = StateMachineTypes<\n SignPsbtDAOutput,\n SignPsbtDAInput,\n SignPsbtDAError,\n SignPsbtDAIntermediateValue,\n SignPsbtDAInternalState\n >;\n\n const { signPsbt, prepareWalletPolicy, buildPsbt } =\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 buildPsbt: fromPromise(buildPsbt),\n signPsbt: fromPromise(signPsbt),\n },\n guards: {\n noInternalError: ({ context }) => context._internalState.error === null,\n skipOpenApp: ({ context }) => context.input.skipOpenApp,\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: \"SignPsbtDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => ({\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.OPEN_APP,\n },\n _internalState: {\n error: null,\n wallet: null,\n buildPsbtResult: null,\n signatures: null,\n signedPsbt: null,\n },\n }),\n states: {\n InitialState: {\n always: [\n {\n target: \"PrepareWalletPolicy\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.OPEN_APP,\n }),\n }),\n invoke: {\n id: \"openAppStateMachine\",\n input: { appName: \"Bitcoin\" },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: ({ event }) => ({\n ...event.snapshot.context.intermediateValue,\n step: signPsbtDAStateSteps.OPEN_APP,\n }),\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<SignPsbtDAInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\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 entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.PREPARE_WALLET_POLICY,\n }),\n }),\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: 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 onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n PrepareWalletPolicyResultCheck: {\n always: [\n { guard: \"noInternalError\", target: \"BuildPsbt\" },\n { target: \"Error\" },\n ],\n },\n BuildPsbt: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.BUILD_PSBT,\n }),\n }),\n invoke: {\n id: \"buildPsbt\",\n src: \"buildPsbt\",\n input: ({ context }) => ({\n psbt: context.input.psbt,\n wallet: context._internalState.wallet!,\n dataStoreService: context.input.dataStoreService,\n psbtMapper: context.input.psbtMapper,\n }),\n onDone: {\n target: \"BuildPsbtResultCheck\",\n actions: assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n buildPsbtResult: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n BuildPsbtResultCheck: {\n always: [\n { guard: \"noInternalError\", target: \"SignPsbt\" },\n { target: \"Error\" },\n ],\n },\n SignPsbt: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n step: signPsbtDAStateSteps.SIGN_PSBT,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.SIGN_PSBT,\n },\n }),\n invoke: {\n id: \"signPsbt\",\n src: \"signPsbt\",\n input: ({ context }) => ({\n walletSerializer: context.input.walletSerializer,\n valueParser: context.input.valueParser,\n buildPsbtResult: context._internalState.buildPsbtResult!,\n wallet: context._internalState.wallet!,\n }),\n onDone: {\n target: \"SignPsbtResultCheck\",\n actions: assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n signatures: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n SignPsbtResultCheck: {\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: ({\n context: {\n _internalState: { signatures, error },\n },\n }) =>\n signatures\n ? Right(signatures)\n : Left(error || new UnknownDAError(\"No error in final state\")),\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\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 buildPsbt = async (arg0: {\n input: {\n psbt: ApiPsbt;\n wallet: InternalWallet;\n dataStoreService: DataStoreService;\n psbtMapper: PsbtMapper;\n };\n }): Promise<CommandResult<BuildPsbtTaskResult, BtcErrorCodes>> => {\n const {\n input: { psbt, wallet, dataStoreService, psbtMapper },\n } = arg0;\n return new BuildPsbtTask(\n { psbt, wallet },\n dataStoreService,\n psbtMapper,\n ).run();\n };\n const signPsbt = async (arg0: {\n input: {\n wallet: InternalWallet;\n buildPsbtResult: BuildPsbtTaskResult;\n walletSerializer: WalletSerializer;\n valueParser: ValueParser;\n };\n }): Promise<CommandResult<PsbtSignature[], BtcErrorCodes>> => {\n const {\n input: { wallet, buildPsbtResult, walletSerializer, valueParser },\n } = arg0;\n return await new SignPsbtTask(\n internalApi,\n { wallet, ...buildPsbtResult },\n walletSerializer,\n valueParser,\n ).run();\n };\n\n return {\n prepareWalletPolicy,\n buildPsbt,\n signPsbt,\n };\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAIE,0BAAAA,EACA,uBAAAC,EAEA,kBAAAC,EACA,2BAAAC,EACA,sBAAAC,MACK,kCACP,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAC5B,OAAS,UAAAC,EAAQ,eAAAC,EAAa,SAAAC,MAAa,SAE3C,OAME,wBAAAC,MACK,4CAKP,OACE,iBAAAC,MAEK,0CACP,OAAS,2BAAAC,MAA+B,oDACxC,OAAS,gBAAAC,MAAoB,yCAqCtB,MAAMC,
|
|
6
|
-
"names": ["isSuccessCommandResult", "OpenAppDeviceAction", "UnknownDAError", "UserInteractionRequired", "XStateDeviceAction", "Left", "Right", "assign", "fromPromise", "setup", "signPsbtDAStateSteps", "BuildPsbtTask", "PrepareWalletPolicyTask", "SignPsbtTask", "SignPsbtDeviceAction", "internalApi", "signPsbt", "prepareWalletPolicy", "buildPsbt", "context", "_", "input", "event", "error", "signatures", "arg0", "walletBuilder", "wallet", "psbt", "dataStoreService", "psbtMapper", "buildPsbtResult", "walletSerializer", "valueParser"]
|
|
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 SignPsbtDAError,\n type SignPsbtDAInput,\n type SignPsbtDAIntermediateValue,\n type SignPsbtDAInternalState,\n type SignPsbtDAOutput,\n signPsbtDAStateSteps,\n} from \"@api/app-binder/SignPsbtDeviceActionTypes\";\nimport { type Psbt as ApiPsbt } from \"@api/model/Psbt\";\nimport { type PsbtSignature } from \"@api/model/Signature\";\nimport { type Wallet as ApiWallet } from \"@api/model/Wallet\";\nimport { type BtcErrorCodes } from \"@internal/app-binder/command/utils/bitcoinAppErrors\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport {\n BuildPsbtTask,\n type BuildPsbtTaskResult,\n} from \"@internal/app-binder/task/BuildPsbtTask\";\nimport { PrepareWalletPolicyTask } from \"@internal/app-binder/task/PrepareWalletPolicyTask\";\nimport { SignPsbtTask } from \"@internal/app-binder/task/SignPsbtTask\";\nimport type { DataStoreService } from \"@internal/data-store/service/DataStoreService\";\nimport type { PsbtMapper } from \"@internal/psbt/service/psbt/PsbtMapper\";\nimport type { ValueParser } from \"@internal/psbt/service/value/ValueParser\";\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 MachineDependencies = {\n readonly prepareWalletPolicy: (arg0: {\n input: {\n wallet: ApiWallet;\n walletBuilder: WalletBuilder;\n };\n }) => Promise<CommandResult<InternalWallet, BtcErrorCodes>>;\n readonly buildPsbt: (arg0: {\n input: {\n psbt: ApiPsbt;\n wallet: InternalWallet;\n dataStoreService: DataStoreService;\n psbtMapper: PsbtMapper;\n };\n }) => Promise<CommandResult<BuildPsbtTaskResult, BtcErrorCodes>>;\n readonly signPsbt: (arg0: {\n input: {\n wallet: InternalWallet;\n buildPsbtResult: BuildPsbtTaskResult;\n walletSerializer: WalletSerializer;\n valueParser: ValueParser;\n };\n }) => Promise<CommandResult<PsbtSignature[], BtcErrorCodes>>;\n};\n\nexport type ExtractMachineDependencies = (\n internalApi: InternalApi,\n) => MachineDependencies;\n\nexport class SignPsbtDeviceAction extends XStateDeviceAction<\n SignPsbtDAOutput,\n SignPsbtDAInput,\n SignPsbtDAError,\n SignPsbtDAIntermediateValue,\n SignPsbtDAInternalState\n> {\n makeStateMachine(\n internalApi: InternalApi,\n ): DeviceActionStateMachine<\n SignPsbtDAOutput,\n SignPsbtDAInput,\n SignPsbtDAError,\n SignPsbtDAIntermediateValue,\n SignPsbtDAInternalState\n > {\n type types = StateMachineTypes<\n SignPsbtDAOutput,\n SignPsbtDAInput,\n SignPsbtDAError,\n SignPsbtDAIntermediateValue,\n SignPsbtDAInternalState\n >;\n\n const { signPsbt, prepareWalletPolicy, buildPsbt } =\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: APP_NAME },\n }).makeStateMachine(internalApi),\n prepareWalletPolicy: fromPromise(prepareWalletPolicy),\n buildPsbt: fromPromise(buildPsbt),\n signPsbt: fromPromise(signPsbt),\n },\n guards: {\n noInternalError: ({ context }) => context._internalState.error === null,\n skipOpenApp: ({ context }) => context.input.skipOpenApp,\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: \"SignPsbtDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => ({\n input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.OPEN_APP,\n },\n _internalState: {\n error: null,\n wallet: null,\n buildPsbtResult: null,\n signatures: null,\n signedPsbt: null,\n },\n }),\n states: {\n InitialState: {\n always: [\n {\n target: \"PrepareWalletPolicy\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.OPEN_APP,\n }),\n }),\n invoke: {\n id: \"openAppStateMachine\",\n input: { appName: APP_NAME },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: ({ event }) => ({\n ...event.snapshot.context.intermediateValue,\n step: signPsbtDAStateSteps.OPEN_APP,\n }),\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<SignPsbtDAInternalState>({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\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 entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.PREPARE_WALLET_POLICY,\n }),\n }),\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: 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 onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n PrepareWalletPolicyResultCheck: {\n always: [\n { guard: \"noInternalError\", target: \"BuildPsbt\" },\n { target: \"Error\" },\n ],\n },\n BuildPsbt: {\n entry: assign({\n intermediateValue: () => ({\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.BUILD_PSBT,\n }),\n }),\n invoke: {\n id: \"buildPsbt\",\n src: \"buildPsbt\",\n input: ({ context }) => ({\n psbt: context.input.psbt,\n wallet: context._internalState.wallet!,\n dataStoreService: context.input.dataStoreService,\n psbtMapper: context.input.psbtMapper,\n }),\n onDone: {\n target: \"BuildPsbtResultCheck\",\n actions: assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n buildPsbtResult: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n BuildPsbtResultCheck: {\n always: [\n { guard: \"noInternalError\", target: \"SignPsbt\" },\n { target: \"Error\" },\n ],\n },\n SignPsbt: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n step: signPsbtDAStateSteps.SIGN_PSBT,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n step: signPsbtDAStateSteps.SIGN_PSBT,\n },\n }),\n invoke: {\n id: \"signPsbt\",\n src: \"signPsbt\",\n input: ({ context }) => ({\n walletSerializer: context.input.walletSerializer,\n valueParser: context.input.valueParser,\n buildPsbtResult: context._internalState.buildPsbtResult!,\n wallet: context._internalState.wallet!,\n }),\n onDone: {\n target: \"SignPsbtResultCheck\",\n actions: assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n signatures: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n SignPsbtResultCheck: {\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: ({\n context: {\n _internalState: { signatures, error },\n },\n }) =>\n signatures\n ? Right(signatures)\n : Left(error || new UnknownDAError(\"No error in final state\")),\n });\n }\n\n extractDependencies(internalApi: InternalApi): MachineDependencies {\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 buildPsbt = async (arg0: {\n input: {\n psbt: ApiPsbt;\n wallet: InternalWallet;\n dataStoreService: DataStoreService;\n psbtMapper: PsbtMapper;\n };\n }): Promise<CommandResult<BuildPsbtTaskResult, BtcErrorCodes>> => {\n const {\n input: { psbt, wallet, dataStoreService, psbtMapper },\n } = arg0;\n return new BuildPsbtTask(\n { psbt, wallet },\n dataStoreService,\n psbtMapper,\n ).run();\n };\n const signPsbt = async (arg0: {\n input: {\n wallet: InternalWallet;\n buildPsbtResult: BuildPsbtTaskResult;\n walletSerializer: WalletSerializer;\n valueParser: ValueParser;\n };\n }): Promise<CommandResult<PsbtSignature[], BtcErrorCodes>> => {\n const {\n input: { wallet, buildPsbtResult, walletSerializer, valueParser },\n } = arg0;\n return await new SignPsbtTask(\n internalApi,\n { wallet, ...buildPsbtResult },\n walletSerializer,\n valueParser,\n ).run();\n };\n\n return {\n prepareWalletPolicy,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sC,CAC5D,KAAM,CACJ,MAAO,CAAE,OAAAE,EAAQ,gBAAAI,EAAiB,iBAAAC,EAAkB,YAAAC,CAAY,CAClE,EAAIR,EACJ,OAAO,MAAM,IAAIZ,EACfE,EACA,CAAE,OAAAY,EAAQ,GAAGI,CAAgB,EAC7BC,EACAC,CACF,EAAE,IAAI,CACR,CAMA,CACF,CACF",
|
|
6
|
+
"names": ["isSuccessCommandResult", "OpenAppDeviceAction", "UnknownDAError", "UserInteractionRequired", "XStateDeviceAction", "Left", "Right", "assign", "fromPromise", "setup", "signPsbtDAStateSteps", "APP_NAME", "BuildPsbtTask", "PrepareWalletPolicyTask", "SignPsbtTask", "SignPsbtDeviceAction", "internalApi", "signPsbt", "prepareWalletPolicy", "buildPsbt", "context", "_", "input", "event", "error", "signatures", "arg0", "walletBuilder", "wallet", "psbt", "dataStoreService", "psbtMapper", "buildPsbtResult", "walletSerializer", "valueParser"]
|
|
7
7
|
}
|
package/lib/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BtcAppBinder.d.ts","sourceRoot":"","sources":["../../../../src/internal/app-binder/BtcAppBinder.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,KAAK,eAAe,EACpB,sBAAsB,EAGvB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EACjC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EACjC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CA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AM,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,OAAO,CAAC;KACtB,GAAG,4BAA4B;IAmBhC,eAAe,CAAC,IAAI,EAAE;QACpB,IAAI,EAAE,IAAI,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,OAAO,CAAC;KACtB,GAAG,2BAA2B;IAmB/B,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,0BAA0B;CAwBxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContinueCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/ContinueCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"ContinueCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/ContinueCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qDAAqD,CAAC;AAI7D,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAEnD,qBAAa,eACX,YACE,OAAO,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,aAAa,CAAC;IAIpE,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAH/B,QAAQ,CAAC,IAAI,cAAc;gBAER,KAAK,EAAE,mBAAmB,EAC1B,YAAY,kDAO5B;IAGH,OAAO,IAAI,IAAI;IAWf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC;CAOzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetExtendedPublicKeyCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAIT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"GetExtendedPublicKeyCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/GetExtendedPublicKeyCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAIT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qDAAqD,CAAC;AAI7D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAChD,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,qBAAa,2BACX,YACE,OAAO,CACL,mCAAmC,EACnC,+BAA+B,EAC/B,aAAa,CACd;IAID,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAH/B,QAAQ,CAAC,IAAI,0BAA0B;gBAEpB,KAAK,EAAE,+BAA+B,EACtC,YAAY,yEAO5B;IAGH,OAAO,IAAI,IAAI;IAsBf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,mCAAmC,EAAE,aAAa,CAAC;CAwBrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetMasterFingerprintCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/GetMasterFingerprintCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAIT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"GetMasterFingerprintCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/GetMasterFingerprintCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAIT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qDAAqD,CAAC;AAM7D,KAAK,mCAAmC,GAAG;IACzC,iBAAiB,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,qBAAa,2BACX,YAAW,OAAO,CAAC,mCAAmC,EAAE,IAAI,EAAE,aAAa,CAAC;IAI1E,OAAO,CAAC,QAAQ,CAAC,YAAY;IAF/B,QAAQ,CAAC,IAAI,0BAA0B;gBAEpB,YAAY,yEAO5B;IAEH,OAAO,IAAI,IAAI;IAUf,aAAa,CACX,QAAQ,EAAE,YAAY,GACrB,aAAa,CAAC,mCAAmC,EAAE,aAAa,CAAC;CAsBrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/internal/app-binder/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetWalletAddressDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAMhB,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAE9B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,MAAM,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"GetWalletAddressDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/device-action/GetWalletAddress/GetWalletAddressDeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAMhB,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAE9B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,KA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ChC;IACC,gBAAgB,CACd,WAAW,EAAE,WAAW,GACvB,wBAAwB,CACzB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,mCAAmC,EACnC,+BAA+B,CAChC;IAgOD,mBAAmB,CACjB,WAAW,EAAE,WAAW,GACvB,mCAAmC;CAkDvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignPsbtDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAMhB,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAEtB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,KAAK,MAAM,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"SignPsbtDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/app-binder/device-action/SignPsbt/SignPsbtDeviceAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAMhB,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAEtB,MAAM,2CAA2C,CAAC;AACnD,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