Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
feat: Added sendProviderError to JS Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Nov 8, 2023
1 parent d1b4d49 commit 76f4a45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/web3_provider/lib/assets/posi.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -26292,6 +26292,12 @@
}
},
},
{
key: "sendProviderError",
value: function sendProviderError(id, code, message) {
this.sendError(id, new _error["default"](code, message));
},
},
]);
return PosiWeb3Provider;
})(_base_provider["default"]);
Expand Down
6 changes: 6 additions & 0 deletions packages/web3_provider/lib/js_bridge_callback_bean.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ extension Web3Result on InAppWebViewController {
evaluateJavascript(source: script);
}

/// send error to dapp
void sendProviderError(int id, int code, String message) {
final script = "window.ethereum.sendProviderError($id, $code,\"$message\")";
evaluateJavascript(source: script);
}

/// send result to dapp
void sendResult(String result, int id) {
final script = "window.ethereum.sendResponse($id, \"$result\")";
Expand Down

0 comments on commit 76f4a45

Please sign in to comment.