{"_id":"@0xaibridge/sdk","_rev":"6-16941f43757936979bdc5014c30d7e18","name":"@0xaibridge/sdk","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@0xaibridge/sdk","version":"1.0.0","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa"],"license":"Apache-2.0","_id":"@0xaibridge/sdk@1.0.0","maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"homepage":"https://github.com/sftgroup/0xainet-bridge#readme","bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"dist":{"shasum":"28389cde9ce50b8f81fe5502d3dce66544e80c72","tarball":"https://registry.npmjs.org/@0xaibridge/sdk/-/sdk-1.0.0.tgz","fileCount":4,"integrity":"sha512-6TtFzgn70KDicQ8GGZ4LuR63fQaMXnhu6nJfO5Cfa6KLncVRKc9E3GKwUIHTMYHa1wMSiYR2v7mlDdfPdSq+gA==","signatures":[{"sig":"MEQCIHiAqPEbBRzqz+V2zsRfpRNq+ZMTaNS2Z8SkKuyF1TVjAiBbEuFoh21ivOspysRAL3PMyJ3abuEuGcEKzYIvDP7K9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17564},"main":"src/index.js","types":"src/index.d.ts","gitHead":"daec77b2e6ceb68759d0b7820fc22f96cfd9777f","_npmUser":{"name":"stevenwang000x","email":"apply.wang@hotmail.com"},"repository":{"url":"git+https://github.com/sftgroup/0xainet-bridge.git","type":"git"},"_npmVersion":"10.8.2","description":"0xAINet Cross-Chain Bridge SDK — one-line cross-chain ERC20 transfers","directories":{},"_nodeVersion":"20.20.2","dependencies":{"ethers":"^6.13.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1785079906090_0.9556876123606872","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@0xaibridge/sdk","version":"1.0.1","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa"],"license":"Apache-2.0","_id":"@0xaibridge/sdk@1.0.1","maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"homepage":"https://github.com/sftgroup/0xainet-bridge#readme","bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"dist":{"shasum":"a3f81dbdbfb40406e00682ea396330073d84c959","tarball":"https://registry.npmjs.org/@0xaibridge/sdk/-/sdk-1.0.1.tgz","fileCount":4,"integrity":"sha512-x5iri5B+y+RDfwYlP8WejaieAWl1v6QNKhnGh3CP3fC0saPLcFbtzWI69GSu3TwSbREz3IGg4fQSz+QhonrxSg==","signatures":[{"sig":"MEQCIBx9CaoMYMIyTd/zbL+I72DZxU6h5yZy/mpVd5c2wHcRAiA+7kP99blk7tDJhtZsTSIWu7HnG9X9y7F28tf7C2dbaA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20661},"main":"src/index.js","types":"src/index.d.ts","gitHead":"9ecc624792be65253e94f853d2194669aafb43fb","_npmUser":{"name":"stevenwang000x","email":"apply.wang@hotmail.com"},"repository":{"url":"git+https://github.com/sftgroup/0xainet-bridge.git","type":"git"},"_npmVersion":"10.9.8","description":"0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ethers":"^6.13.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.1_1786314094982_0.33862930889513865","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@0xaibridge/sdk","version":"1.0.2","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa"],"license":"Apache-2.0","_id":"@0xaibridge/sdk@1.0.2","maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"homepage":"https://github.com/sftgroup/0xainet-bridge#readme","bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"dist":{"shasum":"da6525b75c15c6e287d84e727842b659b1996309","tarball":"https://registry.npmjs.org/@0xaibridge/sdk/-/sdk-1.0.2.tgz","fileCount":4,"integrity":"sha512-5zDYurVvkYwBaSNC1U67+qa9L9/P9bAVSM2pwGyoKtFUu9eInLI8UT3aPQ7lgw9XOB4njC9KftzfPtEAk4Ys1Q==","signatures":[{"sig":"MEQCIGBGFKhJTJH54IUhDFHRcyrob9NCtWSVf1vYxvBDd5DeAiBkD+d5OBtII/RxWtbSLkV8wpunZtMVQMwc4tvmxwE1iQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20693},"main":"src/index.js","types":"src/index.d.ts","gitHead":"a69db7b6b64b9b2d2b717c3e0e31285dbb5d749a","_npmUser":{"name":"stevenwang000x","email":"apply.wang@hotmail.com"},"repository":{"url":"git+https://github.com/sftgroup/0xainet-bridge.git","type":"git"},"_npmVersion":"10.9.8","description":"0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ethers":"^6.13.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.2_1786373807602_0.18734449264994324","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@0xaibridge/sdk","version":"1.0.3","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa"],"license":"Apache-2.0","_id":"@0xaibridge/sdk@1.0.3","maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"homepage":"https://github.com/sftgroup/0xainet-bridge#readme","bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"dist":{"shasum":"806d3b7353693930ceb7d498cf6365b06d5fa779","tarball":"https://registry.npmjs.org/@0xaibridge/sdk/-/sdk-1.0.3.tgz","fileCount":4,"integrity":"sha512-2Z/iIaDI0diphONC702VhvUqKmlO2BryUMJNQ8DOyB4B3JjvhmPnkPpWaOQpT4kQJwCH40RyFrUH1w8lE0znqQ==","signatures":[{"sig":"MEQCIHSNRxaGaesnLxW9EcrGvzT5Bzjyr5to3gb7F4eTcLGlAiBxWxH++7Ae+Qam8CyAqnddexSV63AYZX7l3/kIFFocrw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21300},"main":"src/index.js","types":"src/index.d.ts","gitHead":"5bb3cfaed55a580b6b1fb05875dfb5d65d8d4d9b","_npmUser":{"name":"stevenwang000x","email":"apply.wang@hotmail.com"},"repository":{"url":"git+https://github.com/sftgroup/0xainet-bridge.git","type":"git"},"_npmVersion":"10.9.8","description":"0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ethers":"^6.13.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.3_1786376049984_0.8529130571394081","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@0xaibridge/sdk","version":"1.0.4","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa"],"license":"Apache-2.0","_id":"@0xaibridge/sdk@1.0.4","maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"homepage":"https://github.com/sftgroup/0xainet-bridge#readme","bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"dist":{"shasum":"63c50912689eb0c2eeeb1a680da2c47f3e695f72","tarball":"https://registry.npmjs.org/@0xaibridge/sdk/-/sdk-1.0.4.tgz","fileCount":4,"integrity":"sha512-/xkFg0pgJhn9on5MYLmK1PI5ZfRWJ3Cx5KcJbve0H38GypvynXK35nTZiPhsJFFjJvwm+tVYcnGwvGQJBQ6gVw==","signatures":[{"sig":"MEUCICjD0Olgscnfpie4flY579GTYrHMnQ9YGIMsI0c8AuWiAiEAvm5aAVcOUa965a7HCp18/a0fDY5mxX/1OKfIMsWUn9I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21481},"main":"src/index.js","types":"src/index.d.ts","gitHead":"35891d5309d65c4a1b09c8145563e0c0c987c6ee","_npmUser":{"name":"stevenwang000x","email":"apply.wang@hotmail.com"},"repository":{"url":"git+https://github.com/sftgroup/0xainet-bridge.git","type":"git"},"_npmVersion":"10.9.8","description":"0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ethers":"^6.13.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.4_1786376983114_0.015082885812989666","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@0xaibridge/sdk","version":"1.0.5","description":"0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery, plus OxaChain L1 test-token faucet","main":"src/index.js","types":"src/index.d.ts","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa","faucet"],"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/sftgroup/0xainet-bridge.git"},"dependencies":{"@0xachain/faucet-sdk":"^1.0.2","ethers":"^6.13.0"},"publishConfig":{"access":"public"},"_id":"@0xaibridge/sdk@1.0.5","gitHead":"7b8a09ca5a9bc62bf1f892995eedc76ae7be9d8c","bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"homepage":"https://github.com/sftgroup/0xainet-bridge#readme","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-AUQQbiYkzIKAubS/GpfAqLKL6qFhnEVSFG3k4+PJdJ8Ud+hsmYlnRLbXrHrZg4U5IhH8hoGmuBPnLqADB08JDA==","shasum":"f20b381b5221a9acf6cb5467e032840078888121","tarball":"https://registry.npmjs.org/@0xaibridge/sdk/-/sdk-1.0.5.tgz","fileCount":4,"unpackedSize":26565,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCID4jrmasQ/N8+ahzwFf3KfCDovC/uoS8oxlZbnQwvhyUAiBuNP2Wc91m8YNQBTMFk713kGJB3n0BjR9OFJvQQoGOLg=="}]},"_npmUser":{"name":"stevenwang000x","email":"apply.wang@hotmail.com"},"directories":{},"maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.5_1787441589550_0.21510136431611016"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-26T15:31:45.897Z","modified":"2026-08-22T23:33:09.888Z","1.0.0":"2026-07-26T15:31:46.226Z","1.0.1":"2026-08-09T22:21:35.150Z","1.0.2":"2026-08-10T14:56:47.754Z","1.0.3":"2026-08-10T15:34:10.152Z","1.0.4":"2026-08-10T15:49:43.275Z","1.0.5":"2026-08-22T23:33:09.703Z"},"bugs":{"url":"https://github.com/sftgroup/0xainet-bridge/issues"},"license":"Apache-2.0","homepage":"https://github.com/sftgroup/0xainet-bridge#readme","keywords":["cross-chain","bridge","erc20","wormhole","ecdsa","faucet"],"repository":{"type":"git","url":"git+https://github.com/sftgroup/0xainet-bridge.git"},"description":"0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery, plus OxaChain L1 test-token faucet","maintainers":[{"name":"stevenwang000x","email":"apply.wang@hotmail.com"}],"readme":"# @0xaibridge/sdk\n\n0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery.\n\n```bash\nnpm install @0xaibridge/sdk\n```\n\n## Quick Start\n\n### Dual-Mode API\n\n```js\nimport { bridge, estimateFee, getRoute } from '@0xaibridge/sdk';\n\n// Mode 1: Quick cross-chain transfer (requires PRIVATE_KEY env)\nconst { txHash, estimatedTime } = await bridge({\n  fromChain: '11155111',   // Sepolia\n  toChain: '19505',         // OxaChain L1\n  token: '0x87dec5277dA56Bc843C76A1fFc26Fe5964Bee9e4',\n  amount: '1000000',        // in wei\n  recipient: '0x...',\n});\n\n// Mode 2: SDK instance (full control)\nconst sdk = bridge({\n  bridgeAddress: '0x139632f19355bF58f95818553CbB9E0F77f62202',\n  rpcUrl: 'https://ethereum-sepolia.publicnode.com',\n  signerKey: process.env.PRIVATE_KEY,\n});\n\nconst { tx, sequence } = await sdk.transfer({\n  token: '0x...',\n  amount: '1000000',\n  toChain: 19505,\n  to: '0x...',\n});\n```\n\n## API Reference\n\n### Functions\n\n| Function | Description |\n|----------|-------------|\n| `bridge(opts)` | **Dual-mode**: with `bridgeAddress` → returns `BridgeSDK` instance; with `fromChain` → executes transfer directly |\n| `estimateFee({fromChain, toChain, token, amount})` | Estimate gas fee for a bridge transfer. Returns `{ fee, feeToken, estimatedTime }` |\n| `getRoute({fromChain, toChain, token})` | Query available bridge routes. Returns `{ available, routes }` |\n| `hashTransfer(transfer)` | Hash a Transfer struct for signing |\n| `encodeTransfer(transfer)` | ABI-encode a Transfer struct |\n\n### BridgeSDK Class\n\n```ts\nclass BridgeSDK {\n  constructor(opts: BridgeOptions)\n  \n  // Read\n  chainId(): Promise<number>\n  isWrapped(token: string): Promise<boolean>\n  wrappedAsset(tokenChain: number, tokenAddress: string): Promise<string>\n  isTransferCompleted(tokenChain: number, tokenAddress: string, sequence: bigint): Promise<boolean>\n  \n  // Write\n  transfer(params: TransferParams): Promise<{ tx, sequence }>\n  \n  // Events\n  onTransfer(chainId: number, callback): ethers.Contract\n  \n  // Static\n  static signAndComplete(params): Promise<{ tx, blockNumber }>\n  static parseTransferFromLog(log): BridgeTransfer\n}\n```\n\n### BridgeOptions\n\n```ts\ninterface BridgeOptions {\n  bridgeAddress: string;         // Bridge contract address\n  rpcUrl?: string;               // RPC endpoint (or use provider)\n  provider?: ethers.Provider;    // ethers Provider instance\n  signerKey?: string;            // Private key for signing\n  signer?: ethers.Signer;        // ethers Signer instance\n  gasLimitTransfer?: number;     // Default: 400000\n  gasLimitComplete?: number;     // Default: 300000\n}\n```\n\n### TransferParams\n\n```ts\ninterface TransferParams {\n  token: string;       // ERC20 token address\n  amount: string | bigint;  // Amount in wei\n  toChain: number;     // Destination chain ID\n  to: string;          // Recipient address\n}\n```\n\n## Supported Chains\n\n| Chain | ID | Bridge Address |\n|-------|----|----------------|\n| Sepolia | 11155111 | `0x139632f19355bF58f95818553CbB9E0F77f62202`（bridgeChainId=10002） |\n| OxaChain L1 | 19505 | `0x86a81a183085Ce7F44813982b06ad5b3C57B8d83` |\n| BSC Testnet | 97 | `0x0000000000000000000000000000000000000000` |\n\n## Examples\n\n### Estimate Fees\n\n```js\nconst { fee, feeToken, estimatedTime } = await estimateFee({\n  fromChain: '11155111',\n  toChain: '19505',\n  token: '0x87dec5277dA56Bc843C76A1fFc26Fe5964Bee9e4',\n  amount: '1000000',\n});\nconsole.log(`Fee: ${fee} ${feeToken}, ETA: ${estimatedTime}s`);\n```\n\n### Check Available Routes\n\n```js\nconst { available, routes } = await getRoute({\n  fromChain: '11155111',\n  toChain: '19505',\n  token: '0x...',\n});\n// routes[0] → { bridge: '0xBridge', fee: '~0.001 ETH', time: 60 }\n```\n\n### Listen for Incoming Transfers\n\n```js\nconst sdk = bridge({\n  bridgeAddress: '0x86a81a183085Ce7F44813982b06ad5b3C57B8d83',\n  rpcUrl: 'http://43.156.99.215:18545',\n});\n\n// Listen for transfers targeting chain 19505\nsdk.onTransfer(19505, ({ transfer, log }) => {\n  console.log(`Incoming transfer: seq=${transfer.sequence}, amount=${transfer.amount}`);\n});\n```\n\n## Release Notes\n\n### 1.0.4 (2026-08-10)\n- **Fixed**: `LogTransfer` event ABI declared `indexed` params while the on-chain event has **no indexed params** (topics contain only topic0; all fields are encoded in `data`). This caused `parseLog` to fail and `transfer()` to return `sequence = 0`. The ABI now matches the deployed contracts — `transfer()` returns the correct sequence, verified against on-chain events (SDK result == on-chain event sequence).\n- **No breaking changes** to the public API.\n\n### 1.0.3 (2026-08-10)\n- **Added**: New Bridge addresses for the re-deployed contracts — Sepolia `0x139632f19355bF58f95818553CbB9E0F77f62202` (bridgeChainId `10002`), OxaChain L1 `0x86a81a183085Ce7F44813982b06ad5b3C57B8d83` (chainId `19505`).\n- **Added**: `isTransferCompleted(tokenChain, tokenAddress, sequence)` — three-argument completion query keyed by `(tokenChain, tokenAddress, sequence)`, matching the on-chain fix for cross-chain sequence collisions.\n- **Fixed**: `signAndComplete` now signs the raw digest (`signingKey.sign`) instead of `signMessage()`, which added the EIP-191 prefix and produced signatures the contract's `verifyMessage` (raw `ecrecover`) rejected.\n\n### 1.0.2 (2026-08-10)\n- **Fixed**: Corrected the default OxaChain L1 Bridge address in `DEFAULT_CHAINS` (`0xd43Eba…` → correct deployment).\n- **Fixed**: Replaced the dead drpc Sepolia RPC with `https://ethereum-sepolia.publicnode.com`.\n\n### 1.0.1 (2026-08-10)\n- **Fixed**: `gasLimit` applied on the `transferTokens` transaction.\n\n### 1.0.0 (2026-07-17)\n- Initial release: cross-chain ERC20 transfers (Native Lock/Unlock), fee estimation, route discovery, event listening.\n","readmeFilename":"README.md"}