# 如何调用合约-从Jumper Exchange开始 **Published by:** [Liangzmt](https://paragraph.com/@liangzmt/) **Published on:** 2023-05-07 **URL:** https://paragraph.com/@liangzmt/jumper-exchange ## Content 1.前言由于Linea Voyage的任务导致Jumper前端受到大量请求,从而导致无法进行正常的用户交互。因此,本文将向大家介绍如何进行合约调用。在本文中,我们将详细介绍如何使用Metamask进行绕过注册以太坊节点进行合约交互。2.步骤2.1 首先要明确各个网络上的合约地址 goerli合约地址 UNI- 0x41E5E6045f91B61AACC99edca0967D518fB44CFB USDT- 0xfad6367E97217cC51b4cd838Cc086831f81d38C2 linea的合约地址 UNI- 0x7823E8DCC8bfc23EA3AC899EB86921f90e80F499 USDT- 0x1990BC6dfe2ef605Bfc08f5A23564dB75642Ad73 2.2 API访问 这里直接通过网页访问获取数据,绕过前端,其中合约地址1为goerli合约地址,合约地址2为linea的合约地址,还要填写自己的地址,之后获取datahttp://staging.li.quest/v1/quote?fromChain=5&toChain=59140&fromToken=合约地址1&toToken=合约地址2&fromAddress=你的地址&fromAmount=10000&slippage=0.01&allowBridges=&allowExchanges= data段2.3 代币授权 这一步直接可以在Jumper前端进行写入就不赘述了.代币授权2.4 合约调用 获得data之后,进入有Metamask的浏览器,按住F12调用控制台,进行钱包连接ethereum.request({ method: 'eth_requestAccounts' }); 连接钱包成功后直接请求发送交易,在params参数那里填写得到的data那一块ethereum.request({ method: 'eth_sendTransaction', params: [ { 这里填获得的数据,注意前一个没有‘’,例如 gasPrice: '0x09184e72a000', gas: '0x2710' }, ], }) .then((txHash) => console.log(txHash)) .catch((error) => console.error(error)); 之后小狐狸会谈起合约交互请求,完成后即可.3.总结在合约交互这一块默认使用Metamask就不用去infura等第三方API申请帐号了,直接在浏览器完成十分简单.如果对你有帮助欢迎关注我的Twitter:@Liangzmt赞助GETH: 0xB8C3F7F9B134D4498f3EA98E7a2a468575930778 ## Publication Information - [Liangzmt](https://paragraph.com/@liangzmt/): Publication homepage - [All Posts](https://paragraph.com/@liangzmt/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@liangzmt): Subscribe to updates - [Twitter](https://twitter.com/liangzmt): Follow on Twitter