{"_id":"@adamik/sdk","_rev":"5-a641ae722647d915c29cf06badcbf71a","name":"@adamik/sdk","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@adamik/sdk","version":"1.0.0","keywords":["adamik","blockchain","sdk","typescript","cryptocurrency","transaction","verification","multi-chain"],"author":{"name":"Adamik SAS"},"license":"MIT","_id":"@adamik/sdk@1.0.0","maintainers":[{"name":"hakim-adamik","email":"admin@adamik.io"},{"name":"snear","email":"fabrice@adamik.io"}],"homepage":"https://github.com/AdamikHQ/adamik-sdk#readme","bugs":{"url":"https://github.com/AdamikHQ/adamik-sdk/issues"},"dist":{"shasum":"9e5b1789ec31602dd3bc1405f0cc2e5d665d8d68","tarball":"https://registry.npmjs.org/@adamik/sdk/-/sdk-1.0.0.tgz","fileCount":119,"integrity":"sha512-UvpNGvwbiHA+tsgZ220ZYfJ+rpGvJQ1idqB0fNrOJNtbGwR6atFXW/1+YDZ0vhKFOqYP17J5eqYh6wroqsaO3Q==","signatures":[{"sig":"MEUCIHYsRL68YbBe4a8sCP1PbO4E1o2a64lOlosJw0YIAgjXAiEA+kP93CbKFeFioBKvv3AIO0UmIAN4CIQnhiSlUZDt/w8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":638509},"main":"dist/src/index.js","types":"dist/src/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"6e2306d38e192d598a77356618c7d3beb76db816","scripts":{"dev":"ts-node src/index.ts","lint":"eslint src tests --ext .ts","test":"jest","build":"tsc","format":"prettier --write .","lint:fix":"eslint src tests --ext .ts --fix","test:evm":"jest --testNamePattern='EVM|Ethereum'","typecheck":"tsc --noEmit","test:watch":"jest --watch","format:check":"prettier --check .","test:bitcoin":"jest --testNamePattern='Bitcoin'","test:decoders":"jest --testNamePattern='Decoders'","prepublishOnly":"pnpm run build && pnpm run typecheck && pnpm test"},"_npmUser":{"name":"snear","email":"fabrice@adamik.io"},"repository":{"url":"git+https://github.com/AdamikHQ/adamik-sdk.git","type":"git"},"_npmVersion":"10.7.0","description":"TypeScript SDK for verifying Adamik API responses and decoding blockchain transactions","directories":{},"_nodeVersion":"18.20.4","dependencies":{"zod":"^3.23.8","viem":"^2.32.0","tronweb":"^6.0.3","cosmjs-types":"^0.9.0","bitcoinjs-lib":"^6.1.7","@solana/web3.js":"^1.95.0","@cosmjs/encoding":"^0.34.0","@cosmjs/stargate":"^0.34.0","@solana/spl-token":"^0.4.13","@cosmjs/proto-signing":"^0.34.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^11.0.3","jest":"^30.0.4","eslint":"^8.57.0","ts-jest":"^29.4.0","ts-node":"^10.9.2","prettier":"^3.6.2","jest-junit":"^16.0.0","typescript":"^5.8.3","@types/glob":"^9.0.0","@types/jest":"^30.0.0","@types/node":"^18.0.0","@jest/reporters":"^30.0.4","jest-html-reporter":"^4.3.0","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.0.0","@typescript-eslint/eslint-plugin":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1753776715879_0.826104892197123","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@adamik/sdk","version":"1.0.2","keywords":["adamik","blockchain","sdk","typescript","cryptocurrency","transaction","verification","multi-chain"],"author":{"name":"Adamik SAS"},"license":"MIT","_id":"@adamik/sdk@1.0.2","maintainers":[{"name":"hakim-adamik","email":"admin@adamik.io"},{"name":"snear","email":"fabrice@adamik.io"}],"homepage":"https://github.com/AdamikHQ/adamik-sdk#readme","bugs":{"url":"https://github.com/AdamikHQ/adamik-sdk/issues"},"dist":{"shasum":"6da8684bf35c0761fa281b7ff5f0d7e8c4a148a2","tarball":"https://registry.npmjs.org/@adamik/sdk/-/sdk-1.0.2.tgz","fileCount":119,"integrity":"sha512-sYpni7J+DFnZtGfUi1wxRdwKXMheeqkOBmh5BA9/2gboC5DY8NTAMfb6QkN7sg8DFkYuDk+lN7x/cj+tsh7wig==","signatures":[{"sig":"MEUCIQD04Qw5sKWDzFhyH8I6HszQE+10dzF0m8B+ydpkZKZsgAIgYG0j4YU1Vqo2B9SlDxBUWpXKrzuyUagznBFWlYe3GEY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":639414},"main":"dist/src/index.js","_from":"file:adamik-sdk-1.0.2.tgz","types":"dist/src/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"ts-node src/index.ts","lint":"eslint src tests --ext .ts","test":"jest","build":"tsc","format":"prettier --write .","lint:fix":"eslint src tests --ext .ts --fix","test:evm":"jest --testNamePattern='EVM|Ethereum'","typecheck":"tsc --noEmit","test:watch":"jest --watch","format:check":"prettier --check .","test:bitcoin":"jest --testNamePattern='Bitcoin'","test:decoders":"jest --testNamePattern='Decoders'"},"_npmUser":{"name":"hakim-adamik","email":"admin@adamik.io"},"_resolved":"/tmp/3e62c9740deed4aefb09a1819a2319d5/adamik-sdk-1.0.2.tgz","_integrity":"sha512-sYpni7J+DFnZtGfUi1wxRdwKXMheeqkOBmh5BA9/2gboC5DY8NTAMfb6QkN7sg8DFkYuDk+lN7x/cj+tsh7wig==","repository":{"url":"git+https://github.com/AdamikHQ/adamik-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"TypeScript SDK for verifying Adamik API responses and decoding blockchain transactions","directories":{},"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.23.8","viem":"^2.32.0","tronweb":"^6.0.3","cosmjs-types":"^0.9.0","bitcoinjs-lib":"^6.1.7","@solana/web3.js":"^1.95.0","@cosmjs/encoding":"^0.34.0","@cosmjs/stargate":"^0.34.0","@solana/spl-token":"^0.4.13","@cosmjs/proto-signing":"^0.34.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^11.0.3","jest":"^30.0.4","eslint":"^8.57.0","ts-jest":"^29.4.0","ts-node":"^10.9.2","prettier":"^3.6.2","jest-junit":"^16.0.0","typescript":"^5.8.3","@types/glob":"^9.0.0","@types/jest":"^30.0.0","@types/node":"^18.0.0","@jest/reporters":"^30.0.4","jest-html-reporter":"^4.3.0","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.0.0","@typescript-eslint/eslint-plugin":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.2_1758192421936_0.17786277107821213","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@adamik/sdk","version":"1.0.3","keywords":["adamik","blockchain","sdk","typescript","cryptocurrency","transaction","verification","multi-chain"],"author":{"name":"Adamik SAS"},"license":"MIT","_id":"@adamik/sdk@1.0.3","maintainers":[{"name":"hakim-adamik","email":"admin@adamik.io"},{"name":"snear","email":"fabrice@adamik.io"}],"homepage":"https://github.com/AdamikHQ/adamik-sdk#readme","bugs":{"url":"https://github.com/AdamikHQ/adamik-sdk/issues"},"dist":{"shasum":"dc5c1f478ca456859a4fb78ac20a5eec01e6f1e8","tarball":"https://registry.npmjs.org/@adamik/sdk/-/sdk-1.0.3.tgz","fileCount":119,"integrity":"sha512-kfB0HwOV0TjST6yr0v3aT1dpgHgjy2/yfGNvBaNFV694F2UGM5E97mFqjnPDl6lD9hWHgaVUFzqxwW244uFRRg==","signatures":[{"sig":"MEUCIGLfNbMcwPC/eUrQRw5fYeN0xa0VMvzjgfcSI9tXxRkOAiEAtgpntduFi1cKcgoHcp4Vx5sEBfXrblJo7EJ5I6Y51BI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":642252},"main":"dist/src/index.js","_from":"file:adamik-sdk-1.0.3.tgz","types":"dist/src/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"ts-node src/index.ts","lint":"eslint src tests --ext .ts","test":"jest","build":"tsc","format":"prettier --write .","lint:fix":"eslint src tests --ext .ts --fix","test:evm":"jest --testNamePattern='EVM|Ethereum'","typecheck":"tsc --noEmit","test:watch":"jest --watch","format:check":"prettier --check .","test:bitcoin":"jest --testNamePattern='Bitcoin'","test:decoders":"jest --testNamePattern='Decoders'"},"_npmUser":{"name":"hakim-adamik","email":"admin@adamik.io"},"_resolved":"/tmp/180712a8265c94bc7f5437c973e35088/adamik-sdk-1.0.3.tgz","_integrity":"sha512-kfB0HwOV0TjST6yr0v3aT1dpgHgjy2/yfGNvBaNFV694F2UGM5E97mFqjnPDl6lD9hWHgaVUFzqxwW244uFRRg==","repository":{"url":"git+https://github.com/AdamikHQ/adamik-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"TypeScript SDK for verifying Adamik API responses and decoding blockchain transactions","directories":{},"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.23.8","viem":"^2.32.0","tronweb":"^6.0.3","cosmjs-types":"^0.9.0","bitcoinjs-lib":"^6.1.7","@solana/web3.js":"^1.95.0","@cosmjs/encoding":"^0.34.0","@cosmjs/stargate":"^0.34.0","@solana/spl-token":"^0.4.13","@cosmjs/proto-signing":"^0.34.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^11.0.3","jest":"^30.0.4","eslint":"^8.57.0","ts-jest":"^29.4.0","ts-node":"^10.9.2","prettier":"^3.6.2","jest-junit":"^16.0.0","typescript":"^5.8.3","@types/glob":"^9.0.0","@types/jest":"^30.0.0","@types/node":"^18.0.0","@jest/reporters":"^30.0.4","jest-html-reporter":"^4.3.0","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.0.0","@typescript-eslint/eslint-plugin":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.3_1758202831532_0.07594519517466591","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@adamik/sdk","version":"1.0.4","keywords":["adamik","blockchain","sdk","typescript","cryptocurrency","transaction","verification","multi-chain"],"author":{"name":"Adamik SAS"},"license":"MIT","_id":"@adamik/sdk@1.0.4","maintainers":[{"name":"hakim-adamik","email":"admin@adamik.io"},{"name":"snear","email":"fabrice@adamik.io"}],"homepage":"https://github.com/AdamikHQ/adamik-sdk#readme","bugs":{"url":"https://github.com/AdamikHQ/adamik-sdk/issues"},"dist":{"shasum":"5bd1c79a808ca704904dfc9a078ace000ce89299","tarball":"https://registry.npmjs.org/@adamik/sdk/-/sdk-1.0.4.tgz","fileCount":119,"integrity":"sha512-6qNUpEQOO5RCHXosTCVa+FlkO5bd/w2yAMrGiQm+FauTKfbwszq/a0nPjEFrkGMY8oou9sruX/hpH6JS3Q512Q==","signatures":[{"sig":"MEUCIAb1MhLCpE8syafv4mAz/V80DrNAs9rYEzHTzLCe9kK8AiEAr2qhUROUtiJsi6GdmYFz33TdoFymQQUssJNfCe6i4EE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":649378},"main":"dist/src/index.js","_from":"file:adamik-sdk-1.0.4.tgz","types":"dist/src/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"ts-node src/index.ts","lint":"eslint src tests --ext .ts","test":"jest","build":"tsc","format":"prettier --write .","lint:fix":"eslint src tests --ext .ts --fix","test:evm":"jest --testNamePattern='EVM|Ethereum'","typecheck":"tsc --noEmit","test:watch":"jest --watch","format:check":"prettier --check .","test:bitcoin":"jest --testNamePattern='Bitcoin'","test:decoders":"jest --testNamePattern='Decoders'"},"_npmUser":{"name":"hakim-adamik","email":"admin@adamik.io"},"_resolved":"/tmp/dae3da48b5b3faddf3ea7353187c1c33/adamik-sdk-1.0.4.tgz","_integrity":"sha512-6qNUpEQOO5RCHXosTCVa+FlkO5bd/w2yAMrGiQm+FauTKfbwszq/a0nPjEFrkGMY8oou9sruX/hpH6JS3Q512Q==","repository":{"url":"git+https://github.com/AdamikHQ/adamik-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"TypeScript SDK for verifying Adamik API responses and decoding blockchain transactions","directories":{},"_nodeVersion":"22.14.0","dependencies":{"zod":"^3.23.8","viem":"^2.32.0","tronweb":"^6.0.3","cosmjs-types":"^0.9.0","bitcoinjs-lib":"^6.1.7","@solana/web3.js":"^1.95.0","@cosmjs/encoding":"^0.34.0","@cosmjs/stargate":"^0.34.0","@solana/spl-token":"^0.4.13","@cosmjs/proto-signing":"^0.34.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^11.0.3","jest":"^30.0.4","eslint":"^8.57.0","ts-jest":"^29.4.0","ts-node":"^10.9.2","prettier":"^3.6.2","jest-junit":"^16.0.0","typescript":"^5.8.3","@types/glob":"^9.0.0","@types/jest":"^30.0.0","@types/node":"^18.0.0","@jest/reporters":"^30.0.4","jest-html-reporter":"^4.3.0","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.0.0","@typescript-eslint/eslint-plugin":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.4_1758293102861_0.36185778405495883","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@adamik/sdk","version":"1.0.5","main":"dist/src/index.js","types":"dist/src/index.d.ts","keywords":["adamik","blockchain","sdk","typescript","cryptocurrency","transaction","verification","multi-chain"],"author":{"name":"Adamik SAS"},"license":"MIT","description":"TypeScript SDK for verifying Adamik API responses and decoding blockchain transactions","repository":{"type":"git","url":"git+https://github.com/AdamikHQ/adamik-sdk.git"},"bugs":{"url":"https://github.com/AdamikHQ/adamik-sdk/issues"},"homepage":"https://github.com/AdamikHQ/adamik-sdk#readme","engines":{"node":">=18.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"devDependencies":{"@jest/reporters":"^30.0.4","@types/glob":"^9.0.0","@types/jest":"^30.0.0","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","eslint":"^8.57.0","eslint-config-prettier":"^9.1.0","glob":"^11.0.3","jest":"^30.0.4","jest-html-reporter":"^4.3.0","jest-junit":"^16.0.0","prettier":"^3.6.2","ts-jest":"^29.4.0","ts-node":"^10.9.2","typescript":"^5.8.3"},"dependencies":{"@cosmjs/encoding":"^0.34.0","@cosmjs/proto-signing":"^0.34.0","@cosmjs/stargate":"^0.34.0","@solana/spl-token":"^0.4.13","@solana/web3.js":"^1.95.0","bitcoinjs-lib":"^6.1.7","cosmjs-types":"^0.9.0","tronweb":"^6.0.3","viem":"^2.32.0","zod":"^3.23.8"},"scripts":{"build":"tsc","test":"jest","test:watch":"jest --watch","test:bitcoin":"jest --testNamePattern='Bitcoin'","test:evm":"jest --testNamePattern='EVM|Ethereum'","test:decoders":"jest --testNamePattern='Decoders'","dev":"ts-node src/index.ts","format":"prettier --write .","format:check":"prettier --check .","typecheck":"tsc --noEmit","lint":"eslint src tests --ext .ts","lint:fix":"eslint src tests --ext .ts --fix"},"_id":"@adamik/sdk@1.0.5","_integrity":"sha512-u04EUJc5IqepguhfXU3QKCQnxSLCIiG5pcyk4tLkSCoECPh+6eRvNLfhHJfnGi+v1C4KrC1Foi+LbqVfoly7BA==","_resolved":"/tmp/f98c1d51dc2ab51112b67b58fffd516a/adamik-sdk-1.0.5.tgz","_from":"file:adamik-sdk-1.0.5.tgz","_nodeVersion":"22.14.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-u04EUJc5IqepguhfXU3QKCQnxSLCIiG5pcyk4tLkSCoECPh+6eRvNLfhHJfnGi+v1C4KrC1Foi+LbqVfoly7BA==","shasum":"a178c010b3d9361c66c0dd88ea2c24687408c9fa","tarball":"https://registry.npmjs.org/@adamik/sdk/-/sdk-1.0.5.tgz","fileCount":119,"unpackedSize":663331,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCbL/gZ0HlsK5l5lRgyeHzOR4Rol9Fo652DefHAAIG/nQIgJUZ0tXoXVS7KYYAvmPFMS3uimBCPgMd/cDlFyikWhk4="}]},"_npmUser":{"name":"hakim-adamik","email":"admin@adamik.io"},"directories":{},"maintainers":[{"name":"hakim-adamik","email":"admin@adamik.io"},{"name":"snear","email":"fabrice@adamik.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.5_1758731414499_0.05940547580676103"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-29T08:11:55.803Z","modified":"2025-09-24T16:30:14.907Z","1.0.0":"2025-07-29T08:11:56.064Z","1.0.2":"2025-09-18T10:47:02.129Z","1.0.3":"2025-09-18T13:40:31.692Z","1.0.4":"2025-09-19T14:45:03.125Z","1.0.5":"2025-09-24T16:30:14.717Z"},"bugs":{"url":"https://github.com/AdamikHQ/adamik-sdk/issues"},"author":{"name":"Adamik SAS"},"license":"MIT","homepage":"https://github.com/AdamikHQ/adamik-sdk#readme","keywords":["adamik","blockchain","sdk","typescript","cryptocurrency","transaction","verification","multi-chain"],"repository":{"type":"git","url":"git+https://github.com/AdamikHQ/adamik-sdk.git"},"description":"TypeScript SDK for verifying Adamik API responses and decoding blockchain transactions","maintainers":[{"name":"hakim-adamik","email":"admin@adamik.io"},{"name":"snear","email":"fabrice@adamik.io"}],"readme":"# Adamik SDK\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://badge.fury.io/js/@adamik/sdk.svg)](https://badge.fury.io/js/@adamik/sdk)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.8-blue)](https://www.typescriptlang.org/)\n[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-green)](https://nodejs.org/)\n\nA TypeScript/Node.js SDK with two powerful capabilities:\n\n1. **🔓 Multi-chain Transaction Decoder** - Decode raw unsigned transactions across multiple blockchains\n2. **🛡️ Security Verification** - Verify that API responses match your original transaction intent before signing\n\n## Two Ways to Use This SDK\n\n### 1. As a Multi-chain Decoder\n\nDecode raw transaction data from any blockchain without needing blockchain-specific libraries:\n\n```typescript\nimport AdamikSDK from \"@adamik/sdk\";\n\nconst sdk = new AdamikSDK();\n\n// Decode an Ethereum transaction\nconst ethResult = await sdk.decode({\n  chainId: \"ethereum\",\n  format: \"RLP\",\n  encodedData: \"0xf86c0a8502540be400...\",\n});\n\nconsole.log(ethResult.decoded);\n// { recipientAddress: \"0x...\", amount: \"1000000000000000000\", ... }\n\n// Decode a Bitcoin PSBT\nconst btcResult = await sdk.decode({\n  chainId: \"bitcoin\",\n  format: \"PSBT\",\n  encodedData: \"cHNidP8BAH0CAAAAAf...\",\n});\n\n// Decode a Cosmos transaction\nconst cosmosResult = await sdk.decode({\n  chainId: \"cosmoshub\",\n  format: \"COSMOS_PROTOBUF\",\n  encodedData: \"0a9f010a9c010a...\",\n});\n```\n\n### 2. As a Security Verification Tool\n\nVerify that transaction data from any API matches your original intent:\n\n```typescript\n// Your intent\nconst intent = { recipientAddress: \"0x123...\", amount: \"1000\" };\n\n// API response (from Adamik or any source)\nconst apiResponse = await getTransactionFromAPI(intent);\n\n// Verify before signing!\nconst result = await sdk.verify(apiResponse, intent);\nif (!result.isValid) {\n  throw new Error(\"Transaction doesn't match intent!\");\n}\n```\n\n## Features\n\n- **🔓 Multi-chain Decoding**: Unified interface for decoding transactions across blockchains\n- **🛡️ Security Verification**: Two-step validation of API responses\n- **📦 TypeScript Support**: Full type definitions and IDE support\n- **🔍 Real Decoders**: Production-ready decoders for EVM, Bitcoin, Cosmos, and Tron\n- **✅ Comprehensive Testing**: 92 tests across 9 test suites\n- **🏗️ Clean Architecture**: Modular design with utility classes\n- **⚡ Minimal Dependencies**: Only trusted blockchain libraries\n- **🔍 Chain Discovery**: Runtime methods to discover supported chains and formats\n\n## Supported Blockchains\n\n**Real Decoders Available:**\n\n- **EVM Chains**: Ethereum, Polygon, BSC, Avalanche, Arbitrum, Optimism, Base (37 chains using `viem`)\n- **Bitcoin**: Bitcoin mainnet and testnet (5 chains using `bitcoinjs-lib`)\n- **Cosmos SDK**: Cosmos Hub, Celestia, Injective, Babylon (42 chains using `@cosmjs/proto-signing`)\n- **Tron**: Tron mainnet with TRC20 support (using `tronweb`)\n- **Solana**: Solana with SPL token support (using `@solana/web3.js`)\n\n**Total: 86 chains with real decoders**\n\nUse `sdk.getSupportedChains()` to get the complete list of supported chains at runtime.\n\n## Prerequisites\n\n- Node.js >= 18.0.0\n- TypeScript >= 5.0 (for development)\n\n## Installation\n\n```bash\nnpm install @adamik/sdk\n# or\nyarn add @adamik/sdk\n# or\npnpm add @adamik/sdk\n```\n\n## Quick Start\n\n### Decode Transactions\n\n```typescript\nimport AdamikSDK from \"@adamik/sdk\";\n\nconst sdk = new AdamikSDK();\n\n// Example: Decode an Ethereum transaction\nconst result = await sdk.decode({\n  chainId: \"ethereum\",\n  format: \"RLP\",\n  encodedData: \"0xf86c0a8502540be400...\",\n});\n\nif (result.decoded) {\n  console.log(\"To:\", result.decoded.recipientAddress);\n  console.log(\"Amount:\", result.decoded.amount);\n  console.log(\"Mode:\", result.decoded.mode);\n}\n```\n\n### Verify API Responses\n\n```typescript\n// Your transaction intent\nconst intent = {\n  mode: \"transfer\",\n  recipientAddress: \"0x123...\",\n  amount: \"1000000000000000000\" // 1 ETH\n};\n\n// Get response from API\nconst apiResponse = await fetch(...).then(r => r.json());\n\n// Verify before signing!\nconst verification = await sdk.verify(apiResponse, intent);\n\nif (verification.isValid) {\n  // Safe to sign\n  await wallet.sign(apiResponse.transaction.encoded[0].raw.value);\n} else {\n  console.error(\"Transaction tampered:\", verification.errors);\n}\n```\n\n### Supported Formats\n\n| Blockchain                   | Format          | Status               | Library Used            |\n| ---------------------------- | --------------- | -------------------- | ----------------------- |\n| Ethereum, Polygon, BSC, etc. | RLP             | ✅ Real              | `viem`                  |\n| Bitcoin                      | PSBT            | ✅ Real              | `bitcoinjs-lib`         |\n| Cosmos Hub, Celestia, etc.   | COSMOS_PROTOBUF | ✅ Real              | `@cosmjs/proto-signing` |\n| Tron                         | RAW_TRANSACTION | ✅ Real              | `tronweb`               |\n| Solana                       | BORSH           | ✅ Real              | `@solana/web3.js`       |\n| Algorand, Aptos, TON         | Various         | ❌ Not supported yet | -                       |\n\n### How Security Works\n\nThe SDK provides two levels of verification:\n\n**1. Intent Validation** (all chains):\n\n- Transaction mode matches (transfer, stake, etc.)\n- Recipient address matches\n- Amount matches\n- Token ID matches (for token transfers)\n\n**2. Encoded Validation** (EVM, Bitcoin, Cosmos, Tron, Solana):\n\n- Decodes the actual transaction bytes\n- Verifies decoded data matches intent\n- Catches malicious encoded transactions\n\n```typescript\n// Attack example: API shows correct data but encoded transaction sends elsewhere\nconst intent = {\n  recipientAddress: \"0xYourFriend...\",\n  amount: \"100\",\n};\n\nconst maliciousResponse = {\n  transaction: {\n    data: intent, // Shows correct data\n    encoded: [\n      {\n        raw: {\n          value: \"0x...\", // But sends to attacker!\n        },\n      },\n    ],\n  },\n};\n\n// SDK catches the attack\nconst result = await sdk.verify(maliciousResponse, intent);\nconsole.log(result.isValid); // false\nconsole.log(result.errors); // [\"Critical: Decoded recipient mismatch\"]\n```\n\n## Usage Examples\n\n### Complete Example with Adamik API\n\n```typescript\nimport AdamikSDK from \"@adamik/sdk\";\n\nconst sdk = new AdamikSDK();\n\n// 1. Define your transaction intent\nconst intent = {\n  mode: \"transfer\",\n  senderAddress: \"0x1234...\",\n  recipientAddress: \"0xABCD...\",\n  amount: \"1000000000000000000\", // 1 ETH\n};\n\n// 2. Get encoded transaction from Adamik API\nconst apiResponse = await fetch(\"https://api.adamik.io/v1/ethereum/transaction/encode\", {\n  method: \"POST\",\n  headers: {\n    Authorization: \"Bearer YOUR_API_KEY\",\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({ transaction: { data: intent } }),\n}).then((r) => r.json());\n\n// 3. Verify the response\nconst verification = await sdk.verify(apiResponse, intent);\n\nif (verification.isValid) {\n  // 4. Optionally decode to inspect\n  const decoded = await sdk.decode({\n    chainId: apiResponse.chainId,\n    format: apiResponse.transaction.encoded[0].raw.format,\n    encodedData: apiResponse.transaction.encoded[0].raw.value,\n  });\n\n  console.log(\"Transaction details:\", decoded.decoded);\n\n  // 5. Safe to sign\n  const tx = apiResponse.transaction.encoded[0].raw.value;\n  await wallet.signTransaction(tx);\n} else {\n  console.error(\"DO NOT SIGN:\", verification.errors);\n}\n```\n\n### Decode-Only Usage\n\nFor when you just need to decode transactions:\n\n```typescript\n// Decode various blockchain transactions\nconst examples = [\n  {\n    name: \"Ethereum Transfer\",\n    chainId: \"ethereum\",\n    format: \"RLP\",\n    encodedData: \"0xf86c0a85...\",\n  },\n  {\n    name: \"Bitcoin PSBT\",\n    chainId: \"bitcoin\",\n    format: \"PSBT\",\n    encodedData: \"cHNidP8BAH...\",\n  },\n  {\n    name: \"Cosmos Send\",\n    chainId: \"cosmoshub\",\n    format: \"COSMOS_PROTOBUF\",\n    encodedData: \"0a9f010a9c...\",\n  },\n];\n\nfor (const tx of examples) {\n  const result = await sdk.decode(tx);\n  console.log(`${tx.name}:`, result.decoded);\n}\n```\n\n## Development\n\n### Run Tests\n\n```bash\n# Run all tests\npnpm test\n\n# Run specific test suites\npnpm test -- --testNamePattern=\"SDK Validation\"\npnpm test -- --testNamePattern=\"Test Scenarios\"\npnpm test -- --testNamePattern=\"Decoders\"\n\n# Run with real API integration\nUSE_REAL_API=true pnpm test\n\n# Run in watch mode\npnpm run test:watch\n```\n\n### Test Organization\n\nThe SDK includes a streamlined test suite with:\n\n```bash\n# Core test files\ntests/sdk-validation.test.ts        # Complete validation tests (12 tests)\ntests/attack-scenarios.test.ts      # Security attack tests (9 tests)\ntests/decoders.test.ts             # Decoder and registry tests (17 tests)\ntests/integration.test.ts          # End-to-end tests (1 test)\ntests/api-responses.test.ts        # API response validation tests (12 tests)\ntests/edge-cases.test.ts           # Boundary condition tests (11 tests)\ntests/error-handling.test.ts       # Error path tests (10 tests)\ntests/evm-chainid-real-data.test.ts # EVM chain ID security tests (8 tests)\n\n# Fixtures\ntests/fixtures/api-responses/    # Real API response data per blockchain\n```\n\nSee `tests/README.md` for detailed test documentation.\n\n### Build\n\n```bash\npnpm run build\n```\n\n### Run in Development\n\n```bash\npnpm run dev\n```\n\n## Extending the SDK\n\n### Adding a New Chain Decoder\n\n1. Create a new decoder class extending `BaseDecoder`:\n\n```typescript\nimport { BaseDecoder } from \"./base\";\n\nexport class MyChainDecoder extends BaseDecoder {\n  constructor(chainId: ChainId) {\n    super(chainId, \"MY_FORMAT\");\n  }\n\n  async decode(rawData: string): Promise<unknown> {\n    // Implement decoding logic\n  }\n\n  validate(decodedData: unknown): boolean {\n    // Implement validation logic\n  }\n}\n```\n\n2. Register the decoder in `DecoderRegistry`:\n\n```typescript\nthis.registerDecoder(new MyChainDecoder(\"mychain\"));\n```\n\n## API Reference\n\n### `verify(apiResponse: AdamikEncodeResponse, originalIntent: TransactionIntent): Promise<VerificationResult>`\n\nVerifies that an Adamik API response matches the original transaction intent.\n\n**Parameters:**\n\n- `apiResponse`: The response from Adamik API encode endpoint\n- `originalIntent`: The original transaction intent\n\n**Returns:**\n\n- `VerificationResult` object containing:\n  - `isValid`: Boolean indicating if verification passed\n  - `errors`: Array of error messages (if any)\n  - `decodedData`: Decoded transaction data\n\n### `decode(params: DecodeParams): Promise<DecodeResult>`\n\nDecodes raw transaction data for a specific blockchain without running verification.\n\n**Parameters:**\n\n- `params`: Object containing:\n  - `chainId`: The blockchain identifier (e.g., \"ethereum\", \"bitcoin\")\n  - `format`: The encoding format (e.g., \"RLP\", \"PSBT\")\n  - `encodedData`: The encoded transaction data as a string\n\n**Returns:**\n\n- `DecodeResult` object containing:\n  - `decoded`: The decoded transaction data (null if decoding failed)\n  - `warnings`: Any warnings generated during decoding\n  - `error`: Error message if decoding failed\n\n**Example:**\n\n```typescript\nconst result = await sdk.decode({\n  chainId: \"ethereum\",\n  format: \"RLP\",\n  encodedData: \"0xf86c0a8502540be400...\",\n});\n\nif (result.decoded) {\n  console.log(\"Recipient:\", result.decoded.recipientAddress);\n  console.log(\"Amount:\", result.decoded.amount);\n  console.log(\"Fee:\", result.decoded.fee);\n}\n```\n\n### `getSupportedChains(): Record<string, ChainInfo>`\n\nGets all blockchain chains that have decoder support in the SDK.\n\n**Returns:**\n\nAn object mapping chain IDs to their information:\n\n- `family`: The blockchain family (e.g., \"evm\", \"bitcoin\", \"cosmos\")\n- `formats`: Array of supported encoding formats\n- `hasDecoder`: Always true for returned chains\n\n**Example:**\n\n```typescript\nconst supportedChains = sdk.getSupportedChains();\nconsole.log(supportedChains);\n// {\n//   \"ethereum\": { family: \"evm\", formats: [\"RLP\"], hasDecoder: true },\n//   \"bitcoin\": { family: \"bitcoin\", formats: [\"PSBT\"], hasDecoder: true },\n//   \"cosmoshub\": { family: \"cosmos\", formats: [\"COSMOS_PROTOBUF\", \"SIGNDOC_DIRECT\", ...], hasDecoder: true },\n//   ...\n// }\n\n// Count chains by family\nconst families = Object.values(supportedChains).reduce((acc, chain) => {\n  acc[chain.family] = (acc[chain.family] || 0) + 1;\n  return acc;\n}, {});\nconsole.log(families); // { evm: 37, bitcoin: 5, cosmos: 42, tron: 1, solana: 1 }\n```\n\n### DecodedTransaction Structure\n\nThe decoded transaction object contains:\n\n```typescript\ninterface DecodedTransaction {\n  chainId?: string; // Blockchain identifier\n  mode?: TransactionMode; // \"transfer\", \"transferToken\", \"stake\", etc.\n  senderAddress?: string; // Transaction sender\n  recipientAddress?: string; // Transaction recipient\n  amount?: string; // Transaction amount in smallest unit\n  fee?: string; // Transaction fee in native currency\n  memo?: string; // Transaction memo/message\n  tokenId?: string; // Token contract address (for token transfers)\n  validatorAddress?: string; // Validator address (for staking operations)\n  targetValidatorAddress?: string; // Target validator (for re-delegation)\n  chainSpecificData?: unknown; // Chain-specific additional data\n}\n```\n\n## Contributing\n\nContributions are welcome! Please:\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\nFor detailed guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md) (coming soon).\n\n## Security\n\n### Supported Versions\n\n| Version | Supported          |\n| ------- | ------------------ |\n| 1.x.x   | :white_check_mark: |\n| < 1.0   | :x:                |\n\n### Reporting a Vulnerability\n\n**Please do not report security vulnerabilities through public GitHub issues.**\n\nInstead, please report them via email to contact@adamik.io.\n\nYou should receive a response within 48 hours. If for some reason you do not, please follow up via email to ensure we received your original message.\n\nPlease include the following information:\n\n- Type of issue (e.g., buffer overflow, SQL injection, cross-site scripting, etc.)\n- Full paths of source file(s) related to the manifestation of the issue\n- The location of the affected source code (tag/branch/commit or direct URL)\n- Any special configuration required to reproduce the issue\n- Step-by-step instructions to reproduce the issue\n- Proof-of-concept or exploit code (if possible)\n- Impact of the issue, including how an attacker might exploit the issue\n\nThis information will help us triage your report more quickly.\n\n### Preferred Languages\n\nWe prefer all communications to be in English.\n\n### Policy\n\nAdamik follows the principle of Coordinated Vulnerability Disclosure.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Links\n\n- [GitHub Repository](https://github.com/AdamikHQ/adamik-sdk)\n- [NPM Package](https://www.npmjs.com/package/@adamik/sdk)\n- [Report Issues](https://github.com/AdamikHQ/adamik-sdk/issues)\n- [Adamik API Documentation](https://docs.adamik.io)\n","readmeFilename":"README.md"}