EverWallet sendMessage参数数量不匹配错误原因咨询
错误原因分析:everwallet sendMessage: Parameter count mismatch
这个错误的核心是你调用sendMessage时的参数传递方式不符合EverWallet接口要求:
- EverWallet的
rawApi.sendMessage接口不接收单个配置对象作为参数,而是需要逐个传入独立参数。 - 你当前把所有参数打包成一个对象传递,相当于只传了1个参数,但接口期望多个独立参数,因此触发了「参数数量不匹配」的错误。
修正后的代码示例
public async getEverWalletTransaction( recipient: string, price: any, payload: any, ): Promise<string> { console.log(this.wallet.address); console.log(recipient); console.log(price.toString()); console.log(payload); // 改为逐个传入参数,最后一个是包含bounce、payload的配置对象 const { transaction } = await this.ton.rawApi.sendMessage( this.wallet.address, recipient, price.toString(), { bounce: true, payload } ); return transaction.id.hash; }
关键说明
sendMessage的标准参数顺序为:sender(字符串)、recipient(字符串)、amount(字符串),最后是可选的配置对象(包含bounce、payload等属性)。- 严格按照这个参数结构传递,就能解决参数数量不匹配的问题。
内容的提问来源于stack exchange,提问作者Стас Рябцев
相关产品推荐
相关产品推荐

