multichain-interop-js
v3.6.3
Published
A simple Web3 wallet connector supporting Ethereum, Solana, Tron, and Arbitrum.
Maintainers
Readme
MultiChain Interoperability SDK
TypeScript SDK for FullOn Network blockchain interoperability with other multiple supported chains for transaction operations, supporting login signatures and transaction submissions for mainstream blockchains such as Ethereum, BSC, Arbitrum, Solana and Tron.
Features
- 🌐 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
Install
npm install multichain-interop-js
# or
yarn add multichain-interop-jsCurrenly Supported Chain Types
EthereumBSCArbitrumSolanaTron
Wallet login example
import MultichainInteropJs, { AccountInfo, ChainType } from 'multichain-interop-js';
// Initialize configuration (update chainApi URL when necessary)
MultichainInteropJs.setConfig({
chainApi: "https://m.flonscan.io",
proxyApi: "https://proxy.flon.network/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)
}
};Submit transaction example
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)
}
};