メインコンテンツまでスキップ

エラー

プロバイダーリクエストは必ずtry / catchで囲んでください。Paliは可能な限り標準のJSON-RPCおよびEIP-1193スタイルのエラーを使用し、未サポートネットワーク、ハードウェアウォレット制約、passkey状態にはウォレット固有のエラーも使用します。

try {
await window.ethereum.request({
method: 'eth_sendTransaction',
params: [tx],
});
} catch (error) {
switch (error.code) {
case 4001:
console.log('User rejected the request.');
break;
case 4100:
console.log('The dapp is not authorized.');
break;
case 4200:
console.log('The method is unsupported.');
break;
default:
console.error(error);
}
}

一般的なカテゴリ

コード意味
4001ユーザーがリクエストを拒否しました。
4100未承認のアカウントまたはメソッドです。
4101メソッドは別のチェーンファミリーでのみ利用できます。
4200未サポートのメソッドです。
4900プロバイダーが切断されています。
4901プロバイダーが要求されたチェーンから切断されています。
5710EIP-5792 bundleのチェーンに対するRPCがウォレットに設定されていません(wallet_getCallsStatus / wallet_showCallsStatus)。
5720wallet_sendCallsでdappが指定したEIP-5792 bundle idの重複です。
5730wallet_getCallsStatus / wallet_showCallsStatusの不明なEIP-5792 bundle idです。

より長いリファレンスはError codesを参照してください。