我正在嘗試顯示await this.contract.mint(amount, {value: this.state.tokenPrice.mul(amount)}). 我想看看它輸出什么。
async mintTokens(amount: number): Promise<void>
{
try {
let showResult = await this.contract.mint(amount, {value: this.state.tokenPrice.mul(amount)});
this.setState({
successMessage: showResult,
});
} catch (e) {
this.setError(e);
}
}
代碼有錯誤Type 'ContractTransaction' is not assignable to type 'string'.,我不太確定如何解決這個問題。
uj5u.com熱心網友回復:
您可以對物件進行字串化:
...
this.setState({
successMessage: JSON.stringify(showResult),
});
...
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/432119.html
下一篇:從剛剛完成的請求中讀取資料
