@ledgerhq/device-signer-kit-solana 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/cjs/api/SignerSolanaBuilder.js +1 -1
  2. package/lib/cjs/api/SignerSolanaBuilder.js.map +3 -3
  3. package/lib/cjs/api/SolanaToolsBuilder.js +1 -1
  4. package/lib/cjs/api/SolanaToolsBuilder.js.map +3 -3
  5. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js +1 -1
  6. package/lib/cjs/api/app-binder/SignTransactionDeviceActionTypes.js.map +2 -2
  7. package/lib/cjs/internal/DefaultSignerSolana.test.js +1 -1
  8. package/lib/cjs/internal/DefaultSignerSolana.test.js.map +3 -3
  9. package/lib/cjs/internal/DefaultSolanaTools.test.js +1 -1
  10. package/lib/cjs/internal/DefaultSolanaTools.test.js.map +3 -3
  11. package/lib/cjs/internal/app-binder/SolanaAppBinder.js +1 -1
  12. package/lib/cjs/internal/app-binder/SolanaAppBinder.js.map +2 -2
  13. package/lib/cjs/internal/app-binder/SolanaAppBinder.test.js +1 -1
  14. package/lib/cjs/internal/app-binder/SolanaAppBinder.test.js.map +3 -3
  15. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.js +1 -1
  16. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.js.map +3 -3
  17. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.test.js +1 -1
  18. package/lib/cjs/internal/app-binder/device-action/SignTransactionDeviceAction.test.js.map +3 -3
  19. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  20. package/lib/cjs/internal/app-binder/task/BuildTransactionContextTask.test.js.map +3 -3
  21. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  22. package/lib/cjs/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  23. package/lib/cjs/internal/di.js +1 -1
  24. package/lib/cjs/internal/di.js.map +3 -3
  25. package/lib/cjs/package.json +2 -2
  26. package/lib/esm/api/SignerSolanaBuilder.js +1 -1
  27. package/lib/esm/api/SignerSolanaBuilder.js.map +3 -3
  28. package/lib/esm/api/SolanaToolsBuilder.js +1 -1
  29. package/lib/esm/api/SolanaToolsBuilder.js.map +3 -3
  30. package/lib/esm/api/app-binder/SignTransactionDeviceActionTypes.js.map +2 -2
  31. package/lib/esm/internal/DefaultSignerSolana.test.js +1 -1
  32. package/lib/esm/internal/DefaultSignerSolana.test.js.map +3 -3
  33. package/lib/esm/internal/DefaultSolanaTools.test.js +1 -1
  34. package/lib/esm/internal/DefaultSolanaTools.test.js.map +3 -3
  35. package/lib/esm/internal/app-binder/SolanaAppBinder.js +1 -1
  36. package/lib/esm/internal/app-binder/SolanaAppBinder.js.map +2 -2
  37. package/lib/esm/internal/app-binder/SolanaAppBinder.test.js +1 -1
  38. package/lib/esm/internal/app-binder/SolanaAppBinder.test.js.map +3 -3
  39. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.js +1 -1
  40. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.js.map +3 -3
  41. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.test.js +1 -1
  42. package/lib/esm/internal/app-binder/device-action/SignTransactionDeviceAction.test.js.map +3 -3
  43. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js +1 -1
  44. package/lib/esm/internal/app-binder/task/BuildTransactionContextTask.test.js.map +3 -3
  45. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js +1 -1
  46. package/lib/esm/internal/app-binder/task/ProvideTransactionContextTask.test.js.map +3 -3
  47. package/lib/esm/internal/di.js +1 -1
  48. package/lib/esm/internal/di.js.map +3 -3
  49. package/lib/esm/package.json +2 -2
  50. package/lib/types/api/SignerSolanaBuilder.d.ts.map +1 -1
  51. package/lib/types/api/SolanaToolsBuilder.d.ts.map +1 -1
  52. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts +1 -2
  53. package/lib/types/api/app-binder/SignTransactionDeviceActionTypes.d.ts.map +1 -1
  54. package/lib/types/internal/app-binder/SolanaAppBinder.d.ts.map +1 -1
  55. package/lib/types/internal/app-binder/device-action/SignTransactionDeviceAction.d.ts +7 -1
  56. package/lib/types/internal/app-binder/device-action/SignTransactionDeviceAction.d.ts.map +1 -1
  57. package/lib/types/internal/di.d.ts.map +1 -1
  58. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  59. package/package.json +7 -7
  60. package/lib/cjs/internal/app-binder/services/utils/NullLoggerPublisherService.js +0 -2
  61. package/lib/cjs/internal/app-binder/services/utils/NullLoggerPublisherService.js.map +0 -7
  62. package/lib/cjs/internal/app-binder/services/utils/NullLoggerPublisherService.test.js +0 -2
  63. package/lib/cjs/internal/app-binder/services/utils/NullLoggerPublisherService.test.js.map +0 -7
  64. package/lib/esm/internal/app-binder/services/utils/NullLoggerPublisherService.js +0 -2
  65. package/lib/esm/internal/app-binder/services/utils/NullLoggerPublisherService.js.map +0 -7
  66. package/lib/esm/internal/app-binder/services/utils/NullLoggerPublisherService.test.js +0 -2
  67. package/lib/esm/internal/app-binder/services/utils/NullLoggerPublisherService.test.js.map +0 -7
  68. package/lib/types/internal/app-binder/services/utils/NullLoggerPublisherService.d.ts +0 -3
  69. package/lib/types/internal/app-binder/services/utils/NullLoggerPublisherService.d.ts.map +0 -1
  70. package/lib/types/internal/app-binder/services/utils/NullLoggerPublisherService.test.d.ts +0 -2
  71. package/lib/types/internal/app-binder/services/utils/NullLoggerPublisherService.test.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var c=(o,e)=>{for(var t in e)r(o,t,{get:e[t],enumerable:!0})},m=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!g.call(o,i)&&i!==t&&r(o,i,{get:()=>e[i],enumerable:!(n=l(e,i))||n.enumerable});return o};var S=o=>m(r({},"__esModule",{value:!0}),o);var M={};c(M,{SignerSolanaBuilder:()=>p});module.exports=S(M);var s=require("@ledgerhq/context-module"),d=require("../internal/app-binder/services/utils/NullLoggerPublisherService"),u=require("../internal/DefaultSignerSolana");class p{_dmk;_sessionId;_customContextModule;_originToken;constructor({dmk:e,sessionId:t,originToken:n}){this._dmk=e,this._sessionId=t,this._originToken=n}withContextModule(e){return this._customContextModule=e,this}build(){return new u.DefaultSignerSolana({dmk:this._dmk,sessionId:this._sessionId,contextModule:this._customContextModule??new s.ContextModuleBuilder({originToken:this._originToken,loggerFactory:e=>{const t=this._dmk.getLoggerFactory?.();return t?t(`SignerSolanaContextModule-${e}`):(0,d.NullLoggerPublisherService)(`SignerSolanaContextModule-${e}`)}}).build()})}}0&&(module.exports={SignerSolanaBuilder});
1
+ "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},c=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!a.call(t,i)&&i!==o&&s(t,i,{get:()=>e[i],enumerable:!(n=u(e,i))||n.enumerable});return t};var m=t=>c(s({},"__esModule",{value:!0}),t);var M={};g(M,{SignerSolanaBuilder:()=>p});module.exports=m(M);var r=require("@ledgerhq/context-module"),d=require("../internal/DefaultSignerSolana");class p{_dmk;_sessionId;_customContextModule;_originToken;constructor({dmk:e,sessionId:o,originToken:n}){this._dmk=e,this._sessionId=o,this._originToken=n}withContextModule(e){return this._customContextModule=e,this}build(){return new d.DefaultSignerSolana({dmk:this._dmk,sessionId:this._sessionId,contextModule:this._customContextModule??new r.ContextModuleBuilder({originToken:this._originToken,loggerFactory:e=>this._dmk.getLoggerFactory()(["ContextModule",e])}).build()})}}0&&(module.exports={SignerSolanaBuilder});
2
2
  //# sourceMappingURL=SignerSolanaBuilder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/SignerSolanaBuilder.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 { NullLoggerPublisherService } from \"@internal/app-binder/services/utils/NullLoggerPublisherService\";\nimport { DefaultSignerSolana } from \"@internal/DefaultSignerSolana\";\n\ntype SignerSolanaBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n originToken?: string;\n};\n\n/**\n * Builder for the `SignerSolana` class.\n *\n * @example\n * ```\n * const signer = new SignerSolanaBuilder({ dmk, sessionId })\n * .build();\n * ```\n */\nexport class SignerSolanaBuilder {\n private _dmk: DeviceManagementKit;\n private _sessionId: DeviceSessionId;\n private _customContextModule: ContextModule | undefined;\n private _originToken: string | undefined;\n\n constructor({\n dmk,\n sessionId,\n originToken,\n }: SignerSolanaBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n this._originToken = originToken;\n }\n\n /**\n * Override the default context module\n *\n * @param contextModule\n * @returns this\n */\n withContextModule(contextModule: ContextModule) {\n this._customContextModule = contextModule;\n return this;\n }\n\n /**\n * Build the solana signer\n *\n * @returns the solana signer\n */\n public build() {\n return new DefaultSignerSolana({\n dmk: this._dmk,\n sessionId: this._sessionId,\n contextModule:\n this._customContextModule ??\n new ContextModuleBuilder({\n originToken: this._originToken,\n loggerFactory: (tag: string) => {\n const factory = this._dmk.getLoggerFactory?.();\n return factory\n ? factory(`SignerSolanaContextModule-${tag}`)\n : NullLoggerPublisherService(`SignerSolanaContextModule-${tag}`);\n },\n }).build(),\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,oCAMPC,EAA2C,0EAC3CC,EAAoC,yCAiB7B,MAAMJ,CAAoB,CACvB,KACA,WACA,qBACA,aAER,YAAY,CACV,IAAAK,EACA,UAAAC,EACA,YAAAC,CACF,EAAuC,CACrC,KAAK,KAAOF,EACZ,KAAK,WAAaC,EAClB,KAAK,aAAeC,CACtB,CAQA,kBAAkBC,EAA8B,CAC9C,YAAK,qBAAuBA,EACrB,IACT,CAOO,OAAQ,CACb,OAAO,IAAI,sBAAoB,CAC7B,IAAK,KAAK,KACV,UAAW,KAAK,WAChB,cACE,KAAK,sBACL,IAAI,uBAAqB,CACvB,YAAa,KAAK,aAClB,cAAgBC,GAAgB,CAC9B,MAAMC,EAAU,KAAK,KAAK,mBAAmB,EAC7C,OAAOA,EACHA,EAAQ,6BAA6BD,CAAG,EAAE,KAC1C,8BAA2B,6BAA6BA,CAAG,EAAE,CACnE,CACF,CAAC,EAAE,MAAM,CACb,CAAC,CACH,CACF",
6
- "names": ["SignerSolanaBuilder_exports", "__export", "SignerSolanaBuilder", "__toCommonJS", "import_context_module", "import_NullLoggerPublisherService", "import_DefaultSignerSolana", "dmk", "sessionId", "originToken", "contextModule", "tag", "factory"]
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 { DefaultSignerSolana } from \"@internal/DefaultSignerSolana\";\n\ntype SignerSolanaBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n originToken?: string;\n};\n\n/**\n * Builder for the `SignerSolana` class.\n *\n * @example\n * ```\n * const signer = new SignerSolanaBuilder({ dmk, sessionId })\n * .build();\n * ```\n */\nexport class SignerSolanaBuilder {\n private _dmk: DeviceManagementKit;\n private _sessionId: DeviceSessionId;\n private _customContextModule: ContextModule | undefined;\n private _originToken: string | undefined;\n\n constructor({\n dmk,\n sessionId,\n originToken,\n }: SignerSolanaBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n this._originToken = originToken;\n }\n\n /**\n * Override the default context module\n *\n * @param contextModule\n * @returns this\n */\n withContextModule(contextModule: ContextModule) {\n this._customContextModule = contextModule;\n return this;\n }\n\n /**\n * Build the solana signer\n *\n * @returns the solana signer\n */\n public build() {\n return new DefaultSignerSolana({\n dmk: this._dmk,\n sessionId: this._sessionId,\n contextModule:\n this._customContextModule ??\n new ContextModuleBuilder({\n originToken: this._originToken,\n loggerFactory: (tag: string) =>\n this._dmk.getLoggerFactory()([\"ContextModule\", tag]),\n }).build(),\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,oCAMPC,EAAoC,yCAiB7B,MAAMH,CAAoB,CACvB,KACA,WACA,qBACA,aAER,YAAY,CACV,IAAAI,EACA,UAAAC,EACA,YAAAC,CACF,EAAuC,CACrC,KAAK,KAAOF,EACZ,KAAK,WAAaC,EAClB,KAAK,aAAeC,CACtB,CAQA,kBAAkBC,EAA8B,CAC9C,YAAK,qBAAuBA,EACrB,IACT,CAOO,OAAQ,CACb,OAAO,IAAI,sBAAoB,CAC7B,IAAK,KAAK,KACV,UAAW,KAAK,WAChB,cACE,KAAK,sBACL,IAAI,uBAAqB,CACvB,YAAa,KAAK,aAClB,cAAgBC,GACd,KAAK,KAAK,iBAAiB,EAAE,CAAC,gBAAiBA,CAAG,CAAC,CACvD,CAAC,EAAE,MAAM,CACb,CAAC,CACH,CACF",
6
+ "names": ["SignerSolanaBuilder_exports", "__export", "SignerSolanaBuilder", "__toCommonJS", "import_context_module", "import_DefaultSignerSolana", "dmk", "sessionId", "originToken", "contextModule", "tag"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var m=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},c=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!a.call(o,i)&&i!==t&&s(o,i,{get:()=>e[i],enumerable:!(n=u(e,i))||n.enumerable});return o};var p=o=>c(s({},"__esModule",{value:!0}),o);var M={};m(M,{SolanaToolsBuilder:()=>g});module.exports=p(M);var r=require("@ledgerhq/context-module"),d=require("../internal/DefaultSolanaTools");class g{_dmk;_sessionId;_customContextModule;_originToken;constructor({dmk:e,sessionId:t,originToken:n}){this._dmk=e,this._sessionId=t,this._originToken=n}withContextModule(e){return this._customContextModule=e,this}build(){return new d.DefaultSolanaTools({dmk:this._dmk,sessionId:this._sessionId,contextModule:this._customContextModule??new r.ContextModuleBuilder({originToken:this._originToken}).build()})}}0&&(module.exports={SolanaToolsBuilder});
1
+ "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},g=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of u(e))!a.call(o,i)&&i!==t&&s(o,i,{get:()=>e[i],enumerable:!(n=l(e,i))||n.enumerable});return o};var m=o=>g(s({},"__esModule",{value:!0}),o);var M={};c(M,{SolanaToolsBuilder:()=>p});module.exports=m(M);var r=require("@ledgerhq/context-module"),d=require("../internal/DefaultSolanaTools");class p{_dmk;_sessionId;_customContextModule;_originToken;constructor({dmk:e,sessionId:t,originToken:n}){this._dmk=e,this._sessionId=t,this._originToken=n}withContextModule(e){return this._customContextModule=e,this}build(){return new d.DefaultSolanaTools({dmk:this._dmk,sessionId:this._sessionId,contextModule:this._customContextModule??new r.ContextModuleBuilder({originToken:this._originToken,loggerFactory:e=>this._dmk.getLoggerFactory()(["ContextModule",e])}).build()})}}0&&(module.exports={SolanaToolsBuilder});
2
2
  //# sourceMappingURL=SolanaToolsBuilder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/SolanaToolsBuilder.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 { DefaultSolanaTools } from \"@internal/DefaultSolanaTools\";\n\ntype SolanaToolsBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n originToken?: string;\n};\n\n/**\n * Builder for the `SolanaTools` class.\n *\n * @example\n * ```\n * const solanaTools = new SolanaToolsBuilder({ dmk, sessionId })\n * .build();\n * ```\n */\nexport class SolanaToolsBuilder {\n private _dmk: DeviceManagementKit;\n private _sessionId: DeviceSessionId;\n private _customContextModule: ContextModule | undefined;\n private _originToken: string | undefined;\n\n constructor({\n dmk,\n sessionId,\n originToken,\n }: SolanaToolsBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n this._originToken = originToken;\n }\n\n /**\n * Override the default context module\n *\n * @param contextModule\n * @returns this\n */\n withContextModule(contextModule: ContextModule) {\n this._customContextModule = contextModule;\n return this;\n }\n\n /**\n * Build the solana tools instance\n *\n * @returns the solana tools instance\n */\n public build() {\n return new DefaultSolanaTools({\n dmk: this._dmk,\n sessionId: this._sessionId,\n contextModule:\n this._customContextModule ??\n new ContextModuleBuilder({ originToken: this._originToken }).build(),\n });\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,oCAMPC,EAAmC,wCAiB5B,MAAMH,CAAmB,CACtB,KACA,WACA,qBACA,aAER,YAAY,CACV,IAAAI,EACA,UAAAC,EACA,YAAAC,CACF,EAAsC,CACpC,KAAK,KAAOF,EACZ,KAAK,WAAaC,EAClB,KAAK,aAAeC,CACtB,CAQA,kBAAkBC,EAA8B,CAC9C,YAAK,qBAAuBA,EACrB,IACT,CAOO,OAAQ,CACb,OAAO,IAAI,qBAAmB,CAC5B,IAAK,KAAK,KACV,UAAW,KAAK,WAChB,cACE,KAAK,sBACL,IAAI,uBAAqB,CAAE,YAAa,KAAK,YAAa,CAAC,EAAE,MAAM,CACvE,CAAC,CACH,CACF",
6
- "names": ["SolanaToolsBuilder_exports", "__export", "SolanaToolsBuilder", "__toCommonJS", "import_context_module", "import_DefaultSolanaTools", "dmk", "sessionId", "originToken", "contextModule"]
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 { DefaultSolanaTools } from \"@internal/DefaultSolanaTools\";\n\ntype SolanaToolsBuilderConstructorArgs = {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n originToken?: string;\n};\n\n/**\n * Builder for the `SolanaTools` class.\n *\n * @example\n * ```\n * const solanaTools = new SolanaToolsBuilder({ dmk, sessionId })\n * .build();\n * ```\n */\nexport class SolanaToolsBuilder {\n private _dmk: DeviceManagementKit;\n private _sessionId: DeviceSessionId;\n private _customContextModule: ContextModule | undefined;\n private _originToken: string | undefined;\n\n constructor({\n dmk,\n sessionId,\n originToken,\n }: SolanaToolsBuilderConstructorArgs) {\n this._dmk = dmk;\n this._sessionId = sessionId;\n this._originToken = originToken;\n }\n\n /**\n * Override the default context module\n *\n * @param contextModule\n * @returns this\n */\n withContextModule(contextModule: ContextModule) {\n this._customContextModule = contextModule;\n return this;\n }\n\n /**\n * Build the solana tools instance\n *\n * @returns the solana tools instance\n */\n public build() {\n return new DefaultSolanaTools({\n dmk: this._dmk,\n sessionId: this._sessionId,\n contextModule:\n this._customContextModule ??\n new ContextModuleBuilder({\n originToken: this._originToken,\n loggerFactory: (tag: string) =>\n this._dmk.getLoggerFactory()([\"ContextModule\", tag]),\n }).build(),\n });\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAGO,oCAMPC,EAAmC,wCAiB5B,MAAMH,CAAmB,CACtB,KACA,WACA,qBACA,aAER,YAAY,CACV,IAAAI,EACA,UAAAC,EACA,YAAAC,CACF,EAAsC,CACpC,KAAK,KAAOF,EACZ,KAAK,WAAaC,EAClB,KAAK,aAAeC,CACtB,CAQA,kBAAkBC,EAA8B,CAC9C,YAAK,qBAAuBA,EACrB,IACT,CAOO,OAAQ,CACb,OAAO,IAAI,qBAAmB,CAC5B,IAAK,KAAK,KACV,UAAW,KAAK,WAChB,cACE,KAAK,sBACL,IAAI,uBAAqB,CACvB,YAAa,KAAK,aAClB,cAAgBC,GACd,KAAK,KAAK,iBAAiB,EAAE,CAAC,gBAAiBA,CAAG,CAAC,CACvD,CAAC,EAAE,MAAM,CACb,CAAC,CACH,CACF",
6
+ "names": ["SolanaToolsBuilder_exports", "__export", "SolanaToolsBuilder", "__toCommonJS", "import_context_module", "import_DefaultSolanaTools", "dmk", "sessionId", "originToken", "contextModule", "tag"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var c=(n,t)=>{for(var r in t)o(n,r,{get:t[r],enumerable:!0})},A=(n,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!s.call(n,e)&&e!==r&&o(n,e,{get:()=>t[e],enumerable:!(a=i(t,e))||a.enumerable});return n};var S=n=>A(o({},"__esModule",{value:!0}),n);var T={};c(T,{signTransactionDAStateSteps:()=>l});module.exports=S(T);const l=Object.freeze({OPEN_APP:"signer.sol.steps.openApp",GET_APP_CONFIG:"signer.sol.steps.getAppConfig",INSPECT_TRANSACTION:"signer.sol.steps.inspectTransaction",BUILD_TRANSACTION_CONTEXT:"signer.sol.steps.buildTransactionContext",PROVIDE_TRANSACTION_CONTEXT:"signer.sol.steps.provideTransactionContext",SIGN_TRANSACTION:"signer.sol.steps.signTransaction"});0&&(module.exports={signTransactionDAStateSteps});
1
+ "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var c=(n,t)=>{for(var r in t)o(n,r,{get:t[r],enumerable:!0})},A=(n,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!s.call(n,e)&&e!==r&&o(n,e,{get:()=>t[e],enumerable:!(a=i(t,e))||a.enumerable});return n};var S=n=>A(o({},"__esModule",{value:!0}),n);var l={};c(l,{signTransactionDAStateSteps:()=>T});module.exports=S(l);const T=Object.freeze({OPEN_APP:"signer.sol.steps.openApp",GET_APP_CONFIG:"signer.sol.steps.getAppConfig",INSPECT_TRANSACTION:"signer.sol.steps.inspectTransaction",BUILD_TRANSACTION_CONTEXT:"signer.sol.steps.buildTransactionContext",PROVIDE_TRANSACTION_CONTEXT:"signer.sol.steps.provideTransactionContext",SIGN_TRANSACTION:"signer.sol.steps.signTransaction"});0&&(module.exports={signTransactionDAStateSteps});
2
2
  //# sourceMappingURL=SignTransactionDeviceActionTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/app-binder/SignTransactionDeviceActionTypes.ts"],
4
- "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport { type SolanaTransactionContextResultSuccess } from \"@ledgerhq/context-module/src/solana/domain/solanaContextTypes.js\";\nimport {\n type DeviceActionState,\n type ExecuteDeviceActionReturnType,\n type LoggerPublisherService,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type SendCommandInAppDAError,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type AppConfiguration } from \"@api/model/AppConfiguration\";\nimport { type Signature } from \"@api/model/Signature\";\nimport { type SolanaTransactionOptionalConfig } from \"@api/model/SolanaTransactionOptionalConfig\";\nimport { type Transaction } from \"@api/model/Transaction\";\nimport { type SolanaAppErrorCodes } from \"@internal/app-binder/command/utils/SolanaApplicationErrors\";\nimport { type TxInspectorResult } from \"@internal/app-binder/services/TransactionInspector\";\n\nexport const signTransactionDAStateSteps = Object.freeze({\n OPEN_APP: \"signer.sol.steps.openApp\",\n GET_APP_CONFIG: \"signer.sol.steps.getAppConfig\",\n INSPECT_TRANSACTION: \"signer.sol.steps.inspectTransaction\",\n BUILD_TRANSACTION_CONTEXT: \"signer.sol.steps.buildTransactionContext\",\n PROVIDE_TRANSACTION_CONTEXT: \"signer.sol.steps.provideTransactionContext\",\n SIGN_TRANSACTION: \"signer.sol.steps.signTransaction\",\n} as const);\n\nexport type SignTransactionDAStateStep =\n (typeof signTransactionDAStateSteps)[keyof typeof signTransactionDAStateSteps];\n\nexport type SignTransactionDAOutput = Signature;\n\nexport type SignTransactionDAInput = {\n readonly loggerFactory: (tag: string) => LoggerPublisherService;\n readonly derivationPath: string;\n readonly transaction: Transaction;\n readonly contextModule: ContextModule;\n readonly transactionOptions?: SolanaTransactionOptionalConfig;\n};\n\nexport type SignTransactionDAError =\n | OpenAppDAError\n | SendCommandInAppDAError<SolanaAppErrorCodes>;\n\ntype SignTransactionDARequiredInteraction =\n | UserInteractionRequired\n | OpenAppDARequiredInteraction;\n\nexport type SignTransactionDAIntermediateValue = {\n requiredUserInteraction: SignTransactionDARequiredInteraction;\n step: SignTransactionDAStateStep;\n};\n\nexport type SignTransactionDAState = DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n\nexport type SignTransactionDAInternalState = {\n readonly error: SignTransactionDAError | null;\n readonly signature: Signature | null;\n readonly appConfig: AppConfiguration | null;\n readonly solanaTransactionContext: SolanaTransactionContextResultSuccess | null;\n readonly inspectorResult: TxInspectorResult | null;\n};\n\nexport type SignTransactionDAReturnType = ExecuteDeviceActionReturnType<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAmBO,MAAME,EAA8B,OAAO,OAAO,CACvD,SAAU,2BACV,eAAgB,gCAChB,oBAAqB,sCACrB,0BAA2B,2CAC3B,4BAA6B,6CAC7B,iBAAkB,kCACpB,CAAU",
4
+ "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport { type SolanaTransactionContextResultSuccess } from \"@ledgerhq/context-module/src/solana/domain/solanaContextTypes.js\";\nimport {\n type DeviceActionState,\n type ExecuteDeviceActionReturnType,\n type OpenAppDAError,\n type OpenAppDARequiredInteraction,\n type SendCommandInAppDAError,\n type UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type AppConfiguration } from \"@api/model/AppConfiguration\";\nimport { type Signature } from \"@api/model/Signature\";\nimport { type SolanaTransactionOptionalConfig } from \"@api/model/SolanaTransactionOptionalConfig\";\nimport { type Transaction } from \"@api/model/Transaction\";\nimport { type SolanaAppErrorCodes } from \"@internal/app-binder/command/utils/SolanaApplicationErrors\";\nimport { type TxInspectorResult } from \"@internal/app-binder/services/TransactionInspector\";\n\nexport const signTransactionDAStateSteps = Object.freeze({\n OPEN_APP: \"signer.sol.steps.openApp\",\n GET_APP_CONFIG: \"signer.sol.steps.getAppConfig\",\n INSPECT_TRANSACTION: \"signer.sol.steps.inspectTransaction\",\n BUILD_TRANSACTION_CONTEXT: \"signer.sol.steps.buildTransactionContext\",\n PROVIDE_TRANSACTION_CONTEXT: \"signer.sol.steps.provideTransactionContext\",\n SIGN_TRANSACTION: \"signer.sol.steps.signTransaction\",\n} as const);\n\nexport type SignTransactionDAStateStep =\n (typeof signTransactionDAStateSteps)[keyof typeof signTransactionDAStateSteps];\n\nexport type SignTransactionDAOutput = Signature;\n\nexport type SignTransactionDAInput = {\n readonly derivationPath: string;\n readonly transaction: Transaction;\n readonly contextModule: ContextModule;\n readonly transactionOptions?: SolanaTransactionOptionalConfig;\n};\n\nexport type SignTransactionDAError =\n | OpenAppDAError\n | SendCommandInAppDAError<SolanaAppErrorCodes>;\n\ntype SignTransactionDARequiredInteraction =\n | UserInteractionRequired\n | OpenAppDARequiredInteraction;\n\nexport type SignTransactionDAIntermediateValue = {\n requiredUserInteraction: SignTransactionDARequiredInteraction;\n step: SignTransactionDAStateStep;\n};\n\nexport type SignTransactionDAState = DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n\nexport type SignTransactionDAInternalState = {\n readonly error: SignTransactionDAError | null;\n readonly signature: Signature | null;\n readonly appConfig: AppConfiguration | null;\n readonly solanaTransactionContext: SolanaTransactionContextResultSuccess | null;\n readonly inspectorResult: TxInspectorResult | null;\n};\n\nexport type SignTransactionDAReturnType = ExecuteDeviceActionReturnType<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n>;\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAkBO,MAAME,EAA8B,OAAO,OAAO,CACvD,SAAU,2BACV,eAAgB,gCAChB,oBAAqB,sCACrB,0BAA2B,2CAC3B,4BAA6B,6CAC7B,iBAAkB,kCACpB,CAAU",
6
6
  "names": ["SignTransactionDeviceActionTypes_exports", "__export", "signTransactionDAStateSteps", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=require("vitest"),t=require("./DefaultSignerSolana");describe("DefaultSignerSolana",()=>{const o={};it("should be defined",()=>{const e=new t.DefaultSignerSolana({dmk:{},sessionId:{},contextModule:o});expect(e).toBeDefined()}),it("should call getAddress",()=>{const e={executeDeviceAction:s.vi.fn()},n={};new t.DefaultSignerSolana({dmk:e,sessionId:n,contextModule:o}).getAddress("derivationPath",{}),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call signTransaction",()=>{const e={executeDeviceAction:s.vi.fn()},n={};new t.DefaultSignerSolana({dmk:e,sessionId:n,contextModule:o}).signTransaction("derivationPath",new Uint8Array),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call signMessage",()=>{const e={executeDeviceAction:s.vi.fn()},n={};new t.DefaultSignerSolana({dmk:e,sessionId:n,contextModule:o}).signMessage("44'/501'/0'/0'","Hello world"),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call getAppConfiguration",()=>{const e={executeDeviceAction:s.vi.fn()},n={};new t.DefaultSignerSolana({dmk:e,sessionId:n,contextModule:o}).getAppConfiguration(),expect(e.executeDeviceAction).toHaveBeenCalled()})});
1
+ "use strict";var n=require("vitest"),o=require("./DefaultSignerSolana");const i=()=>({debug:n.vi.fn(),info:n.vi.fn(),warn:n.vi.fn(),error:n.vi.fn(),subscribers:[]});describe("DefaultSignerSolana",()=>{const s={};it("should be defined",()=>{const e=new o.DefaultSignerSolana({dmk:{},sessionId:{},contextModule:s});expect(e).toBeDefined()}),it("should call getAddress",()=>{const e={executeDeviceAction:n.vi.fn(),getLoggerFactory:n.vi.fn().mockReturnValue(i)},t={};new o.DefaultSignerSolana({dmk:e,sessionId:t,contextModule:s}).getAddress("derivationPath",{}),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call signTransaction",()=>{const e={executeDeviceAction:n.vi.fn(),getLoggerFactory:n.vi.fn().mockReturnValue(i)},t={};new o.DefaultSignerSolana({dmk:e,sessionId:t,contextModule:s}).signTransaction("derivationPath",new Uint8Array),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call signMessage",()=>{const e={executeDeviceAction:n.vi.fn(),getLoggerFactory:n.vi.fn().mockReturnValue(i)},t={};new o.DefaultSignerSolana({dmk:e,sessionId:t,contextModule:s}).signMessage("44'/501'/0'/0'","Hello world"),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call getAppConfiguration",()=>{const e={executeDeviceAction:n.vi.fn(),getLoggerFactory:n.vi.fn().mockReturnValue(i)},t={};new o.DefaultSignerSolana({dmk:e,sessionId:t,contextModule:s}).getAppConfiguration(),expect(e.executeDeviceAction).toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=DefaultSignerSolana.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/internal/DefaultSignerSolana.test.ts"],
4
- "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { vi } from \"vitest\";\n\nimport { DefaultSignerSolana } from \"./DefaultSignerSolana\";\n\ndescribe(\"DefaultSignerSolana\", () => {\n const contextModuleStub: ContextModule = {} as ContextModule;\n\n it(\"should be defined\", () => {\n const signer = new DefaultSignerSolana({\n dmk: {} as DeviceManagementKit,\n sessionId: {} as DeviceSessionId,\n contextModule: contextModuleStub,\n });\n expect(signer).toBeDefined();\n });\n\n it(\"should call getAddress\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.getAddress(\"derivationPath\", {});\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call signTransaction\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.signTransaction(\"derivationPath\", new Uint8Array());\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call signMessage\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.signMessage(\"44'/501'/0'/0'\", \"Hello world\");\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call getAppConfiguration\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.getAppConfiguration();\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n});\n"],
5
- "mappings": "aAKA,IAAAA,EAAmB,kBAEnBC,EAAoC,iCAEpC,SAAS,sBAAuB,IAAM,CACpC,MAAMC,EAAmC,CAAC,EAE1C,GAAG,oBAAqB,IAAM,CAC5B,MAAMC,EAAS,IAAI,sBAAoB,CACrC,IAAK,CAAC,EACN,UAAW,CAAC,EACZ,cAAeD,CACjB,CAAC,EACD,OAAOC,CAAM,EAAE,YAAY,CAC7B,CAAC,EAED,GAAG,yBAA0B,IAAM,CACjC,MAAMC,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,WAAW,iBAAkB,CAAC,CAAC,EACtC,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,gBAAgB,iBAAkB,IAAI,UAAY,EACzD,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,0BAA2B,IAAM,CAClC,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,YAAY,iBAAkB,aAAa,EAClD,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,oBAAoB,EAC3B,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,CACH,CAAC",
6
- "names": ["import_vitest", "import_DefaultSignerSolana", "contextModuleStub", "signer", "dmk", "sessionId"]
4
+ "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { vi } from \"vitest\";\n\nimport { DefaultSignerSolana } from \"./DefaultSignerSolana\";\n\nconst mockLoggerFactory = () => ({\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n subscribers: [],\n});\n\ndescribe(\"DefaultSignerSolana\", () => {\n const contextModuleStub: ContextModule = {} as ContextModule;\n\n it(\"should be defined\", () => {\n const signer = new DefaultSignerSolana({\n dmk: {} as DeviceManagementKit,\n sessionId: {} as DeviceSessionId,\n contextModule: contextModuleStub,\n });\n expect(signer).toBeDefined();\n });\n\n it(\"should call getAddress\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.getAddress(\"derivationPath\", {});\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call signTransaction\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.signTransaction(\"derivationPath\", new Uint8Array());\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call signMessage\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.signMessage(\"44'/501'/0'/0'\", \"Hello world\");\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call getAppConfiguration\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const signer = new DefaultSignerSolana({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n signer.getAppConfiguration();\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "aAKA,IAAAA,EAAmB,kBAEnBC,EAAoC,iCAEpC,MAAMC,EAAoB,KAAO,CAC/B,MAAO,KAAG,GAAG,EACb,KAAM,KAAG,GAAG,EACZ,KAAM,KAAG,GAAG,EACZ,MAAO,KAAG,GAAG,EACb,YAAa,CAAC,CAChB,GAEA,SAAS,sBAAuB,IAAM,CACpC,MAAMC,EAAmC,CAAC,EAE1C,GAAG,oBAAqB,IAAM,CAC5B,MAAMC,EAAS,IAAI,sBAAoB,CACrC,IAAK,CAAC,EACN,UAAW,CAAC,EACZ,cAAeD,CACjB,CAAC,EACD,OAAOC,CAAM,EAAE,YAAY,CAC7B,CAAC,EAED,GAAG,yBAA0B,IAAM,CACjC,MAAMC,EAAM,CACV,oBAAqB,KAAG,GAAG,EAC3B,iBAAkB,KAAG,GAAG,EAAE,gBAAgBH,CAAiB,CAC7D,EACMI,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,WAAW,iBAAkB,CAAC,CAAC,EACtC,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,EAC3B,iBAAkB,KAAG,GAAG,EAAE,gBAAgBH,CAAiB,CAC7D,EACMI,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,gBAAgB,iBAAkB,IAAI,UAAY,EACzD,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,0BAA2B,IAAM,CAClC,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,EAC3B,iBAAkB,KAAG,GAAG,EAAE,gBAAgBH,CAAiB,CAC7D,EACMI,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,YAAY,iBAAkB,aAAa,EAClD,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,EAC3B,iBAAkB,KAAG,GAAG,EAAE,gBAAgBH,CAAiB,CAC7D,EACMI,EAAY,CAAC,EACJ,IAAI,sBAAoB,CACrC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACM,oBAAoB,EAC3B,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,CACH,CAAC",
6
+ "names": ["import_vitest", "import_DefaultSignerSolana", "mockLoggerFactory", "contextModuleStub", "signer", "dmk", "sessionId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=require("vitest"),n=require("./DefaultSolanaTools");describe("DefaultSolanaTools",()=>{const t={};it("should be defined",()=>{const e=new n.DefaultSolanaTools({dmk:{},sessionId:{},contextModule:t});expect(e).toBeDefined()}),it("should call getAddress",()=>{const e={executeDeviceAction:s.vi.fn()},o={};new n.DefaultSolanaTools({dmk:e,sessionId:o,contextModule:t}).getAddress("derivationPath",{}),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call getAppConfiguration",()=>{const e={executeDeviceAction:s.vi.fn()},o={};new n.DefaultSolanaTools({dmk:e,sessionId:o,contextModule:t}).getAppConfiguration(),expect(e.executeDeviceAction).toHaveBeenCalled()}),it("should call generateTransaction",()=>{const e={executeDeviceAction:s.vi.fn()},o={};new n.DefaultSolanaTools({dmk:e,sessionId:o,contextModule:t}).generateTransaction("derivationPath"),expect(e.executeDeviceAction).toHaveBeenCalled()})});
1
+ "use strict";var e=require("vitest"),t=require("./DefaultSolanaTools");const a=()=>({debug:e.vi.fn(),info:e.vi.fn(),warn:e.vi.fn(),error:e.vi.fn(),subscribers:[]});describe("DefaultSolanaTools",()=>{const s={};it("should be defined",()=>{const o=new t.DefaultSolanaTools({dmk:{},sessionId:{},contextModule:s});expect(o).toBeDefined()}),it("should call getAddress",()=>{const o={executeDeviceAction:e.vi.fn(),getLoggerFactory:e.vi.fn().mockReturnValue(a)},n={};new t.DefaultSolanaTools({dmk:o,sessionId:n,contextModule:s}).getAddress("derivationPath",{}),expect(o.executeDeviceAction).toHaveBeenCalled()}),it("should call getAppConfiguration",()=>{const o={executeDeviceAction:e.vi.fn(),getLoggerFactory:e.vi.fn().mockReturnValue(a)},n={};new t.DefaultSolanaTools({dmk:o,sessionId:n,contextModule:s}).getAppConfiguration(),expect(o.executeDeviceAction).toHaveBeenCalled()}),it("should call generateTransaction",()=>{const o={executeDeviceAction:e.vi.fn(),getLoggerFactory:e.vi.fn().mockReturnValue(a)},n={};new t.DefaultSolanaTools({dmk:o,sessionId:n,contextModule:s}).generateTransaction("derivationPath"),expect(o.executeDeviceAction).toHaveBeenCalled()})});
2
2
  //# sourceMappingURL=DefaultSolanaTools.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/internal/DefaultSolanaTools.test.ts"],
4
- "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { vi } from \"vitest\";\n\nimport { DefaultSolanaTools } from \"./DefaultSolanaTools\";\n\ndescribe(\"DefaultSolanaTools\", () => {\n const contextModuleStub: ContextModule = {} as ContextModule;\n\n it(\"should be defined\", () => {\n const solanaTools = new DefaultSolanaTools({\n dmk: {} as DeviceManagementKit,\n sessionId: {} as DeviceSessionId,\n contextModule: contextModuleStub,\n });\n expect(solanaTools).toBeDefined();\n });\n\n it(\"should call getAddress\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const solanaTools = new DefaultSolanaTools({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n solanaTools.getAddress(\"derivationPath\", {});\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call getAppConfiguration\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const solanaTools = new DefaultSolanaTools({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n solanaTools.getAppConfiguration();\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call generateTransaction\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const solanaTools = new DefaultSolanaTools({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n solanaTools.generateTransaction(\"derivationPath\");\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n});\n"],
5
- "mappings": "aAKA,IAAAA,EAAmB,kBAEnBC,EAAmC,gCAEnC,SAAS,qBAAsB,IAAM,CACnC,MAAMC,EAAmC,CAAC,EAE1C,GAAG,oBAAqB,IAAM,CAC5B,MAAMC,EAAc,IAAI,qBAAmB,CACzC,IAAK,CAAC,EACN,UAAW,CAAC,EACZ,cAAeD,CACjB,CAAC,EACD,OAAOC,CAAW,EAAE,YAAY,CAClC,CAAC,EAED,GAAG,yBAA0B,IAAM,CACjC,MAAMC,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACC,IAAI,qBAAmB,CACzC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACW,WAAW,iBAAkB,CAAC,CAAC,EAC3C,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACC,IAAI,qBAAmB,CACzC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACW,oBAAoB,EAChC,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,MAAMA,EAAM,CACV,oBAAqB,KAAG,GAAG,CAC7B,EACMC,EAAY,CAAC,EACC,IAAI,qBAAmB,CACzC,IAAAD,EACA,UAAAC,EACA,cAAeH,CACjB,CAAC,EACW,oBAAoB,gBAAgB,EAChD,OAAOE,EAAI,mBAAmB,EAAE,iBAAiB,CACnD,CAAC,CACH,CAAC",
6
- "names": ["import_vitest", "import_DefaultSolanaTools", "contextModuleStub", "solanaTools", "dmk", "sessionId"]
4
+ "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\nimport { vi } from \"vitest\";\n\nimport { DefaultSolanaTools } from \"./DefaultSolanaTools\";\n\nconst mockLoggerFactory = () => ({\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n subscribers: [],\n});\n\ndescribe(\"DefaultSolanaTools\", () => {\n const contextModuleStub: ContextModule = {} as ContextModule;\n\n it(\"should be defined\", () => {\n const solanaTools = new DefaultSolanaTools({\n dmk: {} as DeviceManagementKit,\n sessionId: {} as DeviceSessionId,\n contextModule: contextModuleStub,\n });\n expect(solanaTools).toBeDefined();\n });\n\n it(\"should call getAddress\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const solanaTools = new DefaultSolanaTools({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n solanaTools.getAddress(\"derivationPath\", {});\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call getAppConfiguration\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const solanaTools = new DefaultSolanaTools({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n solanaTools.getAppConfiguration();\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n\n it(\"should call generateTransaction\", () => {\n const dmk = {\n executeDeviceAction: vi.fn(),\n getLoggerFactory: vi.fn().mockReturnValue(mockLoggerFactory),\n } as unknown as DeviceManagementKit;\n const sessionId = {} as DeviceSessionId;\n const solanaTools = new DefaultSolanaTools({\n dmk,\n sessionId,\n contextModule: contextModuleStub,\n });\n solanaTools.generateTransaction(\"derivationPath\");\n expect(dmk.executeDeviceAction).toHaveBeenCalled();\n });\n});\n"],
5
+ "mappings": "aAKA,IAAAA,EAAmB,kBAEnBC,EAAmC,gCAEnC,MAAMC,EAAoB,KAAO,CAC/B,MAAO,KAAG,GAAG,EACb,KAAM,KAAG,G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ModuleStub", "solanaTools", "dmk", "sessionId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var i in e)d(t,i,{get:e[i],enumerable:!0})},I=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of f(e))!k.call(t,n)&&n!==i&&d(t,n,{get:()=>e[n],enumerable:!(o=g(e,n))||o.enumerable});return t};var O=t=>I(d({},"__esModule",{value:!0}),t),A=(t,e,i,o)=>{for(var n=o>1?void 0:o?g(e,i):e,m=t.length-1,u;m>=0;m--)(u=t[m])&&(n=(o?u(e,i,n):u(n))||n);return o&&n&&d(e,i,n),n},a=(t,e)=>(i,o)=>e(i,o,t);var x={};y(x,{SolanaAppBinder:()=>c});module.exports=O(x);var r=require("@ledgerhq/device-management-kit"),s=require("inversify"),v=require("../app-binder/task/SendSignMessageTask"),p=require("../externalTypes"),l=require("./command/GetAppConfigurationCommand"),D=require("./command/GetPubKeyCommand"),T=require("./device-action/GenerateTransactionDeviceAction"),h=require("./device-action/SignTransactionDeviceAction");let c=class{constructor(e,i,o,n){this.dmk=e;this.sessionId=i;this.contextModule=o;this.dmkLoggerFactory=n}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new r.SendCommandInAppDeviceAction({input:{command:new D.GetPubKeyCommand(e),appName:"Solana",requiredUserInteraction:e.checkOnDevice?r.UserInteractionRequired.VerifyAddress:r.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp}})})}signTransaction(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new h.SignTransactionDeviceAction({input:{derivationPath:e.derivationPath,transaction:e.transaction,transactionOptions:e.solanaTransactionOptionalConfig,contextModule:this.contextModule,loggerFactory:this.dmkLoggerFactory}})})}generateTransaction(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new T.GenerateTransactionDeviceAction({input:{derivationPath:e.derivationPath,skipOpenApp:e.skipOpenApp,contextModule:this.contextModule}})})}signMessage(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new r.CallTaskInAppDeviceAction({input:{task:async i=>new v.SendSignMessageTask(i,{derivationPath:e.derivationPath,sendingData:new TextEncoder().encode(e.message)}).run(),appName:"Solana",requiredUserInteraction:r.UserInteractionRequired.SignPersonalMessage,skipOpenApp:e.skipOpenApp}})})}getAppConfiguration(){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new r.SendCommandInAppDeviceAction({input:{command:new l.GetAppConfigurationCommand,appName:"Solana",requiredUserInteraction:r.UserInteractionRequired.None,skipOpenApp:!1}})})}};c=A([(0,s.injectable)(),a(0,(0,s.inject)(p.externalTypes.Dmk)),a(1,(0,s.inject)(p.externalTypes.SessionId)),a(2,(0,s.inject)(p.externalTypes.ContextModule)),a(3,(0,s.inject)(p.externalTypes.DmkLoggerFactory))],c);0&&(module.exports={SolanaAppBinder});
1
+ "use strict";var d=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var i in e)d(t,i,{get:e[i],enumerable:!0})},I=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!f.call(t,n)&&n!==i&&d(t,n,{get:()=>e[n],enumerable:!(o=A(e,n))||o.enumerable});return t};var C=t=>I(d({},"__esModule",{value:!0}),t),u=(t,e,i,o)=>{for(var n=o>1?void 0:o?A(e,i):e,m=t.length-1,g;m>=0;m--)(g=t[m])&&(n=(o?g(e,i,n):g(n))||n);return o&&n&&d(e,i,n),n},s=(t,e)=>(i,o)=>e(i,o,t);var S={};y(S,{SolanaAppBinder:()=>c});module.exports=C(S);var r=require("@ledgerhq/device-management-kit"),a=require("inversify"),v=require("../app-binder/task/SendSignMessageTask"),p=require("../externalTypes"),l=require("./command/GetAppConfigurationCommand"),D=require("./command/GetPubKeyCommand"),h=require("./device-action/GenerateTransactionDeviceAction"),k=require("./device-action/SignTransactionDeviceAction");let c=class{constructor(e,i,o,n){this.dmk=e;this.sessionId=i;this.contextModule=o;this.dmkLoggerFactory=n}getAddress(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new r.SendCommandInAppDeviceAction({input:{command:new D.GetPubKeyCommand(e),appName:"Solana",requiredUserInteraction:e.checkOnDevice?r.UserInteractionRequired.VerifyAddress:r.UserInteractionRequired.None,skipOpenApp:e.skipOpenApp},logger:this.dmkLoggerFactory("SendCommandInAppDeviceAction")})})}signTransaction(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new k.SignTransactionDeviceAction({input:{derivationPath:e.derivationPath,transaction:e.transaction,transactionOptions:e.solanaTransactionOptionalConfig,contextModule:this.contextModule},loggerFactory:this.dmkLoggerFactory})})}generateTransaction(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new h.GenerateTransactionDeviceAction({input:{derivationPath:e.derivationPath,skipOpenApp:e.skipOpenApp,contextModule:this.contextModule}})})}signMessage(e){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new r.CallTaskInAppDeviceAction({input:{task:async i=>new v.SendSignMessageTask(i,{derivationPath:e.derivationPath,sendingData:new TextEncoder().encode(e.message)}).run(),appName:"Solana",requiredUserInteraction:r.UserInteractionRequired.SignPersonalMessage,skipOpenApp:e.skipOpenApp},logger:this.dmkLoggerFactory("CallTaskInAppDeviceAction")})})}getAppConfiguration(){return this.dmk.executeDeviceAction({sessionId:this.sessionId,deviceAction:new r.SendCommandInAppDeviceAction({input:{command:new l.GetAppConfigurationCommand,appName:"Solana",requiredUserInteraction:r.UserInteractionRequired.None,skipOpenApp:!1},logger:this.dmkLoggerFactory("SendCommandInAppDeviceAction")})})}};c=u([(0,a.injectable)(),s(0,(0,a.inject)(p.externalTypes.Dmk)),s(1,(0,a.inject)(p.externalTypes.SessionId)),s(2,(0,a.inject)(p.externalTypes.ContextModule)),s(3,(0,a.inject)(p.externalTypes.DmkLoggerFactory))],c);0&&(module.exports={SolanaAppBinder});
2
2
  //# sourceMappingURL=SolanaAppBinder.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/app-binder/SolanaAppBinder.ts"],
4
- "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n CallTaskInAppDeviceAction,\n DeviceManagementKit,\n type DeviceSessionId,\n LoggerPublisherService,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { GenerateTransactionDAReturnType } from \"@api/app-binder/GenerateTransactionDeviceActionTypes\";\nimport { GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { GetAppConfigurationDAReturnType } from \"@api/app-binder/GetAppConfigurationDeviceActionTypes\";\nimport { SignMessageDAReturnType } from \"@api/app-binder/SignMessageDeviceActionTypes\";\nimport { SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { SolanaTransactionOptionalConfig } from \"@api/model/SolanaTransactionOptionalConfig\";\nimport { Transaction } from \"@api/model/Transaction\";\nimport { SendSignMessageTask } from \"@internal/app-binder/task/SendSignMessageTask\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\nimport { GetAppConfigurationCommand } from \"./command/GetAppConfigurationCommand\";\nimport { GetPubKeyCommand } from \"./command/GetPubKeyCommand\";\nimport { GenerateTransactionDeviceAction } from \"./device-action/GenerateTransactionDeviceAction\";\nimport { SignTransactionDeviceAction } from \"./device-action/SignTransactionDeviceAction\";\n\n@injectable()\nexport class SolanaAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n @inject(externalTypes.ContextModule) private contextModule: ContextModule,\n @inject(externalTypes.DmkLoggerFactory)\n private dmkLoggerFactory: (tag: string) => LoggerPublisherService,\n ) {}\n\n getAddress(args: {\n derivationPath: string;\n checkOnDevice: boolean;\n skipOpenApp: boolean;\n }): GetAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetPubKeyCommand(args),\n appName: \"Solana\",\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n signTransaction(args: {\n derivationPath: string;\n transaction: Transaction;\n solanaTransactionOptionalConfig?: SolanaTransactionOptionalConfig;\n }): SignTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SignTransactionDeviceAction({\n input: {\n derivationPath: args.derivationPath,\n transaction: args.transaction,\n transactionOptions: args.solanaTransactionOptionalConfig,\n contextModule: this.contextModule,\n loggerFactory: this.dmkLoggerFactory,\n },\n }),\n });\n }\n\n generateTransaction(args: {\n derivationPath: string;\n skipOpenApp: boolean;\n }): GenerateTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new GenerateTransactionDeviceAction({\n input: {\n derivationPath: args.derivationPath,\n skipOpenApp: args.skipOpenApp,\n contextModule: this.contextModule,\n },\n }),\n });\n }\n\n signMessage(args: {\n derivationPath: string;\n message: string;\n skipOpenApp: boolean;\n }): SignMessageDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new SendSignMessageTask(internalApi, {\n derivationPath: args.derivationPath,\n sendingData: new TextEncoder().encode(args.message),\n }).run(),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.SignPersonalMessage,\n skipOpenApp: args.skipOpenApp,\n },\n }),\n });\n }\n\n getAppConfiguration(): GetAppConfigurationDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigurationCommand(),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: false,\n },\n }),\n });\n }\n}\n"],
5
- "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAOO,2CACPC,EAAmC,qBASnCC,EAAoC,yDACpCC,EAA8B,mCAE9BC,EAA2C,gDAC3CC,EAAiC,sCACjCC,EAAgD,2DAChDC,EAA4C,uDAGrC,IAAMC,EAAN,KAAsB,CAC3B,YACqCC,EACMC,EACIC,EAErCC,EACR,CALmC,SAAAH,EACM,eAAAC,EACI,mBAAAC,EAErC,sBAAAC,CACP,CAEH,WAAWC,EAIgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,mBAAiBA,CAAI,EAClC,QAAS,SACT,wBAAyBA,EAAK,cAC1B,0BAAwB,cACxB,0BAAwB,KAC5B,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,gBAAgBA,EAIgB,CAC9B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,8BAA4B,CAC5C,MAAO,CACL,eAAgBA,EAAK,eACrB,YAAaA,EAAK,YAClB,mBAAoBA,EAAK,gCACzB,cAAe,KAAK,cACpB,cAAe,KAAK,gBACtB,CACF,CAAC,CACH,CAAC,CACH,CAEA,oBAAoBA,EAGgB,CAClC,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,kCAAgC,CAChD,MAAO,CACL,eAAgBA,EAAK,eACrB,YAAaA,EAAK,YAClB,cAAe,KAAK,aACtB,CACF,CAAC,CACH,CAAC,CACH,CAEA,YAAYA,EAIgB,CAC1B,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,4BAA0B,CAC1C,MAAO,CACL,KAAM,MAAOC,GACX,IAAI,sBAAoBA,EAAa,CACnC,eAAgBD,EAAK,eACrB,YAAa,IAAI,YAAY,EAAE,OAAOA,EAAK,OAAO,CACpD,CAAC,EAAE,IAAI,EACT,QAAS,SACT,wBAAyB,0BAAwB,oBACjD,YAAaA,EAAK,WACpB,CACF,CAAC,CACH,CAAC,CACH,CAEA,qBAAuD,CACrD,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI,6BACb,QAAS,SACT,wBAAyB,0BAAwB,KACjD,YAAa,EACf,CACF,CAAC,CACH,CAAC,CACH,CACF,EAnGaL,EAANO,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,GAC9BA,EAAA,eAAO,gBAAc,aAAa,GAClCA,EAAA,eAAO,gBAAc,gBAAgB,IAL7BR",
4
+ "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n CallTaskInAppDeviceAction,\n DeviceManagementKit,\n type DeviceSessionId,\n LoggerPublisherService,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport { GenerateTransactionDAReturnType } from \"@api/app-binder/GenerateTransactionDeviceActionTypes\";\nimport { GetAddressDAReturnType } from \"@api/app-binder/GetAddressDeviceActionTypes\";\nimport { GetAppConfigurationDAReturnType } from \"@api/app-binder/GetAppConfigurationDeviceActionTypes\";\nimport { SignMessageDAReturnType } from \"@api/app-binder/SignMessageDeviceActionTypes\";\nimport { SignTransactionDAReturnType } from \"@api/app-binder/SignTransactionDeviceActionTypes\";\nimport { SolanaTransactionOptionalConfig } from \"@api/model/SolanaTransactionOptionalConfig\";\nimport { Transaction } from \"@api/model/Transaction\";\nimport { SendSignMessageTask } from \"@internal/app-binder/task/SendSignMessageTask\";\nimport { externalTypes } from \"@internal/externalTypes\";\n\nimport { GetAppConfigurationCommand } from \"./command/GetAppConfigurationCommand\";\nimport { GetPubKeyCommand } from \"./command/GetPubKeyCommand\";\nimport { GenerateTransactionDeviceAction } from \"./device-action/GenerateTransactionDeviceAction\";\nimport { SignTransactionDeviceAction } from \"./device-action/SignTransactionDeviceAction\";\n\n@injectable()\nexport class SolanaAppBinder {\n constructor(\n @inject(externalTypes.Dmk) private dmk: DeviceManagementKit,\n @inject(externalTypes.SessionId) private sessionId: DeviceSessionId,\n @inject(externalTypes.ContextModule) private contextModule: ContextModule,\n @inject(externalTypes.DmkLoggerFactory)\n private dmkLoggerFactory: (tag: string) => LoggerPublisherService,\n ) {}\n\n getAddress(args: {\n derivationPath: string;\n checkOnDevice: boolean;\n skipOpenApp: boolean;\n }): GetAddressDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetPubKeyCommand(args),\n appName: \"Solana\",\n requiredUserInteraction: args.checkOnDevice\n ? UserInteractionRequired.VerifyAddress\n : UserInteractionRequired.None,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"SendCommandInAppDeviceAction\"),\n }),\n });\n }\n\n signTransaction(args: {\n derivationPath: string;\n transaction: Transaction;\n solanaTransactionOptionalConfig?: SolanaTransactionOptionalConfig;\n }): SignTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SignTransactionDeviceAction({\n input: {\n derivationPath: args.derivationPath,\n transaction: args.transaction,\n transactionOptions: args.solanaTransactionOptionalConfig,\n contextModule: this.contextModule,\n },\n loggerFactory: this.dmkLoggerFactory,\n }),\n });\n }\n\n generateTransaction(args: {\n derivationPath: string;\n skipOpenApp: boolean;\n }): GenerateTransactionDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new GenerateTransactionDeviceAction({\n input: {\n derivationPath: args.derivationPath,\n skipOpenApp: args.skipOpenApp,\n contextModule: this.contextModule,\n },\n }),\n });\n }\n\n signMessage(args: {\n derivationPath: string;\n message: string;\n skipOpenApp: boolean;\n }): SignMessageDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new CallTaskInAppDeviceAction({\n input: {\n task: async (internalApi) =>\n new SendSignMessageTask(internalApi, {\n derivationPath: args.derivationPath,\n sendingData: new TextEncoder().encode(args.message),\n }).run(),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.SignPersonalMessage,\n skipOpenApp: args.skipOpenApp,\n },\n logger: this.dmkLoggerFactory(\"CallTaskInAppDeviceAction\"),\n }),\n });\n }\n\n getAppConfiguration(): GetAppConfigurationDAReturnType {\n return this.dmk.executeDeviceAction({\n sessionId: this.sessionId,\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigurationCommand(),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: false,\n },\n logger: this.dmkLoggerFactory(\"SendCommandInAppDeviceAction\"),\n }),\n });\n }\n}\n"],
5
+ "mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAOO,2CACPC,EAAmC,qBASnCC,EAAoC,yDACpCC,EAA8B,mCAE9BC,EAA2C,gDAC3CC,EAAiC,sCACjCC,EAAgD,2DAChDC,EAA4C,uDAGrC,IAAMC,EAAN,KAAsB,CAC3B,YACqCC,EACMC,EACIC,EAErCC,EACR,CALmC,SAAAH,EACM,eAAAC,EACI,mBAAAC,EAErC,sBAAAC,CACP,CAEH,WAAWC,EAIgB,CACzB,OAAO,KAAK,IAAI,oBAAoB,CAClC,UAAW,KAAK,UAChB,aAAc,IAAI,+BAA6B,CAC7C,MAAO,CACL,QAAS,IAAI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tGaL,EAANO,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,gBAAc,GAAG,GACxBA,EAAA,eAAO,gBAAc,SAAS,GAC9BA,EAAA,eAAO,gBAAc,aAAa,GAClCA,EAAA,eAAO,gBAAc,gBAAgB,IAL7BR",
6
6
  "names": ["SolanaAppBinder_exports", "__export", "SolanaAppBinder", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_SendSignMessageTask", "import_externalTypes", "import_GetAppConfigurationCommand", "import_GetPubKeyCommand", "import_GenerateTransactionDeviceAction", "import_SignTransactionDeviceAction", "SolanaAppBinder", "dmk", "sessionId", "contextModule", "dmkLoggerFactory", "args", "internalApi", "__decorateClass", "__decorateParam"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=require("@ledgerhq/device-management-kit"),A=require("rxjs"),v=require("./command/GetAppConfigurationCommand"),m=require("./command/GetPubKeyCommand"),D=require("./device-action/GenerateTransactionDeviceAction"),g=require("./device-action/SignTransactionDeviceAction"),c=require("./services/utils/NullLoggerPublisherService"),u=require("./SolanaAppBinder");describe("SolanaAppBinder",()=>{const a={},i={sendCommand:vi.fn(),executeDeviceAction:vi.fn()};beforeEach(()=>{vi.clearAllMocks()}),it("should be defined",()=>{const n=new u.SolanaAppBinder({},{},a,c.NullLoggerPublisherService);expect(n).toBeDefined()}),describe("getAddress",()=>{it("should return the address",()=>new Promise((n,s)=>{const t="D2PPQSYFe83nDzk96FqGumVU8JA7J8vj2Rhjc2oXzEi5";vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:o.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const p=new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService),{observable:d}=p.getAddress({derivationPath:"44'/501'",checkOnDevice:!1,skipOpenApp:!1}),r=[];d.subscribe({next:e=>{r.push(e)},error:e=>{s(e)},complete:()=>{try{expect(r).toEqual([{status:o.DeviceActionStatus.Completed,output:t}]),n()}catch(e){s(e)}}})})),describe("calls of executeDeviceAction with the correct params",()=>{const n={derivationPath:"44'/60'/3'/2/1",returnChainCode:!1,skipOpenApp:!1};it("when checkOnDevice is true: UserInteractionRequired.VerifyAddress",()=>{const t={...n,checkOnDevice:!0};new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService).getAddress(t),expect(i.executeDeviceAction).toHaveBeenCalledWith({sessionId:"sessionId",deviceAction:new o.SendCommandInAppDeviceAction({input:{command:new m.GetPubKeyCommand(t),appName:"Solana",requiredUserInteraction:o.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}})})}),it("when checkOnDevice is false: UserInteractionRequired.None",()=>{const t={...n,checkOnDevice:!1};new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService).getAddress(t),expect(i.executeDeviceAction).toHaveBeenCalledWith({sessionId:"sessionId",deviceAction:new o.SendCommandInAppDeviceAction({input:{command:new m.GetPubKeyCommand(t),appName:"Solana",requiredUserInteraction:o.UserInteractionRequired.None,skipOpenApp:!1}})})})})}),describe("signTransaction",()=>{it("should return the signature",()=>new Promise((n,s)=>{const t=new Uint8Array([1,2,3]);vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:o.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const p=new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService),{observable:d}=p.signTransaction({derivationPath:"44'/501'",transaction:new Uint8Array([1,2,3,4]),solanaTransactionOptionalConfig:{skipOpenApp:!1}}),r=[];d.subscribe({next:e=>{r.push(e)},error:e=>{s(e)},complete:()=>{try{expect(r).toEqual([{status:o.DeviceActionStatus.Completed,output:t}]),n()}catch(e){s(e)}}})})),it("should call executeDeviceAction with the correct params",()=>{const n="44'/60'/3'/2/1",s=new Uint8Array([1,2,3,4]),t=!1;new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService).signTransaction({derivationPath:n,transaction:s,solanaTransactionOptionalConfig:{skipOpenApp:!1}}),expect(i.executeDeviceAction).toHaveBeenCalledWith({sessionId:"sessionId",deviceAction:new g.SignTransactionDeviceAction({input:{derivationPath:n,transaction:s,transactionOptions:{skipOpenApp:t},contextModule:a,loggerFactory:c.NullLoggerPublisherService}})})})}),describe("signMessage",()=>{it("should return the signed message",()=>new Promise((n,s)=>{const t={signature:"signature"},p={derivationPath:"44'/501'/0'/0'",message:"Hello world",skipOpenApp:!1};vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:o.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const d=new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService),{observable:r}=d.signMessage(p),e=[];r.subscribe({next:l=>{e.push(l)},error:l=>{s(l)},complete:()=>{try{expect(e).toEqual([{status:o.DeviceActionStatus.Completed,output:t}]),n()}catch(l){s(l)}}})}))}),describe("getAppConfiguration",()=>{it("should return the app configuration",()=>new Promise((n,s)=>{const t={blindSigningEnabled:!0,pubKeyDisplayMode:"LONG",version:"2.5.10"};vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:o.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const p=new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService),{observable:d}=p.getAppConfiguration(),r=[];d.subscribe({next:e=>{r.push(e)},error:e=>{s(e)},complete:()=>{try{expect(r).toEqual([{status:o.DeviceActionStatus.Completed,output:t}]),n()}catch(e){s(e)}}})})),it("should call executeDeviceAction with the correct params",()=>{new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService).getAppConfiguration(),expect(i.executeDeviceAction).toHaveBeenCalledWith({sessionId:"sessionId",deviceAction:new o.SendCommandInAppDeviceAction({input:{command:new v.GetAppConfigurationCommand,appName:"Solana",requiredUserInteraction:o.UserInteractionRequired.None,skipOpenApp:!1}})})})}),describe("generateTransaction",()=>{it("should return the serialized transaction",()=>new Promise((n,s)=>{const t="BASE64_OR_HEX_TX";vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:o.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const p=new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService),{observable:d}=p.generateTransaction({derivationPath:"44'/501'/0'/0'",skipOpenApp:!1}),r=[];d.subscribe({next:e=>r.push(e),error:e=>s(e),complete:()=>{try{expect(r).toEqual([{status:o.DeviceActionStatus.Completed,output:t}]),n()}catch(e){s(e)}}})})),it("should call executeDeviceAction with the correct params",()=>{const n="44'/501'/0'/0'";new u.SolanaAppBinder(i,"sessionId",a,c.NullLoggerPublisherService).generateTransaction({derivationPath:n,skipOpenApp:!0}),expect(i.executeDeviceAction).toHaveBeenCalledWith({sessionId:"sessionId",deviceAction:new D.GenerateTransactionDeviceAction({input:{derivationPath:n,skipOpenApp:!0,contextModule:a}})})})})});
1
+ "use strict";var s=require("@ledgerhq/device-management-kit"),A=require("rxjs"),v=require("./command/GetAppConfigurationCommand"),m=require("./command/GetPubKeyCommand"),D=require("./device-action/GenerateTransactionDeviceAction"),p=require("./SolanaAppBinder");const u=()=>({debug:vi.fn(),info:vi.fn(),warn:vi.fn(),error:vi.fn(),subscribers:[]});describe("SolanaAppBinder",()=>{const a={},i={sendCommand:vi.fn(),executeDeviceAction:vi.fn()};beforeEach(()=>{vi.clearAllMocks()}),it("should be defined",()=>{const n=new p.SolanaAppBinder({},{},a,u);expect(n).toBeDefined()}),describe("getAddress",()=>{it("should return the address",()=>new Promise((n,o)=>{const t="D2PPQSYFe83nDzk96FqGumVU8JA7J8vj2Rhjc2oXzEi5";vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:s.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const c=new p.SolanaAppBinder(i,"sessionId",a,u),{observable:d}=c.getAddress({derivationPath:"44'/501'",checkOnDevice:!1,skipOpenApp:!1}),r=[];d.subscribe({next:e=>{r.push(e)},error:e=>{o(e)},complete:()=>{try{expect(r).toEqual([{status:s.DeviceActionStatus.Completed,output:t}]),n()}catch(e){o(e)}}})})),describe("calls of executeDeviceAction with the correct params",()=>{const n={derivationPath:"44'/60'/3'/2/1",returnChainCode:!1,skipOpenApp:!1};it("when checkOnDevice is true: UserInteractionRequired.VerifyAddress",()=>{const t={...n,checkOnDevice:!0};new p.SolanaAppBinder(i,"sessionId",a,u).getAddress(t),expect(i.executeDeviceAction).toHaveBeenCalledWith(expect.objectContaining({sessionId:"sessionId",deviceAction:expect.objectContaining({input:{command:new m.GetPubKeyCommand(t),appName:"Solana",requiredUserInteraction:s.UserInteractionRequired.VerifyAddress,skipOpenApp:!1}})}))}),it("when checkOnDevice is false: UserInteractionRequired.None",()=>{const t={...n,checkOnDevice:!1};new p.SolanaAppBinder(i,"sessionId",a,u).getAddress(t),expect(i.executeDeviceAction).toHaveBeenCalledWith(expect.objectContaining({sessionId:"sessionId",deviceAction:expect.objectContaining({input:{command:new m.GetPubKeyCommand(t),appName:"Solana",requiredUserInteraction:s.UserInteractionRequired.None,skipOpenApp:!1}})}))})})}),describe("signTransaction",()=>{it("should return the signature",()=>new Promise((n,o)=>{const t=new Uint8Array([1,2,3]);vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:s.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const c=new p.SolanaAppBinder(i,"sessionId",a,u),{observable:d}=c.signTransaction({derivationPath:"44'/501'",transaction:new Uint8Array([1,2,3,4]),solanaTransactionOptionalConfig:{skipOpenApp:!1}}),r=[];d.subscribe({next:e=>{r.push(e)},error:e=>{o(e)},complete:()=>{try{expect(r).toEqual([{status:s.DeviceActionStatus.Completed,output:t}]),n()}catch(e){o(e)}}})})),it("should call executeDeviceAction with the correct params",()=>{const n="44'/60'/3'/2/1",o=new Uint8Array([1,2,3,4]),t=!1;new p.SolanaAppBinder(i,"sessionId",a,u).signTransaction({derivationPath:n,transaction:o,solanaTransactionOptionalConfig:{skipOpenApp:!1}}),expect(i.executeDeviceAction).toHaveBeenCalledWith(expect.objectContaining({sessionId:"sessionId",deviceAction:expect.objectContaining({input:{derivationPath:n,transaction:o,transactionOptions:{skipOpenApp:t},contextModule:a}})}))})}),describe("signMessage",()=>{it("should return the signed message",()=>new Promise((n,o)=>{const t={signature:"signature"},c={derivationPath:"44'/501'/0'/0'",message:"Hello world",skipOpenApp:!1};vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:s.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const d=new p.SolanaAppBinder(i,"sessionId",a,u),{observable:r}=d.signMessage(c),e=[];r.subscribe({next:l=>{e.push(l)},error:l=>{o(l)},complete:()=>{try{expect(e).toEqual([{status:s.DeviceActionStatus.Completed,output:t}]),n()}catch(l){o(l)}}})}))}),describe("getAppConfiguration",()=>{it("should return the app configuration",()=>new Promise((n,o)=>{const t={blindSigningEnabled:!0,pubKeyDisplayMode:"LONG",version:"2.5.10"};vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:s.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const c=new p.SolanaAppBinder(i,"sessionId",a,u),{observable:d}=c.getAppConfiguration(),r=[];d.subscribe({next:e=>{r.push(e)},error:e=>{o(e)},complete:()=>{try{expect(r).toEqual([{status:s.DeviceActionStatus.Completed,output:t}]),n()}catch(e){o(e)}}})})),it("should call executeDeviceAction with the correct params",()=>{new p.SolanaAppBinder(i,"sessionId",a,u).getAppConfiguration(),expect(i.executeDeviceAction).toHaveBeenCalledWith(expect.objectContaining({sessionId:"sessionId",deviceAction:expect.objectContaining({input:{command:new v.GetAppConfigurationCommand,appName:"Solana",requiredUserInteraction:s.UserInteractionRequired.None,skipOpenApp:!1}})}))})}),describe("generateTransaction",()=>{it("should return the serialized transaction",()=>new Promise((n,o)=>{const t="BASE64_OR_HEX_TX";vi.spyOn(i,"executeDeviceAction").mockReturnValue({observable:(0,A.from)([{status:s.DeviceActionStatus.Completed,output:t}]),cancel:vi.fn()});const c=new p.SolanaAppBinder(i,"sessionId",a,u),{observable:d}=c.generateTransaction({derivationPath:"44'/501'/0'/0'",skipOpenApp:!1}),r=[];d.subscribe({next:e=>r.push(e),error:e=>o(e),complete:()=>{try{expect(r).toEqual([{status:s.DeviceActionStatus.Completed,output:t}]),n()}catch(e){o(e)}}})})),it("should call executeDeviceAction with the correct params",()=>{const n="44'/501'/0'/0'";new p.SolanaAppBinder(i,"sessionId",a,u).generateTransaction({derivationPath:n,skipOpenApp:!0}),expect(i.executeDeviceAction).toHaveBeenCalledWith({sessionId:"sessionId",deviceAction:new D.GenerateTransactionDeviceAction({input:{derivationPath:n,skipOpenApp:!0,contextModule:a}})})})})});
2
2
  //# sourceMappingURL=SolanaAppBinder.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/internal/app-binder/SolanaAppBinder.test.ts"],
4
- "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceActionIntermediateValue,\n type DeviceActionState,\n DeviceActionStatus,\n type DeviceManagementKit,\n type DeviceSessionId,\n type DmkError,\n SendCommandInAppDeviceAction,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { from } from \"rxjs\";\n\nimport {\n type GenerateTransactionDAError,\n type GenerateTransactionDAIntermediateValue,\n type GenerateTransactionDAOutput,\n} from \"@api/app-binder/GenerateTransactionDeviceActionTypes\";\nimport {\n type GetAppConfigurationDAError,\n type GetAppConfigurationDAIntermediateValue,\n type GetAppConfigurationDAOutput,\n} from \"@api/app-binder/GetAppConfigurationDeviceActionTypes\";\nimport {\n type GetAddressDAError,\n type GetAddressDAIntermediateValue,\n type GetAddressDAOutput,\n type SignMessageDAOutput,\n type SignTransactionDAError,\n type SignTransactionDAIntermediateValue,\n type SignTransactionDAOutput,\n} from \"@api/index\";\n\nimport { GetAppConfigurationCommand } from \"./command/GetAppConfigurationCommand\";\nimport { GetPubKeyCommand } from \"./command/GetPubKeyCommand\";\nimport { GenerateTransactionDeviceAction } from \"./device-action/GenerateTransactionDeviceAction\";\nimport { SignTransactionDeviceAction } from \"./device-action/SignTransactionDeviceAction\";\nimport { NullLoggerPublisherService } from \"./services/utils/NullLoggerPublisherService\";\nimport { SolanaAppBinder } from \"./SolanaAppBinder\";\n\ndescribe(\"SolanaAppBinder\", () => {\n // stub ContextModule for tests\n const contextModuleStub: ContextModule = {} as ContextModule;\n\n const mockedDmk: DeviceManagementKit = {\n sendCommand: vi.fn(),\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"should be defined\", () => {\n const binder = new SolanaAppBinder(\n {} as DeviceManagementKit,\n {} as DeviceSessionId,\n contextModuleStub,\n NullLoggerPublisherService,\n );\n expect(binder).toBeDefined();\n });\n\n describe(\"getAddress\", () => {\n it(\"should return the address\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const address = \"D2PPQSYFe83nDzk96FqGumVU8JA7J8vj2Rhjc2oXzEi5\";\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: address,\n } as DeviceActionState<\n GetAddressDAOutput,\n GetAddressDAError,\n GetAddressDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n const { observable } = appBinder.getAddress({\n derivationPath: \"44'/501'\",\n checkOnDevice: false,\n skipOpenApp: false,\n });\n\n // THEN\n const states: DeviceActionState<\n GetAddressDAOutput,\n GetAddressDAError,\n GetAddressDAIntermediateValue\n >[] = [];\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: address,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n describe(\"calls of executeDeviceAction with the correct params\", () => {\n const baseParams = {\n derivationPath: \"44'/60'/3'/2/1\",\n returnChainCode: false,\n skipOpenApp: false,\n };\n\n it(\"when checkOnDevice is true: UserInteractionRequired.VerifyAddress\", () => {\n // GIVEN\n const checkOnDevice = true;\n const params = {\n ...baseParams,\n checkOnDevice,\n };\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n appBinder.getAddress(params);\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({\n sessionId: \"sessionId\",\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetPubKeyCommand(params),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n }),\n });\n });\n\n it(\"when checkOnDevice is false: UserInteractionRequired.None\", () => {\n // GIVEN\n const checkOnDevice = false;\n const params = {\n ...baseParams,\n checkOnDevice,\n };\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n appBinder.getAddress(params);\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({\n sessionId: \"sessionId\",\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetPubKeyCommand(params),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: false,\n },\n }),\n });\n });\n });\n });\n\n describe(\"signTransaction\", () => {\n it(\"should return the signature\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const signature = new Uint8Array([0x01, 0x02, 0x03]);\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: signature,\n } as DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n const { observable } = appBinder.signTransaction({\n derivationPath: \"44'/501'\",\n transaction: new Uint8Array([0x01, 0x02, 0x03, 0x04]),\n solanaTransactionOptionalConfig: { skipOpenApp: false },\n });\n\n // THEN\n const states: DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n >[] = [];\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: signature,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n it(\"should call executeDeviceAction with the correct params\", () => {\n // GIVEN\n const derivationPath = \"44'/60'/3'/2/1\";\n const transaction = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n const skipOpenApp = false;\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n appBinder.signTransaction({\n derivationPath,\n transaction,\n solanaTransactionOptionalConfig: { skipOpenApp: false },\n });\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({\n sessionId: \"sessionId\",\n deviceAction: new SignTransactionDeviceAction({\n input: {\n derivationPath,\n transaction,\n transactionOptions: { skipOpenApp },\n contextModule: contextModuleStub,\n loggerFactory: NullLoggerPublisherService,\n },\n }),\n });\n });\n });\n\n describe(\"signMessage\", () => {\n it(\"should return the signed message\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const signedMessage = {\n signature: \"signature\",\n };\n const signMessageArgs = {\n derivationPath: \"44'/501'/0'/0'\",\n message: \"Hello world\",\n skipOpenApp: false,\n };\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: signedMessage,\n } as DeviceActionState<\n SignMessageDAOutput,\n DmkError,\n DeviceActionIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n const { observable } = appBinder.signMessage(signMessageArgs);\n\n // THEN\n const states: DeviceActionState<\n SignMessageDAOutput,\n unknown,\n unknown\n >[] = [];\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: signedMessage,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n });\n\n describe(\"getAppConfiguration\", () => {\n it(\"should return the app configuration\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const appConfiguration = {\n blindSigningEnabled: true,\n pubKeyDisplayMode: \"LONG\",\n version: \"2.5.10\",\n };\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: appConfiguration,\n } as DeviceActionState<\n GetAppConfigurationDAOutput,\n GetAppConfigurationDAError,\n GetAppConfigurationDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n const { observable } = appBinder.getAppConfiguration();\n\n // THEN\n const states: DeviceActionState<\n GetAppConfigurationDAOutput,\n GetAppConfigurationDAError,\n GetAppConfigurationDAIntermediateValue\n >[] = [];\n\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: appConfiguration,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n it(\"should call executeDeviceAction with the correct params\", () => {\n // GIVEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n\n // WHEN\n appBinder.getAppConfiguration();\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({\n sessionId: \"sessionId\",\n deviceAction: new SendCommandInAppDeviceAction({\n input: {\n command: new GetAppConfigurationCommand(),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: false,\n },\n }),\n });\n });\n });\n\n describe(\"generateTransaction\", () => {\n it(\"should return the serialized transaction\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const serializedTx = \"BASE64_OR_HEX_TX\";\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: serializedTx,\n } as DeviceActionState<\n GenerateTransactionDAOutput,\n GenerateTransactionDAError,\n GenerateTransactionDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n const { observable } = appBinder.generateTransaction({\n derivationPath: \"44'/501'/0'/0'\",\n skipOpenApp: false,\n });\n\n // THEN\n const states: DeviceActionState<\n GenerateTransactionDAOutput,\n GenerateTransactionDAError,\n GenerateTransactionDAIntermediateValue\n >[] = [];\n observable.subscribe({\n next: (state) => states.push(state),\n error: (err) => reject(err),\n complete: () => {\n try {\n expect(states).toEqual([\n { status: DeviceActionStatus.Completed, output: serializedTx },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n it(\"should call executeDeviceAction with the correct params\", () => {\n // GIVEN\n const derivationPath = \"44'/501'/0'/0'\";\n const skipOpenApp = true;\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n NullLoggerPublisherService,\n );\n appBinder.generateTransaction({ derivationPath, skipOpenApp });\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({\n sessionId: \"sessionId\",\n deviceAction: new GenerateTransactionDeviceAction({\n input: {\n derivationPath,\n skipOpenApp,\n contextModule: contextModuleStub,\n },\n }),\n });\n });\n });\n});\n"],
5
- "mappings": "aACA,IAAAA,EASO,2CACPC,EAAqB,gBAsBrBC,EAA2C,gDAC3CC,EAAiC,sCACjCC,EAAgD,2DAChDC,EAA4C,uDAC5CC,EAA2C,uDAC3CC,EAAgC,6BAEhC,SAAS,kBAAmB,IAAM,CAEhC,MAAMC,EAAmC,CAAC,EAEpCC,EAAiC,CACrC,YAAa,GAAG,GAAG,EACnB,oBAAqB,GAAG,GAAG,CAC7B,EACA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,oBAAqB,IAAM,CAC5B,MAAMC,EAAS,IAAI,kBACjB,CAAC,EACD,CAAC,EACDF,EACA,4BACF,EACA,OAAOE,CAAM,EAAE,YAAY,CAC7B,CAAC,EAED,SAAS,aAAc,IAAM,CAC3B,GAAG,4BAA6B,IAC9B,IAAI,QAAc,CAACC,EAASC,IAAW,CAErC,MAAMC,EAAU,+CAEhB,GAAG,MAAMJ,EAAW,qBAAqB,EAAE,gBAAgB,CACzD,cAAY,QAAK,CACf,CACE,OAAQ,qBAAmB,UAC3B,OAAQI,CACV,CAKF,CAAC,EACD,OAAQ,GAAG,GAAG,CAChB,CAAC,EAGD,MAAMC,EAAY,IAAI,kBACpBL,EACA,YACAD,EACA,4BACF,EACM,CAAE,WAAAO,CAAW,EAAID,EAAU,WAAW,CAC1C,eAAgB,WAChB,cAAe,GACf,YAAa,EACf,CAAC,EAGKE,EAIA,CAAC,EACPD,EAAW,UAAU,CACnB,KAAOE,GAAU,CACfD,EAAO,KAAKC,CAAK,CACnB,EACA,MAAQC,GAAQ,CACdN,EAAOM,CAAG,CACZ,EACA,SAAU,IA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ACpBb,EACA,YACAD,EACA,4BACF,EACU,oBAAoB,CAAE,eAAAc,EAAgB,cAAY,CAAC,EAG7D,OAAOb,EAAU,mBAAmB,EAAE,qBAAqB,CACzD,UAAW,YACX,aAAc,IAAI,kCAAgC,CAChD,MAAO,CACL,eAAAa,EACA,eACA,cAAed,CACjB,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["import_device_management_kit", "import_rxjs", "import_GetAppConfigurationCommand", "import_GetPubKeyCommand", "import_GenerateTransactionDeviceAction", "import_SignTransactionDeviceAction", "import_NullLoggerPublisherService", "import_SolanaAppBinder", "contextModuleStub", "mockedDmk", "binder", "resolve", "reject", "address", "appBinder", "observable", "states", "state", "err", "baseParams", "params", "signature", "derivationPath", "transaction", "skipOpenApp", "signedMessage", "signMessageArgs", "appConfiguration", "serializedTx"]
4
+ "sourcesContent": ["import { type ContextModule } from \"@ledgerhq/context-module\";\nimport {\n type DeviceActionIntermediateValue,\n type DeviceActionState,\n DeviceActionStatus,\n type DeviceManagementKit,\n type DeviceSessionId,\n type DmkError,\n UserInteractionRequired,\n} from \"@ledgerhq/device-management-kit\";\nimport { from } from \"rxjs\";\n\nimport {\n type GenerateTransactionDAError,\n type GenerateTransactionDAIntermediateValue,\n type GenerateTransactionDAOutput,\n} from \"@api/app-binder/GenerateTransactionDeviceActionTypes\";\nimport {\n type GetAppConfigurationDAError,\n type GetAppConfigurationDAIntermediateValue,\n type GetAppConfigurationDAOutput,\n} from \"@api/app-binder/GetAppConfigurationDeviceActionTypes\";\nimport {\n type GetAddressDAError,\n type GetAddressDAIntermediateValue,\n type GetAddressDAOutput,\n type SignMessageDAOutput,\n type SignTransactionDAError,\n type SignTransactionDAIntermediateValue,\n type SignTransactionDAOutput,\n} from \"@api/index\";\n\nimport { GetAppConfigurationCommand } from \"./command/GetAppConfigurationCommand\";\nimport { GetPubKeyCommand } from \"./command/GetPubKeyCommand\";\nimport { GenerateTransactionDeviceAction } from \"./device-action/GenerateTransactionDeviceAction\";\nimport { SolanaAppBinder } from \"./SolanaAppBinder\";\n\nconst mockLoggerFactory = () => ({\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n subscribers: [],\n});\n\ndescribe(\"SolanaAppBinder\", () => {\n // stub ContextModule for tests\n const contextModuleStub: ContextModule = {} as ContextModule;\n\n const mockedDmk: DeviceManagementKit = {\n sendCommand: vi.fn(),\n executeDeviceAction: vi.fn(),\n } as unknown as DeviceManagementKit;\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"should be defined\", () => {\n const binder = new SolanaAppBinder(\n {} as DeviceManagementKit,\n {} as DeviceSessionId,\n contextModuleStub,\n mockLoggerFactory,\n );\n expect(binder).toBeDefined();\n });\n\n describe(\"getAddress\", () => {\n it(\"should return the address\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const address = \"D2PPQSYFe83nDzk96FqGumVU8JA7J8vj2Rhjc2oXzEi5\";\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: address,\n } as DeviceActionState<\n GetAddressDAOutput,\n GetAddressDAError,\n GetAddressDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n const { observable } = appBinder.getAddress({\n derivationPath: \"44'/501'\",\n checkOnDevice: false,\n skipOpenApp: false,\n });\n\n // THEN\n const states: DeviceActionState<\n GetAddressDAOutput,\n GetAddressDAError,\n GetAddressDAIntermediateValue\n >[] = [];\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: address,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n describe(\"calls of executeDeviceAction with the correct params\", () => {\n const baseParams = {\n derivationPath: \"44'/60'/3'/2/1\",\n returnChainCode: false,\n skipOpenApp: false,\n };\n\n it(\"when checkOnDevice is true: UserInteractionRequired.VerifyAddress\", () => {\n // GIVEN\n const checkOnDevice = true;\n const params = {\n ...baseParams,\n checkOnDevice,\n };\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n appBinder.getAddress(params);\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith(\n expect.objectContaining({\n sessionId: \"sessionId\",\n deviceAction: expect.objectContaining({\n input: {\n command: new GetPubKeyCommand(params),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.VerifyAddress,\n skipOpenApp: false,\n },\n }),\n }),\n );\n });\n\n it(\"when checkOnDevice is false: UserInteractionRequired.None\", () => {\n // GIVEN\n const checkOnDevice = false;\n const params = {\n ...baseParams,\n checkOnDevice,\n };\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n appBinder.getAddress(params);\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith(\n expect.objectContaining({\n sessionId: \"sessionId\",\n deviceAction: expect.objectContaining({\n input: {\n command: new GetPubKeyCommand(params),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: false,\n },\n }),\n }),\n );\n });\n });\n });\n\n describe(\"signTransaction\", () => {\n it(\"should return the signature\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const signature = new Uint8Array([0x01, 0x02, 0x03]);\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: signature,\n } as DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n const { observable } = appBinder.signTransaction({\n derivationPath: \"44'/501'\",\n transaction: new Uint8Array([0x01, 0x02, 0x03, 0x04]),\n solanaTransactionOptionalConfig: { skipOpenApp: false },\n });\n\n // THEN\n const states: DeviceActionState<\n SignTransactionDAOutput,\n SignTransactionDAError,\n SignTransactionDAIntermediateValue\n >[] = [];\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: signature,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n it(\"should call executeDeviceAction with the correct params\", () => {\n // GIVEN\n const derivationPath = \"44'/60'/3'/2/1\";\n const transaction = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n const skipOpenApp = false;\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n appBinder.signTransaction({\n derivationPath,\n transaction,\n solanaTransactionOptionalConfig: { skipOpenApp: false },\n });\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith(\n expect.objectContaining({\n sessionId: \"sessionId\",\n deviceAction: expect.objectContaining({\n input: {\n derivationPath,\n transaction,\n transactionOptions: { skipOpenApp },\n contextModule: contextModuleStub,\n },\n }),\n }),\n );\n });\n });\n\n describe(\"signMessage\", () => {\n it(\"should return the signed message\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const signedMessage = {\n signature: \"signature\",\n };\n const signMessageArgs = {\n derivationPath: \"44'/501'/0'/0'\",\n message: \"Hello world\",\n skipOpenApp: false,\n };\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: signedMessage,\n } as DeviceActionState<\n SignMessageDAOutput,\n DmkError,\n DeviceActionIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n const { observable } = appBinder.signMessage(signMessageArgs);\n\n // THEN\n const states: DeviceActionState<\n SignMessageDAOutput,\n unknown,\n unknown\n >[] = [];\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: signedMessage,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n });\n\n describe(\"getAppConfiguration\", () => {\n it(\"should return the app configuration\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const appConfiguration = {\n blindSigningEnabled: true,\n pubKeyDisplayMode: \"LONG\",\n version: \"2.5.10\",\n };\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: appConfiguration,\n } as DeviceActionState<\n GetAppConfigurationDAOutput,\n GetAppConfigurationDAError,\n GetAppConfigurationDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n const { observable } = appBinder.getAppConfiguration();\n\n // THEN\n const states: DeviceActionState<\n GetAppConfigurationDAOutput,\n GetAppConfigurationDAError,\n GetAppConfigurationDAIntermediateValue\n >[] = [];\n\n observable.subscribe({\n next: (state) => {\n states.push(state);\n },\n error: (err) => {\n reject(err);\n },\n complete: () => {\n try {\n expect(states).toEqual([\n {\n status: DeviceActionStatus.Completed,\n output: appConfiguration,\n },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n it(\"should call executeDeviceAction with the correct params\", () => {\n // GIVEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n\n // WHEN\n appBinder.getAppConfiguration();\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith(\n expect.objectContaining({\n sessionId: \"sessionId\",\n deviceAction: expect.objectContaining({\n input: {\n command: new GetAppConfigurationCommand(),\n appName: \"Solana\",\n requiredUserInteraction: UserInteractionRequired.None,\n skipOpenApp: false,\n },\n }),\n }),\n );\n });\n });\n\n describe(\"generateTransaction\", () => {\n it(\"should return the serialized transaction\", () =>\n new Promise<void>((resolve, reject) => {\n // GIVEN\n const serializedTx = \"BASE64_OR_HEX_TX\";\n\n vi.spyOn(mockedDmk, \"executeDeviceAction\").mockReturnValue({\n observable: from([\n {\n status: DeviceActionStatus.Completed,\n output: serializedTx,\n } as DeviceActionState<\n GenerateTransactionDAOutput,\n GenerateTransactionDAError,\n GenerateTransactionDAIntermediateValue\n >,\n ]),\n cancel: vi.fn(),\n });\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n const { observable } = appBinder.generateTransaction({\n derivationPath: \"44'/501'/0'/0'\",\n skipOpenApp: false,\n });\n\n // THEN\n const states: DeviceActionState<\n GenerateTransactionDAOutput,\n GenerateTransactionDAError,\n GenerateTransactionDAIntermediateValue\n >[] = [];\n observable.subscribe({\n next: (state) => states.push(state),\n error: (err) => reject(err),\n complete: () => {\n try {\n expect(states).toEqual([\n { status: DeviceActionStatus.Completed, output: serializedTx },\n ]);\n resolve();\n } catch (err) {\n reject(err as Error);\n }\n },\n });\n }));\n\n it(\"should call executeDeviceAction with the correct params\", () => {\n // GIVEN\n const derivationPath = \"44'/501'/0'/0'\";\n const skipOpenApp = true;\n\n // WHEN\n const appBinder = new SolanaAppBinder(\n mockedDmk,\n \"sessionId\",\n contextModuleStub,\n mockLoggerFactory,\n );\n appBinder.generateTransaction({ derivationPath, skipOpenApp });\n\n // THEN\n expect(mockedDmk.executeDeviceAction).toHaveBeenCalledWith({\n sessionId: \"sessionId\",\n deviceAction: new GenerateTransactionDeviceAction({\n input: {\n derivationPath,\n skipOpenApp,\n contextModule: contextModuleStub,\n },\n }),\n });\n });\n });\n});\n"],
5
+ "mappings": "aACA,IAAAA,EAQO,2CACPC,EAAqB,gBAsBrBC,EAA2C,gDAC3CC,EAAiC,sCACjCC,EAAgD,2DAChDC,EAAgC,6BAEhC,MAAMC,EAAoB,KAAO,CAC/B,MAAO,GAAG,GAAG,EACb,KAAM,GAAG,GAAG,EACZ,KAAM,GAAG,GAAG,EACZ,MAAO,GAAG,GAAG,EACb,YAAa,CAAC,CAChB,GAEA,SAAS,kBAAmB,IAAM,CAEhC,MAAMC,EAAmC,CAAC,EAEpCC,EAAiC,CACrC,YAAa,GAAG,GAAG,EACnB,oBAAqB,GAAG,GAAG,CAC7B,EACA,WAAW,IAAM,CACf,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,oBAAqB,IAAM,CAC5B,MAAMC,EAAS,IAAI,kBACjB,CAAC,EACD,CAAC,EACDF,EACAD,CACF,EACA,OAAOG,CAAM,EAAE,YAAY,CAC7B,CAAC,EAED,SAAS,aAAc,IAAM,CAC3B,GAAG,4BAA6B,IAC9B,IAAI,QAAc,CAACC,EAASC,IAAW,CAErC,MAAMC,EAAU,+CAEhB,GAAG,MAAMJ,EAAW,qBAAqB,EAAE,gBAAgB,CACzD,cAAY,QAAK,CACf,CACE,OAAQ,qBAAmB,UAC3B,OAAQI,CACV,CAKF,CAAC,EACD,OAAQ,GAAG,GAAG,CAChB,CAAC,EAGD,MAAMC,EAAY,IAAI,kBACpBL,EACA,YACAD,EACAD,CACF,EACM,CAAE,WAAAQ,CAAW,EAAID,EAAU,WAAW,CAC1C,eAAgB,WAChB,cAAe,GACf,YAAa,EACf,CAAC,EAGKE,EAIA,CAAC,EACPD,EAAW,UAAU,CACnB,KAAOE,GAAU,CACfD,EAAO,K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V,OAASO,EAAK,CACZN,EAAOM,CAAY,CACrB,CACF,CACF,CAAC,CACH,CAAC,CAAC,EAEJ,GAAG,0DAA2D,IAAM,CAElE,MAAMI,EAAiB,iBAIL,IAAI,kBACpBb,EACA,YACAD,EACAD,CACF,EACU,oBAAoB,CAAE,eAAAe,EAAgB,cAAY,CAAC,EAG7D,OAAOb,EAAU,mBAAmB,EAAE,qBAAqB,CACzD,UAAW,YACX,aAAc,IAAI,kCAAgC,CAChD,MAAO,CACL,eAAAa,EACA,eACA,cAAed,CACjB,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_device_management_kit", "import_rxjs", "import_GetAppConfigurationCommand", "import_GetPubKeyCommand", "import_GenerateTransactionDeviceAction", "import_SolanaAppBinder", "mockLoggerFactory", "contextModuleStub", "mockedDmk", "binder", "resolve", "reject", "address", "appBinder", "observable", "states", "state", "err", "baseParams", "params", "signature", "derivationPath", "transaction", "skipOpenApp", "signedMessage", "signMessageArgs", "appConfiguration", "serializedTx"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var T=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var P=(s,r)=>{for(var c in r)T(s,c,{get:r[c],enumerable:!0})},h=(s,r,c,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of E(r))!R.call(s,p)&&p!==c&&T(s,p,{get:()=>r[p],enumerable:!(l=v(r,p))||l.enumerable});return s};var k=s=>h(T({},"__esModule",{value:!0}),s);var O={};P(O,{SignTransactionDeviceAction:()=>_});module.exports=k(O);var n=require("@ledgerhq/device-management-kit"),d=require("purify-ts"),a=require("xstate"),o=require("../../../api/app-binder/SignTransactionDeviceActionTypes"),m=require("../../app-binder/command/GetAppConfigurationCommand"),y=require("../../app-binder/command/SignTransactionCommand"),I=require("../../app-binder/services/ApplicationChecker"),S=require("../../app-binder/services/TransactionInspector"),D=require("../../app-binder/task/BuildTransactionContextTask"),f=require("../../app-binder/task/ProvideTransactionContextTask"),x=require("../../app-binder/task/SendSignDataTask");class _ extends n.XStateDeviceAction{makeStateMachine(r){const{signTransaction:c,getAppConfig:l,buildContext:p,provideContext:A,inspectTransaction:C}=this.extractDependencies(r);let i;const u=t=>{if(!i){const{loggerFactory:e}=t.input;i=e("SignTransactionDeviceAction")}return i};return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new n.OpenAppDeviceAction({input:{appName:"Solana"}}).makeStateMachine(r),getAppConfig:(0,a.fromPromise)(l),inspectTransaction:(0,a.fromPromise)(({input:t})=>C({serializedTransaction:t.serializedTransaction,resolutionContext:t.resolutionContext,rpcUrl:t.rpcUrl})),buildContext:(0,a.fromPromise)(p),provideContext:(0,a.fromPromise)(A),signTransaction:(0,a.fromPromise)(c)},guards:{noInternalError:({context:t})=>t._internalState.error===null,skipOpenApp:({context:t})=>t.input.transactionOptions?.skipOpenApp||!1,isSPLSupported:({context:t})=>new I.ApplicationChecker(r.getDeviceSessionState(),t._internalState.appConfig).withMinVersionExclusive("1.4.0").excludeDeviceModel(n.DeviceModelId.NANO_S).check(),isAnSPLTransaction:({context:t})=>t._internalState.inspectorResult?.transactionType===S.SolanaTransactionTypes.SPL,shouldSkipInspection:({context:t})=>t._internalState.error===null&&!!t.input.transactionOptions?.transactionResolutionContext},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:t=>({...t.context._internalState,error:new n.UnknownDAError(t.event.error instanceof Error?t.event.error.message:String(t.event.error))})}),logInput:({context:t},e)=>{u(t).debug(`[makeStateMachine] step ${e.step}`,{data:{input:t.input}})},logInternalState:({context:t},e)=>{u(t).debug(`[makeStateMachine] step ${e.step}`,{data:{internalState:t._internalState}})}}}).createMachine({id:"SignTransactionDeviceAction",initial:"InitialState",context:({input:t})=>({input:t,intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.OPEN_APP},_internalState:{error:null,signature:null,appConfig:null,solanaTransactionContext:null,inspectorResult:null}}),states:{InitialState:{entry:[{type:"logInput",params:{step:"InitialState"}}],always:[{target:"GetAppConfig",guard:"skipOpenApp"},{target:"OpenAppDeviceAction"}]},OpenAppDeviceAction:{entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.OPEN_APP})}),invoke:{id:"openAppStateMachine",src:"openAppStateMachine",input:()=>({appName:"Solana"}),onSnapshot:{actions:(0,a.assign)({intermediateValue:({event:t})=>({...t.snapshot.context.intermediateValue,step:o.signTransactionDAStateSteps.OPEN_APP})})},onDone:{target:"CheckOpenAppDeviceActionResult",actions:(0,a.assign)({_internalState:({event:t,context:e})=>t.output.caseOf({Right:()=>e._internalState,Left:g=>({...e._internalState,error:g})})})}}},CheckOpenAppDeviceActionResult:{always:[{target:"GetAppConfig",guard:"noInternalError"},{target:"Error"}]},GetAppConfig:{entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.GET_APP_CONFIG})}),invoke:{id:"getAppConfig",src:"getAppConfig",onDone:{target:"GetAppConfigResultCheck",actions:(0,a.assign)({_internalState:({event:t,context:e})=>(0,n.isSuccessCommandResult)(t.output)?{...e._internalState,appConfig:t.output.data}:{...e._internalState,error:t.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetAppConfigResultCheck:{always:[{target:"InspectTransaction",guard:"noInternalError"},{target:"Error"}]},InspectTransaction:{entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.INSPECT_TRANSACTION})}),invoke:{id:"inspectTransaction",src:"inspectTransaction",input:({context:t})=>({serializedTransaction:t.input.transaction,resolutionContext:t.input.transactionOptions?.transactionResolutionContext,rpcUrl:t.input.transactionOptions?.solanaRPCURL}),onDone:{target:"AfterInspect",actions:[(0,a.assign)({_internalState:({context:t,event:e})=>({...t._internalState,inspectorResult:e.output})}),{type:"logInternalState",params:{step:"OnDoneInspectTransaction"}}]},onError:{target:"SignTransaction"}}},AfterInspect:{always:[{target:"BuildContext",guard:"isAnSPLTransaction"},{target:"SignTransaction"}]},BuildContext:{entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.BUILD_TRANSACTION_CONTEXT})}),invoke:{id:"buildContext",src:"buildContext",input:({context:t})=>{const e=t._internalState.inspectorResult?.data;return{contextModule:t.input.contextModule,loggerFactory:t.input.loggerFactory,options:{tokenAddress:e?.tokenAddress,createATA:e?.createATA,tokenInternalId:t.input.transactionOptions?.transactionResolutionContext?.tokenInternalId,templateId:t.input.transactionOptions?.transactionResolutionContext?.templateId}}},onDone:{target:"ProvideContext",actions:[(0,a.assign)({_internalState:({event:t,context:e})=>({...e._internalState,solanaTransactionContext:{tlvDescriptor:t.output.tlvDescriptor,trustedNamePKICertificate:t.output.trustedNamePKICertificate,loadersResults:t.output.loadersResults}})}),{type:"logInternalState",params:{step:"OnDoneBuildContext"}}]},onError:{target:"SignTransaction"}}},ProvideContext:{entry:(0,a.assign)({intermediateValue:()=>({requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.PROVIDE_TRANSACTION_CONTEXT})}),invoke:{id:"provideContext",src:"provideContext",input:({context:t})=>{if(!t._internalState.solanaTransactionContext)throw new n.UnknownDAError("Solana transaction context is not available");return{...t._internalState.solanaTransactionContext,transactionBytes:t.input.transaction,loggerFactory:t.input.loggerFactory}},onDone:{target:"SignTransaction"},onError:{target:"SignTransaction"}}},SignTransaction:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.SignTransaction,step:o.signTransactionDAStateSteps.SIGN_TRANSACTION}}),invoke:{id:"signTransaction",src:"signTransaction",input:({context:t})=>({derivationPath:t.input.derivationPath,serializedTransaction:t.input.transaction,userInputType:t.input.transactionOptions?.transactionResolutionContext?.userInputType}),onDone:{target:"SignTransactionResultCheck",actions:[(0,a.assign)({_internalState:({event:t,context:e})=>{if(!(0,n.isSuccessCommandResult)(t.output))return{...e._internalState,error:t.output.error};const g=t.output.data.extract();return t.output.data.isJust()&&g instanceof Uint8Array?{...e._internalState,signature:g}:{...e._internalState,error:new n.UnknownDAError("No Signature available")}},intermediateValue:{requiredUserInteraction:n.UserInteractionRequired.None,step:o.signTransactionDAStateSteps.SIGN_TRANSACTION}}),{type:"logInternalState",params:{step:"OnDoneSignTransaction"}}]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},SignTransactionResultCheck:{always:[{guard:"noInternalError",target:"Success"},{target:"Error"}]},Success:{type:"final"},Error:{type:"final"}},output:({context:t})=>t._internalState.signature?(0,d.Right)(t._internalState.signature):(0,d.Left)(t._internalState.error||new n.UnknownDAError("No error or signature available"))})}extractDependencies(r){return{getAppConfig:async()=>r.sendCommand(new m.GetAppConfigurationCommand),buildContext:async i=>new D.BuildTransactionContextTask(r,i.input).run(),provideContext:async i=>new f.ProvideSolanaTransactionContextTask(r,i.input).run(),signTransaction:async i=>new x.SignDataTask(r,{commandFactory:u=>new y.SignTransactionCommand({serializedTransaction:u.chunkedData,more:u.more,extend:u.extend,userInputType:i.input.userInputType}),derivationPath:i.input.derivationPath,sendingData:i.input.serializedTransaction}).run(),inspectTransaction:async i=>Promise.resolve(new S.TransactionInspector(i.rpcUrl).inspectTransactionType(i.serializedTransaction,i.resolutionContext?.tokenAddress,i.resolutionContext?.createATA))}}}0&&(module.exports={SignTransactionDeviceAction});
1
+ "use strict";var d=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var E=(o,n)=>{for(var p in n)d(o,p,{get:n[p],enumerable:!0})},P=(o,n,p,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of f(n))!v.call(o,s)&&s!==p&&d(o,s,{get:()=>n[s],enumerable:!(c=x(n,s))||c.enumerable});return o};var R=o=>P(d({},"__esModule",{value:!0}),o);var _={};E(_,{SignTransactionDeviceAction:()=>h});module.exports=R(_);var e=require("@ledgerhq/device-management-kit"),l=require("purify-ts"),r=require("xstate"),i=require("../../../api/app-binder/SignTransactionDeviceActionTypes"),A=require("../../app-binder/command/GetAppConfigurationCommand"),C=require("../../app-binder/command/SignTransactionCommand"),m=require("../../app-binder/services/ApplicationChecker"),g=require("../../app-binder/services/TransactionInspector"),y=require("../../app-binder/task/BuildTransactionContextTask"),I=require("../../app-binder/task/ProvideTransactionContextTask"),D=require("../../app-binder/task/SendSignDataTask");class h extends e.XStateDeviceAction{_loggerFactory;constructor(n){super({input:n.input,inspect:n.inspect,logger:n.loggerFactory("SignTransactionDeviceAction")}),this._loggerFactory=n.loggerFactory}makeStateMachine(n){const{signTransaction:p,getAppConfig:c,buildContext:s,provideContext:T,inspectTransaction:S}=this.extractDependencies(n);return(0,r.setup)({types:{input:{},context:{},output:{}},actors:{openAppStateMachine:new e.OpenAppDeviceAction({input:{appName:"Solana"}}).makeStateMachine(n),getAppConfig:(0,r.fromPromise)(c),inspectTransaction:(0,r.fromPromise)(({input:t})=>S({serializedTransaction:t.serializedTransaction,resolutionContext:t.resolutionContext,rpcUrl:t.rpcUrl})),buildContext:(0,r.fromPromise)(s),provideContext:(0,r.fromPromise)(T),signTransaction:(0,r.fromPromise)(p)},guards:{noInternalError:({context:t})=>t._internalState.error===null,skipOpenApp:({context:t})=>t.input.transactionOptions?.skipOpenApp||!1,isSPLSupported:({context:t})=>new m.ApplicationChecker(n.getDeviceSessionState(),t._internalState.appConfig).withMinVersionExclusive("1.4.0").excludeDeviceModel(e.DeviceModelId.NANO_S).check(),isAnSPLTransaction:({context:t})=>t._internalState.inspectorResult?.transactionType===g.SolanaTransactionTypes.SPL,shouldSkipInspection:({context:t})=>t._internalState.error===null&&!!t.input.transactionOptions?.transactionResolutionContext},actions:{assignErrorFromEvent:(0,r.assign)({_internalState:t=>({...t.context._internalState,error:new e.UnknownDAError(t.event.error instanceof Error?t.event.error.message:String(t.event.error))})})}}).createMachine({id:"SignTransactionDeviceAction",initial:"InitialState",context:({input:t})=>({input:t,intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.OPEN_APP},_internalState:{error:null,signature:null,appConfig:null,solanaTransactionContext:null,inspectorResult:null}}),states:{InitialState:{always:[{target:"GetAppConfig",guard:"skipOpenApp"},{target:"OpenAppDeviceAction"}]},OpenAppDeviceAction:{entry:(0,r.assign)({intermediateValue:()=>({requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.OPEN_APP})}),invoke:{id:"openAppStateMachine",src:"openAppStateMachine",input:()=>({appName:"Solana"}),onSnapshot:{actions:(0,r.assign)({intermediateValue:({event:t})=>({...t.snapshot.context.intermediateValue,step:i.signTransactionDAStateSteps.OPEN_APP})})},onDone:{target:"CheckOpenAppDeviceActionResult",actions:(0,r.assign)({_internalState:({event:t,context:a})=>t.output.caseOf({Right:()=>a._internalState,Left:u=>({...a._internalState,error:u})})})}}},CheckOpenAppDeviceActionResult:{always:[{target:"GetAppConfig",guard:"noInternalError"},{target:"Error"}]},GetAppConfig:{entry:(0,r.assign)({intermediateValue:()=>({requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.GET_APP_CONFIG})}),invoke:{id:"getAppConfig",src:"getAppConfig",onDone:{target:"GetAppConfigResultCheck",actions:(0,r.assign)({_internalState:({event:t,context:a})=>(0,e.isSuccessCommandResult)(t.output)?{...a._internalState,appConfig:t.output.data}:{...a._internalState,error:t.output.error}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetAppConfigResultCheck:{always:[{target:"InspectTransaction",guard:"noInternalError"},{target:"Error"}]},InspectTransaction:{entry:(0,r.assign)({intermediateValue:()=>({requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.INSPECT_TRANSACTION})}),invoke:{id:"inspectTransaction",src:"inspectTransaction",input:({context:t})=>({serializedTransaction:t.input.transaction,resolutionContext:t.input.transactionOptions?.transactionResolutionContext,rpcUrl:t.input.transactionOptions?.solanaRPCURL}),onDone:{target:"AfterInspect",actions:(0,r.assign)({_internalState:({context:t,event:a})=>({...t._internalState,inspectorResult:a.output})})},onError:{target:"SignTransaction"}}},AfterInspect:{always:[{target:"BuildContext",guard:"isAnSPLTransaction"},{target:"SignTransaction"}]},BuildContext:{entry:(0,r.assign)({intermediateValue:()=>({requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.BUILD_TRANSACTION_CONTEXT})}),invoke:{id:"buildContext",src:"buildContext",input:({context:t})=>{const a=t._internalState.inspectorResult?.data;return{contextModule:t.input.contextModule,loggerFactory:this._loggerFactory,options:{tokenAddress:a?.tokenAddress,createATA:a?.createATA,tokenInternalId:t.input.transactionOptions?.transactionResolutionContext?.tokenInternalId,templateId:t.input.transactionOptions?.transactionResolutionContext?.templateId}}},onDone:{target:"ProvideContext",actions:(0,r.assign)({_internalState:({event:t,context:a})=>({...a._internalState,solanaTransactionContext:{tlvDescriptor:t.output.tlvDescriptor,trustedNamePKICertificate:t.output.trustedNamePKICertificate,loadersResults:t.output.loadersResults}})})},onError:{target:"SignTransaction"}}},ProvideContext:{entry:(0,r.assign)({intermediateValue:()=>({requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.PROVIDE_TRANSACTION_CONTEXT})}),invoke:{id:"provideContext",src:"provideContext",input:({context:t})=>{if(!t._internalState.solanaTransactionContext)throw new e.UnknownDAError("Solana transaction context is not available");return{...t._internalState.solanaTransactionContext,transactionBytes:t.input.transaction,loggerFactory:this._loggerFactory}},onDone:{target:"SignTransaction"},onError:{target:"SignTransaction"}}},SignTransaction:{entry:(0,r.assign)({intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.SignTransaction,step:i.signTransactionDAStateSteps.SIGN_TRANSACTION}}),invoke:{id:"signTransaction",src:"signTransaction",input:({context:t})=>({derivationPath:t.input.derivationPath,serializedTransaction:t.input.transaction,userInputType:t.input.transactionOptions?.transactionResolutionContext?.userInputType}),onDone:{target:"SignTransactionResultCheck",actions:(0,r.assign)({_internalState:({event:t,context:a})=>{if(!(0,e.isSuccessCommandResult)(t.output))return{...a._internalState,error:t.output.error};const u=t.output.data.extract();return t.output.data.isJust()&&u instanceof Uint8Array?{...a._internalState,signature:u}:{...a._internalState,error:new e.UnknownDAError("No Signature available")}},intermediateValue:{requiredUserInteraction:e.UserInteractionRequired.None,step:i.signTransactionDAStateSteps.SIGN_TRANSACTION}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},SignTransactionResultCheck:{always:[{guard:"noInternalError",target:"Success"},{target:"Error"}]},Success:{type:"final"},Error:{type:"final"}},output:({context:t})=>t._internalState.signature?(0,l.Right)(t._internalState.signature):(0,l.Left)(t._internalState.error||new e.UnknownDAError("No error or signature available"))})}extractDependencies(n){return{getAppConfig:async()=>n.sendCommand(new A.GetAppConfigurationCommand),buildContext:async t=>new y.BuildTransactionContextTask(n,t.input).run(),provideContext:async t=>new I.ProvideSolanaTransactionContextTask(n,t.input).run(),signTransaction:async t=>new D.SignDataTask(n,{commandFactory:a=>new C.SignTransactionCommand({serializedTransaction:a.chunkedData,more:a.more,extend:a.extend,userInputType:t.input.userInputType}),derivationPath:t.input.derivationPath,sendingData:t.input.serializedTransaction}).run(),inspectTransaction:async t=>Promise.resolve(new g.TransactionInspector(t.rpcUrl).inspectTransactionType(t.serializedTransaction,t.resolutionContext?.tokenAddress,t.resolutionContext?.createATA))}}}0&&(module.exports={SignTransactionDeviceAction});
2
2
  //# sourceMappingURL=SignTransactionDeviceAction.js.map