{"_id":"@arbilink/sdk","_rev":"4-a2ffeb531ec8f5516dce6dbc0a057297","name":"@arbilink/sdk","dist-tags":{"latest":"1.1.2"},"versions":{"0.1.0":{"name":"@arbilink/sdk","version":"0.1.0","keywords":["arbitrum","cross-chain","messaging","bridge","stylus","web3"],"author":{"name":"ArbiLink"},"license":"MIT","_id":"@arbilink/sdk@0.1.0","maintainers":[{"name":"jojoofeth","email":"jojololamartins686@gmail.com"}],"homepage":"https://github.com/Martins-O/ArbiLink#readme","bugs":{"url":"https://github.com/Martins-O/ArbiLink/issues"},"dist":{"shasum":"026b4fb56605836b9020128884cb9d808a51077e","tarball":"https://registry.npmjs.org/@arbilink/sdk/-/sdk-0.1.0.tgz","fileCount":32,"integrity":"sha512-iVsWw/vWN+4tzznIAHYLVr/d1A6ggOGJvgVMhfFZSAEzXy1KufpD3F8dj3DTDd5zwROZZnAH4I/mA+v1DDk5pw==","signatures":[{"sig":"MEYCIQDrFx9ZTVeMKoTjUQmrRJgGvYY4Di39izNEKzRxaNMwQgIhAIHI2v2AXidhqBiZ9j+GIA0WxX9LdNnK5ydN+ku/86ZP","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98122},"main":"dist/index.js","_from":"file:arbilink-sdk-0.1.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"build":"tsc --project tsconfig.json","clean":"rm -rf dist","type-check":"tsc --noEmit","build:watch":"tsc --project tsconfig.json --watch"},"_npmUser":{"name":"jojoofeth","email":"jojololamartins686@gmail.com"},"_resolved":"/tmp/61b2c5b0d36ec24ec3640c634c4b3e18/arbilink-sdk-0.1.0.tgz","_integrity":"sha512-iVsWw/vWN+4tzznIAHYLVr/d1A6ggOGJvgVMhfFZSAEzXy1KufpD3F8dj3DTDd5zwROZZnAH4I/mA+v1DDk5pw==","repository":{"url":"git+https://github.com/Martins-O/ArbiLink.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.10.1","description":"Cross-chain messaging SDK for Arbitrum — send messages to any chain with one function call","directories":{},"_nodeVersion":"25.2.0","dependencies":{"viem":"^2.0.0","ethers":"^6.9.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.0","@types/node":"^20.0.0"},"peerDependencies":{"ethers":"^6.9.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1771665379981_0.9337908526490593","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@arbilink/sdk","version":"0.1.1","keywords":["arbitrum","cross-chain","messaging","bridge","stylus","web3"],"author":{"name":"ArbiLink"},"license":"MIT","_id":"@arbilink/sdk@0.1.1","maintainers":[{"name":"jojoofeth","email":"jojololamartins686@gmail.com"}],"homepage":"https://github.com/Martins-O/ArbiLink#readme","bugs":{"url":"https://github.com/Martins-O/ArbiLink/issues"},"dist":{"shasum":"dd6610351338294b516b6ebc3bf1f8aee013e61f","tarball":"https://registry.npmjs.org/@arbilink/sdk/-/sdk-0.1.1.tgz","fileCount":32,"integrity":"sha512-5mtl/rU9lHNtf3FzpzYWJt/4v0DVxB9CB/rLjS4txn6t8ZQ/0vbZDs3bjvRP6LNmNZp6v7ZDCuQ+X3/jk3q9Dw==","signatures":[{"sig":"MEQCIH0Xhwq8DbuU9q+Id7XIGw4v5zTmyygLTFzxCWxS9B7xAiAWP9juObtVHFLL1nF7nLUcHsRekcgiUZgfLlYJ1cWVZA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98218},"main":"dist/index.js","_from":"file:arbilink-sdk-0.1.1.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"build":"tsc --project tsconfig.json","clean":"rm -rf dist","type-check":"tsc --noEmit","build:watch":"tsc --project tsconfig.json --watch"},"_npmUser":{"name":"jojoofeth","email":"jojololamartins686@gmail.com"},"_resolved":"/tmp/02ff6964f7d040e5ef979d74690e5398/arbilink-sdk-0.1.1.tgz","_integrity":"sha512-5mtl/rU9lHNtf3FzpzYWJt/4v0DVxB9CB/rLjS4txn6t8ZQ/0vbZDs3bjvRP6LNmNZp6v7ZDCuQ+X3/jk3q9Dw==","repository":{"url":"git+https://github.com/Martins-O/ArbiLink.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.10.1","description":"Cross-chain messaging SDK for Arbitrum — send messages to any chain with one function call","directories":{},"_nodeVersion":"25.2.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"viem":"^2.0.0","ethers":"^6.9.0","typescript":"^5.3.0","@types/node":"^20.0.0"},"peerDependencies":{"viem":"^2.0.0","ethers":"^6.9.0"},"peerDependenciesMeta":{"viem":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1771665904622_0.2933364587000251","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@arbilink/sdk","version":"1.1.0","keywords":["arbitrum","cross-chain","messaging","bridge","stylus","web3"],"author":{"name":"ArbiLink"},"license":"MIT","_id":"@arbilink/sdk@1.1.0","maintainers":[{"name":"jojoofeth","email":"jojololamartins686@gmail.com"}],"homepage":"https://github.com/Martins-O/ArbiLink#readme","bugs":{"url":"https://github.com/Martins-O/ArbiLink/issues"},"dist":{"shasum":"67ea0a6820dc66edae406fbe911f0eb9ac5de328","tarball":"https://registry.npmjs.org/@arbilink/sdk/-/sdk-1.1.0.tgz","fileCount":34,"integrity":"sha512-OtCjEwgXwRXzghXxp21OM8PJneuWwLiT4GeaQYp5JhTyCWJthoWCCfTQ5YHOl+8XgInNq5HXEpPeuT1i1f5Kiw==","signatures":[{"sig":"MEUCICTeoX3N1BqHfPL2tb6qWlaiqmkVHWrtEt1V5PztPokGAiEA3Ul5tHuimPgVC6S3mghTERJMvuG10n6bwFnQ4239wcQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":126971},"main":"dist/index.js","_from":"file:arbilink-sdk-1.1.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./abi/*":{"default":"./src/abi/*.json"}},"scripts":{"test":"vitest run","build":"tsc --project tsconfig.json","clean":"rm -rf dist","test:watch":"vitest","type-check":"tsc --noEmit","build:watch":"tsc --project tsconfig.json --watch"},"_npmUser":{"name":"jojoofeth","email":"jojololamartins686@gmail.com"},"_resolved":"/tmp/931573a64891831a039673213b0dcde0/arbilink-sdk-1.1.0.tgz","_integrity":"sha512-OtCjEwgXwRXzghXxp21OM8PJneuWwLiT4GeaQYp5JhTyCWJthoWCCfTQ5YHOl+8XgInNq5HXEpPeuT1i1f5Kiw==","repository":{"url":"git+https://github.com/Martins-O/ArbiLink.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.8.2","description":"Cross-chain messaging SDK for Arbitrum — send messages to any chain with one function call","directories":{},"_nodeVersion":"20.19.6","dependencies":{"viem":"^2.0.0","ethers":"^6.9.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.4.3","vitest":"^4.1.8","typescript":"^5.3.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.1.0_1781282793874_0.06846831542200338","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@arbilink/sdk","version":"1.1.2","description":"Cross-chain messaging SDK for Arbitrum — send messages to any chain with one function call","keywords":["arbitrum","cross-chain","messaging","bridge","stylus","web3"],"license":"MIT","author":{"name":"ArbiLink"},"repository":{"type":"git","url":"git+https://github.com/Martins-O/ArbiLink.git","directory":"packages/sdk"},"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./abi/*":{"default":"./src/abi/*.json"}},"dependencies":{"ethers":"^6.9.0","viem":"^2.0.0"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.3.0","vite":"^6.4.3","vitest":"^4.1.8"},"engines":{"node":">=18.0.0"},"scripts":{"build":"tsc --project tsconfig.json","build:watch":"tsc --project tsconfig.json --watch","clean":"rm -rf dist","type-check":"tsc --noEmit","test":"vitest run","test:watch":"vitest"},"_id":"@arbilink/sdk@1.1.2","bugs":{"url":"https://github.com/Martins-O/ArbiLink/issues"},"homepage":"https://github.com/Martins-O/ArbiLink#readme","_integrity":"sha512-3nuUVhoS6bV2Cw5kovCTOebVlEQdifq9yc/nfh6LDOTgr4rQ7U57NeeiDq98spfRSmIwmRVoakjH2MZySeQk4A==","_resolved":"/tmp/fc29702f57a308fdb3867560ca0417e1/arbilink-sdk-1.1.2.tgz","_from":"file:arbilink-sdk-1.1.2.tgz","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-3nuUVhoS6bV2Cw5kovCTOebVlEQdifq9yc/nfh6LDOTgr4rQ7U57NeeiDq98spfRSmIwmRVoakjH2MZySeQk4A==","shasum":"793813554478db9f94ec28a7feb01d47022ddae0","tarball":"https://registry.npmjs.org/@arbilink/sdk/-/sdk-1.1.2.tgz","fileCount":34,"unpackedSize":126971,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD4kzP/p6F9K52wxYtiOu6VUFK95j8pJrjKuryRZ3ZgIQIhAL88H8Sr0hJka/AGBVGMTxKdx4GxWUFo/EzkeMzW9WxK"}]},"_npmUser":{"name":"jojoofeth","email":"jojololamartins686@gmail.com"},"directories":{},"maintainers":[{"name":"jojoofeth","email":"jojololamartins686@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.1.2_1781282877114_0.5692428202170949"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-21T09:16:19.583Z","modified":"2026-06-12T16:47:57.359Z","0.1.0":"2026-02-21T09:16:20.147Z","0.1.1":"2026-02-21T09:25:04.783Z","1.1.0":"2026-06-12T16:46:34.005Z","1.1.2":"2026-06-12T16:47:57.247Z"},"bugs":{"url":"https://github.com/Martins-O/ArbiLink/issues"},"author":{"name":"ArbiLink"},"license":"MIT","homepage":"https://github.com/Martins-O/ArbiLink#readme","keywords":["arbitrum","cross-chain","messaging","bridge","stylus","web3"],"repository":{"type":"git","url":"git+https://github.com/Martins-O/ArbiLink.git","directory":"packages/sdk"},"description":"Cross-chain messaging SDK for Arbitrum — send messages to any chain with one function call","maintainers":[{"name":"jojoofeth","email":"jojololamartins686@gmail.com"}],"readme":"# @arbilink/sdk\n\nCross-chain messaging made simple. Send messages from **Arbitrum** to any supported chain with a single function call.\n\nBuilt on top of the ArbiLink MessageHub — an optimistic cross-chain relay protocol running on Arbitrum Stylus.\n\n## Installation\n\n```bash\nnpm install @arbilink/sdk ethers\n# or\nyarn add @arbilink/sdk ethers\n```\n\n## Quick Start\n\n```typescript\nimport { ArbiLink, encodeCall } from '@arbilink/sdk';\nimport { ethers }                from 'ethers';\nimport { parseAbi }              from 'viem';\n\n// 1. Connect a signer (must be on Arbitrum Sepolia)\nconst provider = new ethers.BrowserProvider(window.ethereum);\nconst signer   = await provider.getSigner();\n\n// 2. Initialise\nconst arbiLink = new ArbiLink(signer);\n\n// 3. Send a cross-chain message\nconst messageId = await arbiLink.sendMessage({\n  to:     'ethereum',           // destination chain name or numeric ID\n  target: '0x742d35Cc...',     // contract to call on the destination chain\n  data:   encodeCall({\n    abi:          parseAbi(['function mint(address to, uint256 amount)']),\n    functionName: 'mint',\n    args:         ['0xRecipient...', 1_000n],\n  }),\n});\n\nconsole.log('Message sent! ID:', messageId);\n\n// 4. Watch for delivery\nconst unwatch = arbiLink.watchMessage(messageId, (msg) => {\n  console.log('Status update:', msg.status);\n  if (msg.status === 'confirmed') {\n    console.log('Message delivered!');\n    unwatch();\n  }\n});\n```\n\n## API Reference\n\n### `new ArbiLink(signerOrProvider)`\n\n| Mode | Arg | Read | Write |\n|------|-----|------|-------|\n| Full | `ethers.Signer` | ✅ | ✅ |\n| Read-only | `ethers.Provider` | ✅ | ❌ |\n\n---\n\n### `sendMessage(params)` → `Promise<bigint>`\n\nSend a cross-chain message. Returns the message ID.\n\n```typescript\nconst messageId = await arbiLink.sendMessage({\n  to:     'base',           // 'ethereum' | 'base' | 'polygon' | 'optimism' | chainId\n  target: '0xTarget...',\n  data:   '0xcalldata...',\n  fee:    1_000_000_000_000_000n, // optional – fetched from hub if omitted\n});\n```\n\n---\n\n### `getMessageStatus(messageId)` → `Promise<Message>`\n\n```typescript\nconst msg = await arbiLink.getMessageStatus(1n);\n\nconsole.log(msg.status);           // 'pending' | 'relayed' | 'confirmed' | 'failed'\nconsole.log(msg.sender);           // address that sent the message\nconsole.log(msg.destinationChain); // numeric chain ID\nconsole.log(msg.feePaid);          // bigint (wei)\nconsole.log(msg.relayer);          // relayer address (once confirmed)\n```\n\n---\n\n### `calculateFee(chainId)` → `Promise<bigint>`\n\n```typescript\nconst fee = await arbiLink.calculateFee(11155111);\nconsole.log(formatEth(fee)); // \"0.001 ETH\"\n```\n\n---\n\n### `watchMessage(messageId, callback)` → `() => void`\n\nSubscribe to `MessageConfirmed` and `MessageChallenged` events.\nReturns an **unsubscribe** function.\n\n```typescript\nconst unwatch = arbiLink.watchMessage(messageId, (msg) => {\n  if (msg.status === 'confirmed' || msg.status === 'failed') {\n    unwatch();\n  }\n});\n```\n\n---\n\n### `getChainInfo(chainId)` → `Promise<{ enabled, receiverAddress, baseFee } | null>`\n\n```typescript\nconst info = await arbiLink.getChainInfo(11155111);\nconsole.log(info?.enabled);          // true\nconsole.log(info?.receiverAddress);  // '0x...'\nconsole.log(info?.baseFee);          // bigint\n```\n\n---\n\n### `registerRelayer(stakeOverride?)` / `exitRelayer()`\n\n```typescript\n// Register with the hub's minimum stake\nawait arbiLink.registerRelayer();\n\n// Or override the stake amount\nawait arbiLink.registerRelayer(2_000_000_000_000_000_000n); // 2 ETH\n\n// Withdraw stake and deregister\nawait arbiLink.exitRelayer();\n```\n\n---\n\n## Utility Functions\n\n```typescript\nimport {\n  encodeCall,\n  formatMessageId,\n  formatEth,\n  statusLabel,\n  estimateDeliveryTime,\n} from '@arbilink/sdk';\n\nencodeCall({ abi, functionName, args });  // → '0x...'\nformatMessageId(42n);                      // → '#000042'\nformatEth(1_000_000_000_000_000n);        // → '0.001 ETH'\nstatusLabel('confirmed');                  // → 'Confirmed'\nestimateDeliveryTime(11155111);            // → seconds (int)\n```\n\n---\n\n## Supported Chains\n\n| Chain | Name | Chain ID | Status |\n|-------|------|----------|--------|\n| Ethereum Sepolia | `'ethereum'` | 11155111 | ✅ Supported |\n| Base Sepolia | `'base'` | 84532 | ✅ Supported |\n| Polygon Amoy | `'polygon'` | 80002 | 🔜 Coming soon |\n| Optimism Sepolia | `'optimism'` | 11155420 | 🔜 Coming soon |\n\n---\n\n## Full Examples\n\n### NFT Mint on Ethereum\n\n```typescript\nimport { ArbiLink, encodeCall } from '@arbilink/sdk';\nimport { parseAbi } from 'viem';\n\nconst arbiLink = new ArbiLink(signer);\n\nconst data = encodeCall({\n  abi:          parseAbi(['function mint(address to, uint256 tokenId)']),\n  functionName: 'mint',\n  args:         ['0xRecipient...', 1n],\n});\n\nconst messageId = await arbiLink.sendMessage({\n  to:     'ethereum',\n  target: NFT_CONTRACT_ADDRESS,\n  data,\n});\n```\n\n### Token Transfer on Base\n\n```typescript\nconst data = encodeCall({\n  abi:          parseAbi(['function transfer(address to, uint256 amount)']),\n  functionName: 'transfer',\n  args:         [recipient, amount],\n});\n\nconst messageId = await arbiLink.sendMessage({\n  to:     'base',\n  target: TOKEN_CONTRACT_ADDRESS,\n  data,\n});\n```\n\n### Read-only status polling (no wallet required)\n\n```typescript\nimport { ArbiLink } from '@arbilink/sdk';\nimport { ethers }   from 'ethers';\n\nconst provider = new ethers.JsonRpcProvider('https://sepolia-rollup.arbitrum.io/rpc');\nconst arbiLink  = new ArbiLink(provider);\n\nconst msg = await arbiLink.getMessageStatus(42n);\nconsole.log(msg.status); // 'confirmed'\n```\n\n---\n\n## How ArbiLink Works\n\n1. **User** calls `sendMessage()` on the **MessageHub** (Arbitrum Stylus).\n2. **Relayers** watch for `MessageSent` events and deliver the message on the destination chain via `ArbiLinkReceiver.receiveMessage()`.\n3. The relayer submits an **ECDSA execution proof** and calls `confirm_delivery()` on the hub, opening a **5-minute challenge window**.\n4. Anyone can call `challenge_message()` with a fraud proof during that window. A valid fraud proof **slashes the relayer's stake**.\n5. After the window closes without a challenge, `finalize_message()` marks the message as **confirmed**.\n\n---\n\n## Configuration\n\nAfter running `scripts/deploy.sh`, update `src/constants.ts` with your deployed addresses:\n\n```typescript\n// packages/sdk/src/constants.ts\nexport const MESSAGE_HUB_ADDRESS = '0xYourMessageHubAddress';\n\nexport const RECEIVER_ADDRESSES: Record<number, string> = {\n  11155111: '0xYourEthReceiver',\n  84532:    '0xYourBaseReceiver',\n};\n```\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}