Current collected state Current
Observed since 20 Oct, 22:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery, plus OxaChain L1 test-token faucet
0xBridge Cross-Chain SDK — one-line cross-chain ERC20 transfers with fee estimation and route discovery.
npm install @0xaibridge/sdk
import { bridge, estimateFee, getRoute } from '@0xaibridge/sdk';
// Mode 1: Quick cross-chain transfer (requires PRIVATE_KEY env)
const { txHash, estimatedTime } = await bridge({
fromChain: '11155111', // Sepolia
toChain: '19505', // OxaChain L1
token: '0x87dec5277dA56Bc843C76A1fFc26Fe5964Bee9e4',
amount: '1000000', // in wei
recipient: '0x...',
});
// Mode 2: SDK instance (full control)
const sdk = bridge({
bridgeAddress: '0x139632f19355bF58f95818553CbB9E0F77f62202',
rpcUrl: 'https://ethereum-sepolia.publicnode.com',
signerKey: process.env.PRIVATE_KEY,
});
const { tx, sequence } = await sdk.transfer({
token: '0x...',
amount: '1000000',
toChain: 19505,
to: '0x...',
});
| Function | Description |
|---|---|
bridge(opts) | Dual-mode: with bridgeAddress → returns BridgeSDK instance; with fromChain → executes transfer directly |
estimateFee({fromChain, toChain, token, amount}) | Estimate gas fee for a bridge transfer. Returns { fee, feeToken, estimatedTime } |
getRoute({fromChain, toChain, token}) | Query available bridge routes. Returns { available, routes } |
hashTransfer(transfer) | Hash a Transfer struct for signing |
encodeTransfer(transfer) | ABI-encode a Transfer struct |
class BridgeSDK {
constructor(opts: BridgeOptions)
// Read
chainId(): Promise<number>
isWrapped(token: string): Promise<boolean>
wrappedAsset(tokenChain: number, tokenAddress: string): Promise<string>
isTransferCompleted(tokenChain: number, tokenAddress: string, sequence: bigint): Promise<boolean>
// Write
transfer(params: TransferParams): Promise<{ tx, sequence }>
// Events
onTransfer(chainId: number, callback): ethers.Contract
// Static
static signAndComplete(params): Promise<{ tx, blockNumber }>
static parseTransferFromLog(log): BridgeTransfer
}
interface BridgeOptions {
bridgeAddress: string; // Bridge contract address
rpcUrl?: string; // RPC endpoint (or use provider)
provider?: ethers.Provider; // ethers Provider instance
signerKey?: string; // Private key for signing
signer?: ethers.Signer; // ethers Signer instance
gasLimitTransfer?: number; // Default: 400000
gasLimitComplete?: number; // Default: 300000
}
interface TransferParams {
token: string; // ERC20 token address
amount: string | bigint; // Amount in wei
toChain: number; // Destination chain ID
to: string; // Recipient address
}
| Chain | ID | Bridge Address |
|---|---|---|
| Sepolia | 11155111 | 0x139632f19355bF58f95818553CbB9E0F77f62202(bridgeChainId=10002) |
| OxaChain L1 | 19505 | 0x86a81a183085Ce7F44813982b06ad5b3C57B8d83 |
| BSC Testnet | 97 | 0x0000000000000000000000000000000000000000 |
const { fee, feeToken, estimatedTime } = await estimateFee({
fromChain: '11155111',
toChain: '19505',
token: '0x87dec5277dA56Bc843C76A1fFc26Fe5964Bee9e4',
amount: '1000000',
});
console.log(`Fee: ${fee} ${feeToken}, ETA: ${estimatedTime}s`);
const { available, routes } = await getRoute({
fromChain: '11155111',
toChain: '19505',
token: '0x...',
});
// routes[0] → { bridge: '0xBridge', fee: '~0.001 ETH', time: 60 }
const sdk = bridge({
bridgeAddress: '0x86a81a183085Ce7F44813982b06ad5b3C57B8d83',
rpcUrl: 'http://43.156.99.215:18545',
});
// Listen for transfers targeting chain 19505
sdk.onTransfer(19505, ({ transfer, log }) => {
console.log(`Incoming transfer: seq=${transfer.sequence}, amount=${transfer.amount}`);
});
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).0x139632f19355bF58f95818553CbB9E0F77f62202 (bridgeChainId 10002), OxaChain L1 0x86a81a183085Ce7F44813982b06ad5b3C57B8d83 (chainId 19505).isTransferCompleted(tokenChain, tokenAddress, sequence) — three-argument completion query keyed by (tokenChain, tokenAddress, sequence), matching the on-chain fix for cross-chain sequence collisions.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.DEFAULT_CHAINS (0xd43Eba… → correct deployment).https://ethereum-sepolia.publicnode.com.gasLimit applied on the transferTokens transaction.Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:b3df397ce7866122a6b1750488ed032e2e62661cbc88ebf07d6b5946d27b00d6