Frequently Asked Questions

From Status Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

Contents

Status API FAQs

 How can I set the text input value?

You can use status.components.dispatch in tandem with the SET_VALUE object. For instance, if you wanted to suggest a url, you would do the following: status.components.dispatch([status.events.SET_VALUE, "@browse url"])}. A more complete example is also given alongside.
return {
    markup: status.components.touchable({
    onPress: status.components.dispatch([status.events.SET_VALUE, "@browse url"])},
    status.components.view(
        {},
        status.components.text(
            {},
            "Click me"
        )
    )
)};

How can I send a command a display result back?

Here we use the onSend function to direct a user to a website based on their initial input.
status.command({
    name: "google_or_yahoo",
    title: 'TITLE',
    description: 'DESCRIPTION',
    fullscreen: true,
    params: [{
        name: "option",
        type: status.types.TEXT,
        placeholder: "either type G or Y"
    }],
    onSend: function(params){
        console.log('***', params);
        if (params.option == 'g') {
            url = 'http://www.google.com'
        } else {
            url = 'http://www.yahoo.com'
        }
        return {
            title: "Browser",
            dynamicTitle: true,
            singleLineInput: true,
            actions: [ { type: status.actions.FULLSCREEN } ],
            markup: status.components.bridgedWebView(url)
        };
    }
});

Can I send a message asynchrounously after and request has been sent?

Use the latest nightlies and status.sendMessage will now be available.
status.command({
    name: "test",
    icon: "test",
    title: "test",
    description: "test",
    color: "#a187d5",
    sequentialParams: true,
    params: [{
        name: "address",
        type: status.types.TEXT,
        placeholder: "address"
    }],
    handler: function (params) {
        status.sendMessage("Address " + params.address);
    }
});

How can I add an image to my reactive component?

It's easy enough to achieve this by using status.components.image.
status.components.image({
    style: {
        width: 50, height: 50
    }, 
    source: {
        uri: 'https://facebook.github.io/react/img/logo_og.png'
    }
}),

Why do we use async JS calls in React Native but sometimes sync calls for bots?

(Based on answer by @roma in Slack on August 15, 2017)

In general we want to use async, however, different JS environments have different capabilities to consider:

React Native

  1. RN doesn’t support sync http calls (that’s why we didn’t use sync calls with web3 when we used http provider)
  2. RN doesn’t allow to make sync calls to native modules, currently we are calling CallRPC through native modules, that’s why calls can be only async

Dapps

  • Dapps are running in webview env which supports sync calls in some cases (only android), but we don’t support sync calls for iOS, that will not work. Mostly any call to web3 causes http request, so using sync call is a bad idea in one threaded env, in any case. So I wouldn’t use it in dapps.

Bots in Otto VM

During the last year both sync and async calls  were handled by the same function and tbh that was sync call with only difference: in case when we pass callback it was called instead of returning the value. But the call was blocking. I’m not sure if it was implemented, but there were issues with making async calls in otto really async.

Summary

  • Both sync and async calls are available in otto
  • Only async in RN
  • Only async in iOS webview
  • Both async/sync in Android webview

Building A Bot FAQs

 My bot has been deployed but it does not appear to work.

Make sure that the bot-url you provided when adding your bot is accessible from your device. An easy way to test this is to open it in mobile browser.

Is there a way to debug my bot?

status-dev-cli log allows to access outputs from console.log(). So, just add in the necessary console.log()s and read them in your terminal. The team is working actively to make this easier.

Can I connect to a different RPC server?

status-dev-cli switch-node only works for dapp-urls at the moment. Due to the restrictions of the Otto VM jail that the bots js is run in, it still connects by default to Ropsten and your Status account. The team is actively working on ways around this.

I have a suggestionsView similar to the slider view shown in the docs.I want it to set a command argument similar to the SET_COMMAND_ARGUMENT event in a regular suggestions view. How do I accomplish that?

['dispatch', [status.events.SET_COMMAND_ARGUMENT, [0 /*arg idx*/, value, false /*move-to-next? true or false*/]]]
  ['touchable',
        {onPress: ['dispatch', [status.events.SET_COMMAND_ARGUMENT, [0, value, false]]]},
        ['view', {}, ['text', {}, 'Set value']]
    ],

Can custom commands be added to normal chat?

Currently they are only available to 1-1 chat with bots. At some stage in the future we will implement group chats and all your dreams will come true.

JS and web3 FAQs

Can data be stored and retrieved? If so, how?

Yes it can be, using localStorage.
status.addListener("on-message-send", function (params, context) {
    var cnt = localStorage.getItem("cnt");
    if(!cnt) {
        cnt = 0;
    }

    cnt++;

    localStorage.setItem("cnt", cnt);
    if (isNaN(params.message)) {
        return {"text-message": "Seems that you don't want to send money :(. cnt = " + cnt};
    }

    var balance = web3.eth.getBalance(context.from);
    var value = parseFloat(params.message);
    var weiValue = web3.toWei(value, "ether");
    if (bn(weiValue).greaterThan(bn(balance))) {
        return {"text-message": "No way man, you don't have enough money! :)"};
    }
    web3.eth.sendTransaction({
        from: context.from,
        to: context.from,
        value: weiValue
    }, function (error, hash) {
        if (error) {
            status.sendMessage("Something went wrong, try again :(");
            status.showSuggestions(demoSuggestions(params, context).markup);
        } else {
            status.sendMessage("You are the hero, you sent " + value + " ETH to yourself!")
        }
    });
});

Can I interact with web3 object?

Yes! The snippet provided showcases both localStrage and the web3 object operating in tandem.

Can I parse JSON data?

Yes JSON.parse() is supported.

Is XMLHttpRequest supported?

Not yet.

Any examples?

General FAQs

Why a Messenger?

When looking at how to achieve mass adoption for a client, we looked at how people interact with their devices. For instance, as of 2014 more time is spent on mobile devices compared with desktop PCs. Moreover, a third of that total time is spent within instant messaging applications. Amongst mobile apps, instant messengers have the highest retention rates. Once installed they become sticky and typically users won't uninstall immediately. Therefore, for mass adoption an instant messenger simply makes senses. Once network effects come into play and user's friends also begin to utilise the app the average user lifetime skyrockets. When you start thinking about this as a user base and how to connect that with Ethereum, things like payments and applications built atop of Ethereum and integrated into a conversational interface begin to seem like a clear path forward.

Ultimately what we're building is a hybrid browser and messenger, this allows us to have the best chance at casting the widest net which permits us to focus on user acquisition, staying agnostic and as close as possible to the principles that Ethereum embodies.

Does Status support DApps that have their own web page ?

Yes, we absolutely support DApps on their own webpage and are striving for SWARM support also. Chances are, if a DApp works in Mist or MetaMask it is likely to work in Status!

Our goal is to be a DApp browser for Android & iOS, in addition to this we support a Chat API if you wish to integrate within a chat context.

If your web-based DApp renders on mobile, trying using the @browse command inside a chat and navigating to your DApp URL! During our alpha release, DApp developers can also add their DApps as default contacts by following these instructions, but in later releases these will be discoverable to uses through the Discover feature.

Can your App be launched with a link?

Not at the moment, the standard we'll likely support is EIP67

Do I have to run go-ethereum myself or on server?

Status includes go-ethereum and connects directly to the Ethereum network. All you need to do is run the Status app! This is possible to do with the new Light Client Protocol we've implemented into our own Codebase

When did you start coding and how you are funded?

Status is largely self-funded. We've been working on it since prior to Devcon1 in 2015, and we were awarded a Devgrant to port EthereumJ to Android prior to that.

EthereumJ has different goals, its developers intended for server use and had no interest in supporting the light client protocol, another large factor is we wanted largely a single codebase for multiple platforms, we had Java running on iOS and Android, we want unify the GUI but the means to do that (JavaFX) is really not suited to mobile devices.

Our current approach allows us to get bleeding edge tech and stability of geth whilst maintaining a single codebase.

I am new to Ethereum & Blockchain. I would like to contribute to the project, where would you suggest I start?

To get up to speed with Ethereum, here are a few resources to get you started: EthDocs , Ethereum.org , Ethereum Stack Exchange , Ethereum on YouTube , Ethereum from scratch

For contributing to Status directly you will want to check out our Developer Documentation

I have a DApp that runs on Mist how can I test it in Status?

So each chat context has a command @browse - allowing users to access a webview (you can imagine this as a bit like a browser tab), so much in the same way as mist. In terms of integration/compatibility nothing is required on your end to do that if it already works in Mist.

That said, looking beyond the alpha, we'll have developer tooling, and a way for DApp developers to have profiles for theirs DApps (this then makes them discoverable through the 'Discover' feature), along with the Chat API for Developers who want to integrate through a conversational UI rather than (or in addition to) webview.

What is the "jail" in your status-react code?

When the Chat API is ready to use, your javascript code is executed in Otto VM this is the same javascript engine go-ethereum uses. That way your code is executed in a "jail" and shouldn't interfere with the rest of Status. At least, that's the theory, at the moment we have no implementation of the halting problem, but we will.

For web DApps, we rely on the webview to correctly jail javascript.

Is it going to be for Android only?

No, we currently support both iOS and Android and have a dedicated team working on desktop integration.

Is it possible to install Status & how can I test?

We are working through getting more TestFlight invites out for iOS, so make sure to sign up on the homepage. For Android users you can navigate to our http://artifacts.status.im:8081/artifactory/nightlies-local/ nightly build repository] and download an APK for yourself. Alternatively, we have a section on how to </nowiki>build it yourself.

What languages do you support?

We’re currently supporting 30 languages — this includes; English, 官話, 官话, 廣東話, 上海话, Nederlands, Français, Deutsch, हिन्दी, Magyar, Italiano, 日本語, 한국어, Polski, Português brasileiro, Português europeu, Română, Slovenski, Español, Español (Latin-America), Swahili, Svenska, Suisse française, Schweizerdeutsch, Svizzera Italiana, ภาษาไทย, Türkçe, русский, українська, اُردُو & Tiếng Việt!

If you see a typo, mistranslation or something missing, don't hesitate to let us know via the Status Riot, or fix it yourself using our Translation Guide! <Needs link

What about all these permissions in the app?

Permissions are always a hot topic for apps, we hate the way we’re doing them too. The good news is it’s only like this for alpha and in production we’ll make permission usage on-demand. At the moment there’s many moving parts and a bunch of react-native dependencies (and Instabug) which don’t have code to ask on-demand. Thanks for understanding!

  • Contacts, SMS, Telephone — these are for an optional step of phone contact synchronisation. We don’t use them unless you tap on the phone sync request message. This allows you to find your friends with related contacts.
  • Location — Currently used for our /location command. Our aim is to provide this to DApps For things like sharing location with friends, ordering food, or self-driving cars.
  • Microphone — In this version, we don’t need it, it’s there because we intended to send audio messages over Whisper, in practice this was a bad idea. We still intend to offer Audio messages in Beta so it’s going to stay. It is also used in Instabug which we use to collect feedback.
  • Storage — We need a place to put the blockchain data this will most likely be Swarm.
  • Camera — We use this for setting your profile picture and for reading QR codes.

How can I install a nightly for android?

Here you go!

Is there a rationale for using simple optimizations only for prod builds?

difference in size is about 300KB, anyway RN packager makes some magic with js after cljs compiler. The difference in error output is that with `:simple` we have much more useful info if error happens, not just `a.b.adsfas is undefined`.

The only reason why we added `:advanced` was that when resulting cjs was small RN packager ran much faster. And we didn’t meet that non-configurable 300s timeout for packager


Is that intentional? Alice has account Sneaky White Koala. Bob has account Cool Damp Bear

When Alice adds Bob's account, she will see him as e.g. Breezy Tall Elephant Until Bob repays the honors.

the names are not currently deterministic so the best option at the time, was to randomly generate one well, we intentionally did that behaviour but it's not desirable in this revision

Is there no way to skip new account creation wizard after a fresh install? If e.g. I just installed Status on a new device, but only with intention to recover my existing account there?

we'll be redesigning the onboarding but currently, no, the reason was back in the day 90% of people would be making a new account

https://github.com/status-im/status-react/issues/741

Saved username, image, etc are only stored in the device's local storage, right? Not supposed to be restored ?

thats correct, we have no servers to store that on (as we are a p2p application), when we have Light Swarm Clients (goteam i'm looking at you!) we can have some kind of persistent state, photo/audio messaging, encrypted app-db and uploaded to swarm for retrieval

[1]

Why do we use async JS calls in RN but sometimes sync calls for bots?

Different JS environments have different capabilities. In general we want to use async.

React Native

  • RN doesn’t support sync http calls (that’s why we didn’t use sync calls with web3 when we used http provider)
  • RN doesn’t allow to make sync calls to native modules, currently we are calling CallRPC through native modules, that’s why calls can be only async

Dapps

Dapps are running in webview env which supports sync calls in some cases (only android), but we don’t support sync calls for iOS, that will not work. Mostly any call to web3 causes http request, so using sync call is a bad idea in one threaded env, in any case. So i wouldn’t use it in dapps.

Bots in Otto VM

During the last year both sync and async calls were handled by the same function and tbh that was sync call with only difference: in case when we pass callback it was called instead of returning the value. But the call was blocking. I’m not sure if it was implemented, but there was an issues about making async calls in otto really async.

Summary

  • Both sync and async calls are available in otto
  • Only async in rn
  • Only async in iOS webview
  • Both async/sync in Android webview