From 5d10be776751e5458366faeed1e9b66ecd43a040 Mon Sep 17 00:00:00 2001 From: Ivan Tomilov Date: Wed, 20 Sep 2017 18:51:22 +0300 Subject: [PATCH] Updated Usage Patterns (markdown) --- Usage-Patterns.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Usage-Patterns.md b/Usage-Patterns.md index 86edfb1..5ee25b0 100644 --- a/Usage-Patterns.md +++ b/Usage-Patterns.md @@ -9,4 +9,37 @@ This page serves as a place with a collection of random facts about how status-r 1) React Native, which is used for running app itself, this env can call web3 through CallRPC and we have a full control over code inside this env 2) webviews: among other things Status is dapp browser, so users can run dapps in the webview and we inject web3 object into webview in order to make this happen. We don’t have control over code inside this env, it’s third party. All calls to web3 inside webview are passed to CallRPC as well 3) jail (otto vm): we are using this env in order to allow third party to define commands and different bot’s behaviour in chat. Calls to web3 are handled internally on go side, so we don’t use CallRPC at least from status-react side here. Ans again, code is written by third parties, except our own bots -4) JNI signals: https://github.com/status-im/status-go/wiki/Notes-on-Bindings \ No newline at end of file +4) JNI signals: https://github.com/status-im/status-go/wiki/Notes-on-Bindings + +## What are Send and SendAsync? + +![](https://i.imgur.com/Ov1Y0H4.png) + +The source: +``` +Consumer->Go Bindings: Call +Go Bindings->statusAPI: JailCall +statusAPI->Jail: Call +Jail->JailCell: Call +note right of JailCell: cell.Lock() +JailCell->Otto: Call +Otto->+web3: eth_whateverWithoutCallback +web3->jail: Send +note left of jail: cell.Unlock() +note over jail: RPC calls and VM interactions +note left of jail: cell.Lock() +web3-->-Otto: result +note right of JailCell: cell.Unlock() + +Consumer->Go Bindings: Call +Go Bindings->statusAPI: JailCall +statusAPI->Jail: Call +Jail->JailCell: Call +note right of JailCell: cell.Lock() +JailCell->Otto: Call +Otto->+web3: eth_whateverWithCallback +web3->jail: SendAsync +web3-->-Otto: otto.UndefinedValue() +note right of JailCell: cell.Unlock() +note over jail: RPC calls and VM interactions +``` \ No newline at end of file