I am integrating payment transaction for two blockchains , ethereum and solana using Web3.js. But how to automatically convert the dollar price to Ethereum and Solana respectively?
Ethereum payment code
----------------------------------
const amountEth=0.00001
Web3.eth.sendTransaction({
to: paymentAddress,
value: Web3.toWei(amountEth, 'ether')
}, (err, transactionId)=>{
if(err){
}else{
}
})
Solana Payment Code
-------------------------
var transaction = new solanaWeb3.Transaction().add(
solanaWeb3.SystemProgram.transfer({
fromPubkey: resp.publicKey,
toPubkey: recieverWallet,
lamports: 0.00000000001 * solanaWeb3.LAMPORTS_PER_SOL,
}),
);