@ledgerhq/device-signer-kit-ethereum 0.0.0-ledger-button-20250905004746 → 0.0.0-ledger-button-20250905011628

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/cjs/api/SignerEthBuilder.test.js +1 -1
  2. package/lib/cjs/api/SignerEthBuilder.test.js.map +1 -1
  3. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  4. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.js.map +3 -3
  5. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.js +1 -1
  6. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.js.map +3 -3
  7. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  8. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  9. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.js +1 -1
  10. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.js.map +3 -3
  11. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.test.js +1 -1
  12. package/lib/cjs/internal/app-binder/task/SendPayloadInChunksTask.test.js.map +3 -3
  13. package/lib/esm/api/SignerEthBuilder.test.js +1 -1
  14. package/lib/esm/api/SignerEthBuilder.test.js.map +1 -1
  15. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js +1 -1
  16. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.js.map +3 -3
  17. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.js +1 -1
  18. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.js.map +3 -3
  19. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  20. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  21. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.js +1 -1
  22. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.js.map +3 -3
  23. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.test.js +1 -1
  24. package/lib/esm/internal/app-binder/task/SendPayloadInChunksTask.test.js.map +3 -3
  25. package/lib/types/internal/app-binder/task/BuildTransactionContextTask.d.ts.map +1 -1
  26. package/lib/types/internal/app-binder/task/ProvideTransactionContextTask.d.ts.map +1 -1
  27. package/lib/types/internal/app-binder/task/SendPayloadInChunksTask.d.ts +0 -1
  28. package/lib/types/internal/app-binder/task/SendPayloadInChunksTask.d.ts.map +1 -1
  29. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  30. package/package.json +8 -8
  31. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.js +0 -2
  32. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.js.map +0 -7
  33. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js +0 -2
  34. package/lib/cjs/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js.map +0 -7
  35. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.js +0 -2
  36. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.js.map +0 -7
  37. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js +0 -2
  38. package/lib/esm/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.js.map +0 -7
  39. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.d.ts +0 -28
  40. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.d.ts.map +0 -1
  41. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.d.ts +0 -2
  42. package/lib/types/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/device-signer-kit-ethereum",
3
- "version": "0.0.0-ledger-button-20250905004746",
3
+ "version": "0.0.0-ledger-button-20250905011628",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
@@ -25,23 +25,23 @@
25
25
  "reflect-metadata": "0.2.2",
26
26
  "semver": "7.7.2",
27
27
  "xstate": "5.19.2",
28
- "@ledgerhq/signer-utils": "0.0.0-ledger-button-20250905004746"
28
+ "@ledgerhq/signer-utils": "0.0.0-ledger-button-20250905011628"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/semver": "7.7.0",
32
32
  "rxjs": "7.8.2",
33
33
  "ts-node": "10.9.2",
34
- "@ledgerhq/context-module": "0.0.0-ledger-button-20250905004746",
35
- "@ledgerhq/device-management-kit": "0.0.0-ledger-button-20250905004746",
34
+ "@ledgerhq/context-module": "0.0.0-ledger-button-20250905011628",
35
+ "@ledgerhq/device-management-kit": "0.0.0-ledger-button-20250905011628",
36
36
  "@ledgerhq/ldmk-tool": "0.0.1",
37
37
  "@ledgerhq/eslint-config-dsdk": "0.0.2",
38
38
  "@ledgerhq/prettier-config-dsdk": "0.0.2",
39
- "@ledgerhq/tsconfig-dsdk": "1.0.1",
40
- "@ledgerhq/vitest-config-dmk": "0.0.0"
39
+ "@ledgerhq/vitest-config-dmk": "0.0.0",
40
+ "@ledgerhq/tsconfig-dsdk": "1.0.1"
41
41
  },
42
42
  "peerDependencies": {
43
- "@ledgerhq/context-module": "0.0.0-ledger-button-20250905004746",
44
- "@ledgerhq/device-management-kit": "0.0.0-ledger-button-20250905004746"
43
+ "@ledgerhq/context-module": "0.0.0-ledger-button-20250905011628",
44
+ "@ledgerhq/device-management-kit": "0.0.0-ledger-button-20250905011628"
45
45
  },
46
46
  "scripts": {
47
47
  "prebuild": "rimraf lib",
@@ -1,2 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var A=(e,r)=>{for(var o in r)n(e,o,{get:r[o],enumerable:!0})},g=(e,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of l(r))!C.call(e,t)&&t!==o&&n(e,t,{get:()=>r[t],enumerable:!(i=u(r,t))||i.enumerable});return e};var y=e=>g(n({},"__esModule",{value:!0}),e);var f={};A(f,{NetworkConfigurationType:()=>m,ProvideNetworkConfigurationCommand:()=>E});module.exports=y(f);var d=require("@ledgerhq/device-management-kit"),s=require("@ledgerhq/signer-utils"),p=require("purify-ts"),a=require("./utils/ethAppErrors"),m=(o=>(o[o.CONFIGURATION=0]="CONFIGURATION",o[o.ICON=1]="ICON",o))(m||{});class E{constructor(r){this.args=r}errorHelper=new s.CommandErrorHelper(a.ETH_APP_ERRORS,a.EthAppCommandErrorFactory);getApdu(){const r={cla:224,ins:48,p1:this.args.isFirstChunk?1:0,p2:this.args.configurationType};return new d.ApduBuilder(r).addBufferToData(this.args.data).build()}parseResponse(r){return p.Maybe.fromNullable(this.errorHelper.getError(r)).orDefault((0,d.CommandResultFactory)({data:void 0}))}}0&&(module.exports={NetworkConfigurationType,ProvideNetworkConfigurationCommand});
2
- //# sourceMappingURL=ProvideNetworkConfigurationCommand.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.ts"],
4
- "sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-network-configuration\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum NetworkConfigurationType {\n CONFIGURATION = 0x00,\n ICON = 0x01,\n}\n\nexport type ProvideNetworkConfigurationCommandArgs = {\n /**\n * The network configuration data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the network configuration\n */\n readonly isFirstChunk: boolean;\n /**\n * The type of network configuration being provided\n */\n readonly configurationType: NetworkConfigurationType;\n};\n\nexport class ProvideNetworkConfigurationCommand\n implements\n Command<void, ProvideNetworkConfigurationCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideNetworkConfigurationCommandArgs) {}\n\n getApdu(): Apdu {\n const provideNetworkConfigurationArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x30,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: this.args.configurationType,\n };\n\n return new ApduBuilder(provideNetworkConfigurationArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,uCAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAEtBC,EAIO,gCAEKN,OACVA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,KAAO,GAAP,OAFUA,OAAA,IAoBL,MAAMC,CAGb,CAME,YAA6BM,EAA8C,CAA9C,UAAAA,CAA+C,CAL3D,YAAc,IAAI,qBACjC,iBACA,2BACF,EAIA,SAAgB,CACd,MAAMC,EAAmD,CACvD,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,KAAK,KAAK,iBAChB,EAEA,OAAO,IAAI,cAAYA,CAA+B,EACnD,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAO,QAAM,aAAa,KAAK,YAAY,SAASA,CAAQ,CAAC,EAAE,aAC7D,wBAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
6
- "names": ["ProvideNetworkConfigurationCommand_exports", "__export", "NetworkConfigurationType", "ProvideNetworkConfigurationCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ethAppErrors", "args", "provideNetworkConfigurationArgs", "response"]
7
- }
@@ -1,2 +0,0 @@
1
- "use strict";var n=require("@ledgerhq/device-management-kit"),s=require("./utils/ethAppErrors"),r=require("./ProvideNetworkConfigurationCommand");describe("ProvideNetworkConfigurationCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const t={data:Uint8Array.from([1,2,3]),isFirstChunk:!0,configurationType:r.NetworkConfigurationType.CONFIGURATION},e=new r.ProvideNetworkConfigurationCommand(t).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,48,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const t={data:Uint8Array.from([4,5,6]),isFirstChunk:!1,configurationType:r.NetworkConfigurationType.CONFIGURATION},e=new r.ProvideNetworkConfigurationCommand(t).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,48,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const t={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},e=new r.ProvideNetworkConfigurationCommand({data:new Uint8Array(0),isFirstChunk:!0,configurationType:r.NetworkConfigurationType.CONFIGURATION}).parseResponse(t);if((0,n.isSuccessCommandResult)(e))throw new Error("Expected an error");expect(e.error).toBeDefined(),expect(e.error).toBeInstanceOf(s.EthAppCommandError)}),it("should return a success result if the response status code is valid",()=>{const t={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},e=new r.ProvideNetworkConfigurationCommand({data:new Uint8Array(0),isFirstChunk:!0,configurationType:r.NetworkConfigurationType.CONFIGURATION}).parseResponse(t);if((0,n.isSuccessCommandResult)(e))expect(e.data).toBeUndefined();else throw new Error("Expected a success result")})})});
2
- //# sourceMappingURL=ProvideNetworkConfigurationCommand.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.ts"],
4
- "sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n NetworkConfigurationType,\n ProvideNetworkConfigurationCommand,\n type ProvideNetworkConfigurationCommandArgs,\n} from \"./ProvideNetworkConfigurationCommand\";\n\ndescribe(\"ProvideNetworkConfigurationCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAmC,gCACnCC,EAIO,gDAEP,SAAS,qCAAsC,IAAM,CACnD,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAA+C,CACnD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,GACd,kBAAmB,2BAAyB,aAC9C,EAIMC,EADU,IAAI,qCAAmCD,CAAI,EACtC,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAA+C,CACnD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,GACd,kBAAmB,2BAAyB,aAC9C,EAIMC,EADU,IAAI,qCAAmCD,CAAI,EACtC,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAI,qCAAmC,CACrD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,kBAAmB,2BAAyB,aAC9C,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAI,0BAAuBC,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAe,oBAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMD,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAI,qCAAmC,CACrD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,kBAAmB,2BAAyB,aAC9C,CAAC,EACsB,cAAcD,CAAQ,EAG7C,MAAK,0BAAuBC,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_ethAppErrors", "import_ProvideNetworkConfigurationCommand", "args", "apdu", "response", "result"]
7
- }
@@ -1,2 +0,0 @@
1
- import{ApduBuilder as e,CommandResultFactory as t}from"@ledgerhq/device-management-kit";import{CommandErrorHelper as d}from"@ledgerhq/signer-utils";import{Maybe as a}from"purify-ts";import{ETH_APP_ERRORS as n,EthAppCommandErrorFactory as i}from"./utils/ethAppErrors";var s=(o=>(o[o.CONFIGURATION=0]="CONFIGURATION",o[o.ICON=1]="ICON",o))(s||{});class A{constructor(r){this.args=r}errorHelper=new d(n,i);getApdu(){const r={cla:224,ins:48,p1:this.args.isFirstChunk?1:0,p2:this.args.configurationType};return new e(r).addBufferToData(this.args.data).build()}parseResponse(r){return a.fromNullable(this.errorHelper.getError(r)).orDefault(t({data:void 0}))}}export{s as NetworkConfigurationType,A as ProvideNetworkConfigurationCommand};
2
- //# sourceMappingURL=ProvideNetworkConfigurationCommand.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.ts"],
4
- "sourcesContent": ["// https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.adoc#provide-network-configuration\nimport {\n type Apdu,\n ApduBuilder,\n type ApduBuilderArgs,\n type ApduResponse,\n type Command,\n type CommandResult,\n CommandResultFactory,\n} from \"@ledgerhq/device-management-kit\";\nimport { CommandErrorHelper } from \"@ledgerhq/signer-utils\";\nimport { Maybe } from \"purify-ts\";\n\nimport {\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n type EthErrorCodes,\n} from \"./utils/ethAppErrors\";\n\nexport enum NetworkConfigurationType {\n CONFIGURATION = 0x00,\n ICON = 0x01,\n}\n\nexport type ProvideNetworkConfigurationCommandArgs = {\n /**\n * The network configuration data to provide in chunks\n */\n readonly data: Uint8Array;\n /**\n * If this is the first chunk of the network configuration\n */\n readonly isFirstChunk: boolean;\n /**\n * The type of network configuration being provided\n */\n readonly configurationType: NetworkConfigurationType;\n};\n\nexport class ProvideNetworkConfigurationCommand\n implements\n Command<void, ProvideNetworkConfigurationCommandArgs, EthErrorCodes>\n{\n private readonly errorHelper = new CommandErrorHelper<void, EthErrorCodes>(\n ETH_APP_ERRORS,\n EthAppCommandErrorFactory,\n );\n\n constructor(private readonly args: ProvideNetworkConfigurationCommandArgs) {}\n\n getApdu(): Apdu {\n const provideNetworkConfigurationArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x30,\n p1: this.args.isFirstChunk ? 0x01 : 0x00,\n p2: this.args.configurationType,\n };\n\n return new ApduBuilder(provideNetworkConfigurationArgs)\n .addBufferToData(this.args.data)\n .build();\n }\n\n parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes> {\n return Maybe.fromNullable(this.errorHelper.getError(response)).orDefault(\n CommandResultFactory({ data: undefined }),\n );\n }\n}\n"],
5
- "mappings": "AACA,OAEE,eAAAA,EAKA,wBAAAC,MACK,kCACP,OAAS,sBAAAC,MAA0B,yBACnC,OAAS,SAAAC,MAAa,YAEtB,OACE,kBAAAC,EACA,6BAAAC,MAEK,uBAEA,IAAKC,OACVA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,KAAO,GAAP,OAFUA,OAAA,IAoBL,MAAMC,CAGb,CAME,YAA6BC,EAA8C,CAA9C,UAAAA,CAA+C,CAL3D,YAAc,IAAIN,EACjCE,EACAC,CACF,EAIA,SAAgB,CACd,MAAMI,EAAmD,CACvD,IAAK,IACL,IAAK,GACL,GAAI,KAAK,KAAK,aAAe,EAAO,EACpC,GAAI,KAAK,KAAK,iBAChB,EAEA,OAAO,IAAIT,EAAYS,CAA+B,EACnD,gBAAgB,KAAK,KAAK,IAAI,EAC9B,MAAM,CACX,CAEA,cAAcC,EAA4D,CACxE,OAAOP,EAAM,aAAa,KAAK,YAAY,SAASO,CAAQ,CAAC,EAAE,UAC7DT,EAAqB,CAAE,KAAM,MAAU,CAAC,CAC1C,CACF,CACF",
6
- "names": ["ApduBuilder", "CommandResultFactory", "CommandErrorHelper", "Maybe", "ETH_APP_ERRORS", "EthAppCommandErrorFactory", "NetworkConfigurationType", "ProvideNetworkConfigurationCommand", "args", "provideNetworkConfigurationArgs", "response"]
7
- }
@@ -1,2 +0,0 @@
1
- import{isSuccessCommandResult as s}from"@ledgerhq/device-management-kit";import{EthAppCommandError as a}from"./utils/ethAppErrors";import{NetworkConfigurationType as t,ProvideNetworkConfigurationCommand as o}from"./ProvideNetworkConfigurationCommand";describe("ProvideNetworkConfigurationCommand",()=>{describe("getApdu",()=>{it("should return the raw APDU for the first chunk",()=>{const r={data:Uint8Array.from([1,2,3]),isFirstChunk:!0,configurationType:t.CONFIGURATION},e=new o(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,48,1,0,3,1,2,3]))}),it("should return the raw APDU for the subsequent chunk",()=>{const r={data:Uint8Array.from([4,5,6]),isFirstChunk:!1,configurationType:t.CONFIGURATION},e=new o(r).getApdu();expect(e.getRawApdu()).toStrictEqual(Uint8Array.from([224,48,0,0,3,4,5,6]))})}),describe("parseResponse",()=>{it("should return an error if the response status code is invalid",()=>{const r={data:Uint8Array.from([]),statusCode:Uint8Array.from([109,0])},e=new o({data:new Uint8Array(0),isFirstChunk:!0,configurationType:t.CONFIGURATION}).parseResponse(r);if(s(e))throw new Error("Expected an error");expect(e.error).toBeDefined(),expect(e.error).toBeInstanceOf(a)}),it("should return a success result if the response status code is valid",()=>{const r={data:Uint8Array.from([]),statusCode:Uint8Array.from([144,0])},e=new o({data:new Uint8Array(0),isFirstChunk:!0,configurationType:t.CONFIGURATION}).parseResponse(r);if(s(e))expect(e.data).toBeUndefined();else throw new Error("Expected a success result")})})});
2
- //# sourceMappingURL=ProvideNetworkConfigurationCommand.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.ts"],
4
- "sourcesContent": ["import {\n type ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { EthAppCommandError } from \"./utils/ethAppErrors\";\nimport {\n NetworkConfigurationType,\n ProvideNetworkConfigurationCommand,\n type ProvideNetworkConfigurationCommandArgs,\n} from \"./ProvideNetworkConfigurationCommand\";\n\ndescribe(\"ProvideNetworkConfigurationCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should return the raw APDU for the first chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x01, 0x02, 0x03]),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x01, 0x00, 0x03, 0x01, 0x02, 0x03]),\n );\n });\n\n it(\"should return the raw APDU for the subsequent chunk\", () => {\n // GIVEN\n const args: ProvideNetworkConfigurationCommandArgs = {\n data: Uint8Array.from([0x04, 0x05, 0x06]),\n isFirstChunk: false,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand(args);\n const apdu = command.getApdu();\n\n // THEN\n expect(apdu.getRawApdu()).toStrictEqual(\n Uint8Array.from([0xe0, 0x30, 0x00, 0x00, 0x03, 0x04, 0x05, 0x06]),\n );\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should return an error if the response status code is invalid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x6d, 0x00]), // Invalid status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (isSuccessCommandResult(result)) {\n throw new Error(\"Expected an error\");\n } else {\n expect(result.error).toBeDefined();\n expect(result.error).toBeInstanceOf(EthAppCommandError);\n }\n });\n\n it(\"should return a success result if the response status code is valid\", () => {\n // GIVEN\n const response: ApduResponse = {\n data: Uint8Array.from([]),\n statusCode: Uint8Array.from([0x90, 0x00]), // Success status code\n };\n\n // WHEN\n const command = new ProvideNetworkConfigurationCommand({\n data: new Uint8Array(0),\n isFirstChunk: true,\n configurationType: NetworkConfigurationType.CONFIGURATION,\n });\n const result = command.parseResponse(response);\n\n // THEN\n if (!isSuccessCommandResult(result)) {\n throw new Error(\"Expected a success result\");\n } else {\n expect(result.data).toBeUndefined();\n }\n });\n });\n});\n"],
5
- "mappings": "AAAA,OAEE,0BAAAA,MACK,kCAEP,OAAS,sBAAAC,MAA0B,uBACnC,OACE,4BAAAC,EACA,sCAAAC,MAEK,uCAEP,SAAS,qCAAsC,IAAM,CACnD,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAEzD,MAAMC,EAA+C,CACnD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,GACd,kBAAmBF,EAAyB,aAC9C,EAIMG,EADU,IAAIF,EAAmCC,CAAI,EACtC,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,EAED,GAAG,sDAAuD,IAAM,CAE9D,MAAMD,EAA+C,CACnD,KAAM,WAAW,KAAK,CAAC,EAAM,EAAM,CAAI,CAAC,EACxC,aAAc,GACd,kBAAmBF,EAAyB,aAC9C,EAIMG,EADU,IAAIF,EAAmCC,CAAI,EACtC,QAAQ,EAG7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cACxB,WAAW,KAAK,CAAC,IAAM,GAAM,EAAM,EAAM,EAAM,EAAM,EAAM,CAAI,CAAC,CAClE,CACF,CAAC,CACH,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,gEAAiE,IAAM,CAExE,MAAMC,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAIJ,EAAmC,CACrD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,kBAAmBD,EAAyB,aAC9C,CAAC,EACsB,cAAcI,CAAQ,EAG7C,GAAIN,EAAuBO,CAAM,EAC/B,MAAM,IAAI,MAAM,mBAAmB,EAEnC,OAAOA,EAAO,KAAK,EAAE,YAAY,EACjC,OAAOA,EAAO,KAAK,EAAE,eAAeN,CAAkB,CAE1D,CAAC,EAED,GAAG,sEAAuE,IAAM,CAE9E,MAAMK,EAAyB,CAC7B,KAAM,WAAW,KAAK,CAAC,CAAC,EACxB,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,CAC1C,EAQMC,EALU,IAAIJ,EAAmC,CACrD,KAAM,IAAI,WAAW,CAAC,EACtB,aAAc,GACd,kBAAmBD,EAAyB,aAC9C,CAAC,EACsB,cAAcI,CAAQ,EAG7C,GAAKN,EAAuBO,CAAM,EAGhC,OAAOA,EAAO,IAAI,EAAE,cAAc,MAFlC,OAAM,IAAI,MAAM,2BAA2B,CAI/C,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["isSuccessCommandResult", "EthAppCommandError", "NetworkConfigurationType", "ProvideNetworkConfigurationCommand", "args", "apdu", "response", "result"]
7
- }
@@ -1,28 +0,0 @@
1
- import { type Apdu, type ApduResponse, type Command, type CommandResult } from "@ledgerhq/device-management-kit";
2
- import { type EthErrorCodes } from "./utils/ethAppErrors";
3
- export declare enum NetworkConfigurationType {
4
- CONFIGURATION = 0,
5
- ICON = 1
6
- }
7
- export type ProvideNetworkConfigurationCommandArgs = {
8
- /**
9
- * The network configuration data to provide in chunks
10
- */
11
- readonly data: Uint8Array;
12
- /**
13
- * If this is the first chunk of the network configuration
14
- */
15
- readonly isFirstChunk: boolean;
16
- /**
17
- * The type of network configuration being provided
18
- */
19
- readonly configurationType: NetworkConfigurationType;
20
- };
21
- export declare class ProvideNetworkConfigurationCommand implements Command<void, ProvideNetworkConfigurationCommandArgs, EthErrorCodes> {
22
- private readonly args;
23
- private readonly errorHelper;
24
- constructor(args: ProvideNetworkConfigurationCommandArgs);
25
- getApdu(): Apdu;
26
- parseResponse(response: ApduResponse): CommandResult<void, EthErrorCodes>;
27
- }
28
- //# sourceMappingURL=ProvideNetworkConfigurationCommand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProvideNetworkConfigurationCommand.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,IAAI,EAGT,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B,oBAAY,wBAAwB;IAClC,aAAa,IAAO;IACpB,IAAI,IAAO;CACZ;AAED,MAAM,MAAM,sCAAsC,GAAG;IACnD;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;CACtD,CAAC;AAEF,qBAAa,kCACX,YACE,OAAO,CAAC,IAAI,EAAE,sCAAsC,EAAE,aAAa,CAAC;IAO1D,OAAO,CAAC,QAAQ,CAAC,IAAI;IALjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAG1B;gBAE2B,IAAI,EAAE,sCAAsC;IAEzE,OAAO,IAAI,IAAI;IAaf,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC;CAK1E"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ProvideNetworkConfigurationCommand.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProvideNetworkConfigurationCommand.test.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app-binder/command/ProvideNetworkConfigurationCommand.test.ts"],"names":[],"mappings":""}