TypeScript SDK for multi-chain transaction operations, supporting login signatures and transaction submissions for mainstream blockchains such as Ethereum, BSC, Arbitrum, Solana and Tron.
- 🌐 Multi-chain support: integrated EVM-compatible chains (ETH/BSC/Arbitrum) and non-EVM chains (Solana/Tron)
- 🔐 Wallet connection: support MetaMask/Phantom/TronLink and other mainstream wallets
- 📦 Out-of-the-box: encapsulate chain interaction logic to simplify DApp development
npm install multichain-interop-js
# or
yarn add multichain-interop-js
Ethereum
BSC
Arbitrum
Solana
Tron
import MultichainInteropJs, { AccountInfo, ChainType } from 'multichain-interop-js';
// Initialize configuration (update chainApi URL when necessary)
MultichainInteropJs.setConfig({
chainApi: "https://expnode.amaxscan.io",
proxyApi: "https://truedex.io/proxy",
ownerContract:"interopowner",
defaultDelay: 3000,
});
// Ethereum Login
const ethLogin = async () => {
try {
const account: AccountInfo | string = await MultichainInteropJs.loginByChain('eth' as ChainType);
if(typeof account === 'string'){
console.log('errorMsg',account)
}else{
console.log('successObject',account)
}
} catch (error) {
console.error('Login failed:', error);
}
};
// Solana Login
const solanaLogin = async () => {
const account: AccountInfo | string = await MultichainInteropJs.loginByChain('solana' as ChainType);
if(typeof account === 'string'){
console.log('errorMsg',account)
}else{
console.log('Solana public key',account?.address)
}
};
const sendTransaction = async () => {
const result = await MultichainInteropJs.transactByChain(
'eth', // Chain Type
'0x123...4ow', // User address
[{ // Transaction parameters
contract: 'abc.contract', //update contract accordingly
action: 'transfer',
data: {
from: 'apl...eg',
to: 'apl...ee',
quantity: '1.0000 ETH'
}
}]
);
if (result.includes('success:')) {
console.log('Transaction confirmed!');
}else{
console.log('errorMsg',result)
}
};