@ledgerhq/context-module 0.0.0-develop-20260812001624 → 0.0.0-develop-20260814001716

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 (39) hide show
  1. package/lib/cjs/package.json +1 -1
  2. package/lib/cjs/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.js +1 -1
  3. package/lib/cjs/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.js.map +3 -3
  4. package/lib/cjs/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.test.js +1 -1
  5. package/lib/cjs/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.test.js.map +3 -3
  6. package/lib/cjs/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.js +1 -1
  7. package/lib/cjs/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.js.map +2 -2
  8. package/lib/cjs/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.test.js +1 -1
  9. package/lib/cjs/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.test.js.map +3 -3
  10. package/lib/cjs/src/modules/solana/instruction-info/data/InstructionInfoDto.js +1 -1
  11. package/lib/cjs/src/modules/solana/instruction-info/data/InstructionInfoDto.js.map +2 -2
  12. package/lib/cjs/src/shared/utils/deviceModelIdCodec.js +1 -1
  13. package/lib/cjs/src/shared/utils/deviceModelIdCodec.js.map +2 -2
  14. package/lib/cjs/src/shared/utils/deviceModelIdCodec.test.js +1 -1
  15. package/lib/cjs/src/shared/utils/deviceModelIdCodec.test.js.map +2 -2
  16. package/lib/esm/package.json +1 -1
  17. package/lib/esm/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.js +1 -1
  18. package/lib/esm/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.js.map +3 -3
  19. package/lib/esm/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.test.js +1 -1
  20. package/lib/esm/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.test.js.map +3 -3
  21. package/lib/esm/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.js +1 -1
  22. package/lib/esm/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.js.map +2 -2
  23. package/lib/esm/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.test.js +1 -1
  24. package/lib/esm/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.test.js.map +3 -3
  25. package/lib/esm/src/modules/solana/instruction-info/data/InstructionInfoDto.js +1 -1
  26. package/lib/esm/src/modules/solana/instruction-info/data/InstructionInfoDto.js.map +2 -2
  27. package/lib/esm/src/shared/utils/deviceModelIdCodec.js +1 -1
  28. package/lib/esm/src/shared/utils/deviceModelIdCodec.js.map +2 -2
  29. package/lib/esm/src/shared/utils/deviceModelIdCodec.test.js +1 -1
  30. package/lib/esm/src/shared/utils/deviceModelIdCodec.test.js.map +2 -2
  31. package/lib/types/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.d.ts +0 -12
  32. package/lib/types/src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.d.ts.map +1 -1
  33. package/lib/types/src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.d.ts.map +1 -1
  34. package/lib/types/src/modules/solana/instruction-info/data/InstructionInfoDto.d.ts +2 -2
  35. package/lib/types/src/modules/solana/instruction-info/data/InstructionInfoDto.d.ts.map +1 -1
  36. package/lib/types/src/shared/utils/deviceModelIdCodec.d.ts +2 -2
  37. package/lib/types/src/shared/utils/deviceModelIdCodec.d.ts.map +1 -1
  38. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  39. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.test.ts"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport bs58 from \"bs58\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/modules/multichain/pki/domain/PkiCertificateLoader\";\nimport { type TransactionCheckDataSource } from \"@/modules/multichain/transaction-check/data/TransactionCheckDataSource\";\nimport { TransactionCheckPaths } from \"@/modules/multichain/transaction-check/utils/constants\";\nimport { SolanaTransactionScanChainId } from \"@/modules/solana/model/SolanaTransactionScanChainId\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\nimport { SolanaTransactionCheckLoader } from \"./SolanaTransactionCheckLoader\";\n\nconst loggerMock = {\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n subscribers: [],\n};\nconst loggerFactory = () => loggerMock;\n\nconst certificateLoaderMock: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n};\n\nlet dataSourceMock: { check: ReturnType<typeof vi.fn> };\nlet loader: SolanaTransactionCheckLoader;\n\nbeforeEach(() => {\n vi.resetAllMocks();\n dataSourceMock = { check: vi.fn() };\n loader = new SolanaTransactionCheckLoader(\n dataSourceMock as unknown as TransactionCheckDataSource,\n certificateLoaderMock,\n loggerFactory,\n );\n});\n\ndescribe(\"SolanaTransactionCheckLoader\", () => {\n describe(\"canHandle\", () => {\n const validInput = {\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: new Uint8Array([1, 0, 3, 0xde]),\n chain: 1,\n },\n };\n\n it(\"returns true for a valid Solana transaction-check input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.SOLANA_TRANSACTION_CHECK,\n ]),\n ).toBe(true);\n });\n\n it(\"returns false when expected types do not include SOLANA_TRANSACTION_CHECK\", () => {\n expect(\n loader.canHandle(validInput, [ClearSignContextType.SOLANA_TOKEN]),\n ).toBe(false);\n });\n\n it(\"returns false when transactionBytes is not a Uint8Array\", () => {\n expect(\n loader.canHandle(\n {\n ...validInput,\n transactionCheck: {\n ...validInput.transactionCheck,\n transactionBytes: \"0xdead\" as unknown as Uint8Array,\n },\n },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n\n it(\"returns false when transactionBytes is empty\", () => {\n expect(\n loader.canHandle(\n {\n ...validInput,\n transactionCheck: {\n ...validInput.transactionCheck,\n transactionBytes: new Uint8Array(),\n },\n },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n\n it(\"returns false when from is empty\", () => {\n expect(\n loader.canHandle(\n {\n ...validInput,\n transactionCheck: { ...validInput.transactionCheck, from: \"\" },\n },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n\n it(\"returns false for unsupported device models (NANO_S)\", () => {\n expect(\n loader.canHandle(\n { ...validInput, deviceModelId: DeviceModelId.NANO_S },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n });\n\n describe(\"load \u2014 wire format\", () => {\n beforeEach(() => {\n dataSourceMock.check.mockResolvedValue(\n Right({ publicKeyId: \"pk\", descriptor: \"aabb\" }),\n );\n (certificateLoaderMock.loadCertificate as any).mockResolvedValue({\n payload: new Uint8Array([0xcc]),\n keyUsageNumber: 14,\n });\n });\n\n it(\"wraps a legacy message with zero-filled signature placeholders before bs58-encoding\", async () => {\n // message[0] = 2 \u2192 numRequiredSignatures = 2 (legacy, high bit clear)\n const message = new Uint8Array([2, 0, 3, 0xaa, 0xbb, 0xcc]);\n // expected: compact-u16(2) + 2*64 zero bytes + message\n const expected = new Uint8Array(1 + 2 * 64 + message.length);\n expected[0] = 2; // compact-u16 encoding of 2\n expected.set(message, 1 + 2 * 64);\n\n await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: message,\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n const sent = dataSourceMock.check.mock.calls[0]![0];\n\n expect(sent.path).toBe(TransactionCheckPaths.SOLANA_TRANSACTION);\n expect(sent.body.tx.from).toBe(\"signer\");\n expect(sent.body.chain).toBe(SolanaTransactionScanChainId.MAINNET);\n expect(Array.from(bs58.decode(sent.body.tx.raw))).toEqual(\n Array.from(expected),\n );\n expect(sent.body.tx.raw).toBe(bs58.encode(expected));\n });\n\n it(\"wraps a versioned (v0) message with signature placeholders\", async () => {\n // message[0] = 0x80 \u2192 versioned prefix; message[1] = 1 \u2192 numRequiredSignatures = 1\n const message = new Uint8Array([0x80, 1, 0, 3, 0xde, 0xad]);\n // expected: compact-u16(1) + 1*64 zero bytes + message\n const expected = new Uint8Array(1 + 1 * 64 + message.length);\n expected[0] = 1; // compact-u16 encoding of 1\n expected.set(message, 1 + 1 * 64);\n\n await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: message,\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n const raw = dataSourceMock.check.mock.calls[0]![0].body.tx.raw;\n\n expect(Array.from(bs58.decode(raw))).toEqual(Array.from(expected));\n });\n });\n\n describe(\"load \u2014 result mapping\", () => {\n it(\"returns a SOLANA_TRANSACTION_CHECK context with descriptor and certificate on success\", async () => {\n dataSourceMock.check.mockResolvedValue(\n Right({ publicKeyId: \"pk-1\", descriptor: \"deadbeef\" }),\n );\n const cert = { payload: new Uint8Array([0x99]), keyUsageNumber: 14 };\n (certificateLoaderMock.loadCertificate as any).mockResolvedValue(cert);\n\n const [ctx] = await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: new Uint8Array([1, 0, 3, 0xaa]),\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n expect(ctx).toEqual({\n type: ClearSignContextType.SOLANA_TRANSACTION_CHECK,\n payload: { descriptor: \"deadbeef\" },\n certificate: cert,\n });\n });\n\n it(\"returns an ERROR context when the data source returns Left\", async () => {\n const error = new Error(\"network fail\");\n dataSourceMock.check.mockResolvedValue(Left(error));\n\n const [ctx] = await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: new Uint8Array([1, 0, 3, 0xaa]),\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n expect(ctx).toEqual({ type: ClearSignContextType.ERROR, error });\n expect(certificateLoaderMock.loadCertificate).not.toHaveBeenCalled();\n });\n\n it(\"returns an ERROR context when numRequiredSignatures exceeds the 64-signature limit\", async () => {\n // message[0] = 65 \u2192 numRequiredSignatures = 65 (legacy, high bit clear), which exceeds SOLANA_MAX_SIGNATURES\n const message = new Uint8Array([65, 0, 3, 0xaa]);\n\n const [ctx] = await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: message,\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n expect(ctx).toMatchObject({\n type: ClearSignContextType.ERROR,\n error: expect.objectContaining({\n message: expect.stringContaining(\"exceeds SOLANA_MAX_SIGNATURES\"),\n }),\n });\n expect(dataSourceMock.check).not.toHaveBeenCalled();\n });\n });\n});\n"],
5
- "mappings": "AAEA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAOC,MAAU,OACjB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAI5B,OAAS,yBAAAC,MAA6B,yDACtC,OAAS,gCAAAC,MAAoC,sDAC7C,OAAS,wBAAAC,MAA4B,kCAErC,OAAS,gCAAAC,MAAoC,iCAE7C,MAAMC,EAAa,CACjB,MAAO,GAAG,GAAG,EACb,KAAM,GAAG,GAAG,EACZ,KAAM,GAAG,GAAG,EACZ,MAAO,GAAG,GAAG,EACb,YAAa,CAAC,CAChB,EACMC,EAAgB,IAAMD,EAEtBE,EAA8C,CAClD,gBAAiB,GAAG,GAAG,CACzB,EAEA,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACf,GAAG,cAAc,EACjBD,EA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OACtC,CACF,CAAC,EAED,OAAOc,CAAG,EAAE,QAAQ,CAAE,KAAMb,EAAqB,MAAO,MAAAc,CAAM,CAAC,EAC/D,OAAOV,EAAsB,eAAe,EAAE,IAAI,iBAAiB,CACrE,CAAC,EAED,GAAG,qFAAsF,SAAY,CAEnG,MAAMI,EAAU,IAAI,WAAW,CAAC,GAAI,EAAG,EAAG,GAAI,CAAC,EAEzC,CAACK,CAAG,EAAI,MAAMP,EAAO,KAAK,CAC9B,cAAeZ,EAAc,OAC7B,iBAAkB,CAChB,KAAM,SACN,iBAAkBc,EAClB,MAAOT,EAA6B,OACtC,CACF,CAAC,EAED,OAAOc,CAAG,EAAE,cAAc,CACxB,KAAMb,EAAqB,MAC3B,MAAO,OAAO,iBAAiB,CAC7B,QAAS,OAAO,iBAAiB,+BAA+B,CAClE,CAAC,CACH,CAAC,EACD,OAAOK,EAAe,KAAK,EAAE,IAAI,iBAAiB,CACpD,CAAC,CACH,CAAC,CACH,CAAC",
6
- "names": ["DeviceModelId", "bs58", "Left", "Right", "TransactionCheckPaths", "SolanaTransactionScanChainId", "ClearSignContextType", "SolanaTransactionCheckLoader", "loggerMock", "loggerFactory", "certificateLoaderMock", "dataSourceMock", "loader", "validInput", "message", "expected", "sent", "raw", "cert", "ctx", "error"]
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport bs58 from \"bs58\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type PkiCertificateLoader } from \"@/modules/multichain/pki/domain/PkiCertificateLoader\";\nimport { type TransactionCheckDataSource } from \"@/modules/multichain/transaction-check/data/TransactionCheckDataSource\";\nimport { TransactionCheckPaths } from \"@/modules/multichain/transaction-check/utils/constants\";\nimport { SolanaTransactionScanChainId } from \"@/modules/solana/model/SolanaTransactionScanChainId\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\n\nimport { SolanaTransactionCheckLoader } from \"./SolanaTransactionCheckLoader\";\n\nconst loggerMock = {\n debug: vi.fn(),\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n subscribers: [],\n};\nconst loggerFactory = () => loggerMock;\n\nconst certificateLoaderMock: PkiCertificateLoader = {\n loadCertificate: vi.fn(),\n};\n\nlet dataSourceMock: { check: ReturnType<typeof vi.fn> };\nlet loader: SolanaTransactionCheckLoader;\n\nbeforeEach(() => {\n vi.resetAllMocks();\n dataSourceMock = { check: vi.fn() };\n loader = new SolanaTransactionCheckLoader(\n dataSourceMock as unknown as TransactionCheckDataSource,\n certificateLoaderMock,\n loggerFactory,\n );\n});\n\ndescribe(\"SolanaTransactionCheckLoader\", () => {\n describe(\"canHandle\", () => {\n const validInput = {\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: new Uint8Array([1, 0, 3, 0xde]),\n chain: 1,\n },\n };\n\n it(\"returns true for a valid Solana transaction-check input\", () => {\n expect(\n loader.canHandle(validInput, [\n ClearSignContextType.SOLANA_TRANSACTION_CHECK,\n ]),\n ).toBe(true);\n });\n\n it(\"returns false when expected types do not include SOLANA_TRANSACTION_CHECK\", () => {\n expect(\n loader.canHandle(validInput, [ClearSignContextType.SOLANA_TOKEN]),\n ).toBe(false);\n });\n\n it(\"returns false when transactionBytes is not a Uint8Array\", () => {\n expect(\n loader.canHandle(\n {\n ...validInput,\n transactionCheck: {\n ...validInput.transactionCheck,\n transactionBytes: \"0xdead\" as unknown as Uint8Array,\n },\n },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n\n it(\"returns false when transactionBytes is empty\", () => {\n expect(\n loader.canHandle(\n {\n ...validInput,\n transactionCheck: {\n ...validInput.transactionCheck,\n transactionBytes: new Uint8Array(),\n },\n },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n\n it(\"returns false when from is empty\", () => {\n expect(\n loader.canHandle(\n {\n ...validInput,\n transactionCheck: { ...validInput.transactionCheck, from: \"\" },\n },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n\n it(\"returns false for unsupported device models (NANO_S)\", () => {\n expect(\n loader.canHandle(\n { ...validInput, deviceModelId: DeviceModelId.NANO_S },\n [ClearSignContextType.SOLANA_TRANSACTION_CHECK],\n ),\n ).toBe(false);\n });\n });\n\n describe(\"load \u2014 wire format\", () => {\n beforeEach(() => {\n dataSourceMock.check.mockResolvedValue(\n Right({ publicKeyId: \"pk\", descriptor: \"aabb\" }),\n );\n (certificateLoaderMock.loadCertificate as any).mockResolvedValue({\n payload: new Uint8Array([0xcc]),\n keyUsageNumber: 14,\n });\n });\n\n it(\"bs58-encodes transactionBytes and passes it to the data source\", async () => {\n const transactionBytes = new Uint8Array([0xaa, 0xbb, 0xcc, 0xdd]);\n\n await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes,\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n const sent = dataSourceMock.check.mock.calls[0]![0];\n expect(sent.path).toBe(TransactionCheckPaths.SOLANA_TRANSACTION);\n expect(sent.body.tx.from).toBe(\"signer\");\n expect(sent.body.chain).toBe(SolanaTransactionScanChainId.MAINNET);\n expect(sent.body.tx.raw).toBe(bs58.encode(transactionBytes));\n });\n });\n\n describe(\"load \u2014 result mapping\", () => {\n it(\"returns a SOLANA_TRANSACTION_CHECK context with descriptor and certificate on success\", async () => {\n dataSourceMock.check.mockResolvedValue(\n Right({ publicKeyId: \"pk-1\", descriptor: \"deadbeef\" }),\n );\n const cert = { payload: new Uint8Array([0x99]), keyUsageNumber: 14 };\n (certificateLoaderMock.loadCertificate as any).mockResolvedValue(cert);\n\n const [ctx] = await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: new Uint8Array([1, 0, 3, 0xaa]),\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n expect(ctx).toEqual({\n type: ClearSignContextType.SOLANA_TRANSACTION_CHECK,\n payload: { descriptor: \"deadbeef\" },\n certificate: cert,\n });\n });\n\n it(\"returns an ERROR context when the data source returns Left\", async () => {\n const error = new Error(\"network fail\");\n dataSourceMock.check.mockResolvedValue(Left(error));\n\n const [ctx] = await loader.load({\n deviceModelId: DeviceModelId.NANO_X,\n transactionCheck: {\n from: \"signer\",\n transactionBytes: new Uint8Array([1, 0, 3, 0xaa]),\n chain: SolanaTransactionScanChainId.MAINNET,\n },\n });\n\n expect(ctx).toEqual({ type: ClearSignContextType.ERROR, error });\n expect(certificateLoaderMock.loadCertificate).not.toHaveBeenCalled();\n });\n });\n});\n"],
5
+ "mappings": "AAGA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAOC,MAAU,OACjB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAI5B,OAAS,yBAAAC,MAA6B,yDACtC,OAAS,gCAAAC,MAAoC,sDAC7C,OAAS,wBAAAC,MAA4B,kCAErC,OAAS,gCAAAC,MAAoC,iCAE7C,MAAMC,EAAa,CACjB,MAAO,GAAG,GAAG,EACb,KAAM,GAAG,GAAG,EACZ,KAAM,GAAG,GAAG,EACZ,MAAO,GAAG,GAAG,EACb,YAAa,CAAC,CAChB,EACMC,EAAgB,IAAMD,EAEtBE,EAA8C,CAClD,gBAAiB,GAAG,GAAG,CACzB,EAEA,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACf,GAAG,cAAc,EACjBD,EAAiB,CAAE,MAAO,GAAG,GAAG,CAAE,EAClCC,EAAS,IAAIL,EACXI,EACAD,EACAD,CACF,CACF,CAAC,EAED,SAAS,+BAAgC,IAAM,CAC7C,SAAS,YAAa,IAAM,CAC1B,MAAMI,EAAa,CACjB,cAAeb,EAAc,OAC7B,iBAAkB,CAChB,KAAM,SACN,iBAAkB,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,GAAI,CA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CAAG,EAAI,MAAML,EAAO,KAAK,CAC9B,cAAeZ,EAAc,OAC7B,iBAAkB,CAChB,KAAM,SACN,iBAAkB,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,GAAI,CAAC,EAChD,MAAOK,EAA6B,OACtC,CACF,CAAC,EAED,OAAOY,CAAG,EAAE,QAAQ,CAAE,KAAMX,EAAqB,MAAO,MAAAY,CAAM,CAAC,EAC/D,OAAOR,EAAsB,eAAe,EAAE,IAAI,iBAAiB,CACrE,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["DeviceModelId", "bs58", "Left", "Right", "TransactionCheckPaths", "SolanaTransactionScanChainId", "ClearSignContextType", "SolanaTransactionCheckLoader", "loggerMock", "loggerFactory", "certificateLoaderMock", "dataSourceMock", "loader", "validInput", "transactionBytes", "sent", "cert", "ctx", "error"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var g=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var d=(s,o,n,e)=>{for(var r=e>1?void 0:e?E(o,n):o,i=s.length-1,t;i>=0;i--)(t=s[i])&&(r=(e?t(o,n,r):t(r))||r);return e&&r&&g(o,n,r),r},l=(s,o)=>(n,e)=>o(n,e,s);import{inject as I,injectable as y}from"inversify";import{Left as c,Right as D}from"purify-ts";import{configTypes as w}from"../../../../config/di/configTypes";import{SolanaTransactionScanChainId as m}from"../../../../modules/solana/model/SolanaTransactionScanChainId";import{networkTypes as N}from"../../../../shared/network/di/networkTypes";import{calInstructionProgramCodec as S}from"./InstructionInfoDto";import{toInstructionInfoPayload as T,toProgramEnumVariants as M}from"./InstructionInfoMapper";const k={"solana-mainnet":m.MAINNET,"solana-devnet":m.DEVNET,"solana-testnet":m.TESTNET};let u=class{constructor(o,n){this.config=o;this.http=n}async getInstructionInfo({programId:o,network:n}){const e=k[n]??m.MAINNET;let r;try{r=await this.http.get(`${this.config.cal.url}/solana_programs`,{params:{id:o,chain_id:e,output:"id,chain_id,instructions",ref:`branch:${this.config.cal.branch}`}})}catch(t){const f=t instanceof Error?t.message:String(t);return c(new Error(`[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: ${f}`))}if(!Array.isArray(r)||r.length===0)return c(new Error(`[ContextModule] HttpInstructionInfoDataSource: empty response for program ${o}`));const i=r.find(t=>t!=null&&typeof t=="object"&&t.id===o);return i===void 0?c(new Error(`[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${o}`)):S.decode(i).caseOf({Left:t=>c(new Error(`[ContextModule] HttpInstructionInfoDataSource: malformed descriptors for program ${o}: ${t}`)),Right:()=>{const t=this.config.cal.mode??"prod",f=i.instructions,p=Object.fromEntries(f.map(a=>[a.discriminator_hex,a])),h=Object.fromEntries(Object.entries(p).map(([a,C])=>[a,T(o,a,C,t)]));return D({programId:o,descriptors:h,enumVariants:M(p,t)})}})}};u=d([y(),l(0,I(w.Config)),l(1,I(N.NetworkClient))],u);export{u as HttpInstructionInfoDataSource};
1
+ var g=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var d=(s,o,n,e)=>{for(var r=e>1?void 0:e?E(o,n):o,i=s.length-1,t;i>=0;i--)(t=s[i])&&(r=(e?t(o,n,r):t(r))||r);return e&&r&&g(o,n,r),r},l=(s,o)=>(n,e)=>o(n,e,s);import{inject as I,injectable as y}from"inversify";import{Left as c,Right as D}from"purify-ts";import{configTypes as w}from"../../../../config/di/configTypes";import{SolanaTransactionScanChainId as m}from"../../../../modules/solana/model/SolanaTransactionScanChainId";import{networkTypes as N}from"../../../../shared/network/di/networkTypes";import{calInstructionProgramCodec as S}from"./InstructionInfoDto";import{toInstructionInfoPayload as T,toProgramEnumVariants as M}from"./InstructionInfoMapper";const k={"solana-mainnet":m.MAINNET,"solana-devnet":m.DEVNET,"solana-testnet":m.TESTNET};let u=class{constructor(o,n){this.config=o;this.http=n}async getInstructionInfo({programId:o,network:n}){const e=k[n]??m.MAINNET;let r;try{r=await this.http.get(`${this.config.cal.url}/solana_programs`,{params:{id:o,chain_id:e,output:"id,chain_id,instructions",ref:`branch:${this.config.cal.branch}`}})}catch(t){const f=t instanceof Error?t.message:String(t);return c(new Error(`[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: ${f}`))}if(!Array.isArray(r)||r.length===0)return c(new Error(`[ContextModule] HttpInstructionInfoDataSource: empty response for program ${o}`));const i=r.find(t=>t!=null&&typeof t=="object"&&t.id===o);return i===void 0?c(new Error(`[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${o}`)):S.decode(i).caseOf({Left:t=>c(new Error(`[ContextModule] HttpInstructionInfoDataSource: malformed descriptors for program ${o}: ${t}`)),Right:()=>{const t=this.config.cal.mode??"prod",f=i.instructions,p=Object.fromEntries(f.map(a=>[a.discriminator_hex??"",a])),h=Object.fromEntries(Object.entries(p).map(([a,C])=>[a,T(o,a,C,t)]));return D({programId:o,descriptors:h,enumVariants:M(p,t)})}})}};u=d([y(),l(0,I(w.Config)),l(1,I(N.NetworkClient))],u);export{u as HttpInstructionInfoDataSource};
2
2
  //# sourceMappingURL=HttpInstructionInfoDataSource.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.ts"],
4
- "sourcesContent": ["import { DmkNetworkClient } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleServiceConfig } from \"@/config/model/ContextModuleConfig\";\nimport { SolanaTransactionScanChainId } from \"@/modules/solana/model/SolanaTransactionScanChainId\";\nimport { networkTypes } from \"@/shared/network/di/networkTypes\";\n\nimport {\n GetInstructionInfoParams,\n InstructionInfoDataSource,\n InstructionInfoResult,\n} from \"./InstructionInfoDataSource\";\nimport {\n type CalInstructionDescriptorDto,\n calInstructionProgramCodec,\n type CalInstructionProgramDto,\n} from \"./InstructionInfoDto\";\nimport {\n type CalMode,\n toInstructionInfoPayload,\n toProgramEnumVariants,\n} from \"./InstructionInfoMapper\";\n\n// Maps the DMK network label to the numeric CAL `chain_id` (the extended\n// Solana network ids 900/901/902). Unknown labels fall back to mainnet.\nconst CHAIN_ID_BY_NETWORK: Record<string, SolanaTransactionScanChainId> = {\n \"solana-mainnet\": SolanaTransactionScanChainId.MAINNET,\n \"solana-devnet\": SolanaTransactionScanChainId.DEVNET,\n \"solana-testnet\": SolanaTransactionScanChainId.TESTNET,\n};\n\n@injectable()\nexport class HttpInstructionInfoDataSource\n implements InstructionInfoDataSource\n{\n constructor(\n @inject(configTypes.Config)\n private readonly config: ContextModuleServiceConfig,\n @inject(networkTypes.NetworkClient)\n private readonly http: DmkNetworkClient,\n ) {}\n\n public async getInstructionInfo({\n programId,\n network,\n }: GetInstructionInfoParams): Promise<Either<Error, InstructionInfoResult>> {\n const chainId =\n CHAIN_ID_BY_NETWORK[network] ?? SolanaTransactionScanChainId.MAINNET;\n let data: unknown;\n try {\n data = await this.http.get(`${this.config.cal.url}/solana_programs`, {\n params: {\n id: programId,\n chain_id: chainId,\n output: \"id,chain_id,instructions\",\n ref: `branch:${this.config.cal.branch}`,\n },\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: ${reason}`,\n ),\n );\n }\n\n if (!Array.isArray(data) || data.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: empty response for program ${programId}`,\n ),\n );\n }\n\n // Select the program object whose `id` matches the requested `programId`\n // (the response is an array, one object per requested id).\n const program = data.find(\n (entry): entry is { id: unknown } =>\n entry != null &&\n typeof entry === \"object\" &&\n (entry as { id?: unknown }).id === programId,\n );\n if (program === undefined) {\n return Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${programId}`,\n ),\n );\n }\n\n // Validate the program shape so the mapper can dereference `descriptor` /\n // `enum_variants` without runtime-throwing on a malformed CAL payload. A\n // malformed program degrades to a per-program ERROR rather than rejecting\n // the batch. On success we transform each validated DTO into the core\n // payload so the loader never sees the CAL DTO shapes.\n return calInstructionProgramCodec\n .decode(program)\n .caseOf<Either<Error, InstructionInfoResult>>({\n Left: (error) =>\n Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: malformed descriptors for program ${programId}: ${error}`,\n ),\n ),\n Right: () => {\n const mode: CalMode = this.config.cal.mode ?? \"prod\";\n // The codec strips undeclared fields, so we key the original\n // (full) instruction objects by `discriminator_hex` \u2014 the cast is\n // justified now that the shape has been validated.\n const instructions = (program as CalInstructionProgramDto)\n .instructions;\n const descriptorsByDiscriminator: Record<\n string,\n CalInstructionDescriptorDto\n > = Object.fromEntries(\n instructions.map((dto) => [dto.discriminator_hex, dto]),\n );\n const mapped = Object.fromEntries(\n Object.entries(descriptorsByDiscriminator).map(\n ([discriminator, dto]) => [\n discriminator,\n toInstructionInfoPayload(programId, discriminator, dto, mode),\n ],\n ),\n );\n return Right({\n programId,\n descriptors: mapped,\n enumVariants: toProgramEnumVariants(\n descriptorsByDiscriminator,\n mode,\n ),\n });\n },\n });\n }\n}\n"],
5
- "mappings": "iOACA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,gCAAAC,MAAoC,sDAC7C,OAAS,gBAAAC,MAAoB,mCAO7B,OAEE,8BAAAC,MAEK,uBACP,OAEE,4BAAAC,EACA,yBAAAC,MACK,0BAIP,MAAMC,EAAoE,CACxE,iBAAkBC,EAA6B,QAC/C,gBAAiBA,EAA6B,OAC9C,iBAAkBA,EAA6B,OACjD,EAGO,IAAMC,EAAN,KAEP,CACE,YAEmBC,EAEAC,EACjB,CAHiB,YAAAD,EAEA,UAAAC,CAChB,CAEH,MAAa,mBAAmB,CAC9B,UAAAC,EACA,QAAAC,CACF,EAA4E,CAC1E,MAAMC,EACJP,E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AAA,EAAAC,EAAOC,EAAY,MAAM,GAEzBF,EAAA,EAAAC,EAAOE,EAAa,aAAa,IANzB3B",
4
+ "sourcesContent": ["import { DmkNetworkClient } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport { type ContextModuleServiceConfig } from \"@/config/model/ContextModuleConfig\";\nimport { SolanaTransactionScanChainId } from \"@/modules/solana/model/SolanaTransactionScanChainId\";\nimport { networkTypes } from \"@/shared/network/di/networkTypes\";\n\nimport {\n GetInstructionInfoParams,\n InstructionInfoDataSource,\n InstructionInfoResult,\n} from \"./InstructionInfoDataSource\";\nimport {\n type CalInstructionDescriptorDto,\n calInstructionProgramCodec,\n type CalInstructionProgramDto,\n} from \"./InstructionInfoDto\";\nimport {\n type CalMode,\n toInstructionInfoPayload,\n toProgramEnumVariants,\n} from \"./InstructionInfoMapper\";\n\n// Maps the DMK network label to the numeric CAL `chain_id` (the extended\n// Solana network ids 900/901/902). Unknown labels fall back to mainnet.\nconst CHAIN_ID_BY_NETWORK: Record<string, SolanaTransactionScanChainId> = {\n \"solana-mainnet\": SolanaTransactionScanChainId.MAINNET,\n \"solana-devnet\": SolanaTransactionScanChainId.DEVNET,\n \"solana-testnet\": SolanaTransactionScanChainId.TESTNET,\n};\n\n@injectable()\nexport class HttpInstructionInfoDataSource\n implements InstructionInfoDataSource\n{\n constructor(\n @inject(configTypes.Config)\n private readonly config: ContextModuleServiceConfig,\n @inject(networkTypes.NetworkClient)\n private readonly http: DmkNetworkClient,\n ) {}\n\n public async getInstructionInfo({\n programId,\n network,\n }: GetInstructionInfoParams): Promise<Either<Error, InstructionInfoResult>> {\n const chainId =\n CHAIN_ID_BY_NETWORK[network] ?? SolanaTransactionScanChainId.MAINNET;\n let data: unknown;\n try {\n data = await this.http.get(`${this.config.cal.url}/solana_programs`, {\n params: {\n id: programId,\n chain_id: chainId,\n output: \"id,chain_id,instructions\",\n ref: `branch:${this.config.cal.branch}`,\n },\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n return Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: ${reason}`,\n ),\n );\n }\n\n if (!Array.isArray(data) || data.length === 0) {\n return Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: empty response for program ${programId}`,\n ),\n );\n }\n\n // Select the program object whose `id` matches the requested `programId`\n // (the response is an array, one object per requested id).\n const program = data.find(\n (entry): entry is { id: unknown } =>\n entry != null &&\n typeof entry === \"object\" &&\n (entry as { id?: unknown }).id === programId,\n );\n if (program === undefined) {\n return Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${programId}`,\n ),\n );\n }\n\n // Validate the program shape so the mapper can dereference `descriptor` /\n // `enum_variants` without runtime-throwing on a malformed CAL payload. A\n // malformed program degrades to a per-program ERROR rather than rejecting\n // the batch. On success we transform each validated DTO into the core\n // payload so the loader never sees the CAL DTO shapes.\n return calInstructionProgramCodec\n .decode(program)\n .caseOf<Either<Error, InstructionInfoResult>>({\n Left: (error) =>\n Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: malformed descriptors for program ${programId}: ${error}`,\n ),\n ),\n Right: () => {\n const mode: CalMode = this.config.cal.mode ?? \"prod\";\n // The codec strips undeclared fields, so we key the original\n // (full) instruction objects by `discriminator_hex` \u2014 the cast is\n // justified now that the shape has been validated. A descriptor\n // without a discriminator (single-instruction programs such as SPL\n // Memo) is keyed under the empty string.\n const instructions = (program as CalInstructionProgramDto)\n .instructions;\n const descriptorsByDiscriminator: Record<\n string,\n CalInstructionDescriptorDto\n > = Object.fromEntries(\n instructions.map((dto) => [dto.discriminator_hex ?? \"\", dto]),\n );\n const mapped = Object.fromEntries(\n Object.entries(descriptorsByDiscriminator).map(\n ([discriminator, dto]) => [\n discriminator,\n toInstructionInfoPayload(programId, discriminator, dto, mode),\n ],\n ),\n );\n return Right({\n programId,\n descriptors: mapped,\n enumVariants: toProgramEnumVariants(\n descriptorsByDiscriminator,\n mode,\n ),\n });\n },\n });\n }\n}\n"],
5
+ "mappings": "iOACA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YACnC,OAAiB,QAAAC,EAAM,SAAAC,MAAa,YAEpC,OAAS,eAAAC,MAAmB,0BAE5B,OAAS,gCAAAC,MAAoC,sDAC7C,OAAS,gBAAAC,MAAoB,mCAO7B,OAEE,8BAAAC,MAEK,uBACP,OAEE,4BAAAC,EACA,yBAAAC,MACK,0BAIP,MAAMC,EAAoE,CACxE,iBAAkBC,EAA6B,QAC/C,gBAAiBA,EAA6B,OAC9C,iBAAkBA,EAA6B,OACjD,EAGO,IAAMC,EAAN,KAEP,CACE,YAEmBC,EAEAC,EACjB,CAHiB,YAAAD,EAEA,UAAAC,CAChB,CAEH,MAAa,mBAAmB,CAC9B,UAAAC,EACA,QAAAC,CACF,EAA4E,CAC1E,MAAMC,EACJP,EAAoBM,CAAO,GAAKL,EAA6B,QAC/D,IAAIO,EACJ,GAAI,CACFA,EAAO,MAAM,KAAK,KAAK,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,mBAAoB,CACnE,OAAQ,CACN,GAAIH,EACJ,SAAUE,EACV,OAAQ,2BACR,IAAK,UAAU,KAAK,OAAO,IAAI,MAAM,EACvC,CACF,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAASD,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,EACpE,OAAOE,EACL,IAAI,MACF,2FAA2FD,CAAM,EACnG,CACF,CACF,CAEA,GAAI,CAAC,MAAM,QAAQF,CAAI,GAAKA,EAAK,SAAW,EAC1C,OAAOG,EACL,IAAI,MACF,6EAA6EN,CAAS,EACxF,CACF,EAKF,MAAMO,EAAUJ,EAAK,KAClBK,GACCA,GAAS,MACT,OAAOA,GAAU,UAChBA,EAA2B,KAAOR,CACvC,EACA,OAAIO,IAAY,OACPD,EACL,IAAI,MACF,6EAA6EN,CAAS,EACxF,CACF,EAQKS,EACJ,OAAOF,CAAO,EACd,OAA6C,CAC5C,KAAOH,GACLE,EACE,IAAI,MACF,oFAAoFN,CAAS,KAAKI,CAAK,EACzG,CACF,EACF,MAAO,IAAM,CACX,MAAMM,EAAgB,KAAK,OAAO,IAAI,MAAQ,OAMxCC,EAAgBJ,EACnB,aACGK,EAGF,OAAO,YACTD,EAAa,IAAKE,GAAQ,CAACA,EAAI,mBAAqB,GAAIA,CAAG,CAAC,CAC9D,EACMC,EAAS,OAAO,YACpB,OAAO,QAAQF,CAA0B,EAAE,IACzC,CAAC,CAACG,EAAeF,CAAG,IAAM,CACxBE,EACAC,EAAyBhB,EAAWe,EAAeF,EAAKH,CAAI,CAC9D,CACF,CACF,EACA,OAAOO,EAAM,CACX,UAAAjB,EACA,YAAac,EACb,aAAcI,EACZN,EACAF,CACF,CACF,CAAC,CACH,CACF,CAAC,CACL,CACF,EA3Gab,EAANsB,EAAA,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAY,MAAM,GAEzBF,EAAA,EAAAC,EAAOE,EAAa,aAAa,IANzB3B",
6
6
  "names": ["inject", "injectable", "Left", "Right", "configTypes", "SolanaTransactionScanChainId", "networkTypes", "calInstructionProgramCodec", "toInstructionInfoPayload", "toProgramEnumVariants", "CHAIN_ID_BY_NETWORK", "SolanaTransactionScanChainId", "HttpInstructionInfoDataSource", "config", "http", "programId", "network", "chainId", "data", "error", "reason", "Left", "program", "entry", "calInstructionProgramCodec", "mode", "instructions", "descriptorsByDiscriminator", "dto", "mapped", "discriminator", "toInstructionInfoPayload", "Right", "toProgramEnumVariants", "__decorateClass", "injectable", "__decorateParam", "inject", "configTypes", "networkTypes"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Left as u,Right as l}from"purify-ts";import{beforeEach as m,describe as g,expect as o,it as a,vi as d}from"vitest";import{SolanaTransactionScanChainId as i}from"../../../../modules/solana/model/SolanaTransactionScanChainId";import{HttpInstructionInfoDataSource as f}from"./HttpInstructionInfoDataSource";g("HttpInstructionInfoDataSource",()=>{let r,e;const t="11111111111111111111111111111111",s="solana-mainnet",p={cal:{url:"https://global.api.prd.ledger.com/cal/v1",mode:"prod",branch:"main"}},c=[{id:t,chain_id:i.MAINNET,instructions:[{discriminator_hex:"00000000",instruction_name:"createAccount",descriptor:{data:"00010101",signatures:{prod:"prodsig",test:"testsig"}},display_fields:[],value_flow_ports:[],hide_rules:[],account_resets:[]}]}];m(()=>{d.clearAllMocks(),e={get:d.fn()},r=new f(p,e)}),a("calls CAL /solana_programs with id, chain_id and output params",async()=>{e.get.mockResolvedValue(c),await r.getInstructionInfo({programId:t,network:s}),o(e.get).toHaveBeenCalledTimes(1),o(e.get).toHaveBeenCalledWith("https://global.api.prd.ledger.com/cal/v1/solana_programs",{params:{id:t,chain_id:i.MAINNET,output:"id,chain_id,instructions",ref:"branch:main"}})}),a("maps devnet/testnet networks to their numeric chain ids",async()=>{e.get.mockResolvedValue(c),await r.getInstructionInfo({programId:t,network:"solana-devnet"}),o(e.get).toHaveBeenCalledWith("https://global.api.prd.ledger.com/cal/v1/solana_programs",o.objectContaining({params:o.objectContaining({chain_id:901})}))}),a("returns Right with each descriptor transformed into the core payload on success",async()=>{e.get.mockResolvedValue(c);const n=await r.getInstructionInfo({programId:t,network:s});o(n).toEqual(l({programId:t,descriptors:{"00000000":l({programId:t,discriminator:"00000000",instructionInfo:{data:"00010101",signature:"prodsig"},substructures:[],enumVariants:[],idlDescriptor:{typePool:[],rootType:0},mintAssociations:[],valueFlowPorts:[],accountResets:[],displayFields:[]})},enumVariants:[]}))}),a("returns Left when the response array is empty",async()=>{e.get.mockResolvedValue([]);const n=await r.getInstructionInfo({programId:t,network:s});o(n).toEqual(u(new Error(`[ContextModule] HttpInstructionInfoDataSource: empty response for program ${t}`)))}),a("returns Left when no program object matches the requested programId",async()=>{e.get.mockResolvedValue([{id:"OtherProgram",chain_id:i.MAINNET,instructions:[]}]);const n=await r.getInstructionInfo({programId:t,network:s});o(n).toEqual(u(new Error(`[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${t}`)))}),a("returns Left (not a throw) when an instruction descriptor is malformed",async()=>{e.get.mockResolvedValue([{id:t,chain_id:i.MAINNET,instructions:[{discriminator_hex:"00000000"}]}]);const n=await r.getInstructionInfo({programId:t,network:s});o(n.isLeft()).toBe(!0),o(n.extract().message).toMatch(new RegExp(String.raw`\[ContextModule\] HttpInstructionInfoDataSource: malformed descriptors for program ${t}:`))}),a("returns Left when the HTTP client throws",async()=>{e.get.mockRejectedValue(new Error("network"));const n=await r.getInstructionInfo({programId:t,network:s});o(n).toEqual(u(new Error("[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: network")))})});
1
+ import{Left as u,Right as l}from"purify-ts";import{beforeEach as g,describe as f,expect as e,it as s,vi as p}from"vitest";import{SolanaTransactionScanChainId as i}from"../../../../modules/solana/model/SolanaTransactionScanChainId";import{HttpInstructionInfoDataSource as h}from"./HttpInstructionInfoDataSource";f("HttpInstructionInfoDataSource",()=>{let r,o;const t="11111111111111111111111111111111",a="solana-mainnet",m={cal:{url:"https://global.api.prd.ledger.com/cal/v1",mode:"prod",branch:"main"}},c=[{id:t,chain_id:i.MAINNET,instructions:[{discriminator_hex:"00000000",instruction_name:"createAccount",descriptor:{data:"00010101",signatures:{prod:"prodsig",test:"testsig"}},display_fields:[],value_flow_ports:[],hide_rules:[],account_resets:[]}]}];g(()=>{p.clearAllMocks(),o={get:p.fn()},r=new h(m,o)}),s("calls CAL /solana_programs with id, chain_id and output params",async()=>{o.get.mockResolvedValue(c),await r.getInstructionInfo({programId:t,network:a}),e(o.get).toHaveBeenCalledTimes(1),e(o.get).toHaveBeenCalledWith("https://global.api.prd.ledger.com/cal/v1/solana_programs",{params:{id:t,chain_id:i.MAINNET,output:"id,chain_id,instructions",ref:"branch:main"}})}),s("maps devnet/testnet networks to their numeric chain ids",async()=>{o.get.mockResolvedValue(c),await r.getInstructionInfo({programId:t,network:"solana-devnet"}),e(o.get).toHaveBeenCalledWith("https://global.api.prd.ledger.com/cal/v1/solana_programs",e.objectContaining({params:e.objectContaining({chain_id:901})}))}),s("returns Right with each descriptor transformed into the core payload on success",async()=>{o.get.mockResolvedValue(c);const n=await r.getInstructionInfo({programId:t,network:a});e(n).toEqual(l({programId:t,descriptors:{"00000000":l({programId:t,discriminator:"00000000",instructionInfo:{data:"00010101",signature:"prodsig"},substructures:[],enumVariants:[],idlDescriptor:{typePool:[],rootType:0},mintAssociations:[],valueFlowPorts:[],accountResets:[],displayFields:[]})},enumVariants:[]}))}),s("keys a descriptor without `discriminator_hex` under the empty string",async()=>{o.get.mockResolvedValue([{id:t,chain_id:i.MAINNET,instructions:[{instruction_name:"addMemo",descriptor:{data:"00010101",signatures:{prod:"prodsig",test:"testsig"}}}]}]);const n=await r.getInstructionInfo({programId:t,network:a});e(n.isRight()).toBe(!0);const{descriptors:d}=n.unsafeCoerce();e(Object.keys(d)).toEqual([""]),e(d[""].unsafeCoerce()).toEqual(e.objectContaining({programId:t,discriminator:"",instructionInfo:{data:"00010101",signature:"prodsig"}}))}),s("returns Left when the response array is empty",async()=>{o.get.mockResolvedValue([]);const n=await r.getInstructionInfo({programId:t,network:a});e(n).toEqual(u(new Error(`[ContextModule] HttpInstructionInfoDataSource: empty response for program ${t}`)))}),s("returns Left when no program object matches the requested programId",async()=>{o.get.mockResolvedValue([{id:"OtherProgram",chain_id:i.MAINNET,instructions:[]}]);const n=await r.getInstructionInfo({programId:t,network:a});e(n).toEqual(u(new Error(`[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${t}`)))}),s("returns Left (not a throw) when an instruction descriptor is malformed",async()=>{o.get.mockResolvedValue([{id:t,chain_id:i.MAINNET,instructions:[{discriminator_hex:"00000000"}]}]);const n=await r.getInstructionInfo({programId:t,network:a});e(n.isLeft()).toBe(!0),e(n.extract().message).toMatch(new RegExp(String.raw`\[ContextModule\] HttpInstructionInfoDataSource: malformed descriptors for program ${t}:`))}),s("returns Left when the HTTP client throws",async()=>{o.get.mockRejectedValue(new Error("network"));const n=await r.getInstructionInfo({programId:t,network:a});e(n).toEqual(u(new Error("[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: network")))})});
2
2
  //# sourceMappingURL=HttpInstructionInfoDataSource.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.test.ts"],
4
- "sourcesContent": ["import { type DmkNetworkClient } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { type ContextModuleServiceConfig } from \"@/config/model/ContextModuleConfig\";\nimport { SolanaTransactionScanChainId } from \"@/modules/solana/model/SolanaTransactionScanChainId\";\n\nimport { HttpInstructionInfoDataSource } from \"./HttpInstructionInfoDataSource\";\nimport { type InstructionInfoDataSource } from \"./InstructionInfoDataSource\";\nimport { type CalInstructionInfoResponseDto } from \"./InstructionInfoDto\";\n\ndescribe(\"HttpInstructionInfoDataSource\", () => {\n let datasource: InstructionInfoDataSource;\n let httpMock: { get: ReturnType<typeof vi.fn> };\n const programId = \"11111111111111111111111111111111\";\n const network = \"solana-mainnet\";\n const config: ContextModuleServiceConfig = {\n cal: {\n url: \"https://global.api.prd.ledger.com/cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleServiceConfig;\n\n const successResponse: CalInstructionInfoResponseDto = [\n {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [\n {\n discriminator_hex: \"00000000\",\n instruction_name: \"createAccount\",\n descriptor: {\n data: \"00010101\",\n signatures: { prod: \"prodsig\", test: \"testsig\" },\n },\n display_fields: [],\n value_flow_ports: [],\n hide_rules: [],\n account_resets: [],\n },\n ],\n },\n ];\n\n beforeEach(() => {\n vi.clearAllMocks();\n httpMock = { get: vi.fn() };\n datasource = new HttpInstructionInfoDataSource(\n config,\n httpMock as unknown as DmkNetworkClient,\n );\n });\n\n it(\"calls CAL /solana_programs with id, chain_id and output params\", async () => {\n httpMock.get.mockResolvedValue(successResponse);\n\n await datasource.getInstructionInfo({ programId, network });\n\n expect(httpMock.get).toHaveBeenCalledTimes(1);\n expect(httpMock.get).toHaveBeenCalledWith(\n \"https://global.api.prd.ledger.com/cal/v1/solana_programs\",\n {\n params: {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n output: \"id,chain_id,instructions\",\n ref: \"branch:main\",\n },\n },\n );\n });\n\n it(\"maps devnet/testnet networks to their numeric chain ids\", async () => {\n httpMock.get.mockResolvedValue(successResponse);\n\n await datasource.getInstructionInfo({\n programId,\n network: \"solana-devnet\",\n });\n\n expect(httpMock.get).toHaveBeenCalledWith(\n \"https://global.api.prd.ledger.com/cal/v1/solana_programs\",\n expect.objectContaining({\n params: expect.objectContaining({ chain_id: 901 }),\n }),\n );\n });\n\n it(\"returns Right with each descriptor transformed into the core payload on success\", async () => {\n httpMock.get.mockResolvedValue(successResponse);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Right({\n programId,\n descriptors: {\n \"00000000\": Right({\n programId,\n discriminator: \"00000000\",\n instructionInfo: { data: \"00010101\", signature: \"prodsig\" },\n substructures: [],\n enumVariants: [],\n idlDescriptor: { typePool: [], rootType: 0 },\n mintAssociations: [],\n valueFlowPorts: [],\n accountResets: [],\n displayFields: [],\n }),\n },\n enumVariants: [],\n }),\n );\n });\n\n it(\"returns Left when the response array is empty\", async () => {\n httpMock.get.mockResolvedValue([]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: empty response for program ${programId}`,\n ),\n ),\n );\n });\n\n it(\"returns Left when no program object matches the requested programId\", async () => {\n httpMock.get.mockResolvedValue([\n {\n id: \"OtherProgram\",\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [],\n },\n ]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${programId}`,\n ),\n ),\n );\n });\n\n it(\"returns Left (not a throw) when an instruction descriptor is malformed\", async () => {\n // `descriptor` missing on the instruction \u2014 would crash the loader if the\n // datasource handed it through unvalidated.\n httpMock.get.mockResolvedValue([\n {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [{ discriminator_hex: \"00000000\" }],\n },\n ]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result.isLeft()).toBe(true);\n expect((result.extract() as Error).message).toMatch(\n new RegExp(\n String.raw`\\[ContextModule\\] HttpInstructionInfoDataSource: malformed descriptors for program ${programId}:`,\n ),\n );\n });\n\n it(\"returns Left when the HTTP client throws\", async () => {\n httpMock.get.mockRejectedValue(new Error(\"network\"));\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: network\",\n ),\n ),\n );\n });\n});\n"],
5
- "mappings": "AACA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,cAAAC,EAAY,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAAC,MAAU,SAGrD,OAAS,gCAAAC,MAAoC,sDAE7C,OAAS,iCAAAC,MAAqC,kCAI9CL,EAAS,gCAAiC,IAAM,CAC9C,IAAIM,EACAC,EACJ,MAAMC,EAAY,mCACZC,EAAU,iBACVC,EAAqC,CACzC,IAAK,CACH,IAAK,2CACL,KAAM,OACN,OAAQ,MACV,CACF,EAEMC,EAAiD,CACrD,CACE,GAAIH,EACJ,SAAUJ,EAA6B,QACvC,aAAc,CACZ,CACE,kBAAmB,WACnB,iBAAkB,gBAClB,WAAY,CACV,KAAM,WACN,WAAY,CAAE,KAAM,UAAW,KAAM,SAAU,CACjD,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ACE,IAAI,MACF,iGACF,CACF,CACF,CACF,CAAC,CACH,CAAC",
6
- "names": ["Left", "Right", "beforeEach", "describe", "expect", "it", "vi", "SolanaTransactionScanChainId", "HttpInstructionInfoDataSource", "datasource", "httpMock", "programId", "network", "config", "successResponse", "result"]
4
+ "sourcesContent": ["import { type DmkNetworkClient } from \"@ledgerhq/device-management-kit\";\nimport { Left, Right } from \"purify-ts\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { type ContextModuleServiceConfig } from \"@/config/model/ContextModuleConfig\";\nimport { SolanaTransactionScanChainId } from \"@/modules/solana/model/SolanaTransactionScanChainId\";\n\nimport { HttpInstructionInfoDataSource } from \"./HttpInstructionInfoDataSource\";\nimport { type InstructionInfoDataSource } from \"./InstructionInfoDataSource\";\nimport { type CalInstructionInfoResponseDto } from \"./InstructionInfoDto\";\n\ndescribe(\"HttpInstructionInfoDataSource\", () => {\n let datasource: InstructionInfoDataSource;\n let httpMock: { get: ReturnType<typeof vi.fn> };\n const programId = \"11111111111111111111111111111111\";\n const network = \"solana-mainnet\";\n const config: ContextModuleServiceConfig = {\n cal: {\n url: \"https://global.api.prd.ledger.com/cal/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleServiceConfig;\n\n const successResponse: CalInstructionInfoResponseDto = [\n {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [\n {\n discriminator_hex: \"00000000\",\n instruction_name: \"createAccount\",\n descriptor: {\n data: \"00010101\",\n signatures: { prod: \"prodsig\", test: \"testsig\" },\n },\n display_fields: [],\n value_flow_ports: [],\n hide_rules: [],\n account_resets: [],\n },\n ],\n },\n ];\n\n beforeEach(() => {\n vi.clearAllMocks();\n httpMock = { get: vi.fn() };\n datasource = new HttpInstructionInfoDataSource(\n config,\n httpMock as unknown as DmkNetworkClient,\n );\n });\n\n it(\"calls CAL /solana_programs with id, chain_id and output params\", async () => {\n httpMock.get.mockResolvedValue(successResponse);\n\n await datasource.getInstructionInfo({ programId, network });\n\n expect(httpMock.get).toHaveBeenCalledTimes(1);\n expect(httpMock.get).toHaveBeenCalledWith(\n \"https://global.api.prd.ledger.com/cal/v1/solana_programs\",\n {\n params: {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n output: \"id,chain_id,instructions\",\n ref: \"branch:main\",\n },\n },\n );\n });\n\n it(\"maps devnet/testnet networks to their numeric chain ids\", async () => {\n httpMock.get.mockResolvedValue(successResponse);\n\n await datasource.getInstructionInfo({\n programId,\n network: \"solana-devnet\",\n });\n\n expect(httpMock.get).toHaveBeenCalledWith(\n \"https://global.api.prd.ledger.com/cal/v1/solana_programs\",\n expect.objectContaining({\n params: expect.objectContaining({ chain_id: 901 }),\n }),\n );\n });\n\n it(\"returns Right with each descriptor transformed into the core payload on success\", async () => {\n httpMock.get.mockResolvedValue(successResponse);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Right({\n programId,\n descriptors: {\n \"00000000\": Right({\n programId,\n discriminator: \"00000000\",\n instructionInfo: { data: \"00010101\", signature: \"prodsig\" },\n substructures: [],\n enumVariants: [],\n idlDescriptor: { typePool: [], rootType: 0 },\n mintAssociations: [],\n valueFlowPorts: [],\n accountResets: [],\n displayFields: [],\n }),\n },\n enumVariants: [],\n }),\n );\n });\n\n it(\"keys a descriptor without `discriminator_hex` under the empty string\", async () => {\n // Single-instruction programs (e.g. SPL Memo `addMemo`) genuinely have no\n // discriminator, so CAL omits the field.\n httpMock.get.mockResolvedValue([\n {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [\n {\n instruction_name: \"addMemo\",\n descriptor: {\n data: \"00010101\",\n signatures: { prod: \"prodsig\", test: \"testsig\" },\n },\n },\n ],\n },\n ]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result.isRight()).toBe(true);\n const { descriptors } = result.unsafeCoerce();\n expect(Object.keys(descriptors)).toEqual([\"\"]);\n expect(descriptors[\"\"]!.unsafeCoerce()).toEqual(\n expect.objectContaining({\n programId,\n discriminator: \"\",\n instructionInfo: { data: \"00010101\", signature: \"prodsig\" },\n }),\n );\n });\n\n it(\"returns Left when the response array is empty\", async () => {\n httpMock.get.mockResolvedValue([]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: empty response for program ${programId}`,\n ),\n ),\n );\n });\n\n it(\"returns Left when no program object matches the requested programId\", async () => {\n httpMock.get.mockResolvedValue([\n {\n id: \"OtherProgram\",\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [],\n },\n ]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Left(\n new Error(\n `[ContextModule] HttpInstructionInfoDataSource: no descriptors for program ${programId}`,\n ),\n ),\n );\n });\n\n it(\"returns Left (not a throw) when an instruction descriptor is malformed\", async () => {\n // `descriptor` missing on the instruction \u2014 would crash the loader if the\n // datasource handed it through unvalidated.\n httpMock.get.mockResolvedValue([\n {\n id: programId,\n chain_id: SolanaTransactionScanChainId.MAINNET,\n instructions: [{ discriminator_hex: \"00000000\" }],\n },\n ]);\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result.isLeft()).toBe(true);\n expect((result.extract() as Error).message).toMatch(\n new RegExp(\n String.raw`\\[ContextModule\\] HttpInstructionInfoDataSource: malformed descriptors for program ${programId}:`,\n ),\n );\n });\n\n it(\"returns Left when the HTTP client throws\", async () => {\n httpMock.get.mockRejectedValue(new Error(\"network\"));\n\n const result = await datasource.getInstructionInfo({ programId, network });\n\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpInstructionInfoDataSource: Failed to fetch instruction descriptors: network\",\n ),\n ),\n );\n });\n});\n"],
5
+ "mappings": "AACA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAC5B,OAAS,cAAAC,EAAY,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAA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N,EAAW,mBAAmB,CAAE,UAAAE,EAAW,QAAAC,CAAQ,CAAC,EAEzER,EAAOW,CAAM,EAAE,QACbf,EACE,IAAI,MACF,6EAA6EW,CAAS,EACxF,CACF,CACF,CACF,CAAC,EAEDN,EAAG,sEAAuE,SAAY,CACpFK,EAAS,IAAI,kBAAkB,CAC7B,CACE,GAAI,eACJ,SAAUH,EAA6B,QACvC,aAAc,CAAC,CACjB,CACF,CAAC,EAED,MAAMQ,EAAS,MAAMN,EAAW,mBAAmB,CAAE,UAAAE,EAAW,QAAAC,CAAQ,CAAC,EAEzER,EAAOW,CAAM,EAAE,QACbf,EACE,IAAI,MACF,6EAA6EW,CAAS,EACxF,CACF,CACF,CACF,CAAC,EAEDN,EAAG,yEAA0E,SAAY,CAGvFK,EAAS,IAAI,kBAAkB,CAC7B,CACE,GAAIC,EACJ,SAAUJ,EAA6B,QACvC,aAAc,CAAC,CAAE,kBAAmB,UAAW,CAAC,CAClD,CACF,CAAC,EAED,MAAMQ,EAAS,MAAMN,EAAW,mBAAmB,CAAE,UAAAE,EAAW,QAAAC,CAAQ,CAAC,EAEzER,EAAOW,EAAO,OAAO,CAAC,EAAE,KAAK,EAAI,EACjCX,EAAQW,EAAO,QAAQ,EAAY,OAAO,EAAE,QAC1C,IAAI,OACF,OAAO,yFAAyFJ,CAAS,GAC3G,CACF,CACF,CAAC,EAEDN,EAAG,2CAA4C,SAAY,CACzDK,EAAS,IAAI,kBAAkB,IAAI,MAAM,SAAS,CAAC,EAEnD,MAAMK,EAAS,MAAMN,EAAW,mBAAmB,CAAE,UAAAE,EAAW,QAAAC,CAAQ,CAAC,EAEzER,EAAOW,CAAM,EAAE,QACbf,EACE,IAAI,MACF,iGACF,CACF,CACF,CACF,CAAC,CACH,CAAC",
6
+ "names": ["Left", "Right", "beforeEach", "describe", "expect", "it", "vi", "SolanaTransactionScanChainId", "HttpInstructionInfoDataSource", "datasource", "httpMock", "programId", "network", "config", "successResponse", "result", "descriptors"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{array as n,Codec as r,number as s,optional as e,record as i,string as t}from"purify-ts";const c=r.interface({prod:e(t),test:e(t)}),a=r.interface({data:t,signatures:c}),u=r.interface({descriptor:a}),o=r.interface({descriptor:t}),l=r.interface({discriminator_hex:t,descriptor:a,enum_variants:e(i(t,i(t,u))),display_fields:e(n(o)),value_flow_ports:e(n(o)),hide_rules:e(n(o)),account_resets:e(n(o))}),d=r.interface({id:t,chain_id:s,instructions:n(l)});export{d as calInstructionProgramCodec};
1
+ import{array as n,Codec as r,number as s,optional as t,record as i,string as e}from"purify-ts";const c=r.interface({prod:t(e),test:t(e)}),a=r.interface({data:e,signatures:c}),u=r.interface({descriptor:a}),o=r.interface({descriptor:e}),l=r.interface({discriminator_hex:t(e),descriptor:a,enum_variants:t(i(e,i(e,u))),display_fields:t(n(o)),value_flow_ports:t(n(o)),hide_rules:t(n(o)),account_resets:t(n(o))}),d=r.interface({id:e,chain_id:s,instructions:n(l)});export{d as calInstructionProgramCodec};
2
2
  //# sourceMappingURL=InstructionInfoDto.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/modules/solana/instruction-info/data/InstructionInfoDto.ts"],
4
- "sourcesContent": ["// DTO + codecs for the CAL instruction-descriptors response (one object per\n// `programId`, wrapped in a JSON array).\n//\n// The hand-written types describe the consumed shape (with genuinely optional\n// `?:` fields); the codecs below validate that shape at runtime so\n// `HttpInstructionInfoDataSource` can hand the loaders a payload they can\n// dereference without runtime-throwing on a malformed descriptor.\n\nimport { array, Codec, number, optional, record, string } from \"purify-ts\";\n\nexport type CalSignatures = {\n prod?: string;\n test?: string;\n};\n\nexport type CalSignedDescriptorDto = {\n data: string;\n signatures: CalSignatures;\n};\n\n// Decoded CAL JSON shapes (snake_case mirrors the CAL response) that drive\n// host-side requirement building.\n\nexport type CalValueDto = {\n source: string;\n account_index?: number;\n data?: string;\n path?: { steps: number[] };\n};\n\nexport type CalTokenValueDto = {\n kind: string;\n value?: CalValueDto;\n account_index?: number;\n};\n\nexport type CalMintAssociationDto = {\n account_index: number;\n mint_index: number;\n};\n\nexport type CalTypePoolEntryDto = {\n index: number;\n kind: string;\n refs?: number[];\n size?: number;\n encoding?: number;\n len_kind?: string;\n flag_kind?: string;\n sentinel?: string;\n disc_kind?: string;\n total_variants?: number;\n enum_id?: string;\n};\n\nexport type CalEnumVariantDto = {\n variant_name: string;\n payload_kind?: string;\n descriptor: CalSignedDescriptorDto;\n};\n\n/** A substructure CAL serves only as opaque TLV (e.g. HIDE_RULE). */\nexport type CalSubstructureDto = {\n descriptor: string;\n};\n\nexport type CalValueFlowPortDto = CalSubstructureDto & {\n account_indices: number[];\n optional_account_strategy?: string;\n token_value: CalTokenValueDto;\n};\n\nexport type CalAccountResetDto = CalSubstructureDto & {\n account_index?: number;\n require_pre_balance_zero?: boolean;\n};\n\nexport type CalDisplayFieldDto = CalSubstructureDto & {\n name?: string;\n param?: { type: string; value?: CalValueDto; token?: CalValueDto };\n};\n\nexport type CalInstructionDescriptorDto = {\n discriminator_hex: string;\n instruction_name?: string;\n descriptor: CalSignedDescriptorDto;\n idl_descriptor?: {\n type_pool?: CalTypePoolEntryDto[];\n root_type?: number;\n };\n mint_association?: CalMintAssociationDto;\n owner_association?: unknown;\n enum_variants?: Record<string, Record<string, CalEnumVariantDto>>;\n display_fields?: CalDisplayFieldDto[];\n value_flow_ports?: CalValueFlowPortDto[];\n hide_rules?: CalSubstructureDto[];\n account_resets?: CalAccountResetDto[];\n};\n\n// One program object of the `solana_programs` response: the program `id`, its\n// `chain_id`, and the flat `instructions` array (keyed downstream by\n// `discriminator_hex`).\nexport type CalInstructionProgramDto = {\n id: string;\n chain_id: number;\n instructions: CalInstructionDescriptorDto[];\n};\n\n// Outer shape: array of program objects (one per requested `id`).\nexport type CalInstructionInfoResponseDto = CalInstructionProgramDto[];\n\n// --- Validation codecs (runtime). Validate only the fields the loaders read;\n// `Codec.interface` ignores unknown extras so CAL can add fields freely. ---\n\nconst calSignaturesCodec = Codec.interface({\n prod: optional(string),\n test: optional(string),\n});\n\nconst calSignedDescriptorCodec = Codec.interface({\n data: string,\n signatures: calSignaturesCodec,\n});\n\nconst calEnumVariantCodec = Codec.interface({\n descriptor: calSignedDescriptorCodec,\n});\n\nconst calSubstructureCodec = Codec.interface({\n descriptor: string,\n});\n\nconst calInstructionDescriptorCodec = Codec.interface({\n discriminator_hex: string,\n descriptor: calSignedDescriptorCodec,\n enum_variants: optional(record(string, record(string, calEnumVariantCodec))),\n display_fields: optional(array(calSubstructureCodec)),\n value_flow_ports: optional(array(calSubstructureCodec)),\n hide_rules: optional(array(calSubstructureCodec)),\n account_resets: optional(array(calSubstructureCodec)),\n});\n\n/**\n * Codec for one program object of the `solana_programs` response. Used by the\n * datasource to validate the CAL payload before handing it to the loaders.\n * Only loader-consumed fields are validated; unrelated CAL fields\n * (`idl_descriptor`, `mint_association`, \u2026) are ignored.\n */\nexport const calInstructionProgramCodec = Codec.interface({\n id: string,\n chain_id: number,\n instructions: array(calInstructionDescriptorCodec),\n});\n"],
5
- "mappings": "AAQA,OAAS,SAAAA,EAAO,SAAAC,EAAO,UAAAC,EAAQ,YAAAC,EAAU,UAAAC,EAAQ,UAAAC,MAAc,YA0G/D,MAAMC,EAAqBL,EAAM,UAAU,CACzC,KAAME,EAASE,CAAM,EACrB,KAAMF,EAASE,CAAM,CACvB,CAAC,EAEKE,EAA2BN,EAAM,UAAU,CAC/C,KAAMI,EACN,WAAYC,CACd,CAAC,EAEKE,EAAsBP,EAAM,UAAU,CAC1C,WAAYM,CACd,CAAC,EAEKE,EAAuBR,EAAM,UAAU,CAC3C,WAAYI,CACd,CAAC,EAEKK,EAAgCT,EAAM,UAAU,CACpD,kBAAmBI,EACnB,WAAYE,EACZ,cAAeJ,EAASC,EAAOC,EAAQD,EAAOC,EAAQG,CAAmB,CAAC,CAAC,EAC3E,eAAgBL,EAASH,EAAMS,CAAoB,CAAC,EACpD,iBAAkBN,EAASH,EAAMS,CAAoB,CAAC,EACtD,WAAYN,EAASH,EAAMS,CAAoB,CAAC,EAChD,eAAgBN,EAASH,EAAMS,CAAoB,CAAC,CACtD,CAAC,EAQYE,EAA6BV,EAAM,UAAU,CACxD,GAAII,EACJ,SAAUH,EACV,aAAcF,EAAMU,CAA6B,CACnD,CAAC",
4
+ "sourcesContent": ["// DTO + codecs for the CAL instruction-descriptors response (one object per\n// `programId`, wrapped in a JSON array).\n//\n// The hand-written types describe the consumed shape (with genuinely optional\n// `?:` fields); the codecs below validate that shape at runtime so\n// `HttpInstructionInfoDataSource` can hand the loaders a payload they can\n// dereference without runtime-throwing on a malformed descriptor.\n\nimport { array, Codec, number, optional, record, string } from \"purify-ts\";\n\nexport type CalSignatures = {\n prod?: string;\n test?: string;\n};\n\nexport type CalSignedDescriptorDto = {\n data: string;\n signatures: CalSignatures;\n};\n\n// Decoded CAL JSON shapes (snake_case mirrors the CAL response) that drive\n// host-side requirement building.\n\nexport type CalValueDto = {\n source: string;\n account_index?: number;\n data?: string;\n path?: { steps: number[] };\n};\n\nexport type CalTokenValueDto = {\n kind: string;\n value?: CalValueDto;\n account_index?: number;\n};\n\nexport type CalMintAssociationDto = {\n account_index: number;\n mint_index: number;\n};\n\nexport type CalTypePoolEntryDto = {\n index: number;\n kind: string;\n refs?: number[];\n size?: number;\n encoding?: number;\n len_kind?: string;\n flag_kind?: string;\n sentinel?: string;\n disc_kind?: string;\n total_variants?: number;\n enum_id?: string;\n};\n\nexport type CalEnumVariantDto = {\n variant_name: string;\n payload_kind?: string;\n descriptor: CalSignedDescriptorDto;\n};\n\n/** A substructure CAL serves only as opaque TLV (e.g. HIDE_RULE). */\nexport type CalSubstructureDto = {\n descriptor: string;\n};\n\nexport type CalValueFlowPortDto = CalSubstructureDto & {\n account_indices: number[];\n optional_account_strategy?: string;\n token_value: CalTokenValueDto;\n};\n\nexport type CalAccountResetDto = CalSubstructureDto & {\n account_index?: number;\n require_pre_balance_zero?: boolean;\n};\n\nexport type CalDisplayFieldDto = CalSubstructureDto & {\n name?: string;\n param?: { type: string; value?: CalValueDto; token?: CalValueDto };\n};\n\nexport type CalInstructionDescriptorDto = {\n discriminator_hex?: string;\n instruction_name?: string;\n descriptor: CalSignedDescriptorDto;\n idl_descriptor?: {\n type_pool?: CalTypePoolEntryDto[];\n root_type?: number;\n };\n mint_association?: CalMintAssociationDto;\n owner_association?: unknown;\n enum_variants?: Record<string, Record<string, CalEnumVariantDto>>;\n display_fields?: CalDisplayFieldDto[];\n value_flow_ports?: CalValueFlowPortDto[];\n hide_rules?: CalSubstructureDto[];\n account_resets?: CalAccountResetDto[];\n};\n\n// One program object of the `solana_programs` response: the program `id`, its\n// `chain_id`, and the flat `instructions` array (keyed downstream by\n// `discriminator_hex`).\nexport type CalInstructionProgramDto = {\n id: string;\n chain_id: number;\n instructions: CalInstructionDescriptorDto[];\n};\n\n// Outer shape: array of program objects (one per requested `id`).\nexport type CalInstructionInfoResponseDto = CalInstructionProgramDto[];\n\n// --- Validation codecs (runtime). Validate only the fields the loaders read;\n// `Codec.interface` ignores unknown extras so CAL can add fields freely. ---\n\nconst calSignaturesCodec = Codec.interface({\n prod: optional(string),\n test: optional(string),\n});\n\nconst calSignedDescriptorCodec = Codec.interface({\n data: string,\n signatures: calSignaturesCodec,\n});\n\nconst calEnumVariantCodec = Codec.interface({\n descriptor: calSignedDescriptorCodec,\n});\n\nconst calSubstructureCodec = Codec.interface({\n descriptor: string,\n});\n\nconst calInstructionDescriptorCodec = Codec.interface({\n discriminator_hex: optional(string),\n descriptor: calSignedDescriptorCodec,\n enum_variants: optional(record(string, record(string, calEnumVariantCodec))),\n display_fields: optional(array(calSubstructureCodec)),\n value_flow_ports: optional(array(calSubstructureCodec)),\n hide_rules: optional(array(calSubstructureCodec)),\n account_resets: optional(array(calSubstructureCodec)),\n});\n\n/**\n * Codec for one program object of the `solana_programs` response. Used by the\n * datasource to validate the CAL payload before handing it to the loaders.\n * Only loader-consumed fields are validated; unrelated CAL fields\n * (`idl_descriptor`, `mint_association`, \u2026) are ignored.\n */\nexport const calInstructionProgramCodec = Codec.interface({\n id: string,\n chain_id: number,\n instructions: array(calInstructionDescriptorCodec),\n});\n"],
5
+ "mappings": "AAQA,OAAS,SAAAA,EAAO,SAAAC,EAAO,UAAAC,EAAQ,YAAAC,EAAU,UAAAC,EAAQ,UAAAC,MAAc,YA0G/D,MAAMC,EAAqBL,EAAM,UAAU,CACzC,KAAME,EAASE,CAAM,EACrB,KAAMF,EAASE,CAAM,CACvB,CAAC,EAEKE,EAA2BN,EAAM,UAAU,CAC/C,KAAMI,EACN,WAAYC,CACd,CAAC,EAEKE,EAAsBP,EAAM,UAAU,CAC1C,WAAYM,CACd,CAAC,EAEKE,EAAuBR,EAAM,UAAU,CAC3C,WAAYI,CACd,CAAC,EAEKK,EAAgCT,EAAM,UAAU,CACpD,kBAAmBE,EAASE,CAAM,EAClC,WAAYE,EACZ,cAAeJ,EAASC,EAAOC,EAAQD,EAAOC,EAAQG,CAAmB,CAAC,CAAC,EAC3E,eAAgBL,EAASH,EAAMS,CAAoB,CAAC,EACpD,iBAAkBN,EAASH,EAAMS,CAAoB,CAAC,EACtD,WAAYN,EAASH,EAAMS,CAAoB,CAAC,EAChD,eAAgBN,EAASH,EAAMS,CAAoB,CAAC,CACtD,CAAC,EAQYE,EAA6BV,EAAM,UAAU,CACxD,GAAII,EACJ,SAAUH,EACV,aAAcF,EAAMU,CAA6B,CACnD,CAAC",
6
6
  "names": ["array", "Codec", "number", "optional", "record", "string", "calSignaturesCodec", "calSignedDescriptorCodec", "calEnumVariantCodec", "calSubstructureCodec", "calInstructionDescriptorCodec", "calInstructionProgramCodec"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as e}from"@ledgerhq/device-management-kit";import{exactly as o,oneOf as d}from"purify-ts";const t=d([o(e.NANO_X),o(e.NANO_SP),o(e.STAX),o(e.FLEX)]);export{t as deviceModelIdCodec};
1
+ import{DeviceModelId as e}from"@ledgerhq/device-management-kit";import{exactly as o,oneOf as d}from"purify-ts";const t=d([o(e.NANO_X),o(e.NANO_SP),o(e.STAX),o(e.FLEX),o(e.APEX)]);export{t as deviceModelIdCodec};
2
2
  //# sourceMappingURL=deviceModelIdCodec.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/utils/deviceModelIdCodec.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { exactly, oneOf } from \"purify-ts\";\n\n/**\n * Set of device models supported by the clear-signing and transaction-check\n * flows. Excludes `NANO_S` and `APEX`.\n */\nexport const deviceModelIdCodec = oneOf([\n exactly(DeviceModelId.NANO_X),\n exactly(DeviceModelId.NANO_SP),\n exactly(DeviceModelId.STAX),\n exactly(DeviceModelId.FLEX),\n]);\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,WAAAC,EAAS,SAAAC,MAAa,YAMxB,MAAMC,EAAqBD,EAAM,CACtCD,EAAQD,EAAc,MAAM,EAC5BC,EAAQD,EAAc,OAAO,EAC7BC,EAAQD,EAAc,IAAI,EAC1BC,EAAQD,EAAc,IAAI,CAC5B,CAAC",
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { exactly, oneOf } from \"purify-ts\";\n\n/**\n * Set of device models supported by the clear-signing and transaction-check\n * flows. Excludes `NANO_S`.\n */\nexport const deviceModelIdCodec = oneOf([\n exactly(DeviceModelId.NANO_X),\n exactly(DeviceModelId.NANO_SP),\n exactly(DeviceModelId.STAX),\n exactly(DeviceModelId.FLEX),\n exactly(DeviceModelId.APEX),\n]);\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,WAAAC,EAAS,SAAAC,MAAa,YAMxB,MAAMC,EAAqBD,EAAM,CACtCD,EAAQD,EAAc,MAAM,EAC5BC,EAAQD,EAAc,OAAO,EAC7BC,EAAQD,EAAc,IAAI,EAC1BC,EAAQD,EAAc,IAAI,EAC1BC,EAAQD,EAAc,IAAI,CAC5B,CAAC",
6
6
  "names": ["DeviceModelId", "exactly", "oneOf", "deviceModelIdCodec"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{DeviceModelId as e}from"@ledgerhq/device-management-kit";import{Right as t}from"purify-ts";import{deviceModelIdCodec as o}from"./deviceModelIdCodec";describe("deviceModelIdCodec",()=>{it.each([e.NANO_X,e.NANO_SP,e.STAX,e.FLEX])("decodes %s as Right",d=>{expect(o.decode(d)).toEqual(t(d))}),it("rejects NANO_S (unsupported for clear-signing)",()=>{expect(o.decode(e.NANO_S).isLeft()).toBe(!0)}),it.each([null,void 0,"","ledger",42,{},[]])("rejects non-model values: %s",d=>{expect(o.decode(d).isLeft()).toBe(!0)}),it("encodes a model as itself",()=>{expect(o.encode(e.NANO_X)).toBe(e.NANO_X)})});
1
+ import{DeviceModelId as e}from"@ledgerhq/device-management-kit";import{Right as t}from"purify-ts";import{deviceModelIdCodec as o}from"./deviceModelIdCodec";describe("deviceModelIdCodec",()=>{it.each([e.NANO_X,e.NANO_SP,e.STAX,e.FLEX,e.APEX])("decodes %s as Right",d=>{expect(o.decode(d)).toEqual(t(d))}),it("rejects NANO_S (unsupported for clear-signing)",()=>{expect(o.decode(e.NANO_S).isLeft()).toBe(!0)}),it.each([null,void 0,"","ledger",42,{},[]])("rejects non-model values: %s",d=>{expect(o.decode(d).isLeft()).toBe(!0)}),it("encodes a model as itself",()=>{expect(o.encode(e.NANO_X)).toBe(e.NANO_X)})});
2
2
  //# sourceMappingURL=deviceModelIdCodec.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/shared/utils/deviceModelIdCodec.test.ts"],
4
- "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Right } from \"purify-ts\";\n\nimport { deviceModelIdCodec } from \"./deviceModelIdCodec\";\n\ndescribe(\"deviceModelIdCodec\", () => {\n it.each([\n DeviceModelId.NANO_X,\n DeviceModelId.NANO_SP,\n DeviceModelId.STAX,\n DeviceModelId.FLEX,\n ])(\"decodes %s as Right\", (model) => {\n expect(deviceModelIdCodec.decode(model)).toEqual(Right(model));\n });\n\n it(\"rejects NANO_S (unsupported for clear-signing)\", () => {\n expect(deviceModelIdCodec.decode(DeviceModelId.NANO_S).isLeft()).toBe(true);\n });\n\n it.each([null, undefined, \"\", \"ledger\", 42, {}, []])(\n \"rejects non-model values: %s\",\n (value) => {\n expect(deviceModelIdCodec.decode(value).isLeft()).toBe(true);\n },\n );\n\n it(\"encodes a model as itself\", () => {\n expect(deviceModelIdCodec.encode(DeviceModelId.NANO_X)).toBe(\n DeviceModelId.NANO_X,\n );\n });\n});\n"],
5
- "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,SAAAC,MAAa,YAEtB,OAAS,sBAAAC,MAA0B,uBAEnC,SAAS,qBAAsB,IAAM,CACnC,GAAG,KAAK,CACNF,EAAc,OACdA,EAAc,QACdA,EAAc,KACdA,EAAc,IAChB,CAAC,EAAE,sBAAwBG,GAAU,CACnC,OAAOD,EAAmB,OAAOC,CAAK,CAAC,EAAE,QAAQF,EAAME,CAAK,CAAC,CAC/D,CAAC,EAED,GAAG,iDAAkD,IAAM,CACzD,OAAOD,EAAmB,OAAOF,EAAc,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAI,CAC5E,CAAC,EAED,GAAG,KAAK,CAAC,KAAM,OAAW,GAAI,SAAU,GAAI,CAAC,EAAG,CAAC,CAAC,CAAC,EACjD,+BACCI,GAAU,CACT,OAAOF,EAAmB,OAAOE,CAAK,EAAE,OAAO,CAAC,EAAE,KAAK,EAAI,CAC7D,CACF,EAEA,GAAG,4BAA6B,IAAM,CACpC,OAAOF,EAAmB,OAAOF,EAAc,MAAM,CAAC,EAAE,KACtDA,EAAc,MAChB,CACF,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { DeviceModelId } from \"@ledgerhq/device-management-kit\";\nimport { Right } from \"purify-ts\";\n\nimport { deviceModelIdCodec } from \"./deviceModelIdCodec\";\n\ndescribe(\"deviceModelIdCodec\", () => {\n it.each([\n DeviceModelId.NANO_X,\n DeviceModelId.NANO_SP,\n DeviceModelId.STAX,\n DeviceModelId.FLEX,\n DeviceModelId.APEX,\n ])(\"decodes %s as Right\", (model) => {\n expect(deviceModelIdCodec.decode(model)).toEqual(Right(model));\n });\n\n it(\"rejects NANO_S (unsupported for clear-signing)\", () => {\n expect(deviceModelIdCodec.decode(DeviceModelId.NANO_S).isLeft()).toBe(true);\n });\n\n it.each([null, undefined, \"\", \"ledger\", 42, {}, []])(\n \"rejects non-model values: %s\",\n (value) => {\n expect(deviceModelIdCodec.decode(value).isLeft()).toBe(true);\n },\n );\n\n it(\"encodes a model as itself\", () => {\n expect(deviceModelIdCodec.encode(DeviceModelId.NANO_X)).toBe(\n DeviceModelId.NANO_X,\n );\n });\n});\n"],
5
+ "mappings": "AAAA,OAAS,iBAAAA,MAAqB,kCAC9B,OAAS,SAAAC,MAAa,YAEtB,OAAS,sBAAAC,MAA0B,uBAEnC,SAAS,qBAAsB,IAAM,CACnC,GAAG,KAAK,CACNF,EAAc,OACdA,EAAc,QACdA,EAAc,KACdA,EAAc,KACdA,EAAc,IAChB,CAAC,EAAE,sBAAwBG,GAAU,CACnC,OAAOD,EAAmB,OAAOC,CAAK,CAAC,EAAE,QAAQF,EAAME,CAAK,CAAC,CAC/D,CAAC,EAED,GAAG,iDAAkD,IAAM,CACzD,OAAOD,EAAmB,OAAOF,EAAc,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAI,CAC5E,CAAC,EAED,GAAG,KAAK,CAAC,KAAM,OAAW,GAAI,SAAU,GAAI,CAAC,EAAG,CAAC,CAAC,CAAC,EACjD,+BACCI,GAAU,CACT,OAAOF,EAAmB,OAAOE,CAAK,EAAE,OAAO,CAAC,EAAE,KAAK,EAAI,CAC7D,CACF,EAEA,GAAG,4BAA6B,IAAM,CACpC,OAAOF,EAAmB,OAAOF,EAAc,MAAM,CAAC,EAAE,KACtDA,EAAc,MAChB,CACF,CAAC,CACH,CAAC",
6
6
  "names": ["DeviceModelId", "Right", "deviceModelIdCodec", "model", "value"]
7
7
  }
@@ -21,17 +21,5 @@ export declare class SolanaTransactionCheckLoader implements TransactionCheckLoa
21
21
  constructor(transactionCheckDataSource: TransactionCheckDataSource, certificateLoader: PkiCertificateLoader, loggerFactory: (tag: string) => LoggerPublisherService, bs58Encoder?: Bs58Encoder);
22
22
  canHandle(input: unknown, expectedType: ClearSignContextType[]): input is SolanaTransactionCheckContextInput;
23
23
  load(ctx: SolanaTransactionCheckContextInput): Promise<ClearSignContext[]>;
24
- /**
25
- * Wrap a serialized Solana Message into a serialized Transaction expected
26
- * by the web3checks endpoint, by prepending a compact-u16 signature count
27
- * and the matching number of zero-filled signature placeholders.
28
- *
29
- * Supports legacy and versioned messages: versioned messages start with a
30
- * version prefix byte (high bit set), shifting `numRequiredSignatures` by
31
- * one position.
32
- */
33
- private wrapMessageAsTransaction;
34
- private readNumRequiredSignatures;
35
- private encodeShortVec;
36
24
  }
37
25
  //# sourceMappingURL=SolanaTransactionCheckLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolanaTransactionCheckLoader.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAEjG,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,wEAAwE,CAAC;AAEzH,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAEpH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,UAAU,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,6BAA6B,CAAC;CACjD,CAAC;AAsBF,qBACa,4BACX,YAAW,sBAAsB,CAAC,kCAAkC,CAAC;IAMnE,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAE3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;gBAI7B,0BAA0B,EAAE,0BAA0B,EAEtD,iBAAiB,EAAE,oBAAoB,EAExD,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,EACrC,WAAW,GAAE,WAAgC;IAKhE,SAAS,CACP,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,oBAAoB,EAAE,GACnC,KAAK,IAAI,kCAAkC;IAUxC,IAAI,CACR,GAAG,EAAE,kCAAkC,GACtC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAkD9B;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,yBAAyB;IAuBjC,OAAO,CAAC,cAAc;CAcvB"}
1
+ {"version":3,"file":"SolanaTransactionCheckLoader.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/multichain/transaction-check/loaders/SolanaTransactionCheckLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAEjG,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,wEAAwE,CAAC;AAEzH,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAEpH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,UAAU,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,6BAA6B,CAAC;CACjD,CAAC;AAeF,qBACa,4BACX,YAAW,sBAAsB,CAAC,kCAAkC,CAAC;IAMnE,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAE3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;gBAI7B,0BAA0B,EAAE,0BAA0B,EAEtD,iBAAiB,EAAE,oBAAoB,EAExD,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,sBAAsB,EACrC,WAAW,GAAE,WAAgC;IAKhE,SAAS,CACP,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,oBAAoB,EAAE,GACnC,KAAK,IAAI,kCAAkC;IAUxC,IAAI,CACR,GAAG,EAAE,kCAAkC,GACtC,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAmC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"HttpInstructionInfoDataSource.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAIrF,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AAoBrC,qBACa,6BACX,YAAW,yBAAyB;IAIlC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,MAAM,EAAE,0BAA0B,EAElC,IAAI,EAAE,gBAAgB;IAG5B,kBAAkB,CAAC,EAC9B,SAAS,EACT,OAAO,GACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;CA4F5E"}
1
+ {"version":3,"file":"HttpInstructionInfoDataSource.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/solana/instruction-info/data/HttpInstructionInfoDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAe,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAIrF,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AAoBrC,qBACa,6BACX,YAAW,yBAAyB;IAIlC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,MAAM,EAAE,0BAA0B,EAElC,IAAI,EAAE,gBAAgB;IAG5B,kBAAkB,CAAC,EAC9B,SAAS,EACT,OAAO,GACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;CA8F5E"}
@@ -64,7 +64,7 @@ export type CalDisplayFieldDto = CalSubstructureDto & {
64
64
  };
65
65
  };
66
66
  export type CalInstructionDescriptorDto = {
67
- discriminator_hex: string;
67
+ discriminator_hex?: string;
68
68
  instruction_name?: string;
69
69
  descriptor: CalSignedDescriptorDto;
70
70
  idl_descriptor?: {
@@ -95,7 +95,7 @@ export declare const calInstructionProgramCodec: Codec<{
95
95
  id: string;
96
96
  chain_id: number;
97
97
  instructions: {
98
- discriminator_hex: string;
98
+ discriminator_hex: string | undefined;
99
99
  descriptor: {
100
100
  data: string;
101
101
  signatures: {
@@ -1 +1 @@
1
- {"version":3,"file":"InstructionInfoDto.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/solana/instruction-info/data/InstructionInfoDto.ts"],"names":[],"mappings":"AAQA,OAAO,EAAS,KAAK,EAAoC,MAAM,WAAW,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,aAAa,CAAC;CAC3B,CAAC;AAKF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EA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CAAC,EAAE;QACf,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;QAClC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACtC,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACzC,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACvC,CAAC;AAKF,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,2BAA2B,EAAE,CAAC;CAC7C,CAAC;AAGF,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,EAAE,CAAC;AAiCvE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC"}
1
+ {"version":3,"file":"InstructionInfoDto.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/solana/instruction-info/data/InstructionInfoDto.ts"],"names":[],"mappings":"AAQA,OAAO,EAAS,KAAK,EAAoC,MAAM,WAAW,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,aAAa,CAAC;CAC3B,CAAC;AAKF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { DeviceModelId } from "@ledgerhq/device-management-kit";
2
2
  /**
3
3
  * Set of device models supported by the clear-signing and transaction-check
4
- * flows. Excludes `NANO_S` and `APEX`.
4
+ * flows. Excludes `NANO_S`.
5
5
  */
6
- export declare const deviceModelIdCodec: import("purify-ts").Codec<DeviceModelId.NANO_SP | DeviceModelId.NANO_X | DeviceModelId.STAX | DeviceModelId.FLEX>;
6
+ export declare const deviceModelIdCodec: import("purify-ts").Codec<DeviceModelId.NANO_SP | DeviceModelId.NANO_X | DeviceModelId.STAX | DeviceModelId.FLEX | DeviceModelId.APEX>;
7
7
  //# sourceMappingURL=deviceModelIdCodec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deviceModelIdCodec.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/deviceModelIdCodec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,mHAK7B,CAAC"}
1
+ {"version":3,"file":"deviceModelIdCodec.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/deviceModelIdCodec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,wIAM7B,CAAC"}