@ledgerhq/device-signer-kit-ethereum 0.0.0-develop-20250410001138 → 0.0.0-develop-20250412001122

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.
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var w=(a,e)=>{for(var t in e)m(a,t,{get:e[t],enumerable:!0})},S=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!f.call(a,r)&&r!==t&&m(a,r,{get:()=>e[r],enumerable:!(i=E(e,r))||i.enumerable});return a};var k=a=>S(m({},"__esModule",{value:!0}),a);var x={};w(x,{ProvideTransactionContextTask:()=>v});module.exports=k(x);var o=require("@ledgerhq/context-module"),n=require("@ledgerhq/device-management-kit"),s=require("purify-ts"),d=require("../../app-binder/command/ProvideNFTInformationCommand"),c=require("../../app-binder/command/ProvideTokenInformationCommand"),u=require("../../app-binder/command/ProvideTrustedNameCommand"),p=require("../../app-binder/command/ProvideWeb3CheckCommand"),h=require("../../app-binder/command/SetExternalPluginCommand"),T=require("../../app-binder/command/SetPluginCommand"),C=require("./SendPayloadInChunksTask");class v{constructor(e,t){this.api=e;this.args=t}async run(){for(const e of this.args.clearSignContexts){const t=await this.provideContext(e);if(!(0,n.isSuccessCommandResult)(t))return(0,s.Just)(t)}if(this.args.web3Check){const e=await this.provideContext(this.args.web3Check);if(!(0,n.isSuccessCommandResult)(e))return(0,s.Just)(e)}return s.Nothing}async provideContext({type:e,payload:t,certificate:i}){switch(i&&await this.api.sendCommand(new n.LoadCertificateCommand({keyUsage:i.keyUsageNumber,certificate:i.payload})),e){case o.ClearSignContextType.PLUGIN:return await this.api.sendCommand(new T.SetPluginCommand({payload:t}));case o.ClearSignContextType.EXTERNAL_PLUGIN:return await this.api.sendCommand(new h.SetExternalPluginCommand({payload:t}));case o.ClearSignContextType.NFT:return await this.api.sendCommand(new d.ProvideNFTInformationCommand({payload:t}));case o.ClearSignContextType.TOKEN:return await this.api.sendCommand(new c.ProvideTokenInformationCommand({payload:t}));case o.ClearSignContextType.TRUSTED_NAME:return new C.SendPayloadInChunksTask(this.api,{payload:t,commandFactory:r=>new u.ProvideTrustedNameCommand({data:r.chunkedData,isFirstChunk:r.isFirstChunk})}).run();case o.ClearSignContextType.ENUM:case o.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION:case o.ClearSignContextType.TRANSACTION_INFO:return(0,n.CommandResultFactory)({error:new n.InvalidStatusWordError("The context type [EXTERNAL_PLUGIN] is not valid here")});case o.ClearSignContextType.WEB3_CHECK:return new C.SendPayloadInChunksTask(this.api,{payload:t,commandFactory:r=>new p.ProvideWeb3CheckCommand({payload:r.chunkedData,isFirstChunk:r.isFirstChunk})}).run();default:{const r=e;return(0,n.CommandResultFactory)({error:new n.InvalidStatusWordError(`The context type [${r}] is not covered`)})}}}}0&&(module.exports={ProvideTransactionContextTask});
1
+ "use strict";var m=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var w=(a,e)=>{for(var t in e)m(a,t,{get:e[t],enumerable:!0})},S=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!f.call(a,r)&&r!==t&&m(a,r,{get:()=>e[r],enumerable:!(i=E(e,r))||i.enumerable});return a};var k=a=>S(m({},"__esModule",{value:!0}),a);var x={};w(x,{ProvideTransactionContextTask:()=>v});module.exports=k(x);var o=require("@ledgerhq/context-module"),n=require("@ledgerhq/device-management-kit"),s=require("purify-ts"),d=require("../../app-binder/command/ProvideNFTInformationCommand"),c=require("../../app-binder/command/ProvideTokenInformationCommand"),u=require("../../app-binder/command/ProvideTrustedNameCommand"),p=require("../../app-binder/command/ProvideWeb3CheckCommand"),h=require("../../app-binder/command/SetExternalPluginCommand"),T=require("../../app-binder/command/SetPluginCommand"),C=require("./SendPayloadInChunksTask");class v{constructor(e,t){this.api=e;this.args=t}async run(){if(this.args.web3Check){const e=await this.provideContext(this.args.web3Check);if(!(0,n.isSuccessCommandResult)(e))return(0,s.Just)(e)}for(const e of this.args.clearSignContexts){const t=await this.provideContext(e);if(!(0,n.isSuccessCommandResult)(t))return(0,s.Just)(t)}return s.Nothing}async provideContext({type:e,payload:t,certificate:i}){switch(i&&await this.api.sendCommand(new n.LoadCertificateCommand({keyUsage:i.keyUsageNumber,certificate:i.payload})),e){case o.ClearSignContextType.PLUGIN:return await this.api.sendCommand(new T.SetPluginCommand({payload:t}));case o.ClearSignContextType.EXTERNAL_PLUGIN:return await this.api.sendCommand(new h.SetExternalPluginCommand({payload:t}));case o.ClearSignContextType.NFT:return await this.api.sendCommand(new d.ProvideNFTInformationCommand({payload:t}));case o.ClearSignContextType.TOKEN:return await this.api.sendCommand(new c.ProvideTokenInformationCommand({payload:t}));case o.ClearSignContextType.TRUSTED_NAME:return new C.SendPayloadInChunksTask(this.api,{payload:t,commandFactory:r=>new u.ProvideTrustedNameCommand({data:r.chunkedData,isFirstChunk:r.isFirstChunk})}).run();case o.ClearSignContextType.ENUM:case o.ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION:case o.ClearSignContextType.TRANSACTION_INFO:return(0,n.CommandResultFactory)({error:new n.InvalidStatusWordError("The context type [EXTERNAL_PLUGIN] is not valid here")});case o.ClearSignContextType.WEB3_CHECK:return new C.SendPayloadInChunksTask(this.api,{payload:t,commandFactory:r=>new p.ProvideWeb3CheckCommand({payload:r.chunkedData,isFirstChunk:r.isFirstChunk})}).run();default:{const r=e;return(0,n.CommandResultFactory)({error:new n.InvalidStatusWordError(`The context type [${r}] is not covered`)})}}}}0&&(module.exports={ProvideTransactionContextTask});
2
2
  //# sourceMappingURL=ProvideTransactionContextTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/ProvideTransactionContextTask.ts"],
4
- "sourcesContent": ["import {\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@ledgerhq/context-module\";\nimport {\n type CommandErrorResult,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n LoadCertificateCommand,\n} from \"@ledgerhq/device-management-kit\";\nimport { Just, type Maybe, Nothing } from \"purify-ts\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport {\n ProvideTokenInformationCommand,\n type ProvideTokenInformationCommandResponse,\n} from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { ProvideTrustedNameCommand } from \"@internal/app-binder/command/ProvideTrustedNameCommand\";\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nimport { SendPayloadInChunksTask } from \"./SendPayloadInChunksTask\";\n\nexport type ProvideTransactionContextTaskArgs = {\n /**\n * The valid clear sign contexts offerred by the `BuildTrancationContextTask`.\n */\n clearSignContexts: ClearSignContextSuccess[];\n web3Check: ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null;\n};\n\n/**\n * This task is responsible for providing the transaction context to the device.\n * It will send the 5 necessary commands:\n * - `SetPluginCommand` (single command)\n * - `SetExternalPluginCommand` (single command)\n * - `ProvideNFTInformationCommand` (single command)\n * - `ProvideTokenInformationCommand` (single command)\n * - `ProvideTrustedNameCommand` (__mulpitle commands__)\n *\n * The method `provideTrustedNameTask` is dedicated to send the multiple `ProvideTrustedNameCommand`.\n */\nexport class ProvideTransactionContextTask {\n constructor(\n private api: InternalApi,\n private args: ProvideTransactionContextTaskArgs,\n ) {}\n\n async run(): Promise<Maybe<CommandErrorResult<EthErrorCodes>>> {\n for (const context of this.args.clearSignContexts) {\n const res = await this.provideContext(context);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n if (this.args.web3Check) {\n const res = await this.provideContext(this.args.web3Check);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n return Nothing;\n }\n\n /**\n * This method will send a command according to the clear sign context type and return the command result if only one command\n * is sent, otherwise it will return the result of the `provideTrustedNameTask`.\n *\n * @param context The clear sign context to provide.\n * @returns A promise that resolves when the command is sent or result of the `provideTrustedNameTask`.\n */\n async provideContext({\n type,\n payload,\n certificate,\n }: ClearSignContextSuccess): Promise<\n CommandResult<void | ProvideTokenInformationCommandResponse, EthErrorCodes>\n > {\n // if a certificate is provided, we load it before sending the command\n if (certificate) {\n await this.api.sendCommand(\n new LoadCertificateCommand({\n keyUsage: certificate.keyUsageNumber,\n certificate: certificate.payload,\n }),\n );\n }\n\n switch (type) {\n case ClearSignContextType.PLUGIN: {\n return await this.api.sendCommand(new SetPluginCommand({ payload }));\n }\n case ClearSignContextType.EXTERNAL_PLUGIN: {\n return await this.api.sendCommand(\n new SetExternalPluginCommand({ payload }),\n );\n }\n case ClearSignContextType.NFT: {\n return await this.api.sendCommand(\n new ProvideNFTInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TOKEN: {\n return await this.api.sendCommand(\n new ProvideTokenInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TRUSTED_NAME: {\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideTrustedNameCommand({\n data: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n }\n case ClearSignContextType.ENUM:\n case ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION:\n case ClearSignContextType.TRANSACTION_INFO: {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n \"The context type [EXTERNAL_PLUGIN] is not valid here\",\n ),\n });\n }\n case ClearSignContextType.WEB3_CHECK:\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideWeb3CheckCommand({\n payload: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n default: {\n const uncoveredType: never = type;\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n `The context type [${uncoveredType}] is not covered`,\n ),\n });\n }\n }\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,oCACPC,EAQO,2CACPC,EAA0C,qBAE1CC,EAA6C,qEAC7CC,EAGO,uEACPC,EAA0C,kEAC1CC,EAAwC,gEACxCC,EAAyC,iEACzCC,EAAiC,yDAGjCC,EAAwC,qCAqBjC,MAAMX,CAA8B,CACzC,YACUY,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAAyD,CAC7D,UAAWC,KAAW,KAAK,KAAK,kBAAmB,CACjD,MAAMC,EAAM,MAAM,KAAK,eAAeD,CAAO,EAC7C,GAAI,IAAC,0BAAuBC,CAAG,EAC7B,SAAO,QAAKA,CAAG,CAEnB,CACA,GAAI,KAAK,KAAK,UAAW,CACvB,MAAMA,EAAM,MAAM,KAAK,eAAe,KAAK,KAAK,SAAS,EACzD,GAAI,IAAC,0BAAuBA,CAAG,EAC7B,SAAO,QAAKA,CAAG,CAEnB,CACA,OAAO,SACT,CASA,MAAM,eAAe,CACnB,KAAAC,EACA,QAAAC,EACA,YAAAC,CACF,EAEE,CAWA,OATIA,GACF,MAAM,KAAK,IAAI,YACb,IAAI,yBAAuB,CACzB,SAAUA,EAAY,eACtB,YAAaA,EAAY,OAC3B,CAAC,CACH,EAGMF,EAAM,CACZ,KAAK,uBAAqB,OACxB,OAAO,MAAM,KAAK,IAAI,YAAY,IAAI,mBAAiB,CAAE,QAAAC,CAAQ,CAAC,CAAC,EAErE,KAAK,uBAAqB,gBACxB,OAAO,MAAM,KAAK,IAAI,YACpB,IAAI,2BAAyB,CAAE,QAAAA,CAAQ,CAAC,CAC1C,EAEF,KAAK,uBAAqB,IACxB,OAAO,MAAM,KAAK,IAAI,YACpB,IAAI,+BAA6B,CAAE,QAAAA,CAAQ,CAAC,CAC9C,EAEF,KAAK,uBAAqB,MACxB,OAAO,MAAM,KAAK,IAAI,YACpB,IAAI,iCAA+B,CAAE,QAAAA,CAAQ,CAAC,CAChD,EAEF,KAAK,uBAAqB,aACxB,OAAO,IAAI,0BAAwB,KAAK,IAAK,CAC3C,QAAAA,EACA,eAAiBJ,GACf,IAAI,4BAA0B,CAC5B,KAAMA,EAAK,YACX,aAAcA,EAAK,YACrB,CAAC,CACL,CAAC,EAAE,IAAI,EAET,KAAK,uBAAqB,KAC1B,KAAK,uBAAqB,8BAC1B,KAAK,uBAAqB,iBACxB,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,sDACF,CACF,CAAC,EAEH,KAAK,uBAAqB,WACxB,OAAO,IAAI,0BAAwB,KAAK,IAAK,CAC3C,QAAAI,EACA,eAAiBJ,GACf,IAAI,0BAAwB,CAC1B,QAASA,EAAK,YACd,aAAcA,EAAK,YACrB,CAAC,CACL,CAAC,EAAE,IAAI,EACT,QAAS,CACP,MAAMM,EAAuBH,EAC7B,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,qBAAqBG,CAAa,kBACpC,CACF,CAAC,CACH,CACF,CACF,CACF",
6
- "names": ["ProvideTransactionContextTask_exports", "__export", "ProvideTransactionContextTask", "__toCommonJS", "import_context_module", "import_device_management_kit", "import_purify_ts", "import_ProvideNFTInformationCommand", "import_ProvideTokenInformationCommand", "import_ProvideTrustedNameCommand", "import_ProvideWeb3CheckCommand", "import_SetExternalPluginCommand", "import_SetPluginCommand", "import_SendPayloadInChunksTask", "api", "args", "context", "res", "type", "payload", "certificate", "uncoveredType"]
4
+ "sourcesContent": ["import {\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@ledgerhq/context-module\";\nimport {\n type CommandErrorResult,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n LoadCertificateCommand,\n} from \"@ledgerhq/device-management-kit\";\nimport { Just, type Maybe, Nothing } from \"purify-ts\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport {\n ProvideTokenInformationCommand,\n type ProvideTokenInformationCommandResponse,\n} from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { ProvideTrustedNameCommand } from \"@internal/app-binder/command/ProvideTrustedNameCommand\";\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nimport { SendPayloadInChunksTask } from \"./SendPayloadInChunksTask\";\n\nexport type ProvideTransactionContextTaskArgs = {\n /**\n * The valid clear sign contexts offerred by the `BuildTrancationContextTask`.\n */\n clearSignContexts: ClearSignContextSuccess[];\n web3Check: ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null;\n};\n\n/**\n * This task is responsible for providing the transaction context to the device.\n * It will send the 5 necessary commands:\n * - `SetPluginCommand` (single command)\n * - `SetExternalPluginCommand` (single command)\n * - `ProvideNFTInformationCommand` (single command)\n * - `ProvideTokenInformationCommand` (single command)\n * - `ProvideTrustedNameCommand` (__mulpitle commands__)\n *\n * The method `provideTrustedNameTask` is dedicated to send the multiple `ProvideTrustedNameCommand`.\n */\nexport class ProvideTransactionContextTask {\n constructor(\n private api: InternalApi,\n private args: ProvideTransactionContextTaskArgs,\n ) {}\n\n async run(): Promise<Maybe<CommandErrorResult<EthErrorCodes>>> {\n if (this.args.web3Check) {\n const res = await this.provideContext(this.args.web3Check);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n for (const context of this.args.clearSignContexts) {\n const res = await this.provideContext(context);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n return Nothing;\n }\n\n /**\n * This method will send a command according to the clear sign context type and return the command result if only one command\n * is sent, otherwise it will return the result of the `provideTrustedNameTask`.\n *\n * @param context The clear sign context to provide.\n * @returns A promise that resolves when the command is sent or result of the `provideTrustedNameTask`.\n */\n async provideContext({\n type,\n payload,\n certificate,\n }: ClearSignContextSuccess): Promise<\n CommandResult<void | ProvideTokenInformationCommandResponse, EthErrorCodes>\n > {\n // if a certificate is provided, we load it before sending the command\n if (certificate) {\n await this.api.sendCommand(\n new LoadCertificateCommand({\n keyUsage: certificate.keyUsageNumber,\n certificate: certificate.payload,\n }),\n );\n }\n\n switch (type) {\n case ClearSignContextType.PLUGIN: {\n return await this.api.sendCommand(new SetPluginCommand({ payload }));\n }\n case ClearSignContextType.EXTERNAL_PLUGIN: {\n return await this.api.sendCommand(\n new SetExternalPluginCommand({ payload }),\n );\n }\n case ClearSignContextType.NFT: {\n return await this.api.sendCommand(\n new ProvideNFTInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TOKEN: {\n return await this.api.sendCommand(\n new ProvideTokenInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TRUSTED_NAME: {\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideTrustedNameCommand({\n data: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n }\n case ClearSignContextType.ENUM:\n case ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION:\n case ClearSignContextType.TRANSACTION_INFO: {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n \"The context type [EXTERNAL_PLUGIN] is not valid here\",\n ),\n });\n }\n case ClearSignContextType.WEB3_CHECK:\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideWeb3CheckCommand({\n payload: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n default: {\n const uncoveredType: never = type;\n return CommandResultFactory({\n error: new Inv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F,KAAK,uBAAqB,MACxB,OAAO,MAAM,KAAK,IAAI,YACpB,IAAI,iCAA+B,CAAE,QAAAA,CAAQ,CAAC,CAChD,EAEF,KAAK,uBAAqB,aACxB,OAAO,IAAI,0BAAwB,KAAK,IAAK,CAC3C,QAAAA,EACA,eAAiBJ,GACf,IAAI,4BAA0B,CAC5B,KAAMA,EAAK,YACX,aAAcA,EAAK,YACrB,CAAC,CACL,CAAC,EAAE,IAAI,EAET,KAAK,uBAAqB,KAC1B,KAAK,uBAAqB,8BAC1B,KAAK,uBAAqB,iBACxB,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,sDACF,CACF,CAAC,EAEH,KAAK,uBAAqB,WACxB,OAAO,IAAI,0BAAwB,KAAK,IAAK,CAC3C,QAAAI,EACA,eAAiBJ,GACf,IAAI,0BAAwB,CAC1B,QAASA,EAAK,YACd,aAAcA,EAAK,YACrB,CAAC,CACL,CAAC,EAAE,IAAI,EACT,QAAS,CACP,MAAMM,EAAuBH,EAC7B,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,qBAAqBG,CAAa,kBACpC,CACF,CAAC,CACH,CACF,CACF,CACF",
6
+ "names": ["ProvideTransactionContextTask_exports", "__export", "ProvideTransactionContextTask", "__toCommonJS", "import_context_module", "import_device_management_kit", "import_purify_ts", "import_ProvideNFTInformationCommand", "import_ProvideTokenInformationCommand", "import_ProvideTrustedNameCommand", "import_ProvideWeb3CheckCommand", "import_SetExternalPluginCommand", "import_SetPluginCommand", "import_SendPayloadInChunksTask", "api", "args", "res", "context", "type", "payload", "certificate", "uncoveredType"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=require("@ledgerhq/context-module"),a=require("@ledgerhq/device-management-kit"),i=require("../../app-binder/command/ProvideNFTInformationCommand"),s=require("../../app-binder/command/ProvideTokenInformationCommand"),c=require("../../app-binder/command/SetExternalPluginCommand"),m=require("../../app-binder/command/SetPluginCommand"),l=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),r=require("./ProvideTransactionContextTask");describe("ProvideTransactionContextTask",()=>{const e=(0,l.makeDeviceActionInternalApiMock)(),p=(0,a.CommandResultFactory)({data:void 0}),d=(0,a.CommandResultFactory)({data:void 0,error:{}});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{const o={clearSignContexts:[{type:n.ClearSignContextType.PLUGIN,payload:"706c7567696e"},{type:n.ClearSignContextType.EXTERNAL_PLUGIN,payload:"65787465726e616c506c7567696e"},{type:n.ClearSignContextType.NFT,payload:"6e6674"},{type:n.ClearSignContextType.TOKEN,payload:"746f6b656e"}],web3Check:null};afterEach(()=>{vi.restoreAllMocks()}),it("should send relative commands when receiving ClearSignContexts of type not trustedName",async()=>{e.sendCommand.mockResolvedValue(p),await new r.ProvideTransactionContextTask(e,o).run(),expect(e.sendCommand).toHaveBeenCalledTimes(4),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.PLUGIN)+1,expect.objectContaining(new m.SetPluginCommand({payload:"706c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.EXTERNAL_PLUGIN)+1,expect.objectContaining(new c.SetExternalPluginCommand({payload:"65787465726e616c506c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.NFT)+1,expect.objectContaining(new i.ProvideNFTInformationCommand({payload:"6e6674"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.TOKEN)+1,expect.objectContaining(new s.ProvideTokenInformationCommand({payload:"746f6b656e"})))}),it("should return the command error result and stop when the command fails",async()=>{e.sendCommand.mockReset(),e.sendCommand.mockResolvedValueOnce(d);const t=await new r.ProvideTransactionContextTask(e,o).run();expect(e.sendCommand).toHaveBeenCalledTimes(1),expect(t.isJust()).toBe(!0),expect(t.extract()).toStrictEqual(d)})})});
1
+ "use strict";var n=require("@ledgerhq/context-module"),a=require("@ledgerhq/device-management-kit"),c=require("../../app-binder/command/ProvideNFTInformationCommand"),m=require("../../app-binder/command/ProvideTokenInformationCommand"),l=require("../../app-binder/command/ProvideWeb3CheckCommand"),C=require("../../app-binder/command/SetExternalPluginCommand"),p=require("../../app-binder/command/SetPluginCommand"),x=require("../../app-binder/device-action/__test-utils__/makeInternalApi"),r=require("./ProvideTransactionContextTask");describe("ProvideTransactionContextTask",()=>{const e=(0,x.makeDeviceActionInternalApiMock)(),i=(0,a.CommandResultFactory)({data:void 0}),d=(0,a.CommandResultFactory)({data:void 0,error:{}});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{const o={clearSignContexts:[{type:n.ClearSignContextType.PLUGIN,payload:"706c7567696e"},{type:n.ClearSignContextType.EXTERNAL_PLUGIN,payload:"65787465726e616c506c7567696e"},{type:n.ClearSignContextType.NFT,payload:"6e6674"},{type:n.ClearSignContextType.TOKEN,payload:"746f6b656e"}],web3Check:null};beforeEach(()=>{vi.resetAllMocks()}),it("should send relative commands when receiving ClearSignContexts of type not trustedName",async()=>{e.sendCommand.mockResolvedValue(i),await new r.ProvideTransactionContextTask(e,o).run(),expect(e.sendCommand).toHaveBeenCalledTimes(4),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.PLUGIN)+1,expect.objectContaining(new p.SetPluginCommand({payload:"706c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.EXTERNAL_PLUGIN)+1,expect.objectContaining(new C.SetExternalPluginCommand({payload:"65787465726e616c506c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.NFT)+1,expect.objectContaining(new c.ProvideNFTInformationCommand({payload:"6e6674"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.ClearSignContextType.TOKEN)+1,expect.objectContaining(new m.ProvideTokenInformationCommand({payload:"746f6b656e"})))}),it("should return the command error result and stop when the command fails",async()=>{e.sendCommand.mockResolvedValueOnce(d);const t=await new r.ProvideTransactionContextTask(e,o).run();expect(e.sendCommand).toHaveBeenCalledTimes(1),expect(t.isJust()).toBe(!0),expect(t.extract()).toStrictEqual(d)}),it("should send the web3Check command when it is provided",async()=>{e.sendCommand.mockResolvedValue(i);const t=await new r.ProvideTransactionContextTask(e,{...o,web3Check:{type:n.ClearSignContextType.WEB3_CHECK,payload:"0x01020304",certificate:{payload:new Uint8Array,keyUsageNumber:1}}}).run();expect(e.sendCommand).toHaveBeenCalledTimes(6),expect(e.sendCommand).toHaveBeenNthCalledWith(1,expect.objectContaining(new a.LoadCertificateCommand({certificate:new Uint8Array,keyUsage:1}))),expect(e.sendCommand).toHaveBeenNthCalledWith(2,expect.objectContaining(new l.ProvideWeb3CheckCommand({payload:(0,a.hexaStringToBuffer)("0x000401020304"),isFirstChunk:!0}))),expect(t.isJust()).toBe(!1)})})});
2
2
  //# sourceMappingURL=ProvideTransactionContextTask.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/ProvideTransactionContextTask.test.ts"],
4
- "sourcesContent": ["import { ClearSignContextType } from \"@ledgerhq/context-module\";\nimport {\n CommandResultFactory,\n type UnknownDeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport { ProvideTokenInformationCommand } from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport {\n ProvideTransactionContextTask,\n type ProvideTransactionContextTaskArgs,\n} from \"./ProvideTransactionContextTask\";\n\ndescribe(\"ProvideTransactionContextTask\", () => {\n const api = makeDeviceActionInternalApiMock();\n const successResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n });\n const errorResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n error: {} as UnknownDeviceExchangeError,\n });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n const args: ProvideTransactionContextTaskArgs = {\n clearSignContexts: [\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"706c7567696e\", // \"plugin\"\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"65787465726e616c506c7567696e\", // \"externalPlugin\"\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"6e6674\", // \"nft\"\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"746f6b656e\", // \"token\"\n },\n ],\n web3Check: null,\n };\n afterEach(() => {\n vi.restoreAllMocks();\n });\n it(\"should send relative commands when receiving ClearSignContexts of type not trustedName\", async () => {\n api.sendCommand.mockResolvedValue(successResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(4);\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetPluginCommand({ payload: \"706c7567696e\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.EXTERNAL_PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetExternalPluginCommand({\n payload: \"65787465726e616c506c7567696e\",\n }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.NFT,\n ) + 1,\n expect.objectContaining(\n new ProvideNFTInformationCommand({ payload: \"6e6674\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.TOKEN,\n ) + 1,\n expect.objectContaining(\n new ProvideTokenInformationCommand({ payload: \"746f6b656e\" }),\n ),\n );\n });\n it(\"should return the command error result and stop when the command fails\", async () => {\n api.sendCommand.mockReset();\n api.sendCommand.mockResolvedValueOnce(errorResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n const result = await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(1);\n expect(result.isJust()).toBe(true);\n expect(result.extract()).toStrictEqual(errorResult);\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAqC,oCACrCC,EAGO,2CAEPC,EAA6C,qEAC7CC,EAA+C,uEAC/CC,EAAyC,iEACzCC,EAAiC,yDAEjCC,EAAgD,6EAEhDC,EAGO,2CAEP,SAAS,gCAAiC,IAAM,CAC9C,MAAMC,KAAM,mCAAgC,EACtCC,KAAgB,wBAA0C,CAC9D,KAAM,MACR,CAAC,EACKC,KAAc,wBAA0C,CAC5D,KAAM,OACN,MAAO,CAAC,CACV,CAAC,EAED,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,MAAO,IAAM,CACpB,MAAMC,EAA0C,CAC9C,kBAAmB,CACjB,CACE,KAAM,uBAAqB,OAC3B,QAAS,cACX,EACA,CACE,KAAM,uBAAqB,gBAC3B,QAAS,8BACX,EACA,CACE,KAAM,uBAAqB,IAC3B,QAAS,QACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,YACX,CACF,EACA,UAAW,IACb,EACA,UAAU,IAAM,CACd,GAAG,gBAAgB,CACrB,CAAC,EACD,GAAG,yFAA0F,SAAY,CACvGH,EAAI,YAAY,kBAAkBC,CAAa,EAI/C,MAFa,IAAI,gCAA8BD,EAAKG,CAAI,EAE7C,IAAI,EAEf,OAAOH,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,OAAOA,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACpBC,GAAMA,EAAE,OAAS,uBAAqB,MACzC,EAAI,EACJ,OAAO,iBACL,IAAI,mBAAiB,CAAE,QAAS,cAAe,CAAC,CAClD,CACF,EACA,OAAOJ,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACpBC,GAAMA,EAAE,OAAS,uBAAqB,eACzC,EAAI,EACJ,OAAO,iBACL,IAAI,2BAAyB,CAC3B,QAAS,8BACX,CAAC,CACH,CACF,EACA,OAAOJ,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACpBC,GAAMA,EAAE,OAAS,uBAAqB,GACzC,EAAI,EACJ,OAAO,iBACL,IAAI,+BAA6B,CAAE,QAAS,QAAS,CAAC,CACxD,CACF,EACA,OAAOJ,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACpBC,GAAMA,EAAE,OAAS,uBAAqB,KACzC,EAAI,EACJ,OAAO,iBACL,IAAI,iCAA+B,CAAE,QAAS,YAAa,CAAC,CAC9D,CACF,CACF,CAAC,EACD,GAAG,yEAA0E,SAAY,CACvFJ,EAAI,YAAY,UAAU,EAC1BA,EAAI,YAAY,sBAAsBE,CAAW,EAIjD,MAAMG,EAAS,MAFF,IAAI,gCAA8BL,EAAKG,CAAI,EAE9B,IAAI,EAE9B,OAAOH,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,OAAOK,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjC,OAAOA,EAAO,QAAQ,CAAC,EAAE,cAAcH,CAAW,CACpD,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_context_module", "import_device_management_kit", "import_ProvideNFTInformationCommand", "import_ProvideTokenInformationCommand", "import_SetExternalPluginCommand", "import_SetPluginCommand", "import_makeInternalApi", "import_ProvideTransactionContextTask", "api", "successResult", "errorResult", "args", "c", "result"]
4
+ "sourcesContent": ["import { ClearSignContextType } from \"@ledgerhq/context-module\";\nimport {\n CommandResultFactory,\n hexaStringToBuffer,\n LoadCertificateCommand,\n type UnknownDeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport { ProvideTokenInformationCommand } from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport {\n ProvideTransactionContextTask,\n type ProvideTransactionContextTaskArgs,\n} from \"./ProvideTransactionContextTask\";\n\ndescribe(\"ProvideTransactionContextTask\", () => {\n const api = makeDeviceActionInternalApiMock();\n const successResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n });\n const errorResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n error: {} as UnknownDeviceExchangeError,\n });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n const args: ProvideTransactionContextTaskArgs = {\n clearSignContexts: [\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"706c7567696e\", // \"plugin\"\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"65787465726e616c506c7567696e\", // \"externalPlugin\"\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"6e6674\", // \"nft\"\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"746f6b656e\", // \"token\"\n },\n ],\n web3Check: null,\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should send relative commands when receiving ClearSignContexts of type not trustedName\", async () => {\n api.sendCommand.mockResolvedValue(successResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(4);\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetPluginCommand({ payload: \"706c7567696e\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.EXTERNAL_PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetExternalPluginCommand({\n payload: \"65787465726e616c506c7567696e\",\n }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.NFT,\n ) + 1,\n expect.objectContaining(\n new ProvideNFTInformationCommand({ payload: \"6e6674\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.TOKEN,\n ) + 1,\n expect.objectContaining(\n new ProvideTokenInformationCommand({ payload: \"746f6b656e\" }),\n ),\n );\n });\n\n it(\"should return the command error result and stop when the command fails\", async () => {\n api.sendCommand.mockResolvedValueOnce(errorResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n const result = await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(1);\n expect(result.isJust()).toBe(true);\n expect(result.extract()).toStrictEqual(errorResult);\n });\n\n it(\"should send the web3Check command when it is provided\", async () => {\n api.sendCommand.mockResolvedValue(successResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, {\n ...args,\n web3Check: {\n type: ClearSignContextType.WEB3_CHECK,\n payload: \"0x01020304\",\n certificate: {\n payload: new Uint8Array(),\n keyUsageNumber: 1,\n },\n },\n });\n // WHEN\n const result = await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(6);\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining(\n new LoadCertificateCommand({\n certificate: new Uint8Array(),\n keyUsage: 1,\n }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining(\n new ProvideWeb3CheckCommand({\n payload: hexaStringToBuffer(\"0x000401020304\")!,\n isFirstChunk: true,\n }),\n ),\n );\n expect(result.isJust()).toBe(false);\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,oCACrCC,EAKO,2CAEPC,EAA6C,qEAC7CC,EAA+C,uEAC/CC,EAAwC,gEACxCC,EAAyC,iEACzCC,EAAiC,yDAEjCC,EAAgD,6EAEhDC,EAGO,2CAEP,SAAS,gCAAiC,IAAM,CAC9C,MAAMC,KAAM,mCAAgC,EACtCC,KAAgB,wBAA0C,CAC9D,KAAM,MACR,CAAC,EACKC,KAAc,wBAA0C,CAC5D,KAAM,OACN,MAAO,CAAC,CACV,CAAC,EAED,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,SAAS,MAAO,IAAM,CACpB,MAAMC,EAA0C,CAC9C,kBAAmB,CACjB,CACE,KAAM,uBAAqB,OAC3B,QAAS,cACX,EACA,CACE,KAAM,uBAAqB,gBAC3B,QAAS,8BACX,EACA,CACE,KAAM,uBAAqB,IAC3B,QAAS,QACX,EACA,CACE,KAAM,uBAAqB,MAC3B,QAAS,YACX,CACF,EACA,UAAW,IACb,EAEA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,yFAA0F,SAAY,CACvGH,EAAI,YAAY,kBAAkBC,CAAa,EAI/C,MAFa,IAAI,gCAA8BD,EAAKG,CAAI,EAE7C,IAAI,EAEf,OAAOH,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,OAAOA,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACp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EAAE,wBACtB,EACA,OAAO,iBACL,IAAI,yBAAuB,CACzB,YAAa,IAAI,WACjB,SAAU,CACZ,CAAC,CACH,CACF,EACA,OAAOA,EAAI,WAAW,EAAE,wBACtB,EACA,OAAO,iBACL,IAAI,0BAAwB,CAC1B,WAAS,sBAAmB,gBAAgB,EAC5C,aAAc,EAChB,CAAC,CACH,CACF,EACA,OAAOK,EAAO,OAAO,CAAC,EAAE,KAAK,EAAK,CACpC,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_context_module", "import_device_management_kit", "import_ProvideNFTInformationCommand", "import_ProvideTokenInformationCommand", "import_ProvideWeb3CheckCommand", "import_SetExternalPluginCommand", "import_SetPluginCommand", "import_makeInternalApi", "import_ProvideTransactionContextTask", "api", "successResult", "errorResult", "args", "c", "result"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ClearSignContextType as t}from"@ledgerhq/context-module";import{CommandResultFactory as a,InvalidStatusWordError as i,isSuccessCommandResult as s,LoadCertificateCommand as d}from"@ledgerhq/device-management-kit";import{Just as m,Nothing as c}from"purify-ts";import{ProvideNFTInformationCommand as u}from"../../app-binder/command/ProvideNFTInformationCommand";import{ProvideTokenInformationCommand as p}from"../../app-binder/command/ProvideTokenInformationCommand";import{ProvideTrustedNameCommand as h}from"../../app-binder/command/ProvideTrustedNameCommand";import{ProvideWeb3CheckCommand as T}from"../../app-binder/command/ProvideWeb3CheckCommand";import{SetExternalPluginCommand as E}from"../../app-binder/command/SetExternalPluginCommand";import{SetPluginCommand as l}from"../../app-binder/command/SetPluginCommand";import{SendPayloadInChunksTask as C}from"./SendPayloadInChunksTask";class R{constructor(r,e){this.api=r;this.args=e}async run(){for(const r of this.args.clearSignContexts){const e=await this.provideContext(r);if(!s(e))return m(e)}if(this.args.web3Check){const r=await this.provideContext(this.args.web3Check);if(!s(r))return m(r)}return c}async provideContext({type:r,payload:e,certificate:o}){switch(o&&await this.api.sendCommand(new d({keyUsage:o.keyUsageNumber,certificate:o.payload})),r){case t.PLUGIN:return await this.api.sendCommand(new l({payload:e}));case t.EXTERNAL_PLUGIN:return await this.api.sendCommand(new E({payload:e}));case t.NFT:return await this.api.sendCommand(new u({payload:e}));case t.TOKEN:return await this.api.sendCommand(new p({payload:e}));case t.TRUSTED_NAME:return new C(this.api,{payload:e,commandFactory:n=>new h({data:n.chunkedData,isFirstChunk:n.isFirstChunk})}).run();case t.ENUM:case t.TRANSACTION_FIELD_DESCRIPTION:case t.TRANSACTION_INFO:return a({error:new i("The context type [EXTERNAL_PLUGIN] is not valid here")});case t.WEB3_CHECK:return new C(this.api,{payload:e,commandFactory:n=>new T({payload:n.chunkedData,isFirstChunk:n.isFirstChunk})}).run();default:{const n=r;return a({error:new i(`The context type [${n}] is not covered`)})}}}}export{R as ProvideTransactionContextTask};
1
+ import{ClearSignContextType as t}from"@ledgerhq/context-module";import{CommandResultFactory as a,InvalidStatusWordError as i,isSuccessCommandResult as s,LoadCertificateCommand as d}from"@ledgerhq/device-management-kit";import{Just as m,Nothing as c}from"purify-ts";import{ProvideNFTInformationCommand as u}from"../../app-binder/command/ProvideNFTInformationCommand";import{ProvideTokenInformationCommand as p}from"../../app-binder/command/ProvideTokenInformationCommand";import{ProvideTrustedNameCommand as h}from"../../app-binder/command/ProvideTrustedNameCommand";import{ProvideWeb3CheckCommand as T}from"../../app-binder/command/ProvideWeb3CheckCommand";import{SetExternalPluginCommand as E}from"../../app-binder/command/SetExternalPluginCommand";import{SetPluginCommand as l}from"../../app-binder/command/SetPluginCommand";import{SendPayloadInChunksTask as C}from"./SendPayloadInChunksTask";class R{constructor(r,e){this.api=r;this.args=e}async run(){if(this.args.web3Check){const r=await this.provideContext(this.args.web3Check);if(!s(r))return m(r)}for(const r of this.args.clearSignContexts){const e=await this.provideContext(r);if(!s(e))return m(e)}return c}async provideContext({type:r,payload:e,certificate:o}){switch(o&&await this.api.sendCommand(new d({keyUsage:o.keyUsageNumber,certificate:o.payload})),r){case t.PLUGIN:return await this.api.sendCommand(new l({payload:e}));case t.EXTERNAL_PLUGIN:return await this.api.sendCommand(new E({payload:e}));case t.NFT:return await this.api.sendCommand(new u({payload:e}));case t.TOKEN:return await this.api.sendCommand(new p({payload:e}));case t.TRUSTED_NAME:return new C(this.api,{payload:e,commandFactory:n=>new h({data:n.chunkedData,isFirstChunk:n.isFirstChunk})}).run();case t.ENUM:case t.TRANSACTION_FIELD_DESCRIPTION:case t.TRANSACTION_INFO:return a({error:new i("The context type [EXTERNAL_PLUGIN] is not valid here")});case t.WEB3_CHECK:return new C(this.api,{payload:e,commandFactory:n=>new T({payload:n.chunkedData,isFirstChunk:n.isFirstChunk})}).run();default:{const n=r;return a({error:new i(`The context type [${n}] is not covered`)})}}}}export{R as ProvideTransactionContextTask};
2
2
  //# sourceMappingURL=ProvideTransactionContextTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/ProvideTransactionContextTask.ts"],
4
- "sourcesContent": ["import {\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@ledgerhq/context-module\";\nimport {\n type CommandErrorResult,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n LoadCertificateCommand,\n} from \"@ledgerhq/device-management-kit\";\nimport { Just, type Maybe, Nothing } from \"purify-ts\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport {\n ProvideTokenInformationCommand,\n type ProvideTokenInformationCommandResponse,\n} from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { ProvideTrustedNameCommand } from \"@internal/app-binder/command/ProvideTrustedNameCommand\";\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nimport { SendPayloadInChunksTask } from \"./SendPayloadInChunksTask\";\n\nexport type ProvideTransactionContextTaskArgs = {\n /**\n * The valid clear sign contexts offerred by the `BuildTrancationContextTask`.\n */\n clearSignContexts: ClearSignContextSuccess[];\n web3Check: ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null;\n};\n\n/**\n * This task is responsible for providing the transaction context to the device.\n * It will send the 5 necessary commands:\n * - `SetPluginCommand` (single command)\n * - `SetExternalPluginCommand` (single command)\n * - `ProvideNFTInformationCommand` (single command)\n * - `ProvideTokenInformationCommand` (single command)\n * - `ProvideTrustedNameCommand` (__mulpitle commands__)\n *\n * The method `provideTrustedNameTask` is dedicated to send the multiple `ProvideTrustedNameCommand`.\n */\nexport class ProvideTransactionContextTask {\n constructor(\n private api: InternalApi,\n private args: ProvideTransactionContextTaskArgs,\n ) {}\n\n async run(): Promise<Maybe<CommandErrorResult<EthErrorCodes>>> {\n for (const context of this.args.clearSignContexts) {\n const res = await this.provideContext(context);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n if (this.args.web3Check) {\n const res = await this.provideContext(this.args.web3Check);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n return Nothing;\n }\n\n /**\n * This method will send a command according to the clear sign context type and return the command result if only one command\n * is sent, otherwise it will return the result of the `provideTrustedNameTask`.\n *\n * @param context The clear sign context to provide.\n * @returns A promise that resolves when the command is sent or result of the `provideTrustedNameTask`.\n */\n async provideContext({\n type,\n payload,\n certificate,\n }: ClearSignContextSuccess): Promise<\n CommandResult<void | ProvideTokenInformationCommandResponse, EthErrorCodes>\n > {\n // if a certificate is provided, we load it before sending the command\n if (certificate) {\n await this.api.sendCommand(\n new LoadCertificateCommand({\n keyUsage: certificate.keyUsageNumber,\n certificate: certificate.payload,\n }),\n );\n }\n\n switch (type) {\n case ClearSignContextType.PLUGIN: {\n return await this.api.sendCommand(new SetPluginCommand({ payload }));\n }\n case ClearSignContextType.EXTERNAL_PLUGIN: {\n return await this.api.sendCommand(\n new SetExternalPluginCommand({ payload }),\n );\n }\n case ClearSignContextType.NFT: {\n return await this.api.sendCommand(\n new ProvideNFTInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TOKEN: {\n return await this.api.sendCommand(\n new ProvideTokenInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TRUSTED_NAME: {\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideTrustedNameCommand({\n data: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n }\n case ClearSignContextType.ENUM:\n case ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION:\n case ClearSignContextType.TRANSACTION_INFO: {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n \"The context type [EXTERNAL_PLUGIN] is not valid here\",\n ),\n });\n }\n case ClearSignContextType.WEB3_CHECK:\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideWeb3CheckCommand({\n payload: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n default: {\n const uncoveredType: never = type;\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n `The context type [${uncoveredType}] is not covered`,\n ),\n });\n }\n }\n }\n}\n"],
5
- "mappings": "AAAA,OAEE,wBAAAA,MACK,2BACP,OAGE,wBAAAC,EAEA,0BAAAC,EACA,0BAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,QAAAC,EAAkB,WAAAC,MAAe,YAE1C,OAAS,gCAAAC,MAAoC,4DAC7C,OACE,kCAAAC,MAEK,8DACP,OAAS,6BAAAC,MAAiC,yDAC1C,OAAS,2BAAAC,MAA+B,uDACxC,OAAS,4BAAAC,MAAgC,wDACzC,OAAS,oBAAAC,MAAwB,gDAGjC,OAAS,2BAAAC,MAA+B,4BAqBjC,MAAMC,CAA8B,CACzC,YACUC,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAAy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ACT,sDACF,CACF,CAAC,EAEH,KAAKF,EAAqB,WACxB,OAAO,IAAIa,EAAwB,KAAK,IAAK,CAC3C,QAAAO,EACA,eAAiBJ,GACf,IAAIN,EAAwB,CAC1B,QAASM,EAAK,YACd,aAAcA,EAAK,YACrB,CAAC,CACL,CAAC,EAAE,IAAI,EACT,QAAS,CACP,MAAMM,EAAuBH,EAC7B,OAAOlB,EAAqB,CAC1B,MAAO,IAAIC,EACT,qBAAqBoB,CAAa,kBACpC,CACF,CAAC,CACH,CACF,CACF,CACF",
6
- "names": ["ClearSignContextType", "CommandResultFactory", "InvalidStatusWordError", "isSuccessCommandResult", "LoadCertificateCommand", "Just", "Nothing", "ProvideNFTInformationCommand", "ProvideTokenInformationCommand", "ProvideTrustedNameCommand", "ProvideWeb3CheckCommand", "SetExternalPluginCommand", "SetPluginCommand", "SendPayloadInChunksTask", "ProvideTransactionContextTask", "api", "args", "context", "res", "type", "payload", "certificate", "uncoveredType"]
4
+ "sourcesContent": ["import {\n type ClearSignContextSuccess,\n ClearSignContextType,\n} from \"@ledgerhq/context-module\";\nimport {\n type CommandErrorResult,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n LoadCertificateCommand,\n} from \"@ledgerhq/device-management-kit\";\nimport { Just, type Maybe, Nothing } from \"purify-ts\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport {\n ProvideTokenInformationCommand,\n type ProvideTokenInformationCommandResponse,\n} from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { ProvideTrustedNameCommand } from \"@internal/app-binder/command/ProvideTrustedNameCommand\";\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\n\nimport { SendPayloadInChunksTask } from \"./SendPayloadInChunksTask\";\n\nexport type ProvideTransactionContextTaskArgs = {\n /**\n * The valid clear sign contexts offerred by the `BuildTrancationContextTask`.\n */\n clearSignContexts: ClearSignContextSuccess[];\n web3Check: ClearSignContextSuccess<ClearSignContextType.WEB3_CHECK> | null;\n};\n\n/**\n * This task is responsible for providing the transaction context to the device.\n * It will send the 5 necessary commands:\n * - `SetPluginCommand` (single command)\n * - `SetExternalPluginCommand` (single command)\n * - `ProvideNFTInformationCommand` (single command)\n * - `ProvideTokenInformationCommand` (single command)\n * - `ProvideTrustedNameCommand` (__mulpitle commands__)\n *\n * The method `provideTrustedNameTask` is dedicated to send the multiple `ProvideTrustedNameCommand`.\n */\nexport class ProvideTransactionContextTask {\n constructor(\n private api: InternalApi,\n private args: ProvideTransactionContextTaskArgs,\n ) {}\n\n async run(): Promise<Maybe<CommandErrorResult<EthErrorCodes>>> {\n if (this.args.web3Check) {\n const res = await this.provideContext(this.args.web3Check);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n for (const context of this.args.clearSignContexts) {\n const res = await this.provideContext(context);\n if (!isSuccessCommandResult(res)) {\n return Just(res);\n }\n }\n return Nothing;\n }\n\n /**\n * This method will send a command according to the clear sign context type and return the command result if only one command\n * is sent, otherwise it will return the result of the `provideTrustedNameTask`.\n *\n * @param context The clear sign context to provide.\n * @returns A promise that resolves when the command is sent or result of the `provideTrustedNameTask`.\n */\n async provideContext({\n type,\n payload,\n certificate,\n }: ClearSignContextSuccess): Promise<\n CommandResult<void | ProvideTokenInformationCommandResponse, EthErrorCodes>\n > {\n // if a certificate is provided, we load it before sending the command\n if (certificate) {\n await this.api.sendCommand(\n new LoadCertificateCommand({\n keyUsage: certificate.keyUsageNumber,\n certificate: certificate.payload,\n }),\n );\n }\n\n switch (type) {\n case ClearSignContextType.PLUGIN: {\n return await this.api.sendCommand(new SetPluginCommand({ payload }));\n }\n case ClearSignContextType.EXTERNAL_PLUGIN: {\n return await this.api.sendCommand(\n new SetExternalPluginCommand({ payload }),\n );\n }\n case ClearSignContextType.NFT: {\n return await this.api.sendCommand(\n new ProvideNFTInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TOKEN: {\n return await this.api.sendCommand(\n new ProvideTokenInformationCommand({ payload }),\n );\n }\n case ClearSignContextType.TRUSTED_NAME: {\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideTrustedNameCommand({\n data: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n }\n case ClearSignContextType.ENUM:\n case ClearSignContextType.TRANSACTION_FIELD_DESCRIPTION:\n case ClearSignContextType.TRANSACTION_INFO: {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n \"The context type [EXTERNAL_PLUGIN] is not valid here\",\n ),\n });\n }\n case ClearSignContextType.WEB3_CHECK:\n return new SendPayloadInChunksTask(this.api, {\n payload,\n commandFactory: (args) =>\n new ProvideWeb3CheckCommand({\n payload: args.chunkedData,\n isFirstChunk: args.isFirstChunk,\n }),\n }).run();\n default: {\n const uncoveredType: never = type;\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n `The context type [${uncoveredType}] is not covered`,\n ),\n });\n }\n }\n }\n}\n"],
5
+ "mappings": "AAAA,OAEE,wBAAAA,MACK,2BACP,OAGE,wBAAAC,EAEA,0BAAAC,EACA,0BAAAC,EACA,0BAAAC,MACK,kCACP,OAAS,QAAAC,EAAkB,WAAAC,MAAe,YAE1C,OAAS,gCAAAC,MAAoC,4DAC7C,OACE,kCAAAC,MAEK,8DACP,OAAS,6BAAAC,MAAiC,yDAC1C,OAAS,2BAAAC,MAA+B,uDACxC,OAAS,4BAAAC,MAAgC,wDACzC,OAAS,oBAAAC,MAAwB,gDAGjC,OAAS,2BAAAC,MAA+B,4BAqBjC,MAAMC,CAA8B,CACzC,YACUC,EACAC,EACR,CAFQ,SAAAD,EACA,UAAAC,CACP,CAEH,MAAM,KAA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,EACT,sDACF,CACF,CAAC,EAEH,KAAKF,EAAqB,WACxB,OAAO,IAAIa,EAAwB,KAAK,IAAK,CAC3C,QAAAO,EACA,eAAiBJ,GACf,IAAIN,EAAwB,CAC1B,QAASM,EAAK,YACd,aAAcA,EAAK,YACrB,CAAC,CACL,CAAC,EAAE,IAAI,EACT,QAAS,CACP,MAAMM,EAAuBH,EAC7B,OAAOlB,EAAqB,CAC1B,MAAO,IAAIC,EACT,qBAAqBoB,CAAa,kBACpC,CACF,CAAC,CACH,CACF,CACF,CACF",
6
+ "names": ["ClearSignContextType", "CommandResultFactory", "InvalidStatusWordError", "isSuccessCommandResult", "LoadCertificateCommand", "Just", "Nothing", "ProvideNFTInformationCommand", "ProvideTokenInformationCommand", "ProvideTrustedNameCommand", "ProvideWeb3CheckCommand", "SetExternalPluginCommand", "SetPluginCommand", "SendPayloadInChunksTask", "ProvideTransactionContextTask", "api", "args", "res", "context", "type", "payload", "certificate", "uncoveredType"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{ClearSignContextType as n}from"@ledgerhq/context-module";import{CommandResultFactory as r}from"@ledgerhq/device-management-kit";import{ProvideNFTInformationCommand as c}from"../../app-binder/command/ProvideNFTInformationCommand";import{ProvideTokenInformationCommand as m}from"../../app-binder/command/ProvideTokenInformationCommand";import{SetExternalPluginCommand as l}from"../../app-binder/command/SetExternalPluginCommand";import{SetPluginCommand as p}from"../../app-binder/command/SetPluginCommand";import{makeDeviceActionInternalApiMock as C}from"../../app-binder/device-action/__test-utils__/makeInternalApi";import{ProvideTransactionContextTask as d}from"./ProvideTransactionContextTask";describe("ProvideTransactionContextTask",()=>{const e=C(),i=r({data:void 0}),a=r({data:void 0,error:{}});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{const o={clearSignContexts:[{type:n.PLUGIN,payload:"706c7567696e"},{type:n.EXTERNAL_PLUGIN,payload:"65787465726e616c506c7567696e"},{type:n.NFT,payload:"6e6674"},{type:n.TOKEN,payload:"746f6b656e"}],web3Check:null};afterEach(()=>{vi.restoreAllMocks()}),it("should send relative commands when receiving ClearSignContexts of type not trustedName",async()=>{e.sendCommand.mockResolvedValue(i),await new d(e,o).run(),expect(e.sendCommand).toHaveBeenCalledTimes(4),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.PLUGIN)+1,expect.objectContaining(new p({payload:"706c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.EXTERNAL_PLUGIN)+1,expect.objectContaining(new l({payload:"65787465726e616c506c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.NFT)+1,expect.objectContaining(new c({payload:"6e6674"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.TOKEN)+1,expect.objectContaining(new m({payload:"746f6b656e"})))}),it("should return the command error result and stop when the command fails",async()=>{e.sendCommand.mockReset(),e.sendCommand.mockResolvedValueOnce(a);const t=await new d(e,o).run();expect(e.sendCommand).toHaveBeenCalledTimes(1),expect(t.isJust()).toBe(!0),expect(t.extract()).toStrictEqual(a)})})});
1
+ import{ClearSignContextType as n}from"@ledgerhq/context-module";import{CommandResultFactory as s,hexaStringToBuffer as c,LoadCertificateCommand as m}from"@ledgerhq/device-management-kit";import{ProvideNFTInformationCommand as l}from"../../app-binder/command/ProvideNFTInformationCommand";import{ProvideTokenInformationCommand as C}from"../../app-binder/command/ProvideTokenInformationCommand";import{ProvideWeb3CheckCommand as p}from"../../app-binder/command/ProvideWeb3CheckCommand";import{SetExternalPluginCommand as x}from"../../app-binder/command/SetExternalPluginCommand";import{SetPluginCommand as h}from"../../app-binder/command/SetPluginCommand";import{makeDeviceActionInternalApiMock as y}from"../../app-binder/device-action/__test-utils__/makeInternalApi";import{ProvideTransactionContextTask as a}from"./ProvideTransactionContextTask";describe("ProvideTransactionContextTask",()=>{const e=y(),r=s({data:void 0}),i=s({data:void 0,error:{}});beforeEach(()=>{vi.resetAllMocks()}),describe("run",()=>{const o={clearSignContexts:[{type:n.PLUGIN,payload:"706c7567696e"},{type:n.EXTERNAL_PLUGIN,payload:"65787465726e616c506c7567696e"},{type:n.NFT,payload:"6e6674"},{type:n.TOKEN,payload:"746f6b656e"}],web3Check:null};beforeEach(()=>{vi.resetAllMocks()}),it("should send relative commands when receiving ClearSignContexts of type not trustedName",async()=>{e.sendCommand.mockResolvedValue(r),await new a(e,o).run(),expect(e.sendCommand).toHaveBeenCalledTimes(4),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.PLUGIN)+1,expect.objectContaining(new h({payload:"706c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.EXTERNAL_PLUGIN)+1,expect.objectContaining(new x({payload:"65787465726e616c506c7567696e"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.NFT)+1,expect.objectContaining(new l({payload:"6e6674"}))),expect(e.sendCommand).toHaveBeenNthCalledWith(o.clearSignContexts.findIndex(t=>t.type===n.TOKEN)+1,expect.objectContaining(new C({payload:"746f6b656e"})))}),it("should return the command error result and stop when the command fails",async()=>{e.sendCommand.mockResolvedValueOnce(i);const t=await new a(e,o).run();expect(e.sendCommand).toHaveBeenCalledTimes(1),expect(t.isJust()).toBe(!0),expect(t.extract()).toStrictEqual(i)}),it("should send the web3Check command when it is provided",async()=>{e.sendCommand.mockResolvedValue(r);const t=await new a(e,{...o,web3Check:{type:n.WEB3_CHECK,payload:"0x01020304",certificate:{payload:new Uint8Array,keyUsageNumber:1}}}).run();expect(e.sendCommand).toHaveBeenCalledTimes(6),expect(e.sendCommand).toHaveBeenNthCalledWith(1,expect.objectContaining(new m({certificate:new Uint8Array,keyUsage:1}))),expect(e.sendCommand).toHaveBeenNthCalledWith(2,expect.objectContaining(new p({payload:c("0x000401020304"),isFirstChunk:!0}))),expect(t.isJust()).toBe(!1)})})});
2
2
  //# sourceMappingURL=ProvideTransactionContextTask.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/ProvideTransactionContextTask.test.ts"],
4
- "sourcesContent": ["import { ClearSignContextType } from \"@ledgerhq/context-module\";\nimport {\n CommandResultFactory,\n type UnknownDeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport { ProvideTokenInformationCommand } from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport {\n ProvideTransactionContextTask,\n type ProvideTransactionContextTaskArgs,\n} from \"./ProvideTransactionContextTask\";\n\ndescribe(\"ProvideTransactionContextTask\", () => {\n const api = makeDeviceActionInternalApiMock();\n const successResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n });\n const errorResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n error: {} as UnknownDeviceExchangeError,\n });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n const args: ProvideTransactionContextTaskArgs = {\n clearSignContexts: [\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"706c7567696e\", // \"plugin\"\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"65787465726e616c506c7567696e\", // \"externalPlugin\"\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"6e6674\", // \"nft\"\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"746f6b656e\", // \"token\"\n },\n ],\n web3Check: null,\n };\n afterEach(() => {\n vi.restoreAllMocks();\n });\n it(\"should send relative commands when receiving ClearSignContexts of type not trustedName\", async () => {\n api.sendCommand.mockResolvedValue(successResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(4);\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetPluginCommand({ payload: \"706c7567696e\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.EXTERNAL_PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetExternalPluginCommand({\n payload: \"65787465726e616c506c7567696e\",\n }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.NFT,\n ) + 1,\n expect.objectContaining(\n new ProvideNFTInformationCommand({ payload: \"6e6674\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.TOKEN,\n ) + 1,\n expect.objectContaining(\n new ProvideTokenInformationCommand({ payload: \"746f6b656e\" }),\n ),\n );\n });\n it(\"should return the command error result and stop when the command fails\", async () => {\n api.sendCommand.mockReset();\n api.sendCommand.mockResolvedValueOnce(errorResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n const result = await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(1);\n expect(result.isJust()).toBe(true);\n expect(result.extract()).toStrictEqual(errorResult);\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,wBAAAA,MAA4B,2BACrC,OACE,wBAAAC,MAEK,kCAEP,OAAS,gCAAAC,MAAoC,4DAC7C,OAAS,kCAAAC,MAAsC,8DAC/C,OAAS,4BAAAC,MA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CAAE,QAAS,QAAS,CAAC,CACxD,CACF,EACA,OAAOM,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACpBC,GAAMA,EAAE,OAASZ,EAAqB,KACzC,EAAI,EACJ,OAAO,iBACL,IAAIG,EAA+B,CAAE,QAAS,YAAa,CAAC,CAC9D,CACF,CACF,CAAC,EACD,GAAG,yEAA0E,SAAY,CACvFK,EAAI,YAAY,UAAU,EAC1BA,EAAI,YAAY,sBAAsBE,CAAW,EAIjD,MAAMG,EAAS,MAFF,IAAIN,EAA8BC,EAAKG,CAAI,EAE9B,IAAI,EAE9B,OAAOH,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,OAAOK,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjC,OAAOA,EAAO,QAAQ,CAAC,EAAE,cAAcH,CAAW,CACpD,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["ClearSignContextType", "CommandResultFactory", "ProvideNFTInformationCommand", "ProvideTokenInformationCommand", "SetExternalPluginCommand", "SetPluginCommand", "makeDeviceActionInternalApiMock", "ProvideTransactionContextTask", "api", "successResult", "errorResult", "args", "c", "result"]
4
+ "sourcesContent": ["import { ClearSignContextType } from \"@ledgerhq/context-module\";\nimport {\n CommandResultFactory,\n hexaStringToBuffer,\n LoadCertificateCommand,\n type UnknownDeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { ProvideNFTInformationCommand } from \"@internal/app-binder/command/ProvideNFTInformationCommand\";\nimport { ProvideTokenInformationCommand } from \"@internal/app-binder/command/ProvideTokenInformationCommand\";\nimport { ProvideWeb3CheckCommand } from \"@internal/app-binder/command/ProvideWeb3CheckCommand\";\nimport { SetExternalPluginCommand } from \"@internal/app-binder/command/SetExternalPluginCommand\";\nimport { SetPluginCommand } from \"@internal/app-binder/command/SetPluginCommand\";\nimport { type EthErrorCodes } from \"@internal/app-binder/command/utils/ethAppErrors\";\nimport { makeDeviceActionInternalApiMock } from \"@internal/app-binder/device-action/__test-utils__/makeInternalApi\";\n\nimport {\n ProvideTransactionContextTask,\n type ProvideTransactionContextTaskArgs,\n} from \"./ProvideTransactionContextTask\";\n\ndescribe(\"ProvideTransactionContextTask\", () => {\n const api = makeDeviceActionInternalApiMock();\n const successResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n });\n const errorResult = CommandResultFactory<void, EthErrorCodes>({\n data: undefined,\n error: {} as UnknownDeviceExchangeError,\n });\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n describe(\"run\", () => {\n const args: ProvideTransactionContextTaskArgs = {\n clearSignContexts: [\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"706c7567696e\", // \"plugin\"\n },\n {\n type: ClearSignContextType.EXTERNAL_PLUGIN,\n payload: \"65787465726e616c506c7567696e\", // \"externalPlugin\"\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"6e6674\", // \"nft\"\n },\n {\n type: ClearSignContextType.TOKEN,\n payload: \"746f6b656e\", // \"token\"\n },\n ],\n web3Check: null,\n };\n\n beforeEach(() => {\n vi.resetAllMocks();\n });\n\n it(\"should send relative commands when receiving ClearSignContexts of type not trustedName\", async () => {\n api.sendCommand.mockResolvedValue(successResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(4);\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetPluginCommand({ payload: \"706c7567696e\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.EXTERNAL_PLUGIN,\n ) + 1,\n expect.objectContaining(\n new SetExternalPluginCommand({\n payload: \"65787465726e616c506c7567696e\",\n }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.NFT,\n ) + 1,\n expect.objectContaining(\n new ProvideNFTInformationCommand({ payload: \"6e6674\" }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n args.clearSignContexts.findIndex(\n (c) => c.type === ClearSignContextType.TOKEN,\n ) + 1,\n expect.objectContaining(\n new ProvideTokenInformationCommand({ payload: \"746f6b656e\" }),\n ),\n );\n });\n\n it(\"should return the command error result and stop when the command fails\", async () => {\n api.sendCommand.mockResolvedValueOnce(errorResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, args);\n // WHEN\n const result = await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(1);\n expect(result.isJust()).toBe(true);\n expect(result.extract()).toStrictEqual(errorResult);\n });\n\n it(\"should send the web3Check command when it is provided\", async () => {\n api.sendCommand.mockResolvedValue(successResult);\n // GIVEN\n const task = new ProvideTransactionContextTask(api, {\n ...args,\n web3Check: {\n type: ClearSignContextType.WEB3_CHECK,\n payload: \"0x01020304\",\n certificate: {\n payload: new Uint8Array(),\n keyUsageNumber: 1,\n },\n },\n });\n // WHEN\n const result = await task.run();\n // THEN\n expect(api.sendCommand).toHaveBeenCalledTimes(6);\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining(\n new LoadCertificateCommand({\n certificate: new Uint8Array(),\n keyUsage: 1,\n }),\n ),\n );\n expect(api.sendCommand).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining(\n new ProvideWeb3CheckCommand({\n payload: hexaStringToBuffer(\"0x000401020304\")!,\n isFirstChunk: true,\n }),\n ),\n );\n expect(result.isJust()).toBe(false);\n });\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,wBAAAA,MAA4B,2BACrC,OACE,wBAAAC,EACA,sBAAAC,EACA,0BAAAC,MAEK,kCAEP,OAAS,gCAAAC,MAAoC,4DAC7C,OAAS,kCAAAC,MAAsC,8DAC/C,OAAS,2BAAAC,MAA+B,uDACxC,OAAS,4BAAAC,M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AE,QAAS,QAAS,CAAC,CACxD,CACF,EACA,OAAOO,EAAI,WAAW,EAAE,wBACtBG,EAAK,kBAAkB,UACpBC,GAAMA,EAAE,OAASf,EAAqB,KACzC,EAAI,EACJ,OAAO,iBACL,IAAIK,EAA+B,CAAE,QAAS,YAAa,CAAC,CAC9D,CACF,CACF,CAAC,EAED,GAAG,yEAA0E,SAAY,CACvFM,EAAI,YAAY,sBAAsBE,CAAW,EAIjD,MAAMG,EAAS,MAFF,IAAIN,EAA8BC,EAAKG,CAAI,EAE9B,IAAI,EAE9B,OAAOH,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,OAAOK,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjC,OAAOA,EAAO,QAAQ,CAAC,EAAE,cAAcH,CAAW,CACpD,CAAC,EAED,GAAG,wDAAyD,SAAY,CACtEF,EAAI,YAAY,kBAAkBC,CAAa,EAc/C,MAAMI,EAAS,MAZF,IAAIN,EAA8BC,EAAK,CAClD,GAAGG,EACH,UAAW,CACT,KAAMd,EAAqB,WAC3B,QAAS,aACT,YAAa,CACX,QAAS,IAAI,WACb,eAAgB,CAClB,CACF,CACF,CAAC,EAEyB,IAAI,EAE9B,OAAOW,EAAI,WAAW,EAAE,sBAAsB,CAAC,EAC/C,OAAOA,EAAI,WAAW,EAAE,wBACtB,EACA,OAAO,iBACL,IAAIR,EAAuB,CACzB,YAAa,IAAI,WACjB,SAAU,CACZ,CAAC,CACH,CACF,EACA,OAAOQ,EAAI,WAAW,EAAE,wBACtB,EACA,OAAO,iBACL,IAAIL,EAAwB,CAC1B,QAASJ,EAAmB,gBAAgB,EAC5C,aAAc,EAChB,CAAC,CACH,CACF,EACA,OAAOc,EAAO,OAAO,CAAC,EAAE,KAAK,EAAK,CACpC,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["ClearSignContextType", "CommandResultFactory", "hexaStringToBuffer", "LoadCertificateCommand", "ProvideNFTInformationCommand", "ProvideTokenInformationCommand", "ProvideWeb3CheckCommand", "SetExternalPluginCommand", "SetPluginCommand", "makeDeviceActionInternalApiMock", "ProvideTransactionContextTask", "api", "successResult", "errorResult", "args", "c", "result"]
7
7
  }