Skip to Content
dApps
このページの内容

API リファレンス

OneKey の Conflux プロバイダーのメソッドと型のリファレンス。


メソッド

メソッド説明
request({ method, params })JSON-RPC リクエストを送信
isConnected()接続状態を確認
on(event, callback)イベントを購読
off(event, callback)イベントの購読を解除

RPC メソッド

メソッド説明
cfx_requestAccounts接続を要求
cfx_accounts接続済みアカウントを取得
cfx_chainIdチェーン ID を取得
cfx_sendTransactionトランザクションを送信
cfx_callコントラクトを呼び出す (読み取り専用)
cfx_estimateGasAndCollateralガスを見積もる
cfx_getBalanceアカウント残高を取得
cfx_getTransactionByHashトランザクションを取得
cfx_getTransactionReceiptレシートを取得
net_versionネットワーク ID を取得

イベント

イベントパラメーター説明
connect{ chainId, networkId }ネットワーク接続時
disconnect-切断時
chainChangedchainIdネットワーク変更時
accountsChangedaccounts[]アカウント変更時

非推奨のメソッド

以下のメソッドは引き続き動作しますが、非推奨です:

// Deprecated: use request({ method: 'cfx_requestAccounts' }) await provider.enable() // Deprecated: use request() await provider.send({ method: 'cfx_accounts' }) await provider.sendAsync({ method: 'cfx_accounts' }, callback) // Deprecated: use request({ method: 'cfx_chainId' }) provider.chainId // Deprecated: use request({ method: 'net_version' }) provider.networkVersion // Deprecated: use request({ method: 'cfx_accounts' }) provider.selectedAddress

エラーコード

コード説明
4001ユーザーがリクエストを拒否
-32700解析エラー
-32600無効なリクエスト
-32601メソッドが見つからない
-32602無効なパラメーター
-32603内部エラー
最終更新日