2016-11-22 12:50:52 +00:00
I18n . translations = {
en : {
phone _title : 'Send Phone Number' ,
phone _description : 'Find friends using your number' ,
phone _placeholder : 'Phone number' ,
confirm _description : 'Confirmation code' ,
confirm _validation _title : 'Confirmation code' ,
confirm _validation _description : 'Wrong format' ,
password _description : 'Password' ,
password _placeholder : 'Type your password' ,
password _placeholder2 : 'Please re-enter password to confirm' ,
password _error : 'Password should be not less then 6 symbols.' ,
password _error1 : 'Password confirmation doesn\'t match password.' ,
2016-12-06 23:09:41 +00:00
password _validation _title : 'Password' ,
2016-11-22 12:50:52 +00:00
2016-12-06 23:09:41 +00:00
faucet _incorrect _title : 'Incorrect faucet' ,
faucet _incorrect _description : 'Please, select a one from the list'
2016-11-22 12:50:52 +00:00
} ,
ru : {
phone _title : 'Отправить номер телефона' ,
phone _description : 'Найти друзей, используя ваш номер' ,
phone _placeholder : 'Номер телефона' ,
confirm _description : 'Код подтверждения' ,
confirm _validation _title : 'Код подтверждения' ,
confirm _validation _description : 'Неверный формат' ,
password _description : 'Пароль' ,
password _placeholder : 'Введите свой пароль' ,
password _placeholder2 : 'Повторно введите пароль для подтверждения' ,
password _error : 'Пароль должен содержать не менее 6 символов' ,
password _error1 : 'Подтверждение пароля не совпадает с паролем' ,
password _validation _title : 'Пароль'
} ,
af : {
phone _title : 'Stuur telefoonnommer' ,
phone _description : 'Vind vriende deur jou nommer te gebruik' ,
phone _placeholder : 'Telefoonnommer' ,
confirm _description : 'Bevestigingskode' ,
confirm _validation _title : 'Bevestigingskode' ,
confirm _validation _description : 'Verkeerde formaat' ,
password _description : 'Wagwoord' ,
password _placeholder : 'Tik jou wagwoord in' ,
password _placeholder2 : 'Tik asseblief weer jou wagwoord in om te bevestig' ,
password _error : 'Wagwoord mag nie minder as 6 simbole wees nie.' ,
password _error1 : 'Wagwoordbevestiging is nie dieselfde as wagwoord nie.' ,
password _validation _title : 'Wagwoord'
} ,
ar : {
phone _title : 'أرسل رقم الهاتف' ,
phone _description : 'ابحث عن الأصدقاء باستخدام رقمك' ,
phone _placeholder : 'رقم الهاتف' ,
confirm _description : 'رمز التأكيد' ,
confirm _validation _title : 'رمز التأكيد' ,
confirm _validation _description : 'صيغة خاطئة' ,
password _description : 'كلمة المرور' ,
password _placeholder : 'اكتب كلمة المرور الخاصة بك' ,
password _placeholder2 : 'الرجاء إعادة إدخال كلمة المرور للتأكيد' ,
password _error : 'ينبغي أن لا تقل كلمة المرور عن 6 رموز.' ,
password _error1 : 'لا يتوافق تأكيد كلمة المرور مع كلمة المرور.' ,
password _validation _title : 'كلمة المرور'
} ,
'zh-hant' : {
phone _title : '發送手機號碼' ,
phone _description : '使用您的號碼發現好友' ,
phone _placeholder : '手機號碼' ,
confirm _description : '確認碼' ,
confirm _validation _title : '確認碼' ,
confirm _validation _description : '格式錯誤' ,
password _description : '密碼' ,
password _placeholder : '鍵入您的密碼' ,
password _placeholder2 : '重新鍵入您的密碼' ,
password _error : '密碼不得短於6個字元。' ,
password _error1 : '確認密碼與鍵入的密碼不一致。' ,
password _validation _title : '密碼'
} ,
'zh-hans' : {
phone _title : '发送电话号码' ,
phone _description : '用你的号码来查找朋友' ,
phone _placeholder : '电话号码' ,
confirm _description : '确认码' ,
confirm _validation _title : '确认码' ,
confirm _validation _description : '格式错误' ,
password _description : '密码' ,
password _placeholder : '输入密码' ,
password _placeholder2 : '请重新输入密码以确认' ,
password _error : '密码应不少于6个字符。' ,
password _error1 : '密码确认信息与密码不匹配。' ,
password _validation _title : '密码'
} ,
'zh-yue' : {
phone _title : '發送電話號碼' ,
phone _description : '使用本電話號碼查找好友' ,
phone _placeholder : '電話號碼' ,
confirm _description : '驗證碼' ,
confirm _validation _title : '驗證碼' ,
confirm _validation _description : '格式錯誤' ,
password _description : '密碼' ,
password _placeholder : '輸入密碼' ,
password _placeholder2 : '請重新輸入密碼確認' ,
password _error : '密碼不能短於6個字符.' ,
password _error1 : '確認密碼與輸入密碼不符.' ,
password _validation _title : '密碼'
} ,
'zh-wuu' : {
phone _title : '发送电话号码' ,
phone _description : '用您的号码查找朋友' ,
phone _placeholder : '电话号码' ,
confirm _description : '确认码' ,
confirm _validation _title : '确认码' ,
confirm _validation _description : '错误格式' ,
password _description : '密码' ,
password _placeholder : '输入密码' ,
password _placeholder2 : '请重新输入密码确认' ,
password _error : '密码应不小于6个字符。' ,
password _error1 : '密码确认不匹配。' ,
password _validation _title : '密码'
} ,
nl : {
phone _title : 'Stuur telefoonnummer' ,
phone _description : 'Zoek vrienden met behulp van je nummer' ,
phone _placeholder : 'Telefoonnummer' ,
confirm _description : 'Bevestigingscode' ,
confirm _validation _title : 'Bevestigingscode' ,
confirm _validation _description : 'Verkeerd format' ,
password _description : 'Wachtwoord' ,
password _placeholder : 'Typ je wachtwoord' ,
password _placeholder2 : 'Voer je wachtwoord opnieuw in om te bevestigen' ,
password _error : 'Wachtwoord moet minstens 6 tekens hebben.' ,
password _error1 : 'Wachtwoordbevestiging komt niet overeen met wachtwoord.' ,
password _validation _title : 'Wachtwoord'
} ,
fr : {
phone _title : 'Envoyer le numéro de téléphone' ,
phone _description : 'Trouver des amis en utilisant votre numéro' ,
phone _placeholder : 'Numéro de téléphone' ,
confirm _description : 'Code de confirmation' ,
confirm _validation _title : 'Code de confirmation' ,
confirm _validation _description : 'Format incorrect' ,
password _description : 'Mot de passe' ,
password _placeholder : 'Tapez votre mot de passe' ,
password _placeholder2 : 'Veuillez retapez votre mot de passe pour le confirmer' ,
password _error : 'Le mot de passe doit contenir 6 symboles au minimum.' ,
password _error1 : 'Le mot de passe de confirmation ne correspond pas au mot de passe.' ,
password _validation _title : 'Mot de passe'
} ,
de : {
phone _title : 'Telefonnummer absenden' ,
phone _description : 'Freunde mit Ihrer Nummer finden' ,
phone _placeholder : 'Telefonnummer' ,
confirm _description : 'Bestätigungscode' ,
confirm _validation _title : 'Bestätigungscode' ,
confirm _validation _description : 'Falsches Format' ,
password _description : 'Passwort' ,
password _placeholder : 'Geben Sie Ihr Passwort ein' ,
password _placeholder2 : 'Bitte geben Sie das Passwort zur Bestätigung erneut ein' ,
password _error : 'Das Passwort sollte nicht weniger als 6 Stellen beinhalten' ,
password _error1 : 'Die Passwortbestätigung stimmt nicht mit dem Passwort überein' ,
password _validation _title : 'Passwort' ,
} ,
hi : {
phone _title : 'फ़ोन नंबर भेजें' ,
phone _description : 'अपने नंबर का उपयोग करके दोस्त ढूंढें' ,
phone _placeholder : 'फ़ोन नंबर' ,
confirm _description : 'पुष्टि कोड' ,
confirm _validation _title : 'पुष्टि कोड' ,
confirm _validation _description : 'गलत प्रारूप' ,
password _description : 'पासवर्ड' ,
password _placeholder : 'अपना पासवर्ड टाइप करें' ,
password _placeholder2 : 'पुष्टि करने के लिए फिर से पासवर्ड दर्ज करें' ,
password _error : 'पासवर्ड 6 प्रतीकों से कम का नहीं होना चाहिए।' ,
password _error1 : 'पासवर्ड पुष्टि पासवर्ड मेल नहीं खाता है।' ,
password _validation _title : 'पासवर्ड'
} ,
hu : {
phone _title : 'Telefonszám küldése' ,
phone _description : 'Ismerősök megkeresése telefonszám alapján' ,
phone _placeholder : 'Telefonszám' ,
confirm _description : 'Megerősítési kód' ,
confirm _validation _title : 'Megerősítési kód' ,
confirm _validation _description : 'Rossz formátum' ,
password _description : 'Jelszó' ,
password _placeholder : 'Add meg a jelszavad' ,
password _placeholder2 : 'A megerősítéshez kérjük, add meg újra a jelszavad' ,
password _error : 'A jelszó nem lehet hosszabb 6 szimbólumnál.' ,
password _error1 : 'A megerősített jelszó nem egyezik a jelszóval.' ,
password _validation _title : 'Jelszó'
} ,
it : {
phone _title : 'Invia numero di telefono' ,
phone _description : 'Trova gli amici che usano il tuo numero' ,
phone _placeholder : 'Numero di telefono' ,
confirm _description : 'Codice di conferma' ,
confirm _validation _title : 'Codice di conferma' ,
confirm _validation _description : 'Formato errato' ,
password _description : 'Password' ,
password _placeholder : 'Digita la tua password' ,
password _placeholder2 : 'Reinserisci la password per confermare' ,
password _error : 'La password deve contenere almeno 6 caratteri.' ,
password _error1 : 'Conferma password\ la password non corrisponde.' ,
password _validation _title : 'Password'
} ,
ja : {
phone _title : '電話番号を送信' ,
phone _description : 'あなたの番号を使用している友人を検索' ,
phone _placeholder : '携帯電話番号' ,
confirm _description : '確認コード' ,
confirm _validation _title : '確認コード' ,
confirm _validation _description : '間違った形式' ,
password _description : 'パスワード' ,
password _placeholder : 'パスワードを入力してください' ,
password _placeholder2 : '確認のためにパスワードを再入力してください' ,
password _error : 'パスワードは6文字以下でなければなりません.' ,
password _error1 : 'パスワードの確認がパスワードと一致しません。' ,
password _validation _title : 'パスワード'
} ,
ko : {
phone _title : '전화번호 보내기' ,
phone _description : '내 번호를 사용하여 친구 찾기' ,
phone _placeholder : '전화번호' ,
confirm _description : '확인 코드' ,
confirm _validation _title : '확인 코드' ,
confirm _validation _description : '잘못된 형식' ,
password _description : '비밀번호' ,
password _placeholder : '비밀번호를 입력하세요' ,
password _placeholder2 : '확인을 위해 비밀번호를 다시 입력해 주세요' ,
password _error : '비밀번호는 6자 이상이어야 합니다.' ,
password _error1 : '확인용 비밀번호가 원래 비밀번호와 일치하지 않습니다.' ,
password _validation _title : '비밀번호'
} ,
pl : {
phone _title : 'Wyślij numer telefonu' ,
phone _description : 'Znajdź znajomych, używając swojego numeru' ,
phone _placeholder : 'Numer telefonu' ,
confirm _description : 'Kod potwierdzający' ,
confirm _validation _title : 'Kod potwierdzający' ,
confirm _validation _description : 'Nieprawidłowy format' ,
password _description : 'Hasło' ,
password _placeholder : 'Wpisz swoje hasło' ,
password _placeholder2 : 'Wprowadź ponownie hasło, aby potwierdzić' ,
password _error : 'Hasło powinno zawierać co najmniej 6 symboli.' ,
password _error1 : 'Wprowadzone i potwierdzone hasła nie są takie same.' ,
password _validation _title : 'Hasło'
} ,
'pt-br' : {
phone _title : 'Enviar número de telefone' ,
phone _description : 'Encontrar amigos por meio do seu número' ,
phone _placeholder : 'Número de telefone' ,
confirm _description : 'Código de confirmação' ,
confirm _validation _title : 'Código de confirmação' ,
confirm _validation _description : 'Formato incorreto' ,
password _description : 'Senha' ,
password _placeholder : 'Digite sua senha' ,
password _placeholder2 : 'Por favor, digite a senha novamente para confirmar' ,
password _error : 'A senha deve ter no mínimo 6 símbolos.' ,
password _error1 : 'A confirmação da senha é diferente da senha.' ,
password _validation _title : 'Senha'
} ,
'pt-pt' : {
phone _title : 'Enviar o Número de Telefone' ,
phone _description : 'Encontrar amigos que utilizem o seu número' ,
phone _placeholder : 'Número de telefone' ,
confirm _description : 'Código de confirmação' ,
confirm _validation _title : 'Código de confirmação' ,
confirm _validation _description : 'Formato errado' ,
password _description : 'Palavra-passe' ,
password _placeholder : 'Digite a sua palavra-passe' ,
password _placeholder2 : 'Por favor, volte a digitar a palavra-passe para confirmar' ,
password _error : 'A palavra-passe não deve ter menos de 6 símbolos.' ,
password _error1 : 'A confirmação da palavra-passe não coincide com a palavra-passe.' ,
password _validation _title : 'Palavra-passe'
} ,
ro : {
phone _title : 'Trimite numărul de telefon' ,
phone _description : 'Găsește prieteni folosindu-ți numărul de telefon' ,
phone _placeholder : 'Număr de telefon' ,
confirm _description : 'Cod de confirmare' ,
confirm _validation _title : 'Cod de confirmare' ,
confirm _validation _description : 'Format greșit' ,
password _description : 'Parolă' ,
password _placeholder : 'Tastează parola' ,
password _placeholder2 : 'Te rugăm să re-introduci parola pentru a confirma' ,
password _error : 'Parola trebuie să aibă cel puțin 6 simboluri.' ,
password _error1 : 'Parola confirmată nu este aceeași cu parola introdusă.' ,
password _validation _title : 'Parolă'
} ,
sl : {
phone _title : 'Pošlji telefonsko številko' ,
phone _description : 'Iskanje prijateljev z uporabo tvoje telefonske številke' ,
phone _placeholder : 'Telefonska številka' ,
confirm _description : 'Potrditvena koda' ,
confirm _validation _title : 'Potrditvena koda' ,
confirm _validation _description : 'Neveljaven format' ,
password _description : 'Geslo' ,
password _placeholder : 'Vnesi svoje geslo' ,
password _placeholder2 : 'Prosimo, ponovno vnesi geslo za potrditev' ,
password _error : 'Geslo mora vsebovati vsaj 6 simbolov.' ,
password _error1 : 'Potrditev gesla se ne ujema z geslom.' ,
password _validation _title : 'Geslo'
} ,
es : {
phone _title : 'Enviar número de teléfono' ,
phone _description : 'Encontrar amigos que estén utilizando tu número' ,
phone _placeholder : 'Número de teléfono' ,
confirm _description : 'Código de confirmación' ,
confirm _validation _title : 'Código de confirmación' ,
confirm _validation _description : 'Formato erróneo' ,
password _description : 'Contraseña' ,
password _placeholder : 'Escribe tu contraseña' ,
password _placeholder2 : 'Por favor, vuelve a escribir la contraseña para confirmar' ,
password _error : 'La contraseña no debe ser inferior a 6 símbolos.' ,
password _error1 : 'La confirmación de contraseña no coincide con la contraseña.' ,
password _validation _title : 'Contraseña'
} ,
'es-ar' : {
phone _title : 'Envia un número telefónico' ,
phone _description : 'Encuentra amigos utilizando tu número' ,
phone _placeholder : 'Número telefónico' ,
confirm _description : 'Código de confirmación' ,
confirm _validation _title : 'Código de confirmación' ,
confirm _validation _description : 'Formato incorrecto' ,
password _description : 'Contraseña' ,
password _placeholder : 'Ingresa tu contraseña' ,
password _placeholder2 : 'Ingresa tu contraseña para confirmar' ,
password _error : 'Las contraseñas deben contener no menos de 6 símbolos.' ,
password _error1 : 'La confirmación de la contraseña no coincide con la contraseña.' ,
password _validation _title : 'Contraseña'
} ,
sw : {
phone _title : 'Tuma Namba ya Simu' ,
phone _description : 'Pata marafiki kwa kutumia namba yako' ,
phone _placeholder : 'Namba ya simu' ,
confirm _description : 'Kificho cha uthibitisho' ,
confirm _validation _title : 'Kificho cha uthibitisho' ,
confirm _validation _description : 'Muundo hafifu' ,
password _description : 'Nenosiri' ,
password _placeholder : 'Andika nenosiri lako' ,
password _placeholder2 : 'Tafadhali ingiza tena nenosiri kuthibitisha' ,
password _error : 'Nenosiri lisiwe chini ya alama 6.' ,
password _error1 : 'Uthibitisho wa nenosiri haulingani na nenosiri.' ,
password _validation _title : 'Nenosiri'
} ,
sv : {
phone _title : 'Skicka telefonnummer' ,
phone _description : 'Hitta vänner som använder ditt nummer' ,
phone _placeholder : 'Telefonnummer' ,
confirm _description : 'Bekräftelsekod' ,
confirm _validation _title : 'Bekräftelsekod' ,
confirm _validation _description : 'Fel format' ,
password _description : 'Lösenord' ,
password _placeholder : 'Skriv ditt lösenord' ,
password _placeholder2 : 'Var god ange ditt lösenord igen för att bekräfta' ,
password _error : 'Lösenordet bör inte vara mindre än 6 symboler.' ,
password _error1 : 'Lösenordsbekräftelsen matcharinte lösenordet.' ,
password _validation _title : 'Lösenord'
} ,
'fr-ch' : {
phone _title : 'Envoyer numéro de téléphone' ,
phone _description : 'Trouvez des amis en utilisant votre numéro' ,
phone _placeholder : 'Numéro de téléphone' ,
confirm _description : 'Code de confirmation' ,
confirm _validation _title : 'Code de confirmation' ,
confirm _validation _description : 'Mauvais format' ,
password _description : 'Mot de passe' ,
password _placeholder : 'Tapez votre mot de passe' ,
password _placeholder2 : 'Veuillez saisir à nouveau le mot de passe pour confirmer' ,
password _error : 'Le mot de passe doit avoir au moins 6 caractères.' ,
password _error1 : 'La confirmation du mot de passe ne correspond pas au premier mot de passe.' ,
password _validation _title : 'Mot de passe'
} ,
'de-ch' : {
phone _title : 'Sende Telefonnummer' ,
phone _description : 'Finde Freunde mittels deiner Telefonnummer' ,
phone _placeholder : 'Telefonnummer' ,
confirm _description : 'Konfirmationscode' ,
confirm _validation _title : 'Konfirmationscode' ,
confirm _validation _description : 'Falsches Format' ,
password _description : 'Passwort' ,
password _placeholder : 'Gib dein Passwort ein' ,
password _placeholder2 : 'Bitte gib das Passwort zur Bestätigung erneut ein' ,
password _error : 'Passwort sollte nicht kleiner als 6 Symbole sein.' ,
password _error1 : 'Passwort Bestätigung stimmt mit Passwort nicht überein.' ,
password _validation _title : 'Passwort'
} ,
'it-ch' : {
phone _title : 'Invia numero di telefono' ,
phone _description : 'Trova amici che utilizzano il tuo numero' ,
phone _placeholder : 'Numero di telefono' ,
confirm _description : 'Codice di conferma' ,
confirm _validation _title : 'Codice di conferma' ,
confirm _validation _description : 'Formato errato' ,
password _description : 'Password' ,
password _placeholder : 'Digita la tua password' ,
password _placeholder2 : 'Inserisci nuovamente la password per confermare' ,
password _error : 'La password non può contenere meno di 6 caratteri.' ,
password _error1 : 'La password di conferma non corrisponde alla password.' ,
password _validation _title : 'Password'
} ,
th : {
phone _title : 'ส่งหมายเลขโทรศัพท์' ,
phone _description : 'ค้นหาเพื่อนโดยใช้หมายเลขของคุณ ' ,
phone _placeholder : 'หมายเลขโทรศัพท์' ,
confirm _description : 'รหัสยืนยัน' ,
confirm _validation _title : 'รหัสยืนยัน' ,
confirm _validation _description : 'รูปแบบผิด' ,
password _description : 'รหัสผ่าน' ,
password _placeholder : 'พิมพ์รหัสผ่านของคุณ' ,
password _placeholder2 : 'โปรดกรอกรหัสผ่านอีกครั้งเพื่อยืนยัน' ,
password _error : 'รหัสผ่านควรมีสัญลักษณ์ไม่น้อยกว่า 6 ตัว' ,
password _error1 : 'การยืนยันรหัสผ่านไม่ตรงกับรหัสผ่าน' ,
password _validation _title : 'รหัสผ่าน'
} ,
tr : {
phone _title : 'Telefon Numarası nı Gönder' ,
phone _description : 'Telefon numaranı kullanarak arkadaşları nı zı bulun' ,
phone _placeholder : 'Telefon numarası ' ,
confirm _description : 'Onay kodu' ,
confirm _validation _title : 'Onay kodu' ,
confirm _validation _description : 'Hatalı format' ,
password _description : 'Şifre' ,
password _placeholder : 'Şifrenizi girin' ,
password _placeholder2 : 'Onaylamak için lütfen parolanı zı yeniden girin' ,
password _error : 'Şifre 6 simgeden daha kı sa olmamalı dı r.' ,
password _error1 : 'Şifre onayı , şifre ile eşleşmiyor.' ,
password _validation _title : 'Şifre'
} ,
uk : {
phone _title : 'Надіслати номер телефону' ,
phone _description : 'Знайдіть друзів, використовуючи свій номер' ,
phone _placeholder : 'Номер телефону' ,
confirm _description : 'Код підтвердження' ,
confirm _validation _title : 'Код підтвердження' ,
confirm _validation _description : 'Неправильний формат' ,
password _description : 'Пароль' ,
password _placeholder : 'Введіть свій пароль' ,
password _placeholder2 : 'Будь ласка, введіть пароль ще раз для підтвердження' ,
password _error : 'Пароль повинен бути не менше 6 символів.' ,
password _error1 : 'Підтвердження паролю не співпадає з паролем.' ,
password _validation _title : 'Пароль'
} ,
ur : {
phone _title : 'فون نمبر بھیجیں' ,
phone _description : 'فون نمبر استعمال کرتے ہوئے دوستوں کو تلاش کریں' ,
phone _placeholder : 'فون نمبر' ,
confirm _description : 'تصدیقی کوڈ' ,
confirm _validation _title : 'تصدیقی کوڈ' ,
confirm _validation _description : 'غلط فارمیٹ' ,
password _description : 'پاسورڈ' ,
password _placeholder : 'اپنا پاسورڈ لکھیں' ,
password _placeholder2 : 'برائے مہربانی تصدیق کے لیے اپنا پاسورڈ دوبارہ لکھیں' ,
password _error : 'پاسورڈ 6 اعداد سے چھوٹا نہیں ہونا چاہیے۔' ,
password _error1 : 'تصدیقی پاسورڈ پاسورڈ سے مماثل نہیں' ,
password _validation _title : 'پاسورڈ'
} ,
vi : {
phone _title : 'Gửi số điện thoại' ,
phone _description : 'Tìm bạn bè bằng các sử dụng số điện thoại của bạn' ,
phone _placeholder : 'Số điện thoại' ,
confirm _description : 'Mã xác nhận' ,
confirm _validation _title : 'Mã xác nhận' ,
confirm _validation _description : 'Sai định dạng' ,
password _description : 'Mật khẩu' ,
password _placeholder : 'Gõ mật khẩu của bạn' ,
password _placeholder2 : 'Vui lòng nhập lại mật khẩu để xác nhận' ,
password _error : 'Mật khẩu không được ít hơn 6 ký tự.' ,
password _error1 : 'Xác nhận mật khẩu không khớp với mật khẩu.' ,
password _validation _title : 'Mật khẩu'
}
} ;
2016-11-02 07:20:50 +00:00
var WEB3 _UNIT = [
'kwei/ada' ,
'mwei/babbage' ,
'gwei/shannon' ,
'szabo' ,
'finney' ,
'ether' ,
'kether/grand/einstein' ,
'mether' ,
'gether' ,
'tether'
] ;
// because web3 doesn't provide params or docs
var DOC _MAP = {
console : {
log : {
desc : 'Outputs a message to chat context.' ,
args : [ {
name : 'text' ,
type : 'String' ,
desc : 'message to output to chat context'
} ]
}
} ,
web3 : {
// setProvider : ['provider'], // TODO
version : {
api : {
desc : 'The ethereum js api version.'
} ,
node : {
desc : 'The client/node version.'
} ,
network : {
desc : 'The network protocol version.'
} ,
ethereum : {
desc : 'The ethereum protocol version.'
} ,
whisper : {
desc : 'The whisper protocol version.'
} ,
} ,
isConnected : {
desc : 'Check if a connection to a node exists.' ,
args : [ ]
} ,
currentProvider : {
desc : 'Will contain the current provider, if one is set. This can be used to check if mist etc. set already a provider.'
} ,
reset : {
desc : 'Should be called to reset state of web3. Resets everything except manager. Uninstalls all filters. Stops polling.' ,
args : [ {
name : 'keepIsSyncing' ,
type : 'Boolean' ,
desc : 'If true it will uninstall all filters, but will keep the web3.eth.isSyncing() polls'
} ]
} ,
sha3 : {
desc : 'Returns the Keccak-256 SHA3 of the given data.' ,
args : [ {
name : 'string' ,
type : 'String' ,
desc : 'The string to hash using the Keccak-256 SHA3 algorithm'
} , {
name : 'options' ,
type : 'Object' ,
optional : true ,
desc : 'Set encoding to hex if the string to hash is encoded in hex. A leading 0x will be automatically ignored.'
} ]
} ,
toHex : {
desc : 'Converts any value into HEX' ,
args : [ {
name : 'mixed' ,
type : 'String|Number|Object|Array|BigNumber' ,
desc : 'The value to parse to HEX. If its an object or array it will be JSON.stringify first. If its a BigNumber it will make it the HEX value of a number.'
} ]
} ,
toAscii : {
desc : 'Converts a HEX string into a ASCII string.' ,
args : [ {
name : 'hexString' ,
type : 'String' ,
desc : 'A HEX string to be converted to ascii.'
} ]
} ,
fromAscii : {
desc : 'Converts any ASCII string to a HEX string.' ,
args : [ {
name : 'string' ,
type : 'String' ,
desc : 'An ASCII string to be converted to HEX.'
} , {
name : 'padding' ,
type : 'Number' ,
desc : 'The number of bytes the returned HEX string should have. '
} ]
} ,
toDecimal : {
desc : 'Converts a HEX string to its number representation.' ,
args : [ {
name : 'hexString' ,
type : 'String' ,
desc : 'An HEX string to be converted to a number.'
} ]
} ,
fromDecimal : {
desc : 'Converts a number or number string to its HEX representation.' ,
args : [ {
name : 'number' ,
type : 'Number' ,
desc : 'A number to be converted to a HEX string.'
} ]
} ,
fromWei : {
desc : 'Converts a number of wei into an ethereum unit' ,
args : [ {
name : 'number' ,
type : 'Number|String|BigNumber' ,
desc : 'A number or BigNumber instance.'
} , {
name : 'unit' ,
type : 'string' ,
desc : 'One of the ether units'
} ]
} ,
toWei : {
desc : 'Converts an ethereum unit into wei' ,
args : [ {
name : 'number' ,
type : 'Number|String|BigNumber' ,
desc : 'A number or BigNumber instance.'
} , {
name : 'unit' ,
type : 'string' ,
desc : 'One of the ether units'
} ]
} ,
toBigNumber : {
desc : 'Converts a given number into a BigNumber instance' ,
args : [ {
name : 'numberOrHexString' ,
type : 'Number|String' ,
desc : 'A number, number string or HEX string of a number.'
} ]
} ,
net : {
listening : {
desc : 'Is node actively listening for network connections?'
} ,
peerCount : {
desc : 'Returns the number of connected peers'
}
} ,
isAddress : {
desc : '' ,
args : [ {
name : '' ,
type : 'string' ,
desc : 'hex string'
} ] , // TODO not in docs
} ,
eth : {
defaultAccount : {
desc : 'The currently set default address'
} ,
defaultBlock : {
desc : 'The default block number to use when querying a state.'
} ,
syncing : {
desc : 'Returns the either a sync object, when the node is syncing or false.'
} ,
isSyncing : {
desc : 'This convenience function calls the callback everytime a sync starts, updates and stops.' ,
args : [ {
name : 'callback' ,
type : 'Function' ,
desc : 'The callback will be fired with true when the syncing starts and with false when it stopped. While syncing it will return the syncing object: {startingBlock, currentBlock, highestBlock}'
} ]
} ,
coinbase : {
desc : 'Returns the coinbase address were the mining rewards go to.'
} ,
mining : {
desc : 'Says whether the node is mining or not.'
} ,
hashrate : {
desc : 'Returns the number of hashes per second that the node is mining with.'
} ,
gasPrice : {
desc : 'Returns the current gas price. The gas price is determined by the x latest blocks median gas price'
} ,
accounts : {
desc : 'Returns a list of accounts the node controls'
} ,
blockNumber : {
desc : 'Returns the current block number'
} ,
getBalance : {
desc : 'Get the balance of an address at a given block.' ,
args : [ {
name : 'addressHexString' ,
type : 'String' ,
desc : 'The address to get the balance of'
} , {
name : 'defaultBlock' ,
type : 'Number|String' ,
optional : true ,
desc : 'If you pass this parameter it will not use the default block set with web3.eth.defaultBlock.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getStorageAt : {
desc : 'Get the storage at a specific position of an address.' ,
args : [ {
name : 'addressHexString' ,
type : 'String' ,
desc : 'The address to get the storage from.'
} , {
name : 'position' ,
type : 'Number' ,
desc : 'The index position of the storage.'
} , {
name : 'defaultBlock' ,
type : 'Number|String' ,
optional : true ,
desc : 'If you pass this parameter it will not use the default block set with web3.eth.defaultBlock.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getCode : {
desc : 'Get the code at a specific address.' ,
args : [ {
name : 'addressHexString' ,
type : 'String' ,
desc : 'The address to get the code from.'
} , {
name : 'defaultBlock' ,
type : 'Number|String' ,
optional : true ,
desc : 'If you pass this parameter it will not use the default block set with web3.eth.defaultBlock.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getBlock : {
desc : 'Returns a block matching the block number or block hash.' ,
args : [ {
name : 'blockHashOrBlockNumber' ,
type : 'String|Number' ,
desc : 'The block number or hash. Or the string "earliest", "latest" or "pending"'
} , {
name : 'returnTransactionObjects' ,
type : 'Boolean' ,
optional : true ,
desc : '(default false) If true, the returned block will contain all transactions as objects, if false it will only contains the transaction hashes.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getBlockTransactionCount : {
desc : 'Returns the number of transaction in a given block.' ,
args : [ {
name : 'hashStringOrBlockNumber' ,
type : 'String|Number' ,
desc : 'The block number or hash. Or the string "earliest", "latest" or "pending"'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getUncle : {
desc : 'Returns a blocks uncle by a given uncle index position' ,
args : [ {
name : 'blockHashStringOrNumber' ,
type : 'String|Number' ,
desc : 'The block number or hash. Or the string "earliest", "latest" or "pending"'
} , {
name : 'uncleNumber' ,
type : 'Number' ,
desc : 'The index position of the uncle.'
} , {
name : 'returnTransactionObjects' ,
type : 'Boolean' ,
desc : '(default false) If true, the returned block will contain all transactions as objects, if false it will only contains the transaction hashes.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getBlockUncleCount : {
desc : '' , // TODO missing from docs
} ,
getTransaction : {
desc : 'Returns a transaction matching the given transaction hash.' ,
args : [ {
name : 'transactionHash' ,
type : 'String' ,
desc : 'The transaction hash.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getTransactionFromBlock : {
desc : 'Returns a transaction based on a block hash or number and the transactions index position.' ,
args : [ {
name : 'hashStringOrBlockNumber' ,
type : 'String|Number' ,
desc : 'The block number or hash. Or the string "earliest", "latest" or "pending"'
} , {
name : 'indexNumber' ,
type : 'Number' ,
desc : 'The transactions index position.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getTransactionReceipt : {
desc : 'Returns the receipt of a transaction by transaction hash.' ,
args : [ {
name : 'hashString' ,
type : 'String' ,
desc : 'The transaction hash.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
getTransactionCount : {
desc : 'Get the numbers of transactions sent from this address.' ,
args : [ {
name : 'addressHexString' ,
type : 'String' ,
desc : 'The address to get the numbers of transactions from.'
} , {
name : 'defaultBlock' ,
type : 'String|Number' ,
desc : 'If you pass this parameter it will not use the default block set with web3.eth.defaultBlock.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
sendTransaction : {
desc : 'Sends a transaction to the network.' ,
args : [ {
name : 'transactionObject' ,
type : 'Object' ,
desc : 'The transaction object to send: {from[, to][, value][, gas][, gasPrice][, data][, nonce]}'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
sendRawTransaction : {
desc : 'Sends an already signed transaction.' ,
args : [ {
name : 'signedTransactionData' ,
type : 'String' ,
desc : 'Signed transaction data in HEX format'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
sign : {
desc : 'Signs data from a specific account. This account needs to be unlocked.' ,
args : [ {
name : 'address' ,
type : 'String' ,
desc : 'Address to sign with.'
} , {
name : 'dataToSign' ,
type : 'String' ,
desc : 'Data to sign.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
call : {
desc : 'Executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.' ,
args : [ {
name : 'callObject' ,
type : 'String' ,
desc : 'Address to sign with.'
} , {
name : 'defaultBlock' ,
type : 'String' ,
optional : true ,
desc : 'Data to sign.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
estimateGas : {
desc : 'Executes a message call or transaction, which is directly executed in the VM of the node, but never mined into the blockchain and returns the amount of the gas used.' ,
args : [ {
name : 'callObject' ,
type : 'Object' ,
desc : 'The transaction object to send: {[from][, to][, value][, gas][, gasPrice][, data][, nonce]}'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
filter : {
// TODO: add description
desc : '' ,
args : [ {
name : 'options' ,
type : 'String|Object' ,
desc : 'The string "latest" or "pending" to watch for changes in the latest block or pending transactions respectively. Or a filter options object as follows: {fromBlock: Number|String, toBlock: Number|String, address: String, topics: StringArray}'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'Watch callback'
} ]
} ,
// TODO filters
// watch : ['callback'],
// stopWatching : ['callback'],
contract : {
desc : 'Creates a contract object for a solidity contract, which can be used to initiate contracts on an address.' ,
args : [ {
name : 'abiArray' ,
type : 'Array' ,
desc : 'ABI array with descriptions of functions and events of the contract.'
} ]
} ,
getCompilers : {
desc : 'Gets a list of available compilers.' ,
args : [ {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'If you pass a callback the HTTP request is made asynchronous.'
} ]
} ,
compile : { // TODO we should auto hide these depending on output from getCompilers
lll : {
desc : 'Compiles LLL source code.' ,
args : [ {
name : 'sourceString' ,
type : 'String' ,
desc : 'The LLL source code.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'Watch callback'
} ]
} ,
solidity : {
desc : 'Compiles solidity source code' ,
args : [ {
name : 'sourceString' ,
type : 'String' ,
desc : 'The solidity source code.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'Watch callback'
} ] ,
} ,
serpent : {
desc : 'Compiles serpent source code' ,
args : [ {
name : 'sourceString' ,
type : 'String' ,
desc : 'The serpent source code.'
} , {
name : 'callback' ,
type : 'Function' ,
optional : true ,
desc : 'Watch callback'
} ]
}
} ,
namereg : {
desc : 'Returns GlobalRegistrar object.'
}
} ,
db : {
putString : {
desc : 'Store a string in the local leveldb database.' ,
args : [ {
name : 'db' ,
type : 'String' ,
desc : 'The database to store to.'
} , {
name : 'key' ,
type : 'String' ,
desc : 'The name of the store.'
} , {
name : 'value' ,
type : 'String' ,
desc : 'The string value to store.'
} ]
} ,
getString : {
desc : 'Retrieve a string from the local leveldb database. (db, key)' ,
args : [ {
name : 'db' ,
type : 'String' ,
desc : 'The database string name to retrieve from.'
} , {
name : 'key' ,
type : 'String' ,
desc : 'The name of the store.'
} ]
} ,
putHex : {
desc : 'Store binary data in the local leveldb database. (db, key, value)' ,
args : [ {
name : 'db' ,
type : 'String' ,
desc : 'The database to store to.'
} , {
name : 'key' ,
type : 'String' ,
desc : 'The name of the store.'
} , {
name : 'value' ,
type : 'String' ,
desc : 'The HEX string to store.'
} ]
} ,
getHex : {
desc : 'Retrieve binary data from the local leveldb database. (db, key)' ,
args : [ {
name : 'db' ,
type : 'String' ,
desc : 'The database string name to retrieve from.'
} , {
name : 'key' ,
type : 'String' ,
desc : 'The name of the store.'
} ]
}
}
}
} ;
function jsSuggestionsContainerStyle ( suggestionsCount ) {
return {
marginVertical : 1 ,
marginHorizontal : 0 ,
//height: Math.min(150, (56 * suggestionsCount)),
backgroundColor : "white" ,
borderRadius : 5 ,
keyboardShouldPersistTaps : true
} ;
}
var jsSuggestionContainerStyle = {
paddingLeft : 16 ,
backgroundColor : "white"
} ;
var jsSubContainerStyle = {
//height: 56,
paddingTop : 9 ,
borderBottomWidth : 1 ,
borderBottomColor : "#0000001f"
} ;
var jsValueStyle = {
fontSize : 14 ,
fontFamily : "font" ,
color : "#000000de"
} ;
var jsBoldValueStyle = {
fontSize : 14 ,
fontFamily : "font" ,
color : "#000000de" ,
fontWeight : "bold"
} ;
var jsDescriptionStyle = {
marginTop : 1.5 ,
fontSize : 14 ,
fontFamily : "font" ,
color : "#838c93de"
} ;
var messages = [ ] ;
console = ( function ( old ) {
return {
log : function ( text ) {
old . log ( text ) ;
var message = {
type : 'log' ,
message : JSON . stringify ( text )
} ;
messages . push ( message ) ;
context . messages . push ( message ) ;
} ,
info : function ( text ) {
old . info ( text ) ;
context . messages . push ( {
type : 'info' ,
message : JSON . stringify ( text )
} ) ;
} ,
warn : function ( text ) {
old . warn ( text ) ;
context . messages . push ( {
type : 'warn' ,
message : JSON . stringify ( text )
} ) ;
} ,
error : function ( text ) {
old . error ( text ) ;
context . messages . push ( {
type : 'error' ,
message : JSON . stringify ( text )
} ) ;
}
} ;
} ( console ) ) ;
if ( ! String . prototype . startsWith ) {
String . prototype . startsWith = function ( searchString , position ) {
position = position || 0 ;
return this . substr ( position , searchString . length ) === searchString ;
} ;
}
function matchSubString ( array , string ) {
var matched = [ ] ;
for ( var i = 0 ; i < array . length ; i ++ ) {
var item = array [ i ] ;
if ( item . toLowerCase ( ) . startsWith ( string . toLowerCase ( ) ) ) {
matched . push ( item ) ;
}
}
return matched ;
}
function cleanCode ( code ) {
// remove comments
var commentsRegex = /\/\*.+?\*\/|\/\/.*/g ;
code = code . replace ( commentsRegex , "" ) ;
// replace string literals
var literalsRegex = /\"(?:\\\\\"|[^\"])*?\"/g ;
code = code . replace ( literalsRegex , '""' ) ;
var literalsRegex = /\'(?:\\\\\'|[^\'])*?\'/g ;
code = code . replace ( literalsRegex , '""' ) ;
return code
}
function createObjectSuggestion ( name , docInfo , code , parameterNumber ) {
var title = name ;
if ( docInfo . args ) {
title += "(" ;
for ( var i = 0 ; i < docInfo . args . length ; i ++ ) {
var argument = docInfo . args [ i ] ;
var argumentText = ( i > 0 ? ", " : "" ) + ( parameterNumber === i ? "*" + argument . name + "*" : argument . name ) ;
if ( argument . optional ) {
argumentText = "[" + argumentText + "]" ;
}
title += argumentText ;
}
title += ")" ;
}
if ( ! docInfo . desc ) {
name += "." ;
} else if ( docInfo . args ) {
name += "(" ;
if ( docInfo . args . length == 0 ) {
name += ")" ;
}
}
var suggestion = {
title : title ,
desc : docInfo . desc
} ;
if ( code != null ) {
suggestion . pressValue = code + name ;
}
return suggestion ;
}
var lastMessage = null ;
function getLastForm ( code ) {
var codeLength = code . length ;
var form = '' ;
var level = 0 ;
var index = codeLength - 1 ;
while ( index >= 0 ) {
var char = code [ index ] ;
if ( level == 0 && ( char == '(' || char == ',' ) ) {
break ;
}
if ( char == ')' ) {
level -- ;
}
if ( char == '(' ) {
level ++ ;
}
form = char + form ;
index -- ;
}
return form ;
}
function getLastLevel ( code ) {
var codeLength = code . length ;
var form = '' ;
var index = codeLength - 1 ;
var nested = false ;
var level = 0 ;
while ( index >= 0 ) {
var char = code [ index ] ;
if ( char == ')' ) {
level -- ;
nested = true ;
}
if ( char == '(' ) {
level ++ ;
if ( level == 0 ) {
nested = false ;
}
if ( level <= 0 ) {
form = "argument" + form ;
index -- ;
continue ;
}
}
if ( ( level == 1 && char == ',' ) || level == 2 ) {
break ;
}
if ( ! nested || level > 0 ) {
form = char + form ;
}
index -- ;
}
if ( form . indexOf ( "(" ) < 0 ) {
var parts = form . split ( ',' ) ;
form = parts [ parts . length - 1 ] ;
}
return form ;
}
function getPartialSuggestions ( doc , fullCode , code ) {
var suggestions = [ ] ;
var functionParts = code . split ( "(" ) ;
var objectParts = code . split ( /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/ ) ;
var index = 0 ;
var suggestedFunction = '' ;
while ( index < objectParts . length ) {
var part = objectParts [ index ] ;
if ( part != "desc" && part != "args" && doc [ part ] != null ) {
doc = doc [ part ] ;
suggestedFunction += part + '.' ;
index ++ ;
} else {
break ;
}
}
suggestedFunction = suggestedFunction . substring ( 0 , suggestedFunction . length - 1 )
if ( functionParts . length == 1 ) {
// object suggestions
if ( index > objectParts . length - 1 ) {
var suggestion = objectParts [ objectParts . length - 1 ] ;
suggestions . push ( createObjectSuggestion ( suggestion , doc , fullCode . substring ( 0 , fullCode . length - suggestion . length ) ) ) ;
} else if ( index === objectParts . length - 1 ) {
var lastPart = objectParts [ index ] ;
var keys = Object . keys ( doc ) ;
var matches = matchSubString ( keys , lastPart ) ;
for ( var i = 0 ; i < matches . length ; i ++ ) {
var suggestion = matches [ i ] ;
if ( suggestion == "desc" || suggestion == "args" ) {
continue ;
}
var docInfo = doc [ suggestion ] ;
if ( docInfo != null ) {
suggestions . push ( createObjectSuggestion ( suggestion , docInfo , fullCode . substring ( 0 , fullCode . length - lastPart . length ) ) ) ;
}
}
}
} else if ( functionParts . length == 2 ) {
// parameter suggestions
var parameters = functionParts [ 1 ] . split ( "," ) ;
if ( doc . args && parameters . length <= doc . args . length && parameters [ parameters . length - 1 ] . indexOf ( ")" ) < 0 ) {
var paramInfo = doc . args [ parameters . length - 1 ] ;
var docInfo = doc ;
docInfo . desc = paramInfo . name + ": " + paramInfo . desc ;
suggestions . push ( createObjectSuggestion ( suggestedFunction , docInfo , null , parameters . length - 1 ) ) ;
}
}
console . log ( suggestions ) ;
return suggestions ;
}
function getJsSuggestions ( code , context ) {
var suggestions = [ ] ;
var doc = DOC _MAP ;
// TODO: what's /c / doing there ???
console . log ( code ) ;
if ( ! code || code == "" || code == "c " ) {
code = "" ;
console . log ( "Last message: " + context . data ) ;
if ( context . data != null ) {
suggestions . push ( {
title : 'Last command used:' ,
desc : context . data ,
pressValue : context . data
} ) ;
}
var keys = Object . keys ( doc ) ;
for ( var i = 0 ; i < keys . length ; i ++ ) {
var suggestion = keys [ i ] ;
var docInfo = doc [ suggestion ] ;
if ( docInfo != null ) {
suggestions . push ( createObjectSuggestion ( suggestion , docInfo , "" ) ) ;
}
}
} else {
// TODO: what's /c / doing there ???
if ( code . startsWith ( "c " ) ) {
code = code . substring ( 2 ) ;
}
2016-12-02 17:13:55 +00:00
if ( context . data != null &&
( typeof context . data === 'string' || context . data instanceof String ) &&
context . data . startsWith ( code ) ) {
suggestions . unshift ( {
title : 'Last command used:' ,
desc : context . data ,
pressValue : context . data
} ) ;
}
2016-11-02 07:20:50 +00:00
var originalCode = code ;
code = cleanCode ( code ) ;
var levelCode = getLastLevel ( code ) ;
var code = getLastForm ( levelCode ) ;
if ( levelCode != code ) {
suggestions = getPartialSuggestions ( doc , originalCode , levelCode ) ;
}
console . log ( "Final code: " + code ) ;
console . log ( "Level code: " + levelCode ) ;
suggestions = suggestions . concat ( getPartialSuggestions ( doc , originalCode , code ) ) ;
}
return suggestions ;
}
function createMarkupText ( text ) {
var parts = [ ] ;
var index = 0 ;
var currentText = '' ;
var isBold = false ;
while ( index < text . length ) {
var char = text [ index ] ;
if ( char == '*' ) {
if ( currentText != '' ) {
parts . push (
status . components . text (
{ style : isBold ? jsBoldValueStyle : jsValueStyle } ,
currentText
)
) ;
currentText = '' ;
}
isBold = ! isBold ;
} else {
currentText += char ;
}
index ++ ;
}
if ( currentText != '' ) {
parts . push (
status . components . text (
{ style : isBold ? jsBoldValueStyle : jsValueStyle } ,
currentText
)
) ;
}
console . log ( parts ) ;
return parts ;
}
function jsSuggestions ( params , context ) {
console . log ( context ) ;
var suggestions = getJsSuggestions ( params . code , context ) ;
var sugestionsMarkup = [ ] ;
for ( var i = 0 ; i < suggestions . length ; i ++ ) {
var suggestion = suggestions [ i ] ;
if ( suggestion . title . indexOf ( '*' ) >= 0 ) {
suggestion . title = createMarkupText ( suggestion . title ) ;
}
var suggestionMarkup = status . components . view ( jsSuggestionContainerStyle ,
[ status . components . view ( jsSubContainerStyle ,
[
status . components . text ( { style : jsValueStyle } ,
suggestion . title ) ,
status . components . text ( { style : jsDescriptionStyle } ,
suggestion . desc )
] ) ] ) ;
if ( suggestion . pressValue ) {
suggestionMarkup = status . components . touchable ( {
onPress : [ status . events . SET _VALUE , suggestion . pressValue ] } ,
suggestionMarkup ) ;
}
sugestionsMarkup . push ( suggestionMarkup ) ;
}
if ( sugestionsMarkup . length > 0 ) {
var view = status . components . scrollView ( jsSuggestionsContainerStyle ( sugestionsMarkup . length ) ,
sugestionsMarkup
) ;
return { markup : view } ;
}
}
function jsHandler ( params , context ) {
var result = {
err : null ,
data : null ,
messages : [ ]
} ;
messages = [ ] ;
try {
result . data = JSON . stringify ( eval ( params . code ) ) ;
localStorage . set ( params . code ) ;
} catch ( e ) {
result . err = e ;
}
result . messages = messages ;
return result ;
}
2016-11-22 12:50:52 +00:00
var phones = [ // TODO this is supposed to be regionalised
2016-09-22 05:24:25 +00:00
{
number : "89171111111" ,
description : "Number format 1"
} ,
{
number : "89371111111" ,
description : "Number format 1"
} ,
{
number : "+79171111111" ,
description : "Number format 2"
} ,
{
number : "9171111111" ,
description : "Number format 3"
}
] ;
function suggestionsContainerStyle ( suggestionsCount ) {
return {
marginVertical : 1 ,
marginHorizontal : 0 ,
height : Math . min ( 150 , ( 56 * suggestionsCount ) ) ,
backgroundColor : "white" ,
2016-11-12 09:25:48 +00:00
borderRadius : 5 ,
2016-11-30 20:31:40 +00:00
flexGrow : 1
2016-09-22 05:24:25 +00:00
} ;
}
var suggestionContainerStyle = {
paddingLeft : 16 ,
backgroundColor : "white"
} ;
var suggestionSubContainerStyle = {
height : 56 ,
borderBottomWidth : 1 ,
borderBottomColor : "#0000001f"
} ;
var valueStyle = {
marginTop : 9 ,
fontSize : 14 ,
fontFamily : "font" ,
color : "#000000de"
} ;
var descriptionStyle = {
marginTop : 1.5 ,
fontSize : 14 ,
fontFamily : "font" ,
color : "#838c93de"
} ;
function startsWith ( str1 , str2 ) {
// String.startsWith(...) doesn't work in otto
return str1 . lastIndexOf ( str2 , 0 ) == 0 && str1 != str2 ;
}
function phoneSuggestions ( params ) {
var ph , suggestions ;
2016-10-06 13:15:57 +00:00
if ( ! params . phone || params . phone == "" ) {
2016-09-22 05:24:25 +00:00
ph = phones ;
} else {
ph = phones . filter ( function ( phone ) {
2016-10-06 13:15:57 +00:00
return startsWith ( phone . number , params . phone ) ;
2016-09-22 05:24:25 +00:00
} ) ;
}
if ( ph . length == 0 ) {
return ;
}
suggestions = ph . map ( function ( phone ) {
return status . components . touchable (
{ onPress : [ status . events . SET _VALUE , phone . number ] } ,
status . components . view ( suggestionContainerStyle ,
[ status . components . view ( suggestionSubContainerStyle ,
[
status . components . text (
{ style : valueStyle } ,
phone . number
) ,
status . components . text (
{ style : descriptionStyle } ,
phone . description
)
] ) ] )
) ;
} ) ;
2016-11-12 09:25:48 +00:00
/ * v a r v i e w = s t a t u s . c o m p o n e n t s . v i e w (
{ style : { flex : 1 , flexDirection : "column" } } ,
[ status . components . scrollView (
suggestionsContainerStyle ( ph . length ) ,
suggestions
) ]
) ; * /
2016-09-22 05:24:25 +00:00
var view = status . components . scrollView (
suggestionsContainerStyle ( ph . length ) ,
suggestions
) ;
return { markup : view } ;
}
var phoneConfig = {
name : "phone" ,
2016-10-31 13:41:47 +00:00
icon : "phone_white" ,
2016-11-22 12:50:52 +00:00
title : I18n . t ( 'phone_title' ) ,
description : I18n . t ( 'phone_description' ) ,
2016-10-31 13:41:47 +00:00
color : "#5bb2a2" ,
2016-12-22 13:18:09 +00:00
validator : function ( params ) {
return {
validationHandler : "phone" ,
parameters : [ params . phone ]
} ;
} ,
2016-09-22 05:24:25 +00:00
params : [ {
name : "phone" ,
type : status . types . PHONE ,
suggestions : phoneSuggestions ,
2016-11-22 12:50:52 +00:00
placeholder : I18n . t ( 'phone_placeholder' )
2016-10-19 12:22:05 +00:00
} ]
2016-09-22 05:24:25 +00:00
} ;
status . response ( phoneConfig ) ;
status . command ( phoneConfig ) ;
2016-12-06 23:09:41 +00:00
var faucets = [
{
2016-12-10 03:01:20 +00:00
name : "Ethereum Ropsten Faucet" ,
2016-12-06 23:09:41 +00:00
url : "http://faucet.ropsten.be:3001"
} ,
{
name : "Status Testnet Faucet" ,
url : "http://46.101.129.137:3001" ,
} ,
{
name : "Zerogox Faucet" ,
url : "https://zerogox.com/ethereum/wei_faucet"
}
] ;
function faucetSuggestions ( params ) {
var suggestions = faucets . map ( function ( entry ) {
return status . components . touchable (
{ onPress : [ status . events . SET _VALUE , entry . url ] } ,
status . components . view (
suggestionContainerStyle ,
[ status . components . view (
suggestionSubContainerStyle ,
[
status . components . text (
{ style : valueStyle } ,
entry . name
) ,
status . components . text (
{ style : descriptionStyle } ,
entry . url
)
]
) ]
)
) ;
} ) ;
var view = status . components . scrollView (
suggestionsContainerStyle ( faucets . length ) ,
suggestions
) ;
return { markup : view } ;
}
status . command ( {
name : "faucet" ,
title : "Faucet" ,
description : "Get some ETH" ,
color : "#7099e6" ,
registeredOnly : true ,
params : [ {
name : "url" ,
type : status . types . TEXT ,
suggestions : faucetSuggestions ,
placeholder : "Faucet URL"
} ] ,
preview : function ( params ) {
return status . components . text (
{ } ,
params . url
) ;
} ,
validator : function ( params , context ) {
var f = faucets . map ( function ( entry ) {
return entry . url ;
} ) ;
if ( f . indexOf ( params . url ) == - 1 ) {
var error = status . components . validationMessage (
I18n . t ( 'faucet_incorrect_title' ) ,
I18n . t ( 'faucet_incorrect_description' )
) ;
return { errors : [ error ] } ;
}
}
} ) ;
function browseSuggestions ( params ) {
if ( params . url && params . url !== "undefined" && params . url != "" ) {
var url = params . url ;
if ( ! /^[a-zA-Z-_]+:/ . test ( url ) ) {
url = 'http://' + url ;
}
return { webViewUrl : url } ;
}
}
status . command ( {
name : "browse" ,
color : "#ffa500" ,
hidden : true ,
fullscreen : true ,
suggestionsTrigger : 'on-send' ,
params : [ {
name : "url" ,
suggestions : browseSuggestions ,
type : status . types . TEXT
} ]
} ) ;
2016-09-22 05:24:25 +00:00
2016-11-22 12:50:52 +00:00
// status.command({
// name: "help",
// title: "Help",
// description: "Request help from Console",
// color: "#7099e6",
// params: [{
// name: "query",
// type: status.types.TEXT
// }]
// });
2016-09-22 05:24:25 +00:00
status . response ( {
name : "confirmation-code" ,
color : "#7099e6" ,
2016-11-22 12:50:52 +00:00
description : I18n . t ( 'confirm_description' ) ,
2016-09-22 05:24:25 +00:00
params : [ {
name : "code" ,
type : status . types . NUMBER
} ] ,
2016-10-06 13:15:57 +00:00
validator : function ( params ) {
if ( ! /^[\d]{4}$/ . test ( params . code ) ) {
2016-09-22 05:24:25 +00:00
var error = status . components . validationMessage (
2016-11-22 12:50:52 +00:00
I18n . t ( 'confirm_validation_title' ) ,
I18n . t ( 'confirm_validation_description' )
2016-09-22 05:24:25 +00:00
) ;
return { errors : [ error ] }
}
}
} ) ;
status . response ( {
2016-09-29 16:07:36 +00:00
name : "password" ,
2016-09-22 05:24:25 +00:00
color : "#7099e6" ,
2016-11-22 12:50:52 +00:00
description : I18n . t ( 'password_description' ) ,
2016-10-06 13:15:57 +00:00
icon : "lock_white" ,
2016-09-22 05:24:25 +00:00
params : [ {
name : "password" ,
2016-09-29 16:07:36 +00:00
type : status . types . PASSWORD ,
2016-11-22 12:50:52 +00:00
placeholder : I18n . t ( 'password_placeholder' )
2016-10-06 13:15:57 +00:00
} , {
name : "password-confirmation" ,
type : status . types . PASSWORD ,
2016-11-22 12:50:52 +00:00
placeholder : I18n . t ( 'password_placeholder2' )
2016-09-22 05:24:25 +00:00
} ] ,
2016-10-06 13:15:57 +00:00
validator : function ( params , context ) {
var errorMessages = [ ] ;
var currentParameter = context [ "current-parameter" ] ;
if (
currentParameter == "password" &&
params . password . length < 6
) {
2016-11-22 12:50:52 +00:00
errorMessages . push ( I18n . t ( 'password_error' ) ) ;
2016-10-06 13:15:57 +00:00
}
if ( currentParameter == "password-confirmation" &&
params . password != params [ "password-confirmation" ] ) {
2016-11-22 12:50:52 +00:00
errorMessages . push ( I18n . t ( 'password_error1' ) ) ;
2016-10-06 13:15:57 +00:00
}
if ( errorMessages . length ) {
var errors = [ ] ;
for ( var idx in errorMessages ) {
errors . push (
2016-09-19 11:47:02 +00:00
status . components . validationMessage (
2016-11-22 12:50:52 +00:00
I18n . t ( 'password_validation_title' ) ,
2016-10-06 13:15:57 +00:00
errorMessages [ idx ]
2016-09-19 11:47:02 +00:00
)
2016-10-06 13:15:57 +00:00
) ;
}
return { errors : errors } ;
2016-09-19 11:47:02 +00:00
}
2016-10-06 13:15:57 +00:00
return { params : params , context : context } ;
2016-09-19 11:47:02 +00:00
} ,
2016-10-06 13:15:57 +00:00
preview : function ( params , context ) {
2016-09-29 16:07:36 +00:00
var style = {
marginTop : 5 ,
marginHorizontal : 0 ,
fontSize : 14 ,
color : "black"
} ;
2016-10-06 13:15:57 +00:00
if ( context . platform == "ios" ) {
2016-09-29 16:07:36 +00:00
style . fontSize = 8 ;
style . marginTop = 10 ;
style . marginBottom = 2 ;
style . letterSpacing = 1 ;
}
return status . components . text ( { style : style } , "●●●●●●●●●●" ) ;
2016-09-22 05:24:25 +00:00
}
} ) ;
2016-11-02 07:20:50 +00:00
2016-12-02 17:13:55 +00:00
status . registerFunction ( "message-suggestions" , function ( params , context ) {
return jsSuggestions ( { code : params . message } , context ) ;
} ) ;
status . registerFunction ( "message-handler" , function ( params , context ) {
return jsHandler ( { code : params . message } , context ) ;
2016-12-06 23:09:41 +00:00
} ) ;