@ledgerhq/device-signer-kit-concordium 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +16 -2
  2. package/lib/cjs/api/SignerConcordium.js +1 -1
  3. package/lib/cjs/api/SignerConcordium.js.map +1 -1
  4. package/lib/cjs/api/SignerConcordiumBuilder.js +1 -1
  5. package/lib/cjs/api/SignerConcordiumBuilder.js.map +2 -2
  6. package/lib/cjs/internal/DefaultSignerConcordium.js +1 -1
  7. package/lib/cjs/internal/DefaultSignerConcordium.js.map +3 -3
  8. package/lib/cjs/internal/app-binder/ConcordiumAppBinder.js.map +2 -2
  9. package/lib/cjs/internal/app-binder/command/SignTransferCommand.js +1 -1
  10. package/lib/cjs/internal/app-binder/command/SignTransferCommand.js.map +2 -2
  11. package/lib/cjs/internal/app-binder/command/SignTransferCommand.test.js +1 -1
  12. package/lib/cjs/internal/app-binder/command/SignTransferCommand.test.js.map +3 -3
  13. package/lib/cjs/internal/app-binder/command/SignTransferWithMemoCommand.js +1 -1
  14. package/lib/cjs/internal/app-binder/command/SignTransferWithMemoCommand.js.map +2 -2
  15. package/lib/cjs/internal/app-binder/command/SignTransferWithMemoCommand.test.js +1 -1
  16. package/lib/cjs/internal/app-binder/command/SignTransferWithMemoCommand.test.js.map +2 -2
  17. package/lib/cjs/internal/app-binder/command/utils/ConcordiumApplicationErrors.js +1 -1
  18. package/lib/cjs/internal/app-binder/command/utils/ConcordiumApplicationErrors.js.map +2 -2
  19. package/lib/cjs/internal/app-binder/command/utils/EncodeMaxFee.js +2 -0
  20. package/lib/cjs/internal/app-binder/command/utils/EncodeMaxFee.js.map +7 -0
  21. package/lib/cjs/internal/app-binder/command/utils/InvalidMaxFeeError.js +2 -0
  22. package/lib/cjs/internal/app-binder/command/utils/InvalidMaxFeeError.js.map +7 -0
  23. package/lib/cjs/internal/app-binder/constants.js +1 -1
  24. package/lib/cjs/internal/app-binder/constants.js.map +3 -3
  25. package/lib/cjs/internal/app-binder/task/SendTransferTask.js +1 -1
  26. package/lib/cjs/internal/app-binder/task/SendTransferTask.js.map +3 -3
  27. package/lib/cjs/internal/app-binder/task/SendTransferTask.test.js +1 -1
  28. package/lib/cjs/internal/app-binder/task/SendTransferTask.test.js.map +3 -3
  29. package/lib/cjs/internal/app-binder/task/SendTransferWithMemoTask.js +1 -1
  30. package/lib/cjs/internal/app-binder/task/SendTransferWithMemoTask.js.map +3 -3
  31. package/lib/cjs/internal/app-binder/task/SendTransferWithMemoTask.test.js +1 -1
  32. package/lib/cjs/internal/app-binder/task/SendTransferWithMemoTask.test.js.map +3 -3
  33. package/lib/cjs/internal/app-binder/task/SignTransactionTaskFactory.js +1 -1
  34. package/lib/cjs/internal/app-binder/task/SignTransactionTaskFactory.js.map +3 -3
  35. package/lib/cjs/internal/app-binder/task/SignTransactionTaskFactory.test.js +1 -1
  36. package/lib/cjs/internal/app-binder/task/SignTransactionTaskFactory.test.js.map +3 -3
  37. package/lib/cjs/internal/app-binder/task/VerifyAddressTask.js +1 -1
  38. package/lib/cjs/internal/app-binder/task/VerifyAddressTask.js.map +2 -2
  39. package/lib/cjs/internal/app-binder/task/VerifyAddressTask.test.js +1 -1
  40. package/lib/cjs/internal/app-binder/task/VerifyAddressTask.test.js.map +2 -2
  41. package/lib/cjs/internal/shared/ConcordiumAppVersions.js +2 -0
  42. package/lib/cjs/internal/shared/ConcordiumAppVersions.js.map +7 -0
  43. package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.js +1 -1
  44. package/lib/cjs/internal/use-cases/transaction/SignTransactionUseCase.js.map +3 -3
  45. package/lib/cjs/package.json +1 -1
  46. package/lib/esm/api/SignerConcordiumBuilder.js +1 -1
  47. package/lib/esm/api/SignerConcordiumBuilder.js.map +3 -3
  48. package/lib/esm/internal/DefaultSignerConcordium.js +1 -1
  49. package/lib/esm/internal/DefaultSignerConcordium.js.map +3 -3
  50. package/lib/esm/internal/app-binder/ConcordiumAppBinder.js.map +2 -2
  51. package/lib/esm/internal/app-binder/command/SignTransferCommand.js +1 -1
  52. package/lib/esm/internal/app-binder/command/SignTransferCommand.js.map +3 -3
  53. package/lib/esm/internal/app-binder/command/SignTransferCommand.test.js +1 -1
  54. package/lib/esm/internal/app-binder/command/SignTransferCommand.test.js.map +3 -3
  55. package/lib/esm/internal/app-binder/command/SignTransferWithMemoCommand.js +1 -1
  56. package/lib/esm/internal/app-binder/command/SignTransferWithMemoCommand.js.map +3 -3
  57. package/lib/esm/internal/app-binder/command/SignTransferWithMemoCommand.test.js +1 -1
  58. package/lib/esm/internal/app-binder/command/SignTransferWithMemoCommand.test.js.map +2 -2
  59. package/lib/esm/internal/app-binder/command/utils/ConcordiumApplicationErrors.js +1 -1
  60. package/lib/esm/internal/app-binder/command/utils/ConcordiumApplicationErrors.js.map +2 -2
  61. package/lib/esm/internal/app-binder/command/utils/EncodeMaxFee.js +2 -0
  62. package/lib/esm/internal/app-binder/command/utils/EncodeMaxFee.js.map +7 -0
  63. package/lib/esm/internal/app-binder/command/utils/InvalidMaxFeeError.js +2 -0
  64. package/lib/esm/internal/app-binder/command/utils/InvalidMaxFeeError.js.map +7 -0
  65. package/lib/esm/internal/app-binder/constants.js +1 -1
  66. package/lib/esm/internal/app-binder/constants.js.map +3 -3
  67. package/lib/esm/internal/app-binder/task/SendTransferTask.js +1 -1
  68. package/lib/esm/internal/app-binder/task/SendTransferTask.js.map +3 -3
  69. package/lib/esm/internal/app-binder/task/SendTransferTask.test.js +1 -1
  70. package/lib/esm/internal/app-binder/task/SendTransferTask.test.js.map +3 -3
  71. package/lib/esm/internal/app-binder/task/SendTransferWithMemoTask.js +1 -1
  72. package/lib/esm/internal/app-binder/task/SendTransferWithMemoTask.js.map +3 -3
  73. package/lib/esm/internal/app-binder/task/SendTransferWithMemoTask.test.js +1 -1
  74. package/lib/esm/internal/app-binder/task/SendTransferWithMemoTask.test.js.map +3 -3
  75. package/lib/esm/internal/app-binder/task/SignTransactionTaskFactory.js +1 -1
  76. package/lib/esm/internal/app-binder/task/SignTransactionTaskFactory.js.map +3 -3
  77. package/lib/esm/internal/app-binder/task/SignTransactionTaskFactory.test.js +1 -1
  78. package/lib/esm/internal/app-binder/task/SignTransactionTaskFactory.test.js.map +3 -3
  79. package/lib/esm/internal/app-binder/task/VerifyAddressTask.js +1 -1
  80. package/lib/esm/internal/app-binder/task/VerifyAddressTask.js.map +2 -2
  81. package/lib/esm/internal/app-binder/task/VerifyAddressTask.test.js +1 -1
  82. package/lib/esm/internal/app-binder/task/VerifyAddressTask.test.js.map +2 -2
  83. package/lib/esm/internal/shared/ConcordiumAppVersions.js +2 -0
  84. package/lib/esm/internal/shared/ConcordiumAppVersions.js.map +7 -0
  85. package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.js +1 -1
  86. package/lib/esm/internal/use-cases/transaction/SignTransactionUseCase.js.map +3 -3
  87. package/lib/esm/package.json +1 -1
  88. package/lib/types/api/SignerConcordium.d.ts +1 -1
  89. package/lib/types/api/SignerConcordium.d.ts.map +1 -1
  90. package/lib/types/api/SignerConcordiumBuilder.d.ts.map +1 -1
  91. package/lib/types/internal/DefaultSignerConcordium.d.ts +1 -1
  92. package/lib/types/internal/DefaultSignerConcordium.d.ts.map +1 -1
  93. package/lib/types/internal/app-binder/ConcordiumAppBinder.d.ts +1 -0
  94. package/lib/types/internal/app-binder/ConcordiumAppBinder.d.ts.map +1 -1
  95. package/lib/types/internal/app-binder/command/SignTransferCommand.d.ts +2 -2
  96. package/lib/types/internal/app-binder/command/SignTransferCommand.d.ts.map +1 -1
  97. package/lib/types/internal/app-binder/command/SignTransferWithMemoCommand.d.ts +1 -0
  98. package/lib/types/internal/app-binder/command/SignTransferWithMemoCommand.d.ts.map +1 -1
  99. package/lib/types/internal/app-binder/command/utils/ConcordiumApplicationErrors.d.ts +2 -1
  100. package/lib/types/internal/app-binder/command/utils/ConcordiumApplicationErrors.d.ts.map +1 -1
  101. package/lib/types/internal/app-binder/command/utils/EncodeMaxFee.d.ts +5 -0
  102. package/lib/types/internal/app-binder/command/utils/EncodeMaxFee.d.ts.map +1 -0
  103. package/lib/types/internal/app-binder/command/utils/InvalidMaxFeeError.d.ts +6 -0
  104. package/lib/types/internal/app-binder/command/utils/InvalidMaxFeeError.d.ts.map +1 -0
  105. package/lib/types/internal/app-binder/constants.d.ts +2 -0
  106. package/lib/types/internal/app-binder/constants.d.ts.map +1 -1
  107. package/lib/types/internal/app-binder/task/SendTransferTask.d.ts +2 -0
  108. package/lib/types/internal/app-binder/task/SendTransferTask.d.ts.map +1 -1
  109. package/lib/types/internal/app-binder/task/SendTransferWithMemoTask.d.ts +2 -0
  110. package/lib/types/internal/app-binder/task/SendTransferWithMemoTask.d.ts.map +1 -1
  111. package/lib/types/internal/app-binder/task/SignTransactionTaskFactory.d.ts +1 -0
  112. package/lib/types/internal/app-binder/task/SignTransactionTaskFactory.d.ts.map +1 -1
  113. package/lib/types/internal/shared/ConcordiumAppVersions.d.ts +6 -0
  114. package/lib/types/internal/shared/ConcordiumAppVersions.d.ts.map +1 -0
  115. package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.d.ts +1 -1
  116. package/lib/types/internal/use-cases/transaction/SignTransactionUseCase.d.ts.map +1 -1
  117. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  118. package/package.json +7 -7
package/README.md CHANGED
@@ -49,9 +49,14 @@ const signerConcordium = new SignerConcordiumBuilder({
49
49
  The builder creates a default `ContextModule` out of the box, which is used by `verifyAddress` to communicate with the trusted metadata service. You can also provide a customized context module:
50
50
 
51
51
  ```typescript
52
- import { ContextModuleBuilder } from "@ledgerhq/context-module";
52
+ import {
53
+ ContextModuleBuilder,
54
+ ContextModuleChainID,
55
+ } from "@ledgerhq/context-module";
53
56
 
54
- const customContextModule = new ContextModuleBuilder({ originToken }).build();
57
+ const customContextModule = new ContextModuleBuilder({ originToken })
58
+ .setChain(ContextModuleChainID.Concordium)
59
+ .build();
55
60
 
56
61
  const signerConcordium = new SignerConcordiumBuilder({
57
62
  dmk,
@@ -151,6 +156,7 @@ Securely sign a Concordium transaction on Ledger devices. Supports both Transfer
151
156
  const { observable, cancel } = signerConcordium.signTransaction(
152
157
  derivationPath,
153
158
  transaction,
159
+ maxFee,
154
160
  options,
155
161
  );
156
162
  ```
@@ -169,6 +175,14 @@ const { observable, cancel } = signerConcordium.signTransaction(
169
175
  - **Type:** `Uint8Array`
170
176
  - The serialized transaction bytes to sign. The transaction type (Transfer or TransferWithMemo) is detected automatically from the type byte at offset 60.
171
177
 
178
+ - `maxFee`
179
+
180
+ - **Required**
181
+ - **Type:** `bigint` (µCCD)
182
+ - The max-fee value to display, as a uint64 in µCCD. Rendered on-device alongside the recipient and amount. The value is **display-only**: it is not part of the canonical signed bytes, so the on-chain transaction hash is unaffected.
183
+ - Requires Concordium app version **5.6.0 or newer** on the device. On older firmware the value is dropped at the wire boundary and the device falls back to the legacy display. Signing still succeeds; only the on-device display degrades. Callers should always pass a real value; do not gate on detected firmware version.
184
+ - Invalid values (non-bigint, negative, or above uint64 range) are rejected with `InvalidMaxFeeError` (errorCode `"invalid_max_fee"`).
185
+
172
186
  - `options`
173
187
 
174
188
  - Optional
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var y=(n,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of s(t))!a.call(n,e)&&e!==o&&i(n,e,{get:()=>t[e],enumerable:!(r=p(t,e))||r.enumerable});return n};var c=n=>y(i({},"__esModule",{value:!0}),n);var m={};module.exports=c(m);
1
+ "use strict";var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var y=(n,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of s(t))!a.call(n,e)&&e!==o&&r(n,e,{get:()=>t[e],enumerable:!(i=p(t,e))||i.enumerable});return n};var m=n=>y(r({},"__esModule",{value:!0}),n);var c={};module.exports=m(c);
2
2
  //# sourceMappingURL=SignerConcordium.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/SignerConcordium.ts"],
4
- "sourcesContent": ["import { type AccountOwnershipNetwork } from \"@ledgerhq/context-module\";\n\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetPublicKeyDAReturnType } from \"@api/app-binder/GetPublicKeyDeviceActionTypes\";\nimport { type SignCredentialDeploymentTransactionDAReturnType } from \"@api/app-binder/SignCredentialDeploymentTransactionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type VerifyAddressDAReturnType } from \"@api/app-binder/VerifyAddressDeviceActionTypes\";\nimport { type PublicKeyOptions } from \"@api/model/PublicKeyOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type VerifyAddressOptions } from \"@api/model/VerifyAddressOptions\";\n\nexport interface SignerConcordium {\n getAppConfiguration: () => GetAppConfigDAReturnType;\n\n getPublicKey: (\n derivationPath: string,\n options?: PublicKeyOptions,\n ) => GetPublicKeyDAReturnType;\n\n signTransaction: (\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ) => SignTransactionDAReturnType;\n\n signCredentialDeploymentTransaction: (\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ) => SignCredentialDeploymentTransactionDAReturnType;\n\n verifyAddress: (\n derivationPath: string,\n address: string,\n network: AccountOwnershipNetwork,\n options?: VerifyAddressOptions,\n ) => VerifyAddressDAReturnType;\n}\n"],
4
+ "sourcesContent": ["import { type AccountOwnershipNetwork } from \"@ledgerhq/context-module\";\n\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetPublicKeyDAReturnType } from \"@api/app-binder/GetPublicKeyDeviceActionTypes\";\nimport { type SignCredentialDeploymentTransactionDAReturnType } from \"@api/app-binder/SignCredentialDeploymentTransactionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type VerifyAddressDAReturnType } from \"@api/app-binder/VerifyAddressDeviceActionTypes\";\nimport { type PublicKeyOptions } from \"@api/model/PublicKeyOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type VerifyAddressOptions } from \"@api/model/VerifyAddressOptions\";\n\nexport interface SignerConcordium {\n getAppConfiguration: () => GetAppConfigDAReturnType;\n\n getPublicKey: (\n derivationPath: string,\n options?: PublicKeyOptions,\n ) => GetPublicKeyDAReturnType;\n\n signTransaction: (\n derivationPath: string,\n transaction: Uint8Array,\n maxFee: bigint,\n options?: TransactionOptions,\n ) => SignTransactionDAReturnType;\n\n signCredentialDeploymentTransaction: (\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ) => SignCredentialDeploymentTransactionDAReturnType;\n\n verifyAddress: (\n derivationPath: string,\n address: string,\n network: AccountOwnershipNetwork,\n options?: VerifyAddressOptions,\n ) => VerifyAddressDAReturnType;\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["SignerConcordium_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(t,e)=>{for(var o in e)n(t,o,{get:e[o],enumerable:!0})},a=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!l.call(t,i)&&i!==o&&n(t,i,{get:()=>e[i],enumerable:!(s=u(e,i))||s.enumerable});return t};var g=t=>a(n({},"__esModule",{value:!0}),t);var p={};m(p,{SignerConcordiumBuilder:()=>C});module.exports=g(p);var r=require("@ledgerhq/context-module"),d=require("../internal/DefaultSignerConcordium");class C{_dmk;_sessionId;_customContextModule;constructor({dmk:e,sessionId:o}){this._dmk=e,this._sessionId=o}withContextModule(e){return this._customContextModule=e,this}build(){const e=this._customContextModule??new r.ContextModuleBuilder({loggerFactory:o=>this._dmk.getLoggerFactory()(["ContextModule",o])}).build();return new d.DefaultSignerConcordium({dmk:this._dmk,sessionId:this._sessionId,contextModule:e})}}0&&(module.exports={SignerConcordiumBuilder});
1
+ "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},C=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!l.call(t,i)&&i!==o&&s(t,i,{get:()=>e[i],enumerable:!(r=u(e,i))||r.enumerable});return t};var a=t=>C(s({},"__esModule",{value:!0}),t);var M={};m(M,{SignerConcordiumBuilder:()=>g});module.exports=a(M);var n=require("@ledgerhq/context-module"),d=require("../internal/DefaultSignerConcordium");class g{_dmk;_sessionId;_customContextModule;constructor({dmk:e,sessionId:o}){this._dmk=e,this._sessionId=o}withContextModule(e){return this._customContextModule=e,this}build(){const e=this._customContextModule??new n.ContextModuleBuilder({loggerFactory:o=>this._dmk.getLoggerFactory()(["ContextModule",o])}).setChain(n.ContextModuleChainID.Concordium).build();return new d.DefaultSignerConcordium({dmk:this._dmk,sessionId:this._sessionId,contextModule:e})}}0&&(module.exports={SignerConcordiumBuilder});
2
2
  //# sourceMappingURL=SignerConcordiumBuilder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/SignerConcordiumBuilder.ts"],
4
- "sourcesContent": ["import {\n type ContextModule,\n ContextModuleBuilder,\n} from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { DefaultSignerConcordium } from \"@internal/DefaultSignerConcordium\";\n\ntype SignerConcordiumBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class SignerConcordiumBuilder {\n private readonly _dmk: DeviceManagementKit;\n private readonly _sessionId: DeviceSessionId;\n private _customContextModule?: ContextModule;\n\n constructor({ dmk, sessionId }: SignerConcordiumBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n }\n\n /**\n * Override the default context module\n *\n * @param contextModule\n * @returns this\n */\n public withContextModule(contextModule: ContextModule): this {\n this._customContextModule = contextModule;\n return this;\n }\n\n public build() {\n const contextModule =\n this._customContextModule ??\n new ContextModuleBuilder({\n loggerFactory: (tag: string) =>\n this._dmk.getLoggerFactory()([\"ContextModule\", tag]),\n }).build();\n\n return new DefaultSignerConcordium({\n dmk: this._dmk,\n sessionId: this._sessionId,\n contextModule,\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,oCAMPC,EAAwC,6CAOjC,MAAMH,CAAwB,CAClB,KACA,WACT,qBAER,YAAY,CAAE,IAAAI,EAAK,UAAAC,CAAU,EAA2C,CACtE,KAAK,KAAOD,EACZ,KAAK,WAAaC,CACpB,CAQO,kBAAkBC,EAAoC,CAC3D,YAAK,qBAAuBA,EACrB,IACT,CAEO,OAAQ,CACb,MAAMA,EACJ,KAAK,sBACL,IAAI,uBAAqB,CACvB,cAAgBC,GACd,KAAK,KAAK,iBAAiB,EAAE,CAAC,gBAAiBA,CAAG,CAAC,CACvD,CAAC,EAAE,MAAM,EAEX,OAAO,IAAI,0BAAwB,CACjC,IAAK,KAAK,KACV,UAAW,KAAK,WAChB,cAAAD,CACF,CAAC,CACH,CACF",
4
+ "sourcesContent": ["import {\n type ContextModule,\n ContextModuleBuilder,\n ContextModuleChainID,\n} from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { DefaultSignerConcordium } from \"@internal/DefaultSignerConcordium\";\n\ntype SignerConcordiumBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n};\n\nexport class SignerConcordiumBuilder {\n private readonly _dmk: DeviceManagementKit;\n private readonly _sessionId: DeviceSessionId;\n private _customContextModule?: ContextModule;\n\n constructor({ dmk, sessionId }: SignerConcordiumBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n }\n\n /**\n * Override the default context module\n *\n * @param contextModule\n * @returns this\n */\n public withContextModule(contextModule: ContextModule): this {\n this._customContextModule = contextModule;\n return this;\n }\n\n public build() {\n const contextModule =\n this._customContextModule ??\n new ContextModuleBuilder({\n loggerFactory: (tag: string) =>\n this._dmk.getLoggerFactory()([\"ContextModule\", tag]),\n })\n .setChain(ContextModuleChainID.Concordium)\n .build();\n\n return new DefaultSignerConcordium({\n dmk: this._dmk,\n sessionId: this._sessionId,\n contextModule,\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAIO,oCAMPC,EAAwC,6CAOjC,MAAMH,CAAwB,CAClB,KACA,WACT,qBAER,YAAY,CAAE,IAAAI,EAAK,UAAAC,CAAU,EAA2C,CACtE,KAAK,KAAOD,EACZ,KAAK,WAAaC,CACpB,CAQO,kBAAkBC,EAAoC,CAC3D,YAAK,qBAAuBA,EACrB,IACT,CAEO,OAAQ,CACb,MAAMA,EACJ,KAAK,sBACL,IAAI,uBAAqB,CACvB,cAAgBC,GACd,KAAK,KAAK,iBAAiB,EAAE,CAAC,gBAAiBA,CAAG,CAAC,CACvD,CAAC,EACE,SAAS,uBAAqB,UAAU,EACxC,MAAM,EAEX,OAAO,IAAI,0BAAwB,CACjC,IAAK,KAAK,KACV,UAAW,KAAK,WAChB,cAAAD,CACF,CAAC,CACH,CACF",
6
6
  "names": ["SignerConcordiumBuilder_exports", "__export", "SignerConcordiumBuilder", "__toCommonJS", "import_context_module", "import_DefaultSignerConcordium", "dmk", "sessionId", "contextModule", "tag"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var C=(n,e)=>{for(var t in e)o(n,t,{get:e[t],enumerable:!0})},d=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f(e))!g.call(n,i)&&i!==t&&o(n,i,{get:()=>e[i],enumerable:!(r=u(e,i))||r.enumerable});return n};var l=n=>d(o({},"__esModule",{value:!0}),n);var T={};C(T,{DefaultSignerConcordium:()=>A});module.exports=l(T);var s=require("./di"),p=require("./use-cases/app-config/di/appConfigTypes"),a=require("./use-cases/credential-deployment/di/credentialDeploymentTypes"),m=require("./use-cases/publickey/di/publicKeyTypes"),y=require("./use-cases/transaction/di/transactionTypes"),c=require("./use-cases/verify-address/di/verifyAddressTypes");class A{_container;constructor({dmk:e,sessionId:t,contextModule:r}){this._container=(0,s.makeContainer)({dmk:e,sessionId:t,contextModule:r})}getAppConfiguration(){return this._container.get(p.appConfigTypes.GetAppConfigUseCase).execute()}getPublicKey(e,t){return this._container.get(m.publicKeyTypes.GetPublicKeyUseCase).execute(e,t)}signTransaction(e,t,r){return this._container.get(y.transactionTypes.SignTransactionUseCase).execute(e,t,r)}signCredentialDeploymentTransaction(e,t,r){return this._container.get(a.credentialDeploymentTypes.SignCredentialDeploymentTransactionUseCase).execute(e,t,r)}verifyAddress(e,t,r,i){return this._container.get(c.verifyAddressTypes.VerifyAddressUseCase).execute(e,t,r,i)}}0&&(module.exports={DefaultSignerConcordium});
1
+ "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var C=(i,e)=>{for(var t in e)o(i,t,{get:e[t],enumerable:!0})},d=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of f(e))!g.call(i,n)&&n!==t&&o(i,n,{get:()=>e[n],enumerable:!(r=u(e,n))||r.enumerable});return i};var l=i=>d(o({},"__esModule",{value:!0}),i);var T={};C(T,{DefaultSignerConcordium:()=>A});module.exports=l(T);var s=require("./di"),p=require("./use-cases/app-config/di/appConfigTypes"),a=require("./use-cases/credential-deployment/di/credentialDeploymentTypes"),m=require("./use-cases/publickey/di/publicKeyTypes"),y=require("./use-cases/transaction/di/transactionTypes"),c=require("./use-cases/verify-address/di/verifyAddressTypes");class A{_container;constructor({dmk:e,sessionId:t,contextModule:r}){this._container=(0,s.makeContainer)({dmk:e,sessionId:t,contextModule:r})}getAppConfiguration(){return this._container.get(p.appConfigTypes.GetAppConfigUseCase).execute()}getPublicKey(e,t){return this._container.get(m.publicKeyTypes.GetPublicKeyUseCase).execute(e,t)}signTransaction(e,t,r,n){return this._container.get(y.transactionTypes.SignTransactionUseCase).execute(e,t,r,n)}signCredentialDeploymentTransaction(e,t,r){return this._container.get(a.credentialDeploymentTypes.SignCredentialDeploymentTransactionUseCase).execute(e,t,r)}verifyAddress(e,t,r,n){return this._container.get(c.verifyAddressTypes.VerifyAddressUseCase).execute(e,t,r,n)}}0&&(module.exports={DefaultSignerConcordium});
2
2
  //# sourceMappingURL=DefaultSignerConcordium.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/internal/DefaultSignerConcordium.ts"],
4
- "sourcesContent": ["import {\n type AccountOwnershipNetwork,\n type ContextModule,\n} from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Container } from \"inversify\";\n\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetPublicKeyDAReturnType } from \"@api/app-binder/GetPublicKeyDeviceActionTypes\";\nimport { type SignCredentialDeploymentTransactionDAReturnType } from \"@api/app-binder/SignCredentialDeploymentTransactionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type VerifyAddressDAReturnType } from \"@api/app-binder/VerifyAddressDeviceActionTypes\";\nimport { type PublicKeyOptions } from \"@api/model/PublicKeyOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type VerifyAddressOptions } from \"@api/model/VerifyAddressOptions\";\nimport { type SignerConcordium } from \"@api/SignerConcordium\";\nimport { makeContainer } from \"@internal/di\";\nimport { appConfigTypes } from \"@internal/use-cases/app-config/di/appConfigTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/app-config/GetAppConfigUseCase\";\nimport { credentialDeploymentTypes } from \"@internal/use-cases/credential-deployment/di/credentialDeploymentTypes\";\nimport { type SignCredentialDeploymentTransactionUseCase } from \"@internal/use-cases/credential-deployment/SignCredentialDeploymentTransactionUseCase\";\nimport { publicKeyTypes } from \"@internal/use-cases/publickey/di/publicKeyTypes\";\nimport { type GetPublicKeyUseCase } from \"@internal/use-cases/publickey/GetPublicKeyUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignTransactionUseCase } from \"@internal/use-cases/transaction/SignTransactionUseCase\";\nimport { verifyAddressTypes } from \"@internal/use-cases/verify-address/di/verifyAddressTypes\";\nimport { type VerifyAddressUseCase } from \"@internal/use-cases/verify-address/VerifyAddressUseCase\";\n\ntype DefaultSignerConcordiumConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n contextModule: ContextModule;\n};\n\nexport class DefaultSignerConcordium implements SignerConcordium {\n private readonly _container: Container;\n\n constructor({\n dmk,\n sessionId,\n contextModule,\n }: DefaultSignerConcordiumConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId, contextModule });\n }\n\n getAppConfiguration(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(appConfigTypes.GetAppConfigUseCase)\n .execute();\n }\n\n getPublicKey(\n derivationPath: string,\n options?: PublicKeyOptions,\n ): GetPublicKeyDAReturnType {\n return this._container\n .get<GetPublicKeyUseCase>(publicKeyTypes.GetPublicKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signTransaction(\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ): SignTransactionDAReturnType {\n return this._container\n .get<SignTransactionUseCase>(transactionTypes.SignTransactionUseCase)\n .execute(derivationPath, transaction, options);\n }\n\n signCredentialDeploymentTransaction(\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ): SignCredentialDeploymentTransactionDAReturnType {\n return this._container\n .get<SignCredentialDeploymentTransactionUseCase>(\n credentialDeploymentTypes.SignCredentialDeploymentTransactionUseCase,\n )\n .execute(derivationPath, transaction, options);\n }\n\n verifyAddress(\n derivationPath: string,\n address: string,\n network: AccountOwnershipNetwork,\n options?: VerifyAddressOptions,\n ): VerifyAddressDAReturnType {\n return this._container\n .get<VerifyAddressUseCase>(verifyAddressTypes.VerifyAddressUseCase)\n .execute(derivationPath, address, network, options);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAmBA,IAAAI,EAA8B,wBAC9BC,EAA+B,4DAE/BC,EAA0C,kFAE1CC,EAA+B,2DAE/BC,EAAiC,+DAEjCC,EAAmC,oEAS5B,MAAMP,CAAoD,CAC9C,WAEjB,YAAY,CACV,IAAAQ,EACA,UAAAC,EACA,cAAAC,CACF,EAA2C,CACzC,KAAK,cAAa,iBAAc,CAAE,IAAAF,EAAK,UAAAC,EAAW,cAAAC,CAAc,CAAC,CACnE,CAEA,qBAAgD,CAC9C,OAAO,KAAK,WACT,IAAyB,iBAAe,mBAAmB,EAC3D,QAAQ,CACb,CAEA,aACEC,EACAC,EAC0B,CAC1B,OAAO,KAAK,WACT,IAAyB,iBAAe,mBAAmB,EAC3D,QAAQD,EAAgBC,CAAO,CACpC,CAEA,gBACED,EACAE,EACAD,EAC6B,CAC7B,OAAO,KAAK,WACT,IAA4B,mBAAiB,sBAAsB,EACnE,QAAQD,EAAgBE,EAAaD,CAAO,CACjD,CAEA,oCACED,EACAE,EACAD,EACiD,CACjD,OAAO,KAAK,WACT,IACC,4BAA0B,0CAC5B,EACC,QAAQD,EAAgBE,EAAaD,CAAO,CACjD,CAEA,cACED,EACAG,EACAC,EACAH,EAC2B,CAC3B,OAAO,KAAK,WACT,IAA0B,qBAAmB,oBAAoB,EACjE,QAAQD,EAAgBG,EAASC,EAASH,CAAO,CACtD,CACF",
6
- "names": ["DefaultSignerConcordium_exports", "__export", "DefaultSignerConcordium", "__toCommonJS", "import_di", "import_appConfigTypes", "import_credentialDeploymentTypes", "import_publicKeyTypes", "import_transactionTypes", "import_verifyAddressTypes", "dmk", "sessionId", "contextModule", "derivationPath", "options", "transaction", "address", "network"]
4
+ "sourcesContent": ["import {\n type AccountOwnershipNetwork,\n type ContextModule,\n} from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { type Container } from \"inversify\";\n\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetPublicKeyDAReturnType } from \"@api/app-binder/GetPublicKeyDeviceActionTypes\";\nimport { type SignCredentialDeploymentTransactionDAReturnType } from \"@api/app-binder/SignCredentialDeploymentTransactionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type VerifyAddressDAReturnType } from \"@api/app-binder/VerifyAddressDeviceActionTypes\";\nimport { type PublicKeyOptions } from \"@api/model/PublicKeyOptions\";\nimport { type TransactionOptions } from \"@api/model/TransactionOptions\";\nimport { type VerifyAddressOptions } from \"@api/model/VerifyAddressOptions\";\nimport { type SignerConcordium } from \"@api/SignerConcordium\";\nimport { makeContainer } from \"@internal/di\";\nimport { appConfigTypes } from \"@internal/use-cases/app-config/di/appConfigTypes\";\nimport { type GetAppConfigUseCase } from \"@internal/use-cases/app-config/GetAppConfigUseCase\";\nimport { credentialDeploymentTypes } from \"@internal/use-cases/credential-deployment/di/credentialDeploymentTypes\";\nimport { type SignCredentialDeploymentTransactionUseCase } from \"@internal/use-cases/credential-deployment/SignCredentialDeploymentTransactionUseCase\";\nimport { publicKeyTypes } from \"@internal/use-cases/publickey/di/publicKeyTypes\";\nimport { type GetPublicKeyUseCase } from \"@internal/use-cases/publickey/GetPublicKeyUseCase\";\nimport { transactionTypes } from \"@internal/use-cases/transaction/di/transactionTypes\";\nimport { type SignTransactionUseCase } from \"@internal/use-cases/transaction/SignTransactionUseCase\";\nimport { verifyAddressTypes } from \"@internal/use-cases/verify-address/di/verifyAddressTypes\";\nimport { type VerifyAddressUseCase } from \"@internal/use-cases/verify-address/VerifyAddressUseCase\";\n\ntype DefaultSignerConcordiumConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n contextModule: ContextModule;\n};\n\nexport class DefaultSignerConcordium implements SignerConcordium {\n private readonly _container: Container;\n\n constructor({\n dmk,\n sessionId,\n contextModule,\n }: DefaultSignerConcordiumConstructorArgs) {\n this._container = makeContainer({ dmk, sessionId, contextModule });\n }\n\n getAppConfiguration(): GetAppConfigDAReturnType {\n return this._container\n .get<GetAppConfigUseCase>(appConfigTypes.GetAppConfigUseCase)\n .execute();\n }\n\n getPublicKey(\n derivationPath: string,\n options?: PublicKeyOptions,\n ): GetPublicKeyDAReturnType {\n return this._container\n .get<GetPublicKeyUseCase>(publicKeyTypes.GetPublicKeyUseCase)\n .execute(derivationPath, options);\n }\n\n signTransaction(\n derivationPath: string,\n transaction: Uint8Array,\n maxFee: bigint,\n options?: TransactionOptions,\n ): SignTransactionDAReturnType {\n return this._container\n .get<SignTransactionUseCase>(transactionTypes.SignTransactionUseCase)\n .execute(derivationPath, transaction, maxFee, options);\n }\n\n signCredentialDeploymentTransaction(\n derivationPath: string,\n transaction: Uint8Array,\n options?: TransactionOptions,\n ): SignCredentialDeploymentTransactionDAReturnType {\n return this._container\n .get<SignCredentialDeploymentTransactionUseCase>(\n credentialDeploymentTypes.SignCredentialDeploymentTransactionUseCase,\n )\n .execute(derivationPath, transaction, options);\n }\n\n verifyAddress(\n derivationPath: string,\n address: string,\n network: AccountOwnershipNetwork,\n options?: VerifyAddressOptions,\n ): VerifyAddressDAReturnType {\n return this._container\n .get<VerifyAddressUseCase>(verifyAddressTypes.VerifyAddressUseCase)\n .execute(derivationPath, address, network, options);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAmBA,IAAAI,EAA8B,wBAC9BC,EAA+B,4DAE/BC,EAA0C,kFAE1CC,EAA+B,2DAE/BC,EAAiC,+DAEjCC,EAAmC,oEAS5B,MAAMP,CAAoD,CAC9C,WAEjB,YAAY,CACV,IAAAQ,EACA,UAAAC,EACA,cAAAC,CACF,EAA2C,CACzC,KAAK,cAAa,iBAAc,CAAE,IAAAF,EAAK,UAAAC,EAAW,cAAAC,CAAc,CAAC,CACnE,CAEA,qBAAgD,CAC9C,OAAO,KAAK,WACT,IAAyB,iBAAe,mBAAmB,EAC3D,QAAQ,CACb,CAEA,aACEC,EACAC,EAC0B,CAC1B,OAAO,KAAK,WACT,IAAyB,iBAAe,mBAAmB,EAC3D,QAAQD,EAAgBC,CAAO,CACpC,CAEA,gBACED,EACAE,EACAC,EACAF,EAC6B,CAC7B,OAAO,KAAK,WACT,IAA4B,mBAAiB,sBAAsB,EACnE,QAAQD,EAAgBE,EAAaC,EAAQF,CAAO,CACzD,CAEA,oCACED,EACAE,EACAD,EACiD,CACjD,OAAO,KAAK,WACT,IACC,4BAA0B,0CAC5B,EACC,QAAQD,EAAgBE,EAAaD,CAAO,CACjD,CAEA,cACED,EACAI,EACAC,EACAJ,EAC2B,CAC3B,OAAO,KAAK,WACT,IAA0B,qBAAmB,oBAAoB,EACjE,QAAQD,EAAgBI,EAASC,EAASJ,CAAO,CACtD,CACF",
6
+ "names": ["DefaultSignerConcordium_exports", "__export", "DefaultSignerConcordium", "__toCommonJS", "import_di", "import_appConfigTypes", "import_credentialDeploymentTypes", "import_publicKeyTypes", "import_transactionTypes", "import_verifyAddressTypes", "dmk", "sessionId", "contextModule", "derivationPath", "options", "transaction", "maxFee", "address", "network"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/app-binder/ConcordiumAppBinder.ts"],
4
- "sourcesContent": ["import {\n type AccountOwnershipNetwork,\n type ContextModule,\n} from \"@ledgerhq/context-module\";\nimport {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\n LoggerPublisherService,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetPublicKeyDAReturnType } from \"@api/app-binder/GetPublicKeyDeviceActionTypes\";\nimport { type SignCredentialDeploymentTransactionDAReturnType } from \"@api/app-binder/SignCredentialDeploymentTransactionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type VerifyAddressDAReturnType } from \"@api/app-binder/VerifyAddressDeviceActionTypes\";\nimport { GetAppConfigCommand } from \"@internal/app-binder/command/GetAppConfigCommand\";\nimport {\n GetPublicKeyCommand,\n type GetPublicKeyCommandArgs,\n} from \"@internal/app-binder/command/GetPublicKeyCommand\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { SendCredentialDeploymentTransactionTask } from \"@internal/app-binder/task/SendCredentialDeploymentTransactionTask\";\nimport { createSignTransactionTask } from \"@internal/app-binder/task/SignTransactionTaskFactory\";\nimport { VerifyAddressTask } from \"@internal/app-binder/task/VerifyAddressTask\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\n@injectable()\nexport class ConcordiumAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n @inject(externalTypes.DmkLoggerFactory)\n private dmkLoggerFactory: (tag: string) => LoggerPublisherService,\n @inject(externalTypes.ContextModule)\n private readonly contextModule: ContextModule,\n ) {}\n\n getAppConfiguration(args: {\n skipOpenApp: boolean;\n }): GetAppConfigDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"GetAppConfigCommand\"),\n }),\n });\n }\n\n getPublicKey(args: GetPublicKeyCommandArgs): GetPublicKeyDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetPublicKeyCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"GetPublicKeyCommand\"),\n }),\n });\n }\n\n signTransaction(args: {\n derivationPath: string;\n transaction: Uint8Array;\n skipOpenApp?: boolean;\n }): SignTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n createSignTransactionTask(\n internalApi,\n args,\n this.dmkLoggerFactory,\n )(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"SignTransaction\"),\n }),\n });\n }\n\n signCredentialDeploymentTransaction(args: {\n derivationPath: string;\n transaction: Uint8Array;\n skipOpenApp?: boolean;\n }): SignCredentialDeploymentTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new SendCredentialDeploymentTransactionTask(\n internalApi,\n {\n derivationPath: args.derivationPath,\n transaction: args.transaction,\n },\n this.dmkLoggerFactory(\"SendCredentialDeploymentTransactionTask\"),\n ).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"SignCredentialDeploymentTransaction\"),\n }),\n });\n }\n\n verifyAddress(args: {\n derivationPath: string;\n address: string;\n network: AccountOwnershipNetwork;\n skipOpenApp?: boolean;\n }): VerifyAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new VerifyAddressTask(\n internalApi,\n {\n derivationPath: args.derivationPath,\n address: args.address,\n network: args.network,\n contextModule: this.contextModule,\n },\n this.dmkLoggerFactory(\"VerifyAddressTask\"),\n ).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"VerifyAddress\"),\n }),\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAIA,IAAAI,EAOO,2CACPC,EAAmC,qBAOnCC,EAAoC,4DACpCC,EAGO,4DACPC,EAAyB,0CACzBC,EAAwD,6EACxDC,EAA0C,gEAC1CC,EAAkC,uDAClCC,EAA8B,mCAGvB,IAAMC,EAAN,KAA0B,CAC/B,YACqCC,EACMC,EAEjCC,EAESC,EACjB,CANmC,SAAAH,EAC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qC,CACrE,CAAC,CACH,CAAC,CACH,CAEA,cAAcA,EAKgB,CAC5B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAM,MAAOC,GACX,IAAI,oBACFA,EACA,CACE,eAAgBD,EAAK,eACrB,QAASA,EAAK,QACd,QAASA,EAAK,QACd,cAAe,KAAK,aACtB,EACA,KAAK,iBAAiB,mBAAmB,CAC3C,EAAE,IAAI,EACR,QAAS,WACT,wBAAyB,0BAAwB,cACjD,YAAaA,EAAK,aAAe,EACnC,EACA,OAAQ,KAAK,iBAAiB,eAAe,CAC/C,CAAC,CACH,CAAC,CACH,CACF,EA5HaL,EAANO,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,GAC9BA,EAAA,eAAO,gBAAc,gBAAgB,GAErCA,EAAA,eAAO,gBAAc,aAAa,IAN1BR",
4
+ "sourcesContent": ["import {\n type AccountOwnershipNetwork,\n type ContextModule,\n} from \"@ledgerhq/context-module\";\nimport {\n CallTaskInAppDeviceAction,\n type DeviceManagementKit,\n type DeviceSessionId,\n LoggerPublisherService,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { type GetAppConfigDAReturnType } from \"@api/app-binder/GetAppConfigDeviceActionTypes\";\nimport { type GetPublicKeyDAReturnType } from \"@api/app-binder/GetPublicKeyDeviceActionTypes\";\nimport { type SignCredentialDeploymentTransactionDAReturnType } from \"@api/app-binder/SignCredentialDeploymentTransactionDeviceActionTypes\";\nimport { type SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { type VerifyAddressDAReturnType } from \"@api/app-binder/VerifyAddressDeviceActionTypes\";\nimport { GetAppConfigCommand } from \"@internal/app-binder/command/GetAppConfigCommand\";\nimport {\n GetPublicKeyCommand,\n type GetPublicKeyCommandArgs,\n} from \"@internal/app-binder/command/GetPublicKeyCommand\";\nimport { APP_NAME } from \"@internal/app-binder/constants\";\nimport { SendCredentialDeploymentTransactionTask } from \"@internal/app-binder/task/SendCredentialDeploymentTransactionTask\";\nimport { createSignTransactionTask } from \"@internal/app-binder/task/SignTransactionTaskFactory\";\nimport { VerifyAddressTask } from \"@internal/app-binder/task/VerifyAddressTask\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\n@injectable()\nexport class ConcordiumAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n @inject(externalTypes.DmkLoggerFactory)\n private dmkLoggerFactory: (tag: string) => LoggerPublisherService,\n @inject(externalTypes.ContextModule)\n private readonly contextModule: ContextModule,\n ) {}\n\n getAppConfiguration(args: {\n skipOpenApp: boolean;\n }): GetAppConfigDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigCommand(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"GetAppConfigCommand\"),\n }),\n });\n }\n\n getPublicKey(args: GetPublicKeyCommandArgs): GetPublicKeyDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetPublicKeyCommand(args),\n appName: APP_NAME,\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"GetPublicKeyCommand\"),\n }),\n });\n }\n\n signTransaction(args: {\n derivationPath: string;\n transaction: Uint8Array;\n maxFee: bigint;\n skipOpenApp?: boolean;\n }): SignTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n createSignTransactionTask(\n internalApi,\n args,\n this.dmkLoggerFactory,\n )(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"SignTransaction\"),\n }),\n });\n }\n\n signCredentialDeploymentTransaction(args: {\n derivationPath: string;\n transaction: Uint8Array;\n skipOpenApp?: boolean;\n }): SignCredentialDeploymentTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new SendCredentialDeploymentTransactionTask(\n internalApi,\n {\n derivationPath: args.derivationPath,\n transaction: args.transaction,\n },\n this.dmkLoggerFactory(\"SendCredentialDeploymentTransactionTask\"),\n ).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.SignTransaction,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"SignCredentialDeploymentTransaction\"),\n }),\n });\n }\n\n verifyAddress(args: {\n derivationPath: string;\n address: string;\n network: AccountOwnershipNetwork;\n skipOpenApp?: boolean;\n }): VerifyAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new VerifyAddressTask(\n internalApi,\n {\n derivationPath: args.derivationPath,\n address: args.address,\n network: args.network,\n contextModule: this.contextModule,\n },\n this.dmkLoggerFactory(\"VerifyAddressTask\"),\n ).run(),\n appName: APP_NAME,\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: args.skipOpenApp ?? false,\n },\n logger: this.dmkLoggerFactory(\"VerifyAddress\"),\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH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O,CACL,KAAM,MAAOC,GACX,IAAI,0CACFA,EACA,CACE,eAAgBD,EAAK,eACrB,YAAaA,EAAK,WACpB,EACA,KAAK,iBAAiB,yCAAyC,CACjE,EAAE,IAAI,EACR,QAAS,WACT,wBAAyB,0BAAwB,gBACjD,YAAaA,EAAK,aAAe,EACnC,EACA,OAAQ,KAAK,iBAAiB,qCAAqC,CACrE,CAAC,CACH,CAAC,CACH,CAEA,cAAcA,EAKgB,CAC5B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAM,MAAOC,GACX,IAAI,oBACFA,EACA,CACE,eAAgBD,EAAK,eACrB,QAASA,EAAK,QACd,QAASA,EAAK,QACd,cAAe,KAAK,aACtB,EACA,KAAK,iBAAiB,mBAAmB,CAC3C,EAAE,IAAI,EACR,QAAS,WACT,wBAAyB,0BAAwB,cACjD,YAAaA,EAAK,aAAe,EACnC,EACA,OAAQ,KAAK,iBAAiB,eAAe,CAC/C,CAAC,CACH,CAAC,CACH,CACF,EA7HaL,EAANO,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,GAC9BA,EAAA,eAAO,gBAAc,gBAAgB,GAErCA,EAAA,eAAO,gBAAc,aAAa,IAN1BR",
6
6
  "names": ["ConcordiumAppBinder_exports", "__export", "ConcordiumAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_GetAppConfigCommand", "import_GetPublicKeyCommand", "import_constants", "import_SendCredentialDeploymentTransactionTask", "import_SignTransactionTaskFactory", "import_VerifyAddressTask", "import_externalTypes", "ConcordiumAppBinder", "dmk", "sessionId", "dmkLoggerFactory", "contextModule", "args", "internalApi", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var n in r)d(e,n,{get:r[n],enumerable:!0})},f=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of C(r))!g.call(e,o)&&o!==n&&d(e,o,{get:()=>r[o],enumerable:!(t=u(r,o))||t.enumerable});return e};var y=e=>f(d({},"__esModule",{value:!0}),e);var R={};l(R,{SignTransferCommand:()=>c});module.exports=y(R);var s=require("@ledgerhq/device-management-kit"),i=require("@ledgerhq/signer-utils"),p=require("purify-ts"),m=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),a=require("../../app-binder/constants");class c{name="SignTransfer";args;errorHelper=new i.CommandErrorHelper(m.CONCORDIUM_APP_ERRORS,m.ConcordiumAppCommandErrorFactory);constructor(r){this.args=r}getApdu(){const r=new s.ApduBuilder({cla:a.LEDGER_CLA,ins:a.INS.SIGN_TRANSFER,p1:0,p2:this.args.isLastChunk?a.P2.LAST:a.P2.MORE});return r.addBufferToData(this.args.chunkedData),r.build()}parseResponse(r){return p.Maybe.fromNullable(this.errorHelper.getError(r)).orDefaultLazy(()=>{const n=new s.ApduParser(r),t=n.getUnparsedRemainingLength(),o=n.extractFieldByLength(t);return(0,s.CommandResultFactory)({data:o})})}}0&&(module.exports={SignTransferCommand});
1
+ "use strict";var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var n in r)d(e,n,{get:r[n],enumerable:!0})},f=(e,r,n,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of g(r))!C.call(e,o)&&o!==n&&d(e,o,{get:()=>r[o],enumerable:!(m=u(r,o))||m.enumerable});return e};var y=e=>f(d({},"__esModule",{value:!0}),e);var S={};l(S,{SignTransferCommand:()=>R});module.exports=y(S);var a=require("@ledgerhq/device-management-kit"),p=require("@ledgerhq/signer-utils"),i=require("purify-ts"),s=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),t=require("../../app-binder/constants");class R{name="SignTransfer";args;errorHelper=new p.CommandErrorHelper(s.CONCORDIUM_APP_ERRORS,s.ConcordiumAppCommandErrorFactory);constructor(r){this.args=r}getApdu(){const r=new a.ApduBuilder({cla:t.LEDGER_CLA,ins:t.INS.SIGN_TRANSFER,p1:0,p2:this.args.p2});return r.addBufferToData(this.args.data),r.build()}parseResponse(r){return i.Maybe.fromNullable(this.errorHelper.getError(r)).orDefaultLazy(()=>{const n=new a.ApduParser(r),m=n.getUnparsedRemainingLength(),o=n.extractFieldByLength(m);return(0,a.CommandResultFactory)({data:o})})}}0&&(module.exports={SignTransferCommand});
2
2
  //# sourceMappingURL=SignTransferCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/SignTransferCommand.ts"],
4
- "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n ApduParser,\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 { type Signature } from \"@api/model/Signature\";\nimport {\n CONCORDIUM_APP_ERRORS,\n ConcordiumAppCommandErrorFactory,\n type ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA, P2 } from \"@internal/app-binder/constants\";\n\nexport type SignTransferCommandArgs = {\n readonly chunkedData: Uint8Array;\n readonly isLastChunk: boolean;\n};\n\nexport type SignTransferCommandResponse = Signature;\n\nexport class SignTransferCommand\n implements\n Command<\n SignTransferCommandResponse,\n SignTransferCommandArgs,\n ConcordiumErrorCodes\n >\n{\n readonly name = \"SignTransfer\";\n\n private readonly args: SignTransferCommandArgs;\n\n private readonly errorHelper = new CommandErrorHelper<\n SignTransferCommandResponse,\n ConcordiumErrorCodes\n >(CONCORDIUM_APP_ERRORS, ConcordiumAppCommandErrorFactory);\n\n constructor(args: SignTransferCommandArgs) {\n this.args = args;\n }\n\n getApdu(): Apdu {\n const apduBuilder = new ApduBuilder({\n cla: LEDGER_CLA,\n ins: INS.SIGN_TRANSFER,\n p1: 0x00,\n p2: this.args.isLastChunk ? P2.LAST : P2.MORE,\n });\n\n apduBuilder.addBufferToData(this.args.chunkedData);\n\n return apduBuilder.build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<SignTransferCommandResponse, ConcordiumErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(apduResponse),\n ).orDefaultLazy(() => {\n const apduParser = new ApduParser(apduResponse);\n const remaining = apduParser.getUnparsedRemainingLength();\n const signature = apduParser.extractFieldByLength(remaining);\n\n return CommandResultFactory({\n data: signature as Signature,\n });\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAGtBC,EAIO,0EACPC,EAAoC,0CAS7B,MAAMN,CAOb,CACW,KAAO,eAEC,KAEA,YAAc,IAAI,qBAGjC,wBAAuB,kCAAgC,EAEzD,YAAYO,EAA+B,CACzC,KAAK,KAAOA,CACd,CAEA,SAAgB,CACd,MAAMC,EAAc,IAAI,cAAY,CAClC,IAAK,aACL,IAAK,MAAI,cACT,GAAI,EACJ,GAAI,KAAK,KAAK,YAAc,KAAG,KAAO,KAAG,IAC3C,CAAC,EAED,OAAAA,EAAY,gBAAgB,KAAK,KAAK,WAAW,EAE1CA,EAAY,MAAM,CAC3B,CAEA,cACEC,EACkE,CAClE,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAY,CACxC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAa,IAAI,aAAWD,CAAY,EACxCE,EAAYD,EAAW,2BAA2B,EAClDE,EAAYF,EAAW,qBAAqBC,CAAS,EAE3D,SAAO,wBAAqB,CAC1B,KAAMC,CACR,CAAC,CACH,CAAC,CACH,CACF",
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n ApduParser,\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 { type Signature } from \"@api/model/Signature\";\nimport {\n CONCORDIUM_APP_ERRORS,\n ConcordiumAppCommandErrorFactory,\n type ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA } from \"@internal/app-binder/constants\";\n\nexport type SignTransferCommandArgs = {\n readonly data: Uint8Array;\n readonly p2: number;\n};\n\nexport type SignTransferCommandResponse = Signature;\n\nexport class SignTransferCommand\n implements\n Command<\n SignTransferCommandResponse,\n SignTransferCommandArgs,\n ConcordiumErrorCodes\n >\n{\n readonly name = \"SignTransfer\";\n\n private readonly args: SignTransferCommandArgs;\n\n private readonly errorHelper = new CommandErrorHelper<\n SignTransferCommandResponse,\n ConcordiumErrorCodes\n >(CONCORDIUM_APP_ERRORS, ConcordiumAppCommandErrorFactory);\n\n constructor(args: SignTransferCommandArgs) {\n this.args = args;\n }\n\n getApdu(): Apdu {\n const apduBuilder = new ApduBuilder({\n cla: LEDGER_CLA,\n ins: INS.SIGN_TRANSFER,\n p1: 0x00,\n p2: this.args.p2,\n });\n\n apduBuilder.addBufferToData(this.args.data);\n\n return apduBuilder.build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<SignTransferCommandResponse, ConcordiumErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(apduResponse),\n ).orDefaultLazy(() => {\n const apduParser = new ApduParser(apduResponse);\n const remaining = apduParser.getUnparsedRemainingLength();\n const signature = apduParser.extractFieldByLength(remaining);\n\n return CommandResultFactory({\n data: signature as Signature,\n });\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAGtBC,EAIO,0EACPC,EAAgC,0CASzB,MAAMN,CAOb,CACW,KAAO,eAEC,KAEA,YAAc,IAAI,qBAGjC,wBAAuB,kCAAgC,EAEzD,YAAYO,EAA+B,CACzC,KAAK,KAAOA,CACd,CAEA,SAAgB,CACd,MAAMC,EAAc,IAAI,cAAY,CAClC,IAAK,aACL,IAAK,MAAI,cACT,GAAI,EACJ,GAAI,KAAK,KAAK,EAChB,CAAC,EAED,OAAAA,EAAY,gBAAgB,KAAK,KAAK,IAAI,EAEnCA,EAAY,MAAM,CAC3B,CAEA,cACEC,EACkE,CAClE,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAY,CACxC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAa,IAAI,aAAWD,CAAY,EACxCE,EAAYD,EAAW,2BAA2B,EAClDE,EAAYF,EAAW,qBAAqBC,CAAS,EAE3D,SAAO,wBAAqB,CAC1B,KAAMC,CACR,CAAC,CACH,CAAC,CACH,CACF",
6
6
  "names": ["SignTransferCommand_exports", "__export", "SignTransferCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ConcordiumApplicationErrors", "import_constants", "args", "apduBuilder", "apduResponse", "apduParser", "remaining", "signature"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=require("@ledgerhq/device-management-kit"),o=require("../../app-binder/command/SignTransferCommand"),c=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),s=require("../../app-binder/constants");describe("SignTransferCommand",()=>{describe("getApdu",()=>{it("should build APDU with P2=MORE when not last chunk",()=>{const e=new o.SignTransferCommand({chunkedData:new Uint8Array(50).fill(1),isLastChunk:!1}).getApdu().getRawApdu();expect(e[0]).toBe(s.LEDGER_CLA),expect(e[1]).toBe(s.INS.SIGN_TRANSFER),expect(e[2]).toBe(0),expect(e[3]).toBe(s.P2.MORE)}),it("should build APDU with P2=LAST when last chunk",()=>{const e=new o.SignTransferCommand({chunkedData:new Uint8Array(50).fill(1),isLastChunk:!0}).getApdu().getRawApdu();expect(e[3]).toBe(s.P2.LAST)}),it("should include chunked data in APDU payload",()=>{const r=new Uint8Array([222,173,190,239]),t=new o.SignTransferCommand({chunkedData:r,isLastChunk:!0}).getApdu().getRawApdu();expect(t.slice(5)).toStrictEqual(r)})}),describe("parseResponse",()=>{it("should extract signature bytes on success",()=>{const r=new o.SignTransferCommand({chunkedData:new Uint8Array(10),isLastChunk:!0}),e=new Uint8Array(64).fill(171),t=new n.ApduResponse({statusCode:new Uint8Array([144,0]),data:e}),a=r.parseResponse(t);expect((0,n.isSuccessCommandResult)(a)).toBe(!0),(0,n.isSuccessCommandResult)(a)&&expect(a.data).toStrictEqual(e)}),it("should return empty data for intermediate chunk response",()=>{const r=new o.SignTransferCommand({chunkedData:new Uint8Array(10),isLastChunk:!1}),e=new n.ApduResponse({statusCode:new Uint8Array([144,0]),data:new Uint8Array([])}),t=r.parseResponse(e);expect((0,n.isSuccessCommandResult)(t)).toBe(!0)}),it("should return ConcordiumAppCommandError on user rejection",()=>{const r=new o.SignTransferCommand({chunkedData:new Uint8Array(10),isLastChunk:!0}),e=new n.ApduResponse({statusCode:new Uint8Array([105,133]),data:new Uint8Array([])}),t=r.parseResponse(e);if(expect((0,n.isSuccessCommandResult)(t)).toBe(!1),!(0,n.isSuccessCommandResult)(t)){const a=t.error;expect(a.errorCode).toBe(c.ConcordiumErrorCodes.USER_REJECTED)}}),it("should return ConcordiumAppCommandError on data invalid",()=>{const r=new o.SignTransferCommand({chunkedData:new Uint8Array(10),isLastChunk:!1}),e=new n.ApduResponse({statusCode:new Uint8Array([106,128]),data:new Uint8Array([])}),t=r.parseResponse(e);if(expect((0,n.isSuccessCommandResult)(t)).toBe(!1),!(0,n.isSuccessCommandResult)(t)){const a=t.error;expect(a.errorCode).toBe(c.ConcordiumErrorCodes.DATA_INVALID)}})})});
1
+ "use strict";var o=require("@ledgerhq/device-management-kit"),s=require("../../app-binder/command/SignTransferCommand"),d=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),t=require("../../app-binder/constants");describe("SignTransferCommand",()=>{describe("getApdu",()=>{it("should build APDU with caller-provided P2=LAST",()=>{const e=new s.SignTransferCommand({data:new Uint8Array(50).fill(1),p2:t.P2.LAST}).getApdu().getRawApdu();expect(e[0]).toBe(t.LEDGER_CLA),expect(e[1]).toBe(t.INS.SIGN_TRANSFER),expect(e[2]).toBe(0),expect(e[3]).toBe(t.P2.LAST)}),it("should build APDU with caller-provided P2=FEE_DISPLAY",()=>{const e=new s.SignTransferCommand({data:new Uint8Array(50).fill(1),p2:t.P2.FEE_DISPLAY}).getApdu().getRawApdu();expect(e[3]).toBe(t.P2.FEE_DISPLAY)}),it("should include data in APDU payload",()=>{const n=new Uint8Array([222,173,190,239]),r=new s.SignTransferCommand({data:n,p2:t.P2.LAST}).getApdu().getRawApdu();expect(r.slice(5)).toStrictEqual(n)})}),describe("parseResponse",()=>{it("should extract signature bytes on success",()=>{const n=new s.SignTransferCommand({data:new Uint8Array(10),p2:t.P2.LAST}),e=new Uint8Array(64).fill(171),r=new o.ApduResponse({statusCode:new Uint8Array([144,0]),data:e}),a=n.parseResponse(r);expect((0,o.isSuccessCommandResult)(a)).toBe(!0),(0,o.isSuccessCommandResult)(a)&&expect(a.data).toStrictEqual(e)}),it("should return ConcordiumAppCommandError on user rejection",()=>{const n=new s.SignTransferCommand({data:new Uint8Array(10),p2:t.P2.LAST}),e=new o.ApduResponse({statusCode:new Uint8Array([105,133]),data:new Uint8Array([])}),r=n.parseResponse(e);if(expect((0,o.isSuccessCommandResult)(r)).toBe(!1),!(0,o.isSuccessCommandResult)(r)){const a=r.error;expect(a.errorCode).toBe(d.ConcordiumErrorCodes.USER_REJECTED)}}),it("should return ConcordiumAppCommandError on data invalid",()=>{const n=new s.SignTransferCommand({data:new Uint8Array(10),p2:t.P2.LAST}),e=new o.ApduResponse({statusCode:new Uint8Array([106,128]),data:new Uint8Array([])}),r=n.parseResponse(e);if(expect((0,o.isSuccessCommandResult)(r)).toBe(!1),!(0,o.isSuccessCommandResult)(r)){const a=r.error;expect(a.errorCode).toBe(d.ConcordiumErrorCodes.DATA_INVALID)}})})});
2
2
  //# sourceMappingURL=SignTransferCommand.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/SignTransferCommand.test.ts"],
4
- "sourcesContent": ["import {\n ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { SignTransferCommand } from \"@internal/app-binder/command/SignTransferCommand\";\nimport {\n type ConcordiumAppCommandError,\n ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA, P2 } from \"@internal/app-binder/constants\";\n\ndescribe(\"SignTransferCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should build APDU with P2=MORE when not last chunk\", () => {\n const command = new SignTransferCommand({\n chunkedData: new Uint8Array(50).fill(0x01),\n isLastChunk: false,\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[0]).toBe(LEDGER_CLA);\n expect(raw[1]).toBe(INS.SIGN_TRANSFER);\n expect(raw[2]).toBe(0x00);\n expect(raw[3]).toBe(P2.MORE);\n });\n\n it(\"should build APDU with P2=LAST when last chunk\", () => {\n const command = new SignTransferCommand({\n chunkedData: new Uint8Array(50).fill(0x01),\n isLastChunk: true,\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[3]).toBe(P2.LAST);\n });\n\n it(\"should include chunked data in APDU payload\", () => {\n const data = new Uint8Array([0xde, 0xad, 0xbe, 0xef]);\n const command = new SignTransferCommand({\n chunkedData: data,\n isLastChunk: true,\n });\n\n const raw = command.getApdu().getRawApdu();\n // Data starts at byte 5\n expect(raw.slice(5)).toStrictEqual(data);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should extract signature bytes on success\", () => {\n const command = new SignTransferCommand({\n chunkedData: new Uint8Array(10),\n isLastChunk: true,\n });\n\n const signature = new Uint8Array(64).fill(0xab);\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: signature,\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n if (isSuccessCommandResult(result)) {\n expect(result.data).toStrictEqual(signature);\n }\n });\n\n it(\"should return empty data for intermediate chunk response\", () => {\n const command = new SignTransferCommand({\n chunkedData: new Uint8Array(10),\n isLastChunk: false,\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n\n it(\"should return ConcordiumAppCommandError on user rejection\", () => {\n const command = new SignTransferCommand({\n chunkedData: new Uint8Array(10),\n isLastChunk: true,\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x69, 0x85]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.USER_REJECTED);\n }\n });\n\n it(\"should return ConcordiumAppCommandError on data invalid\", () => {\n const command = new SignTransferCommand({\n chunkedData: new Uint8Array(10),\n isLastChunk: false,\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x6a, 0x80]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.DATA_INVALID);\n }\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAoC,4DACpCC,EAGO,0EACPC,EAAoC,0CAEpC,SAAS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,CAAC,EAAE,KAAK,EAAK,EAC7C,IAAC,0BAAuBA,CAAM,EAAG,CACnC,MAAMC,EAAMD,EAAO,MACnB,OAAOC,EAAI,SAAS,EAAE,KAAK,uBAAqB,YAAY,CAC9D,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_SignTransferCommand", "import_ConcordiumApplicationErrors", "import_constants", "raw", "data", "command", "signature", "response", "result", "err"]
4
+ "sourcesContent": ["import {\n ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { SignTransferCommand } from \"@internal/app-binder/command/SignTransferCommand\";\nimport {\n type ConcordiumAppCommandError,\n ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA, P2 } from \"@internal/app-binder/constants\";\n\ndescribe(\"SignTransferCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should build APDU with caller-provided P2=LAST\", () => {\n const command = new SignTransferCommand({\n data: new Uint8Array(50).fill(0x01),\n p2: P2.LAST,\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[0]).toBe(LEDGER_CLA);\n expect(raw[1]).toBe(INS.SIGN_TRANSFER);\n expect(raw[2]).toBe(0x00);\n expect(raw[3]).toBe(P2.LAST);\n });\n\n it(\"should build APDU with caller-provided P2=FEE_DISPLAY\", () => {\n const command = new SignTransferCommand({\n data: new Uint8Array(50).fill(0x01),\n p2: P2.FEE_DISPLAY,\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[3]).toBe(P2.FEE_DISPLAY);\n });\n\n it(\"should include data in APDU payload\", () => {\n const buf = new Uint8Array([0xde, 0xad, 0xbe, 0xef]);\n const command = new SignTransferCommand({\n data: buf,\n p2: P2.LAST,\n });\n\n const raw = command.getApdu().getRawApdu();\n // Data starts at byte 5\n expect(raw.slice(5)).toStrictEqual(buf);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should extract signature bytes on success\", () => {\n const command = new SignTransferCommand({\n data: new Uint8Array(10),\n p2: P2.LAST,\n });\n\n const signature = new Uint8Array(64).fill(0xab);\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: signature,\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n if (isSuccessCommandResult(result)) {\n expect(result.data).toStrictEqual(signature);\n }\n });\n\n it(\"should return ConcordiumAppCommandError on user rejection\", () => {\n const command = new SignTransferCommand({\n data: new Uint8Array(10),\n p2: P2.LAST,\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x69, 0x85]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.USER_REJECTED);\n }\n });\n\n it(\"should return ConcordiumAppCommandError on data invalid\", () => {\n const command = new SignTransferCommand({\n data: new Uint8Array(10),\n p2: P2.LAST,\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x6a, 0x80]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.DATA_INVALID);\n }\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAAoC,4DACpCC,EAGO,0EACPC,EAAoC,0CAEpC,SAAS,sBAAuB,IAAM,CACpC,SAAS,UAAW,IAAM,CACxB,GAAG,iDAAkD,IAAM,CAMzD,MAAMC,EALU,IAAI,sBAAoB,CACtC,KAAM,IAAI,WAAW,EAAE,EAAE,KAAK,CAAI,EAClC,GAAI,KAAG,IACT,CAAC,EAEmB,QAAQ,EAAE,WAAW,EAEzC,OAAOA,EAAI,CAAC,CAAC,EAAE,KA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AE,EACvB,GAAI,KAAG,IACT,CAAC,EAEKE,EAAW,IAAI,eAAa,CAChC,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,CAAC,EAEKC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,GADA,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,EAC7C,IAAC,0BAAuBA,CAAM,EAAG,CACnC,MAAMC,EAAMD,EAAO,MACnB,OAAOC,EAAI,SAAS,EAAE,KAAK,uBAAqB,aAAa,CAC/D,CACF,CAAC,EAED,GAAG,0DAA2D,IAAM,CAClE,MAAMJ,EAAU,IAAI,sBAAoB,CACtC,KAAM,IAAI,WAAW,EAAE,EACvB,GAAI,KAAG,IACT,CAAC,EAEKE,EAAW,IAAI,eAAa,CAChC,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,CAAC,EAEKC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,GADA,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,EAC7C,IAAC,0BAAuBA,CAAM,EAAG,CACnC,MAAMC,EAAMD,EAAO,MACnB,OAAOC,EAAI,SAAS,EAAE,KAAK,uBAAqB,YAAY,CAC9D,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_SignTransferCommand", "import_ConcordiumApplicationErrors", "import_constants", "raw", "buf", "command", "signature", "response", "result", "err"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var o in r)i(e,o,{get:r[o],enumerable:!0})},f=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of g(r))!C.call(e,n)&&n!==o&&i(e,n,{get:()=>r[n],enumerable:!(t=u(r,n))||t.enumerable});return e};var y=e=>f(i({},"__esModule",{value:!0}),e);var S={};l(S,{SignTransferWithMemoCommand:()=>R});module.exports=y(S);var a=require("@ledgerhq/device-management-kit"),d=require("@ledgerhq/signer-utils"),p=require("purify-ts"),s=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),m=require("../../app-binder/constants");class R{name="SignTransferWithMemo";args;errorHelper=new d.CommandErrorHelper(s.CONCORDIUM_APP_ERRORS,s.ConcordiumAppCommandErrorFactory);constructor(r){this.args=r}getApdu(){const r=new a.ApduBuilder({cla:m.LEDGER_CLA,ins:m.INS.SIGN_TRANSFER_WITH_MEMO,p1:this.args.p1,p2:m.P2.NONE});return r.addBufferToData(this.args.data),r.build()}parseResponse(r){return p.Maybe.fromNullable(this.errorHelper.getError(r)).orDefaultLazy(()=>{const o=new a.ApduParser(r),t=o.getUnparsedRemainingLength(),n=o.extractFieldByLength(t);return(0,a.CommandResultFactory)({data:n})})}}0&&(module.exports={SignTransferWithMemoCommand});
1
+ "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var o in r)i(e,o,{get:r[o],enumerable:!0})},f=(e,r,o,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of g(r))!C.call(e,n)&&n!==o&&i(e,n,{get:()=>r[n],enumerable:!(m=u(r,n))||m.enumerable});return e};var y=e=>f(i({},"__esModule",{value:!0}),e);var R={};l(R,{SignTransferWithMemoCommand:()=>h});module.exports=y(R);var a=require("@ledgerhq/device-management-kit"),d=require("@ledgerhq/signer-utils"),p=require("purify-ts"),t=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),s=require("../../app-binder/constants");class h{name="SignTransferWithMemo";args;errorHelper=new d.CommandErrorHelper(t.CONCORDIUM_APP_ERRORS,t.ConcordiumAppCommandErrorFactory);constructor(r){this.args=r}getApdu(){const r=new a.ApduBuilder({cla:s.LEDGER_CLA,ins:s.INS.SIGN_TRANSFER_WITH_MEMO,p1:this.args.p1,p2:this.args.p2});return r.addBufferToData(this.args.data),r.build()}parseResponse(r){return p.Maybe.fromNullable(this.errorHelper.getError(r)).orDefaultLazy(()=>{const o=new a.ApduParser(r),m=o.getUnparsedRemainingLength(),n=o.extractFieldByLength(m);return(0,a.CommandResultFactory)({data:n})})}}0&&(module.exports={SignTransferWithMemoCommand});
2
2
  //# sourceMappingURL=SignTransferWithMemoCommand.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/SignTransferWithMemoCommand.ts"],
4
- "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n ApduParser,\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 { type Signature } from \"@api/model/Signature\";\nimport {\n CONCORDIUM_APP_ERRORS,\n ConcordiumAppCommandErrorFactory,\n type ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA, P2 } from \"@internal/app-binder/constants\";\n\nexport type SignTransferWithMemoCommandArgs = {\n readonly p1: number;\n readonly data: Uint8Array;\n};\n\nexport type SignTransferWithMemoCommandResponse = Signature;\n\nexport class SignTransferWithMemoCommand\n implements\n Command<\n SignTransferWithMemoCommandResponse,\n SignTransferWithMemoCommandArgs,\n ConcordiumErrorCodes\n >\n{\n readonly name = \"SignTransferWithMemo\";\n\n private readonly args: SignTransferWithMemoCommandArgs;\n\n private readonly errorHelper = new CommandErrorHelper<\n SignTransferWithMemoCommandResponse,\n ConcordiumErrorCodes\n >(CONCORDIUM_APP_ERRORS, ConcordiumAppCommandErrorFactory);\n\n constructor(args: SignTransferWithMemoCommandArgs) {\n this.args = args;\n }\n\n getApdu(): Apdu {\n const apduBuilder = new ApduBuilder({\n cla: LEDGER_CLA,\n ins: INS.SIGN_TRANSFER_WITH_MEMO,\n p1: this.args.p1,\n p2: P2.NONE,\n });\n\n apduBuilder.addBufferToData(this.args.data);\n\n return apduBuilder.build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<SignTransferWithMemoCommandResponse, ConcordiumErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(apduResponse),\n ).orDefaultLazy(() => {\n const apduParser = new ApduParser(apduResponse);\n const remaining = apduParser.getUnparsedRemainingLength();\n const signature = apduParser.extractFieldByLength(remaining);\n\n return CommandResultFactory({\n data: signature as Signature,\n });\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAGtBC,EAIO,0EACPC,EAAoC,0CAS7B,MAAMN,CAOb,CACW,KAAO,uBAEC,KAEA,YAAc,IAAI,qBAGjC,wBAAuB,kCAAgC,EAEzD,YAAYO,EAAuC,CACjD,KAAK,KAAOA,CACd,CAEA,SAAgB,CACd,MAAMC,EAAc,IAAI,cAAY,CAClC,IAAK,aACL,IAAK,MAAI,wBACT,GAAI,KAAK,KAAK,GACd,GAAI,KAAG,IACT,CAAC,EAED,OAAAA,EAAY,gBAAgB,KAAK,KAAK,IAAI,EAEnCA,EAAY,MAAM,CAC3B,CAEA,cACEC,EAC0E,CAC1E,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAY,CACxC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAa,IAAI,aAAWD,CAAY,EACxCE,EAAYD,EAAW,2BAA2B,EAClDE,EAAYF,EAAW,qBAAqBC,CAAS,EAE3D,SAAO,wBAAqB,CAC1B,KAAMC,CACR,CAAC,CACH,CAAC,CACH,CACF",
4
+ "sourcesContent": ["import {\n type Apdu,\n ApduBuilder,\n ApduParser,\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 { type Signature } from \"@api/model/Signature\";\nimport {\n CONCORDIUM_APP_ERRORS,\n ConcordiumAppCommandErrorFactory,\n type ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA } from \"@internal/app-binder/constants\";\n\nexport type SignTransferWithMemoCommandArgs = {\n readonly p1: number;\n readonly p2: number;\n readonly data: Uint8Array;\n};\n\nexport type SignTransferWithMemoCommandResponse = Signature;\n\nexport class SignTransferWithMemoCommand\n implements\n Command<\n SignTransferWithMemoCommandResponse,\n SignTransferWithMemoCommandArgs,\n ConcordiumErrorCodes\n >\n{\n readonly name = \"SignTransferWithMemo\";\n\n private readonly args: SignTransferWithMemoCommandArgs;\n\n private readonly errorHelper = new CommandErrorHelper<\n SignTransferWithMemoCommandResponse,\n ConcordiumErrorCodes\n >(CONCORDIUM_APP_ERRORS, ConcordiumAppCommandErrorFactory);\n\n constructor(args: SignTransferWithMemoCommandArgs) {\n this.args = args;\n }\n\n getApdu(): Apdu {\n const apduBuilder = new ApduBuilder({\n cla: LEDGER_CLA,\n ins: INS.SIGN_TRANSFER_WITH_MEMO,\n p1: this.args.p1,\n p2: this.args.p2,\n });\n\n apduBuilder.addBufferToData(this.args.data);\n\n return apduBuilder.build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n ): CommandResult<SignTransferWithMemoCommandResponse, ConcordiumErrorCodes> {\n return Maybe.fromNullable(\n this.errorHelper.getError(apduResponse),\n ).orDefaultLazy(() => {\n const apduParser = new ApduParser(apduResponse);\n const remaining = apduParser.getUnparsedRemainingLength();\n const signature = apduParser.extractFieldByLength(remaining);\n\n return CommandResultFactory({\n data: signature as Signature,\n });\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CACPC,EAAmC,kCACnCC,EAAsB,qBAGtBC,EAIO,0EACPC,EAAgC,0CAUzB,MAAMN,CAOb,CACW,KAAO,uBAEC,KAEA,YAAc,IAAI,qBAGjC,wBAAuB,kCAAgC,EAEzD,YAAYO,EAAuC,CACjD,KAAK,KAAOA,CACd,CAEA,SAAgB,CACd,MAAMC,EAAc,IAAI,cAAY,CAClC,IAAK,aACL,IAAK,MAAI,wBACT,GAAI,KAAK,KAAK,GACd,GAAI,KAAK,KAAK,EAChB,CAAC,EAED,OAAAA,EAAY,gBAAgB,KAAK,KAAK,IAAI,EAEnCA,EAAY,MAAM,CAC3B,CAEA,cACEC,EAC0E,CAC1E,OAAO,QAAM,aACX,KAAK,YAAY,SAASA,CAAY,CACxC,EAAE,cAAc,IAAM,CACpB,MAAMC,EAAa,IAAI,aAAWD,CAAY,EACxCE,EAAYD,EAAW,2BAA2B,EAClDE,EAAYF,EAAW,qBAAqBC,CAAS,EAE3D,SAAO,wBAAqB,CAC1B,KAAMC,CACR,CAAC,CACH,CAAC,CACH,CACF",
6
6
  "names": ["SignTransferWithMemoCommand_exports", "__export", "SignTransferWithMemoCommand", "__toCommonJS", "import_device_management_kit", "import_signer_utils", "import_purify_ts", "import_ConcordiumApplicationErrors", "import_constants", "args", "apduBuilder", "apduResponse", "apduParser", "remaining", "signature"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("@ledgerhq/device-management-kit"),a=require("../../app-binder/command/SignTransferWithMemoCommand"),d=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),t=require("../../app-binder/constants");describe("SignTransferWithMemoCommand",()=>{describe("getApdu",()=>{it("should build APDU with INS=SIGN_TRANSFER_WITH_MEMO and given P1",()=>{const e=new a.SignTransferWithMemoCommand({p1:t.P1.INITIAL_WITH_MEMO,data:new Uint8Array(50).fill(1)}).getApdu().getRawApdu();expect(e[0]).toBe(t.LEDGER_CLA),expect(e[1]).toBe(t.INS.SIGN_TRANSFER_WITH_MEMO),expect(e[2]).toBe(t.P1.INITIAL_WITH_MEMO),expect(e[3]).toBe(t.P2.NONE)}),it("should use P1=MEMO for memo chunks",()=>{const e=new a.SignTransferWithMemoCommand({p1:t.P1.MEMO,data:new Uint8Array(100).fill(204)}).getApdu().getRawApdu();expect(e[2]).toBe(t.P1.MEMO)}),it("should use P1=AMOUNT for final amount step",()=>{const e=new a.SignTransferWithMemoCommand({p1:t.P1.AMOUNT,data:new Uint8Array(8).fill(0)}).getApdu().getRawApdu();expect(e[2]).toBe(t.P1.AMOUNT)}),it("should include data in APDU payload",()=>{const n=new Uint8Array([222,173,190,239]),o=new a.SignTransferWithMemoCommand({p1:t.P1.MEMO,data:n}).getApdu().getRawApdu();expect(o.slice(5)).toStrictEqual(n)})}),describe("parseResponse",()=>{it("should extract signature bytes on success",()=>{const n=new a.SignTransferWithMemoCommand({p1:t.P1.AMOUNT,data:new Uint8Array(8)}),e=new Uint8Array(64).fill(171),o=new r.ApduResponse({statusCode:new Uint8Array([144,0]),data:e}),s=n.parseResponse(o);expect((0,r.isSuccessCommandResult)(s)).toBe(!0),(0,r.isSuccessCommandResult)(s)&&expect(s.data).toStrictEqual(e)}),it("should return empty data for intermediate step response",()=>{const n=new a.SignTransferWithMemoCommand({p1:t.P1.INITIAL_WITH_MEMO,data:new Uint8Array(50)}),e=new r.ApduResponse({statusCode:new Uint8Array([144,0]),data:new Uint8Array([])}),o=n.parseResponse(e);expect((0,r.isSuccessCommandResult)(o)).toBe(!0)}),it("should return ConcordiumAppCommandError on user rejection",()=>{const n=new a.SignTransferWithMemoCommand({p1:t.P1.AMOUNT,data:new Uint8Array(8)}),e=new r.ApduResponse({statusCode:new Uint8Array([105,133]),data:new Uint8Array([])}),o=n.parseResponse(e);if(expect((0,r.isSuccessCommandResult)(o)).toBe(!1),!(0,r.isSuccessCommandResult)(o)){const s=o.error;expect(s.errorCode).toBe(d.ConcordiumErrorCodes.USER_REJECTED)}}),it("should return ConcordiumAppCommandError on data invalid",()=>{const n=new a.SignTransferWithMemoCommand({p1:t.P1.MEMO,data:new Uint8Array(10)}),e=new r.ApduResponse({statusCode:new Uint8Array([106,128]),data:new Uint8Array([])}),o=n.parseResponse(e);if(expect((0,r.isSuccessCommandResult)(o)).toBe(!1),!(0,r.isSuccessCommandResult)(o)){const s=o.error;expect(s.errorCode).toBe(d.ConcordiumErrorCodes.DATA_INVALID)}})})});
1
+ "use strict";var r=require("@ledgerhq/device-management-kit"),a=require("../../app-binder/command/SignTransferWithMemoCommand"),d=require("../../app-binder/command/utils/ConcordiumApplicationErrors"),e=require("../../app-binder/constants");describe("SignTransferWithMemoCommand",()=>{describe("getApdu",()=>{it("should build APDU with INS=SIGN_TRANSFER_WITH_MEMO and given P1",()=>{const t=new a.SignTransferWithMemoCommand({p1:e.P1.INITIAL_WITH_MEMO,p2:e.P2.NONE,data:new Uint8Array(50).fill(1)}).getApdu().getRawApdu();expect(t[0]).toBe(e.LEDGER_CLA),expect(t[1]).toBe(e.INS.SIGN_TRANSFER_WITH_MEMO),expect(t[2]).toBe(e.P1.INITIAL_WITH_MEMO),expect(t[3]).toBe(e.P2.NONE)}),it("should use P1=MEMO for memo chunks",()=>{const t=new a.SignTransferWithMemoCommand({p1:e.P1.MEMO,p2:e.P2.NONE,data:new Uint8Array(100).fill(204)}).getApdu().getRawApdu();expect(t[2]).toBe(e.P1.MEMO)}),it("should use P1=AMOUNT for final amount step",()=>{const t=new a.SignTransferWithMemoCommand({p1:e.P1.AMOUNT,p2:e.P2.NONE,data:new Uint8Array(8).fill(0)}).getApdu().getRawApdu();expect(t[2]).toBe(e.P1.AMOUNT)}),it("should include data in APDU payload",()=>{const n=new Uint8Array([222,173,190,239]),o=new a.SignTransferWithMemoCommand({p1:e.P1.MEMO,p2:e.P2.NONE,data:n}).getApdu().getRawApdu();expect(o.slice(5)).toStrictEqual(n)})}),describe("parseResponse",()=>{it("should extract signature bytes on success",()=>{const n=new a.SignTransferWithMemoCommand({p1:e.P1.AMOUNT,p2:e.P2.NONE,data:new Uint8Array(8)}),t=new Uint8Array(64).fill(171),o=new r.ApduResponse({statusCode:new Uint8Array([144,0]),data:t}),s=n.parseResponse(o);expect((0,r.isSuccessCommandResult)(s)).toBe(!0),(0,r.isSuccessCommandResult)(s)&&expect(s.data).toStrictEqual(t)}),it("should return empty data for intermediate step response",()=>{const n=new a.SignTransferWithMemoCommand({p1:e.P1.INITIAL_WITH_MEMO,p2:e.P2.NONE,data:new Uint8Array(50)}),t=new r.ApduResponse({statusCode:new Uint8Array([144,0]),data:new Uint8Array([])}),o=n.parseResponse(t);expect((0,r.isSuccessCommandResult)(o)).toBe(!0)}),it("should return ConcordiumAppCommandError on user rejection",()=>{const n=new a.SignTransferWithMemoCommand({p1:e.P1.AMOUNT,p2:e.P2.NONE,data:new Uint8Array(8)}),t=new r.ApduResponse({statusCode:new Uint8Array([105,133]),data:new Uint8Array([])}),o=n.parseResponse(t);if(expect((0,r.isSuccessCommandResult)(o)).toBe(!1),!(0,r.isSuccessCommandResult)(o)){const s=o.error;expect(s.errorCode).toBe(d.ConcordiumErrorCodes.USER_REJECTED)}}),it("should return ConcordiumAppCommandError on data invalid",()=>{const n=new a.SignTransferWithMemoCommand({p1:e.P1.MEMO,p2:e.P2.NONE,data:new Uint8Array(10)}),t=new r.ApduResponse({statusCode:new Uint8Array([106,128]),data:new Uint8Array([])}),o=n.parseResponse(t);if(expect((0,r.isSuccessCommandResult)(o)).toBe(!1),!(0,r.isSuccessCommandResult)(o)){const s=o.error;expect(s.errorCode).toBe(d.ConcordiumErrorCodes.DATA_INVALID)}})})});
2
2
  //# sourceMappingURL=SignTransferWithMemoCommand.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/command/SignTransferWithMemoCommand.test.ts"],
4
- "sourcesContent": ["import {\n ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { SignTransferWithMemoCommand } from \"@internal/app-binder/command/SignTransferWithMemoCommand\";\nimport {\n type ConcordiumAppCommandError,\n ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA, P1, P2 } from \"@internal/app-binder/constants\";\n\ndescribe(\"SignTransferWithMemoCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should build APDU with INS=SIGN_TRANSFER_WITH_MEMO and given P1\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.INITIAL_WITH_MEMO,\n data: new Uint8Array(50).fill(0x01),\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[0]).toBe(LEDGER_CLA);\n expect(raw[1]).toBe(INS.SIGN_TRANSFER_WITH_MEMO);\n expect(raw[2]).toBe(P1.INITIAL_WITH_MEMO);\n expect(raw[3]).toBe(P2.NONE);\n });\n\n it(\"should use P1=MEMO for memo chunks\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.MEMO,\n data: new Uint8Array(100).fill(0xcc),\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[2]).toBe(P1.MEMO);\n });\n\n it(\"should use P1=AMOUNT for final amount step\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.AMOUNT,\n data: new Uint8Array(8).fill(0x00),\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[2]).toBe(P1.AMOUNT);\n });\n\n it(\"should include data in APDU payload\", () => {\n const data = new Uint8Array([0xde, 0xad, 0xbe, 0xef]);\n const command = new SignTransferWithMemoCommand({\n p1: P1.MEMO,\n data,\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw.slice(5)).toStrictEqual(data);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should extract signature bytes on success\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.AMOUNT,\n data: new Uint8Array(8),\n });\n\n const signature = new Uint8Array(64).fill(0xab);\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: signature,\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n if (isSuccessCommandResult(result)) {\n expect(result.data).toStrictEqual(signature);\n }\n });\n\n it(\"should return empty data for intermediate step response\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.INITIAL_WITH_MEMO,\n data: new Uint8Array(50),\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n\n it(\"should return ConcordiumAppCommandError on user rejection\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.AMOUNT,\n data: new Uint8Array(8),\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x69, 0x85]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.USER_REJECTED);\n }\n });\n\n it(\"should return ConcordiumAppCommandError on data invalid\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.MEMO,\n data: new Uint8Array(10),\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x6a, 0x80]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.DATA_INVALID);\n }\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAA4C,oEAC5CC,EAGO,0EACPC,EAAwC,0CAExC,SAAS,8BAA+B,IAAM,CAC5C,SAAS,UAAW,IAAM,CACxB,GAAG,kEAAmE,IAAM,CAM1E,MAAMC,EALU,IAAI,8BAA4B,CAC9C,GAAI,K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AAW,IAAI,eAAa,CAChC,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,CAAC,EAEKC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,GADA,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,EAC7C,IAAC,0BAAuBA,CAAM,EAAG,CACnC,MAAMC,EAAMD,EAAO,MACnB,OAAOC,EAAI,SAAS,EAAE,KAAK,uBAAqB,YAAY,CAC9D,CACF,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import {\n ApduResponse,\n isSuccessCommandResult,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { SignTransferWithMemoCommand } from \"@internal/app-binder/command/SignTransferWithMemoCommand\";\nimport {\n type ConcordiumAppCommandError,\n ConcordiumErrorCodes,\n} from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { INS, LEDGER_CLA, P1, P2 } from \"@internal/app-binder/constants\";\n\ndescribe(\"SignTransferWithMemoCommand\", () => {\n describe(\"getApdu\", () => {\n it(\"should build APDU with INS=SIGN_TRANSFER_WITH_MEMO and given P1\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.INITIAL_WITH_MEMO,\n p2: P2.NONE,\n data: new Uint8Array(50).fill(0x01),\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[0]).toBe(LEDGER_CLA);\n expect(raw[1]).toBe(INS.SIGN_TRANSFER_WITH_MEMO);\n expect(raw[2]).toBe(P1.INITIAL_WITH_MEMO);\n expect(raw[3]).toBe(P2.NONE);\n });\n\n it(\"should use P1=MEMO for memo chunks\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.MEMO,\n p2: P2.NONE,\n data: new Uint8Array(100).fill(0xcc),\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[2]).toBe(P1.MEMO);\n });\n\n it(\"should use P1=AMOUNT for final amount step\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.AMOUNT,\n p2: P2.NONE,\n data: new Uint8Array(8).fill(0x00),\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw[2]).toBe(P1.AMOUNT);\n });\n\n it(\"should include data in APDU payload\", () => {\n const data = new Uint8Array([0xde, 0xad, 0xbe, 0xef]);\n const command = new SignTransferWithMemoCommand({\n p1: P1.MEMO,\n p2: P2.NONE,\n data,\n });\n\n const raw = command.getApdu().getRawApdu();\n\n expect(raw.slice(5)).toStrictEqual(data);\n });\n });\n\n describe(\"parseResponse\", () => {\n it(\"should extract signature bytes on success\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.AMOUNT,\n p2: P2.NONE,\n data: new Uint8Array(8),\n });\n\n const signature = new Uint8Array(64).fill(0xab);\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: signature,\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n if (isSuccessCommandResult(result)) {\n expect(result.data).toStrictEqual(signature);\n }\n });\n\n it(\"should return empty data for intermediate step response\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.INITIAL_WITH_MEMO,\n p2: P2.NONE,\n data: new Uint8Array(50),\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(true);\n });\n\n it(\"should return ConcordiumAppCommandError on user rejection\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.AMOUNT,\n p2: P2.NONE,\n data: new Uint8Array(8),\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x69, 0x85]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.USER_REJECTED);\n }\n });\n\n it(\"should return ConcordiumAppCommandError on data invalid\", () => {\n const command = new SignTransferWithMemoCommand({\n p1: P1.MEMO,\n p2: P2.NONE,\n data: new Uint8Array(10),\n });\n\n const response = new ApduResponse({\n statusCode: new Uint8Array([0x6a, 0x80]),\n data: new Uint8Array([]),\n });\n\n const result = command.parseResponse(response);\n\n expect(isSuccessCommandResult(result)).toBe(false);\n if (!isSuccessCommandResult(result)) {\n const err = result.error as ConcordiumAppCommandError;\n expect(err.errorCode).toBe(ConcordiumErrorCodes.DATA_INVALID);\n }\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAGO,2CAEPC,EAA4C,oEAC5CC,EAGO,0EACPC,EAAwC,0CAExC,SAAS,8BAA+B,IAAM,CAC5C,SAAS,UAAW,IAAM,CACxB,GAAG,kEAAmE,IAAM,CAO1E,MAAMC,EANU,IAAI,8BAA4B,CAC9C,GAAI,KAAG,kBACP,GAAI,KAAG,KACP,KAAM,IAAI,WAAW,EAAE,EAAE,KAAK,CAAI,CACpC,CAAC,EAEmB,QAAQ,EAAE,WAAW,EAEzC,OAAOA,EAAI,CAAC,CAAC,EAAE,KAAK,YAAU,EAC9B,OAAOA,EAAI,CAAC,CAAC,EAAE,KAAK,MAAI,uBAAuB,EAC/C,OAAOA,EAAI,CAAC,CAAC,EAAE,KAAK,KAAG,iBAAiB,EACxC,OAAOA,EAAI,CAAC,CAAC,EAAE,KAAK,KAAG,IAAI,CAC7B,CAAC,EAED,GAAG,qCAAsC,IAAM,CAO7C,MAAMA,EANU,IAAI,8BAA4B,CAC9C,GAAI,KAAG,KACP,GAAI,KAAG,KACP,KAAM,IAAI,WAAW,GAAG,EAAE,KAAK,GAAI,CACrC,CAAC,EAEmB,QAAQ,EAAE,WAAW,EAEzC,OAAOA,EAAI,CAAC,CAAC,EAAE,KAAK,KAAG,IAAI,CAC7B,CAAC,EAED,GAAG,6CAA8C,IAAM,CAOrD,MAAMA,EANU,IAAI,8BAA4B,CAC9C,GAAI,KAAG,OAC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AE7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAI,CAClD,CAAC,EAED,GAAG,4DAA6D,IAAM,CACpE,MAAMH,EAAU,IAAI,8BAA4B,CAC9C,GAAI,KAAG,OACP,GAAI,KAAG,KACP,KAAM,IAAI,WAAW,CAAC,CACxB,CAAC,EAEKE,EAAW,IAAI,eAAa,CAChC,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,CAAC,EAEKC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,GADA,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,EAC7C,IAAC,0BAAuBA,CAAM,EAAG,CACnC,MAAMC,EAAMD,EAAO,MACnB,OAAOC,EAAI,SAAS,EAAE,KAAK,uBAAqB,aAAa,CAC/D,CACF,CAAC,EAED,GAAG,0DAA2D,IAAM,CAClE,MAAMJ,EAAU,IAAI,8BAA4B,CAC9C,GAAI,KAAG,KACP,GAAI,KAAG,KACP,KAAM,IAAI,WAAW,EAAE,CACzB,CAAC,EAEKE,EAAW,IAAI,eAAa,CAChC,WAAY,IAAI,WAAW,CAAC,IAAM,GAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,CAAC,EAEKC,EAASH,EAAQ,cAAcE,CAAQ,EAG7C,GADA,UAAO,0BAAuBC,CAAM,CAAC,EAAE,KAAK,EAAK,EAC7C,IAAC,0BAAuBA,CAAM,EAAG,CACnC,MAAMC,EAAMD,EAAO,MACnB,OAAOC,EAAI,SAAS,EAAE,KAAK,uBAAqB,YAAY,CAC9D,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_device_management_kit", "import_SignTransferWithMemoCommand", "import_ConcordiumApplicationErrors", "import_constants", "raw", "data", "command", "signature", "response", "result", "err"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var _=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var i=(r,e)=>{for(var t in e)_(r,t,{get:e[t],enumerable:!0})},R=(r,e,t,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!A.call(r,s)&&s!==t&&_(r,s,{get:()=>e[s],enumerable:!(m=p(e,s))||m.enumerable});return r};var c=r=>R(_({},"__esModule",{value:!0}),r);var g={};i(g,{CONCORDIUM_APP_ERRORS:()=>T,ConcordiumAppCommandError:()=>d,ConcordiumAppCommandErrorFactory:()=>D,ConcordiumErrorCodes:()=>o});module.exports=c(g);var n=require("@ledgerhq/device-management-kit"),o=(a=>(a.USER_REJECTED="6985",a.LOCKED_DEVICE="5515",a.DATA_INVALID="6a80",a.INS_NOT_SUPPORTED="6d00",a.CLA_NOT_SUPPORTED="6e00",a.UNKNOWN_ERROR="6f00",a.TRUSTED_NAME_MISMATCH="6b0c",a.UNSUPPORTED_TRANSACTION_TYPE="unsupported_transaction_type",a.TRUSTED_METADATA_SERVICE_ERROR="trusted_metadata_service_error",a.ADDRESS_VERIFICATION_FAILED="address_verification_failed",a))(o||{});const T={6985:{message:"User rejected"},5515:{message:"Locked device"},"6a80":{message:"Data invalid"},"6d00":{message:"INS not supported"},"6e00":{message:"CLA not supported"},"6f00":{message:"Unknown error"},"6b0c":{message:"Trusted name mismatch"},unsupported_transaction_type:{message:"Unsupported transaction type"},trusted_metadata_service_error:{message:"Trusted metadata service error"},address_verification_failed:{message:"Address verification failed"}};class d extends n.DeviceExchangeError{constructor(e){super({tag:"ConcordiumAppCommandError",...e})}}const D=r=>new d(r);0&&(module.exports={CONCORDIUM_APP_ERRORS,ConcordiumAppCommandError,ConcordiumAppCommandErrorFactory,ConcordiumErrorCodes});
1
+ "use strict";var _=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var A=(r,e)=>{for(var t in e)_(r,t,{get:e[t],enumerable:!0})},R=(r,e,t,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of i(e))!o.call(r,s)&&s!==t&&_(r,s,{get:()=>e[s],enumerable:!(m=p(e,s))||m.enumerable});return r};var T=r=>R(_({},"__esModule",{value:!0}),r);var g={};A(g,{CONCORDIUM_APP_ERRORS:()=>c,ConcordiumAppCommandError:()=>E,ConcordiumAppCommandErrorFactory:()=>D,ConcordiumErrorCodes:()=>d});module.exports=T(g);var n=require("@ledgerhq/device-management-kit"),d=(a=>(a.USER_REJECTED="6985",a.LOCKED_DEVICE="5515",a.DATA_INVALID="6a80",a.INS_NOT_SUPPORTED="6d00",a.CLA_NOT_SUPPORTED="6e00",a.UNKNOWN_ERROR="6f00",a.TRUSTED_NAME_MISMATCH="6b0c",a.UNSUPPORTED_TRANSACTION_TYPE="unsupported_transaction_type",a.TRUSTED_METADATA_SERVICE_ERROR="trusted_metadata_service_error",a.ADDRESS_VERIFICATION_FAILED="address_verification_failed",a.INVALID_MAX_FEE="invalid_max_fee",a))(d||{});const c={6985:{message:"User rejected"},5515:{message:"Locked device"},"6a80":{message:"Data invalid"},"6d00":{message:"INS not supported"},"6e00":{message:"CLA not supported"},"6f00":{message:"Unknown error"},"6b0c":{message:"Trusted name mismatch"},unsupported_transaction_type:{message:"Unsupported transaction type"},trusted_metadata_service_error:{message:"Trusted metadata service error"},address_verification_failed:{message:"Address verification failed"},invalid_max_fee:{message:"Invalid maxFee value"}};class E extends n.DeviceExchangeError{constructor(e){super({tag:"ConcordiumAppCommandError",...e})}}const D=r=>new E(r);0&&(module.exports={CONCORDIUM_APP_ERRORS,ConcordiumAppCommandError,ConcordiumAppCommandErrorFactory,ConcordiumErrorCodes});
2
2
  //# sourceMappingURL=ConcordiumApplicationErrors.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/internal/app-binder/command/utils/ConcordiumApplicationErrors.ts"],
4
- "sourcesContent": ["import {\n type CommandErrorArgs,\n type CommandErrors,\n DeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nexport enum ConcordiumErrorCodes {\n USER_REJECTED = \"6985\",\n LOCKED_DEVICE = \"5515\",\n DATA_INVALID = \"6a80\",\n INS_NOT_SUPPORTED = \"6d00\",\n CLA_NOT_SUPPORTED = \"6e00\",\n UNKNOWN_ERROR = \"6f00\",\n TRUSTED_NAME_MISMATCH = \"6b0c\",\n UNSUPPORTED_TRANSACTION_TYPE = \"unsupported_transaction_type\",\n TRUSTED_METADATA_SERVICE_ERROR = \"trusted_metadata_service_error\",\n ADDRESS_VERIFICATION_FAILED = \"address_verification_failed\",\n}\n\nexport const CONCORDIUM_APP_ERRORS: CommandErrors<ConcordiumErrorCodes> = {\n \"6985\": { message: \"User rejected\" },\n \"5515\": { message: \"Locked device\" },\n \"6a80\": { message: \"Data invalid\" },\n \"6d00\": { message: \"INS not supported\" },\n \"6e00\": { message: \"CLA not supported\" },\n \"6f00\": { message: \"Unknown error\" },\n \"6b0c\": { message: \"Trusted name mismatch\" },\n unsupported_transaction_type: { message: \"Unsupported transaction type\" },\n trusted_metadata_service_error: {\n message: \"Trusted metadata service error\",\n },\n address_verification_failed: {\n message: \"Address verification failed\",\n },\n};\n\nexport class ConcordiumAppCommandError extends DeviceExchangeError<ConcordiumErrorCodes> {\n constructor(args: CommandErrorArgs<ConcordiumErrorCodes>) {\n super({ tag: \"ConcordiumAppCommandError\", ...args });\n }\n}\n\nexport const ConcordiumAppCommandErrorFactory = (\n args: CommandErrorArgs<ConcordiumErrorCodes>,\n) => new ConcordiumAppCommandError(args);\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,EAAA,8BAAAC,EAAA,qCAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAN,GAAA,IAAAO,EAIO,2CAEKF,OACVA,EAAA,cAAgB,OAChBA,EAAA,cAAgB,OAChBA,EAAA,aAAe,OACfA,EAAA,kBAAoB,OACpBA,EAAA,kBAAoB,OACpBA,EAAA,cAAgB,OAChBA,EAAA,sBAAwB,OACxBA,EAAA,6BAA+B,+BAC/BA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAVpBA,OAAA,IAaL,MAAMH,EAA6D,CACxE,KAAQ,CAAE,QAAS,eAAgB,EACnC,KAAQ,CAAE,QAAS,eAAgB,EACnC,OAAQ,CAAE,QAAS,cAAe,EAClC,OAAQ,CAAE,QAAS,mBAAoB,EACvC,OAAQ,CAAE,QAAS,mBAAoB,EACvC,OAAQ,CAAE,QAAS,eAAgB,EACnC,OAAQ,CAAE,QAAS,uBAAwB,EAC3C,6BAA8B,CAAE,QAAS,8BAA+B,EACxE,+BAAgC,CAC9B,QAAS,gCACX,EACA,4BAA6B,CAC3B,QAAS,6BACX,CACF,EAEO,MAAMC,UAAkC,qBAA0C,CACvF,YAAYK,EAA8C,CACxD,MAAM,CAAE,IAAK,4BAA6B,GAAGA,CAAK,CAAC,CACrD,CACF,CAEO,MAAMJ,EACXI,GACG,IAAIL,EAA0BK,CAAI",
4
+ "sourcesContent": ["import {\n type CommandErrorArgs,\n type CommandErrors,\n DeviceExchangeError,\n} from \"@ledgerhq/device-management-kit\";\n\nexport enum ConcordiumErrorCodes {\n USER_REJECTED = \"6985\",\n LOCKED_DEVICE = \"5515\",\n DATA_INVALID = \"6a80\",\n INS_NOT_SUPPORTED = \"6d00\",\n CLA_NOT_SUPPORTED = \"6e00\",\n UNKNOWN_ERROR = \"6f00\",\n TRUSTED_NAME_MISMATCH = \"6b0c\",\n UNSUPPORTED_TRANSACTION_TYPE = \"unsupported_transaction_type\",\n TRUSTED_METADATA_SERVICE_ERROR = \"trusted_metadata_service_error\",\n ADDRESS_VERIFICATION_FAILED = \"address_verification_failed\",\n INVALID_MAX_FEE = \"invalid_max_fee\",\n}\n\nexport const CONCORDIUM_APP_ERRORS: CommandErrors<ConcordiumErrorCodes> = {\n \"6985\": { message: \"User rejected\" },\n \"5515\": { message: \"Locked device\" },\n \"6a80\": { message: \"Data invalid\" },\n \"6d00\": { message: \"INS not supported\" },\n \"6e00\": { message: \"CLA not supported\" },\n \"6f00\": { message: \"Unknown error\" },\n \"6b0c\": { message: \"Trusted name mismatch\" },\n unsupported_transaction_type: { message: \"Unsupported transaction type\" },\n trusted_metadata_service_error: {\n message: \"Trusted metadata service error\",\n },\n address_verification_failed: {\n message: \"Address verification failed\",\n },\n invalid_max_fee: {\n message: \"Invalid maxFee value\",\n },\n};\n\nexport class ConcordiumAppCommandError extends DeviceExchangeError<ConcordiumErrorCodes> {\n constructor(args: CommandErrorArgs<ConcordiumErrorCodes>) {\n super({ tag: \"ConcordiumAppCommandError\", ...args });\n }\n}\n\nexport const ConcordiumAppCommandErrorFactory = (\n args: CommandErrorArgs<ConcordiumErrorCodes>,\n) => new ConcordiumAppCommandError(args);\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,EAAA,8BAAAC,EAAA,qCAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAN,GAAA,IAAAO,EAIO,2CAEKF,OACVA,EAAA,cAAgB,OAChBA,EAAA,cAAgB,OAChBA,EAAA,aAAe,OACfA,EAAA,kBAAoB,OACpBA,EAAA,kBAAoB,OACpBA,EAAA,cAAgB,OAChBA,EAAA,sBAAwB,OACxBA,EAAA,6BAA+B,+BAC/BA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,gBAAkB,kBAXRA,OAAA,IAcL,MAAMH,EAA6D,CACxE,KAAQ,CAAE,QAAS,eAAgB,EACnC,KAAQ,CAAE,QAAS,eAAgB,EACnC,OAAQ,CAAE,QAAS,cAAe,EAClC,OAAQ,CAAE,QAAS,mBAAoB,EACvC,OAAQ,CAAE,QAAS,mBAAoB,EACvC,OAAQ,CAAE,QAAS,eAAgB,EACnC,OAAQ,CAAE,QAAS,uBAAwB,EAC3C,6BAA8B,CAAE,QAAS,8BAA+B,EACxE,+BAAgC,CAC9B,QAAS,gCACX,EACA,4BAA6B,CAC3B,QAAS,6BACX,EACA,gBAAiB,CACf,QAAS,sBACX,CACF,EAEO,MAAMC,UAAkC,qBAA0C,CACvF,YAAYK,EAA8C,CACxD,MAAM,CAAE,IAAK,4BAA6B,GAAGA,CAAK,CAAC,CACrD,CACF,CAEO,MAAMJ,EACXI,GACG,IAAIL,EAA0BK,CAAI",
6
6
  "names": ["ConcordiumApplicationErrors_exports", "__export", "CONCORDIUM_APP_ERRORS", "ConcordiumAppCommandError", "ConcordiumAppCommandErrorFactory", "ConcordiumErrorCodes", "__toCommonJS", "import_device_management_kit", "args"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var a=(f,n)=>{for(var r in n)e(f,r,{get:n[r],enumerable:!0})},m=(f,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of x(n))!E.call(f,o)&&o!==r&&e(f,o,{get:()=>n[o],enumerable:!(t=g(n,o))||t.enumerable});return f};var c=f=>m(e({},"__esModule",{value:!0}),f);var w={};a(w,{encodeMaxFeeBigEndian:()=>u});module.exports=c(w);var i=require("../../../app-binder/constants");function u(f){if(f<0n||f>0xffffffffffffffffn)throw new RangeError(`maxFee out of uint64 range: ${f.toString()} (\xB5CCD)`);const n=new Uint8Array(i.FEE_DISPLAY_SIZE);let r=f;for(let t=i.FEE_DISPLAY_SIZE-1;t>=0;t--)n[t]=Number(r&0xffn),r>>=8n;return n}0&&(module.exports={encodeMaxFeeBigEndian});
2
+ //# sourceMappingURL=EncodeMaxFee.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/app-binder/command/utils/EncodeMaxFee.ts"],
4
+ "sourcesContent": ["import { FEE_DISPLAY_SIZE } from \"@internal/app-binder/constants\";\n\n/**\n * Encode \u00B5CCD max-fee as big-endian uint64 for the fee-display APDU extension.\n */\nexport function encodeMaxFeeBigEndian(value: bigint): Uint8Array {\n if (value < 0n || value > 0xffffffffffffffffn) {\n throw new RangeError(\n `maxFee out of uint64 range: ${value.toString()} (\u00B5CCD)`,\n );\n }\n const out = new Uint8Array(FEE_DISPLAY_SIZE);\n let v = value;\n for (let i = FEE_DISPLAY_SIZE - 1; i >= 0; i--) {\n out[i] = Number(v & 0xffn);\n v >>= 8n;\n }\n return out;\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,0CAK1B,SAASF,EAAsBG,EAA2B,CAC/D,GAAIA,EAAQ,IAAMA,EAAQ,oBACxB,MAAM,IAAI,WACR,+BAA+BA,EAAM,SAAS,CAAC,YACjD,EAEF,MAAMC,EAAM,IAAI,WAAW,kBAAgB,EAC3C,IAAIC,EAAIF,EACR,QAASG,EAAI,mBAAmB,EAAGA,GAAK,EAAGA,IACzCF,EAAIE,CAAC,EAAI,OAAOD,EAAI,KAAK,EACzBA,IAAM,GAER,OAAOD,CACT",
6
+ "names": ["EncodeMaxFee_exports", "__export", "encodeMaxFeeBigEndian", "__toCommonJS", "import_constants", "value", "out", "v", "i"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},x=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!a.call(r,n)&&n!==o&&t(r,n,{get:()=>e[n],enumerable:!(i=g(e,n))||i.enumerable});return r};var c=r=>x(t({},"__esModule",{value:!0}),r);var E={};m(E,{InvalidMaxFeeError:()=>I});module.exports=c(E);var f=require("@ledgerhq/device-management-kit"),d=require("../../../app-binder/command/utils/ConcordiumApplicationErrors");const C=0xffffffffffffffffn;class I extends f.DeviceExchangeError{constructor(e){super({tag:"InvalidMaxFeeError",message:u(e),errorCode:d.ConcordiumErrorCodes.INVALID_MAX_FEE})}}function u(r){return typeof r!="bigint"?`Invalid maxFee: expected bigint, got ${typeof r}.`:r<0n?`Invalid maxFee: must be non-negative, got ${r.toString()} \xB5CCD.`:r>C?`Invalid maxFee: exceeds uint64 range, got ${r.toString()} \xB5CCD.`:`Invalid maxFee: ${String(r)}.`}0&&(module.exports={InvalidMaxFeeError});
2
+ //# sourceMappingURL=InvalidMaxFeeError.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/internal/app-binder/command/utils/InvalidMaxFeeError.ts"],
4
+ "sourcesContent": ["import { DeviceExchangeError } from \"@ledgerhq/device-management-kit\";\n\nimport { ConcordiumErrorCodes } from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\n\nconst UINT64_MAX = 0xffffffffffffffffn;\n\nexport class InvalidMaxFeeError extends DeviceExchangeError<ConcordiumErrorCodes> {\n constructor(value: unknown) {\n super({\n tag: \"InvalidMaxFeeError\",\n message: buildMessage(value),\n errorCode: ConcordiumErrorCodes.INVALID_MAX_FEE,\n });\n }\n}\n\nfunction buildMessage(value: unknown): string {\n if (typeof value !== \"bigint\") {\n return `Invalid maxFee: expected bigint, got ${typeof value}.`;\n }\n if (value < 0n) {\n return `Invalid maxFee: must be non-negative, got ${value.toString()} \u00B5CCD.`;\n }\n if (value > UINT64_MAX) {\n return `Invalid maxFee: exceeds uint64 range, got ${value.toString()} \u00B5CCD.`;\n }\n return `Invalid maxFee: ${String(value)}.`;\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,2CAEpCC,EAAqC,0EAErC,MAAMC,EAAa,oBAEZ,MAAMJ,UAA2B,qBAA0C,CAChF,YAAYK,EAAgB,CAC1B,MAAM,CACJ,IAAK,qBACL,QAASC,EAAaD,CAAK,EAC3B,UAAW,uBAAqB,eAClC,CAAC,CACH,CACF,CAEA,SAASC,EAAaD,EAAwB,CAC5C,OAAI,OAAOA,GAAU,SACZ,wCAAwC,OAAOA,CAAK,IAEzDA,EAAQ,GACH,6CAA6CA,EAAM,SAAS,CAAC,YAElEA,EAAQD,EACH,6CAA6CC,EAAM,SAAS,CAAC,YAE/D,mBAAmB,OAAOA,CAAK,CAAC,GACzC",
6
+ "names": ["InvalidMaxFeeError_exports", "__export", "InvalidMaxFeeError", "__toCommonJS", "import_device_management_kit", "import_ConcordiumApplicationErrors", "UINT64_MAX", "value", "buildMessage"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var I=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var O=(T,E)=>{for(var x in E)I(T,x,{get:E[x],enumerable:!0})},L=(T,E,x,N)=>{if(E&&typeof E=="object"||typeof E=="function")for(let _ of A(E))!S.call(T,_)&&_!==x&&I(T,_,{get:()=>E[_],enumerable:!(N=R(E,_))||N.enumerable});return T};var o=T=>L(I({},"__esModule",{value:!0}),T);var t={};O(t,{APP_NAME:()=>G,INS:()=>C,LEDGER_CLA:()=>M,P1:()=>D,P2:()=>F});module.exports=o(t);const G="Concordium",M=224,C={VERIFY_ADDRESS:0,GET_PUBLIC_KEY:1,SIGN_TRANSFER:2,SIGN_TRANSFER_WITH_SCHEDULE:3,SIGN_CREDENTIAL_DEPLOYMENT:4,SIGN_TRANSFER_WITH_MEMO:50,SIGN_TRANSFER_WITH_SCHEDULE_AND_MEMO:52,REGISTER_DATA:53,SET_TRUSTED_NAME:34,GET_CHALLENGE:35,GET_APP_VERSION:64},D={NON_CONFIRM:1,CONFIRM:0,FIRST_CHUNK:0,INITIAL:0,INITIAL_WITH_MEMO:1,MEMO:2,AMOUNT:3,VERIFICATION_KEY_COUNT:10,VERIFICATION_KEY:1,SIGNATURE_THRESHOLD:2,AR_IDENTITY:3,CREDENTIAL_DATES:4,ATTRIBUTE_TAG:5,ATTRIBUTE_VALUE:6,LENGTH_OF_PROOFS:7,PROOFS:8,NEW_OR_EXISTING:9,FULL_PATH:2},F={NONE:0,MORE:128,LAST:0};0&&(module.exports={APP_NAME,INS,LEDGER_CLA,P1,P2});
1
+ "use strict";var x=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var O=(_,E)=>{for(var I in E)x(_,I,{get:E[I],enumerable:!0})},L=(_,E,I,N)=>{if(E&&typeof E=="object"||typeof E=="function")for(let T of R(E))!S.call(_,T)&&T!==I&&x(_,T,{get:()=>E[T],enumerable:!(N=A(E,T))||N.enumerable});return _};var o=_=>L(x({},"__esModule",{value:!0}),_);var P={};O(P,{APP_NAME:()=>D,FEE_DISPLAY_SIZE:()=>C,INS:()=>t,LEDGER_CLA:()=>F,P1:()=>G,P2:()=>M});module.exports=o(P);const D="Concordium",F=224,t={VERIFY_ADDRESS:0,GET_PUBLIC_KEY:1,SIGN_TRANSFER:2,SIGN_TRANSFER_WITH_SCHEDULE:3,SIGN_CREDENTIAL_DEPLOYMENT:4,SIGN_TRANSFER_WITH_MEMO:50,SIGN_TRANSFER_WITH_SCHEDULE_AND_MEMO:52,REGISTER_DATA:53,SET_TRUSTED_NAME:34,GET_CHALLENGE:35,GET_APP_VERSION:64},G={NON_CONFIRM:1,CONFIRM:0,FIRST_CHUNK:0,INITIAL:0,INITIAL_WITH_MEMO:1,MEMO:2,AMOUNT:3,VERIFICATION_KEY_COUNT:10,VERIFICATION_KEY:1,SIGNATURE_THRESHOLD:2,AR_IDENTITY:3,CREDENTIAL_DATES:4,ATTRIBUTE_TAG:5,ATTRIBUTE_VALUE:6,LENGTH_OF_PROOFS:7,PROOFS:8,NEW_OR_EXISTING:9,FULL_PATH:2},M={NONE:0,MORE:128,LAST:0,FEE_DISPLAY:1},C=8;0&&(module.exports={APP_NAME,FEE_DISPLAY_SIZE,INS,LEDGER_CLA,P1,P2});
2
2
  //# sourceMappingURL=constants.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/app-binder/constants.ts"],
4
- "sourcesContent": ["export const APP_NAME = \"Concordium\";\n\nexport const LEDGER_CLA = 0xe0;\n\nexport const INS = {\n VERIFY_ADDRESS: 0x00,\n GET_PUBLIC_KEY: 0x01,\n SIGN_TRANSFER: 0x02,\n SIGN_TRANSFER_WITH_SCHEDULE: 0x03,\n SIGN_CREDENTIAL_DEPLOYMENT: 0x04,\n SIGN_TRANSFER_WITH_MEMO: 0x32,\n SIGN_TRANSFER_WITH_SCHEDULE_AND_MEMO: 0x34,\n REGISTER_DATA: 0x35,\n SET_TRUSTED_NAME: 0x22,\n GET_CHALLENGE: 0x23,\n GET_APP_VERSION: 0x40,\n} as const;\n\nexport const P1 = {\n NON_CONFIRM: 0x01,\n CONFIRM: 0x00,\n FIRST_CHUNK: 0x00,\n INITIAL: 0x00,\n INITIAL_WITH_MEMO: 0x01,\n MEMO: 0x02,\n AMOUNT: 0x03,\n\n // Credential Deployment\n VERIFICATION_KEY_COUNT: 0x0a,\n VERIFICATION_KEY: 0x01,\n SIGNATURE_THRESHOLD: 0x02,\n AR_IDENTITY: 0x03,\n CREDENTIAL_DATES: 0x04,\n ATTRIBUTE_TAG: 0x05,\n ATTRIBUTE_VALUE: 0x06,\n LENGTH_OF_PROOFS: 0x07,\n PROOFS: 0x08,\n NEW_OR_EXISTING: 0x09,\n FULL_PATH: 0x02,\n} as const;\n\nexport const P2 = {\n NONE: 0x00,\n MORE: 0x80,\n LAST: 0x00,\n} as const;\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,QAAAC,EAAA,eAAAC,EAAA,OAAAC,EAAA,OAAAC,IAAA,eAAAC,EAAAP,GAAO,MAAME,EAAW,aAEXE,EAAa,IAEbD,EAAM,CACjB,eAAgB,EAChB,eAAgB,EAChB,cAAe,EACf,4BAA6B,EAC7B,2BAA4B,EAC5B,wBAAyB,GACzB,qCAAsC,GACtC,cAAe,GACf,iBAAkB,GAClB,cAAe,GACf,gBAAiB,EACnB,EAEaE,EAAK,CAChB,YAAa,EACb,QAAS,EACT,YAAa,EACb,QAAS,EACT,kBAAmB,EACnB,KAAM,EACN,OAAQ,EAGR,uBAAwB,GACxB,iBAAkB,EAClB,oBAAqB,EACrB,YAAa,EACb,iBAAkB,EAClB,cAAe,EACf,gBAAiB,EACjB,iBAAkB,EAClB,OAAQ,EACR,gBAAiB,EACjB,UAAW,CACb,EAEaC,EAAK,CAChB,KAAM,EACN,KAAM,IACN,KAAM,CACR",
6
- "names": ["constants_exports", "__export", "APP_NAME", "INS", "LEDGER_CLA", "P1", "P2", "__toCommonJS"]
4
+ "sourcesContent": ["export const APP_NAME = \"Concordium\";\n\nexport const LEDGER_CLA = 0xe0;\n\nexport const INS = {\n VERIFY_ADDRESS: 0x00,\n GET_PUBLIC_KEY: 0x01,\n SIGN_TRANSFER: 0x02,\n SIGN_TRANSFER_WITH_SCHEDULE: 0x03,\n SIGN_CREDENTIAL_DEPLOYMENT: 0x04,\n SIGN_TRANSFER_WITH_MEMO: 0x32,\n SIGN_TRANSFER_WITH_SCHEDULE_AND_MEMO: 0x34,\n REGISTER_DATA: 0x35,\n SET_TRUSTED_NAME: 0x22,\n GET_CHALLENGE: 0x23,\n GET_APP_VERSION: 0x40,\n} as const;\n\nexport const P1 = {\n NON_CONFIRM: 0x01,\n CONFIRM: 0x00,\n FIRST_CHUNK: 0x00,\n INITIAL: 0x00,\n INITIAL_WITH_MEMO: 0x01,\n MEMO: 0x02,\n AMOUNT: 0x03,\n\n // Credential Deployment\n VERIFICATION_KEY_COUNT: 0x0a,\n VERIFICATION_KEY: 0x01,\n SIGNATURE_THRESHOLD: 0x02,\n AR_IDENTITY: 0x03,\n CREDENTIAL_DATES: 0x04,\n ATTRIBUTE_TAG: 0x05,\n ATTRIBUTE_VALUE: 0x06,\n LENGTH_OF_PROOFS: 0x07,\n PROOFS: 0x08,\n NEW_OR_EXISTING: 0x09,\n FULL_PATH: 0x02,\n} as const;\n\nexport const P2 = {\n NONE: 0x00,\n MORE: 0x80,\n LAST: 0x00,\n FEE_DISPLAY: 0x01,\n} as const;\n\nexport const FEE_DISPLAY_SIZE = 8;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,qBAAAC,EAAA,QAAAC,EAAA,eAAAC,EAAA,OAAAC,EAAA,OAAAC,IAAA,eAAAC,EAAAR,GAAO,MAAME,EAAW,aAEXG,EAAa,IAEbD,EAAM,CACjB,eAAgB,EAChB,eAAgB,EAChB,cAAe,EACf,4BAA6B,EAC7B,2BAA4B,EAC5B,wBAAyB,GACzB,qCAAsC,GACtC,cAAe,GACf,iBAAkB,GAClB,cAAe,GACf,gBAAiB,EACnB,EAEaE,EAAK,CAChB,YAAa,EACb,QAAS,EACT,YAAa,EACb,QAAS,EACT,kBAAmB,EACnB,KAAM,EACN,OAAQ,EAGR,uBAAwB,GACxB,iBAAkB,EAClB,oBAAqB,EACrB,YAAa,EACb,iBAAkB,EAClB,cAAe,EACf,gBAAiB,EACjB,iBAAkB,EAClB,OAAQ,EACR,gBAAiB,EACjB,UAAW,CACb,EAEaC,EAAK,CAChB,KAAM,EACN,KAAM,IACN,KAAM,EACN,YAAa,CACf,EAEaJ,EAAmB",
6
+ "names": ["constants_exports", "__export", "APP_NAME", "FEE_DISPLAY_SIZE", "INS", "LEDGER_CLA", "P1", "P2", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(n,r)=>{for(var a in r)d(n,a,{get:r[a],enumerable:!0})},y=(n,r,a,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of h(r))!p.call(n,t)&&t!==a&&d(n,t,{get:()=>r[t],enumerable:!(s=m(r,t))||s.enumerable});return n};var S=n=>y(d({},"__esModule",{value:!0}),n);var v={};f(v,{SendTransferTask:()=>C});module.exports=S(v);var e=require("@ledgerhq/device-management-kit"),u=require("../../app-binder/command/SignTransferCommand"),l=require("../../app-binder/command/utils/EncodeDerivationPath");class C{constructor(r,a,s){this.api=r;this.args=a;this.logger=s}async run(){this.logger.debug("[run] Starting SendTransferTask",{data:{derivationPath:this.args.derivationPath,transactionLength:this.args.transaction.length}});const{derivationPath:r,transaction:a}=this.args,s=(0,l.encodeDerivationPath)(r),t=new Uint8Array(s.length+a.length);t.set(s,0),t.set(a,s.length);for(let o=0;o<t.length;o+=e.APDU_MAX_PAYLOAD){const g=o+e.APDU_MAX_PAYLOAD>=t.length,c=t.slice(o,o+e.APDU_MAX_PAYLOAD),i=await this.api.sendCommand(new u.SignTransferCommand({chunkedData:c,isLastChunk:g}));if(!(0,e.isSuccessCommandResult)(i))return this.logger.debug("[run] Failed to send chunk",{data:{chunkNumber:Math.floor(o/e.APDU_MAX_PAYLOAD),chunkOffset:o,error:i.error}}),i;if(g)return this.logger.debug("[run] All chunks sent successfully",{data:{signature:i.data}}),(0,e.CommandResultFactory)({data:i.data})}return(0,e.CommandResultFactory)({error:new e.InvalidStatusWordError("No signature returned")})}}0&&(module.exports={SendTransferTask});
1
+ "use strict";var g=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var S=(a,e)=>{for(var t in e)g(a,t,{get:e[t],enumerable:!0})},A=(a,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!f.call(a,n)&&n!==t&&g(a,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return a};var P=a=>A(g({},"__esModule",{value:!0}),a);var C={};S(C,{SendTransferTask:()=>T});module.exports=P(C);var r=require("@ledgerhq/device-management-kit"),m=require("../../app-binder/command/SignTransferCommand"),u=require("../../app-binder/command/utils/EncodeDerivationPath"),h=require("../../app-binder/command/utils/EncodeMaxFee"),p=require("../../app-binder/constants");class T{constructor(e,t,o){this.api=e;this.args=t;this.logger=o}async run(){this.logger.debug("[run] Starting SendTransferTask",{data:{derivationPath:this.args.derivationPath,transactionLength:this.args.transaction.length,supportsFeeDisplay:this.args.supportsFeeDisplay}});const{derivationPath:e,transaction:t,maxFee:o,supportsFeeDisplay:n}=this.args,d=(0,u.encodeDerivationPath)(e),l=n?(0,h.encodeMaxFeeBigEndian)(o):new Uint8Array(0),s=new Uint8Array(d.length+t.length+l.length);if(s.set(d,0),s.set(t,d.length),s.set(l,d.length+t.length),s.length>r.APDU_MAX_PAYLOAD)return(0,r.CommandResultFactory)({error:new r.InvalidStatusWordError(`Transfer payload exceeds APDU limit: ${s.length} > ${r.APDU_MAX_PAYLOAD}`)});const i=await this.api.sendCommand(new m.SignTransferCommand({data:s,p2:n?p.P2.FEE_DISPLAY:p.P2.LAST}));return(0,r.isSuccessCommandResult)(i)?(this.logger.debug("[run] Signed successfully",{data:{signature:i.data}}),(0,r.CommandResultFactory)({data:i.data})):(this.logger.debug("[run] Send failed",{data:{error:i.error}}),i)}}0&&(module.exports={SendTransferTask});
2
2
  //# sourceMappingURL=SendTransferTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/internal/app-binder/task/SendTransferTask.ts"],
4
- "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n type LoggerPublisherService,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport {\n SignTransferCommand,\n type SignTransferCommandResponse,\n} from \"@internal/app-binder/command/SignTransferCommand\";\nimport { type ConcordiumErrorCodes } from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { encodeDerivationPath } from \"@internal/app-binder/command/utils/EncodeDerivationPath\";\n\ntype SendTransferTaskArgs = {\n derivationPath: string;\n transaction: Uint8Array;\n};\n\nexport class SendTransferTask {\n constructor(\n private readonly api: InternalApi,\n private readonly args: SendTransferTaskArgs,\n private readonly logger: LoggerPublisherService,\n ) {}\n\n async run(): Promise<\n CommandResult<SignTransferCommandResponse, ConcordiumErrorCodes>\n > {\n this.logger.debug(\"[run] Starting SendTransferTask\", {\n data: {\n derivationPath: this.args.derivationPath,\n transactionLength: this.args.transaction.length,\n },\n });\n\n const { derivationPath, transaction } = this.args;\n const pathBytes = encodeDerivationPath(derivationPath);\n\n // Prepend derivation path to the transaction data so the first chunk\n // contains the path followed by as much transaction data as fits.\n const fullPayload = new Uint8Array(pathBytes.length + transaction.length);\n fullPayload.set(pathBytes, 0);\n fullPayload.set(transaction, pathBytes.length);\n\n for (\n let offset = 0;\n offset < fullPayload.length;\n offset += APDU_MAX_PAYLOAD\n ) {\n const isLastChunk = offset + APDU_MAX_PAYLOAD >= fullPayload.length;\n const chunkedData = fullPayload.slice(offset, offset + APDU_MAX_PAYLOAD);\n\n const result = await this.api.sendCommand(\n new SignTransferCommand({\n chunkedData,\n isLastChunk,\n }),\n );\n\n if (!isSuccessCommandResult(result)) {\n this.logger.debug(\"[run] Failed to send chunk\", {\n data: {\n chunkNumber: Math.floor(offset / APDU_MAX_PAYLOAD),\n chunkOffset: offset,\n error: result.error,\n },\n });\n return result;\n }\n\n if (isLastChunk) {\n this.logger.debug(\"[run] All chunks sent successfully\", {\n data: { signature: result.data },\n });\n return CommandResultFactory({\n data: result.data as Signature,\n });\n }\n }\n\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"No signature returned\"),\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CAGPC,EAGO,4DAEPC,EAAqC,mEAO9B,MAAMJ,CAAiB,CAC5B,YACmBK,EACAC,EACAC,EACjB,CAHiB,SAAAF,EACA,UAAAC,EACA,YAAAC,CAChB,CAEH,MAAM,KAEJ,CACA,KAAK,OAAO,MAAM,kCAAmC,CACnD,KAAM,CACJ,eAAgB,KAAK,KAAK,eAC1B,kBAAmB,KAAK,KAAK,YAAY,MAC3C,CACF,CAAC,EAED,KAAM,CAAE,eAAAC,EAAgB,YAAAC,CAAY,EAAI,KAAK,KACvCC,KAAY,wBAAqBF,CAAc,EAI/CG,EAAc,IAAI,WAAWD,EAAU,OAASD,EAAY,MAAM,EACxEE,EAAY,IAAID,EAAW,CAAC,EAC5BC,EAAY,IAAIF,EAAaC,EAAU,MAAM,EAE7C,QACME,EAAS,EACbA,EAASD,EAAY,OACrBC,GAAU,mBACV,CACA,MAAMC,EAAcD,EAAS,oBAAoBD,EAAY,OACvDG,EAAcH,EAAY,MAAMC,EAAQA,EAAS,kBAAgB,EAEjEG,EAAS,MAAM,KAAK,IAAI,YAC5B,IAAI,sBAAoB,CACtB,YAAAD,EACA,YAAAD,CACF,CAAC,CACH,EAEA,GAAI,IAAC,0BAAuBE,CAAM,EAChC,YAAK,OAAO,MAAM,6BAA8B,CAC9C,KAAM,CACJ,YAAa,KAAK,MAAMH,EAAS,kBAAgB,EACjD,YAAaA,EACb,MAAOG,EAAO,KAChB,CACF,CAAC,EACMA,EAGT,GAAIF,EACF,YAAK,OAAO,MAAM,qCAAsC,CACtD,KAAM,CAAE,UAAWE,EAAO,IAAK,CACjC,CAAC,KACM,wBAAqB,CAC1B,KAAMA,EAAO,IACf,CAAC,CAEL,CAEA,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,uBAAuB,CAC3D,CAAC,CACH,CACF",
6
- "names": ["SendTransferTask_exports", "__export", "SendTransferTask", "__toCommonJS", "import_device_management_kit", "import_SignTransferCommand", "import_EncodeDerivationPath", "api", "args", "logger", "derivationPath", "transaction", "pathBytes", "fullPayload", "offset", "isLastChunk", "chunkedData", "result"]
4
+ "sourcesContent": ["import {\n APDU_MAX_PAYLOAD,\n type CommandResult,\n CommandResultFactory,\n type InternalApi,\n InvalidStatusWordError,\n isSuccessCommandResult,\n type LoggerPublisherService,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type Signature } from \"@api/model/Signature\";\nimport {\n SignTransferCommand,\n type SignTransferCommandResponse,\n} from \"@internal/app-binder/command/SignTransferCommand\";\nimport { type ConcordiumErrorCodes } from \"@internal/app-binder/command/utils/ConcordiumApplicationErrors\";\nimport { encodeDerivationPath } from \"@internal/app-binder/command/utils/EncodeDerivationPath\";\nimport { encodeMaxFeeBigEndian } from \"@internal/app-binder/command/utils/EncodeMaxFee\";\nimport { P2 } from \"@internal/app-binder/constants\";\n\n// Serialized transaction layout:\n// [sender:32][nonce:8][energy:8][payloadSize:4][expiry:8][type:1] = 61 bytes header\n// [recipient:32][amount:8]\n\ntype SendTransferTaskArgs = {\n derivationPath: string;\n transaction: Uint8Array;\n maxFee: bigint;\n supportsFeeDisplay: boolean;\n};\n\nexport class SendTransferTask {\n constructor(\n private readonly api: InternalApi,\n private readonly args: SendTransferTaskArgs,\n private readonly logger: LoggerPublisherService,\n ) {}\n\n async run(): Promise<\n CommandResult<SignTransferCommandResponse, ConcordiumErrorCodes>\n > {\n this.logger.debug(\"[run] Starting SendTransferTask\", {\n data: {\n derivationPath: this.args.derivationPath,\n transactionLength: this.args.transaction.length,\n supportsFeeDisplay: this.args.supportsFeeDisplay,\n },\n });\n\n const { derivationPath, transaction, maxFee, supportsFeeDisplay } =\n this.args;\n const pathBytes = encodeDerivationPath(derivationPath);\n\n const feeSuffix = supportsFeeDisplay\n ? encodeMaxFeeBigEndian(maxFee)\n : new Uint8Array(0);\n\n const payload = new Uint8Array(\n pathBytes.length + transaction.length + feeSuffix.length,\n );\n payload.set(pathBytes, 0);\n payload.set(transaction, pathBytes.length);\n payload.set(feeSuffix, pathBytes.length + transaction.length);\n\n // The firmware handler for SIGN_TRANSFER is single-shot: the full payload\n // (path + canonical bytes + optional fee suffix) must fit in one APDU.\n if (payload.length > APDU_MAX_PAYLOAD) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\n `Transfer payload exceeds APDU limit: ${payload.length} > ${APDU_MAX_PAYLOAD}`,\n ),\n });\n }\n\n const result = await this.api.sendCommand(\n new SignTransferCommand({\n data: payload,\n p2: supportsFeeDisplay ? P2.FEE_DISPLAY : P2.LAST,\n }),\n );\n\n if (!isSuccessCommandResult(result)) {\n this.logger.debug(\"[run] Send failed\", {\n data: { error: result.error },\n });\n return result;\n }\n\n this.logger.debug(\"[run] Signed successfully\", {\n data: { signature: result.data },\n });\n return CommandResultFactory({\n data: result.data as Signature,\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAQO,2CAGPC,EAGO,4DAEPC,EAAqC,mEACrCC,EAAsC,2DACtCC,EAAmB,0CAaZ,MAAMN,CAAiB,CAC5B,YACmBO,EACAC,EACAC,EACjB,CAHiB,SAAAF,EACA,UAAAC,EACA,YAAAC,CAChB,CAEH,MAAM,KAEJ,CACA,KAAK,OAAO,MAAM,kCAAmC,CACnD,KAAM,CACJ,eAAgB,KAAK,KAAK,eAC1B,kBAAmB,KAAK,KAAK,YAAY,OACzC,mBAAoB,KAAK,KAAK,kBAChC,CACF,CAAC,EAED,KAAM,CAAE,eAAAC,EAAgB,YAAAC,EAAa,OAAAC,EAAQ,mBAAAC,CAAmB,EAC9D,KAAK,KACDC,KAAY,wBAAqBJ,CAAc,EAE/CK,EAAYF,KACd,yBAAsBD,CAAM,EAC5B,IAAI,WAAW,CAAC,EAEdI,EAAU,IAAI,WAClBF,EAAU,OAASH,EAAY,OAASI,EAAU,MACpD,EAOA,GANAC,EAAQ,IAAIF,EAAW,CAAC,EACxBE,EAAQ,IAAIL,EAAaG,EAAU,MAAM,EACzCE,EAAQ,IAAID,EAAWD,EAAU,OAASH,EAAY,MAAM,EAIxDK,EAAQ,OAAS,mBACnB,SAAO,wBAAqB,CAC1B,MAAO,IAAI,yBACT,wCAAwCA,EAAQ,MAAM,MAAM,kBAAgB,EAC9E,CACF,CAAC,EAGH,MAAMC,EAAS,MAAM,KAAK,IAAI,YAC5B,IAAI,sBAAoB,CACtB,KAAMD,EACN,GAAIH,EAAqB,KAAG,YAAc,KAAG,IAC/C,CAAC,CACH,EAEA,SAAK,0BAAuBI,CAAM,GAOlC,KAAK,OAAO,MAAM,4BAA6B,CAC7C,KAAM,CAAE,UAAWA,EAAO,IAAK,CACjC,CAAC,KACM,wBAAqB,CAC1B,KAAMA,EAAO,IACf,CAAC,IAXC,KAAK,OAAO,MAAM,oBAAqB,CACrC,KAAM,CAAE,MAAOA,EAAO,KAAM,CAC9B,CAAC,EACMA,EASX,CACF",
6
+ "names": ["SendTransferTask_exports", "__export", "SendTransferTask", "__toCommonJS", "import_device_management_kit", "import_SignTransferCommand", "import_EncodeDerivationPath", "import_EncodeMaxFee", "import_constants", "api", "args", "logger", "derivationPath", "transaction", "maxFee", "supportsFeeDisplay", "pathBytes", "feeSuffix", "payload", "result"]
7
7
  }