Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(components): add components #70

Merged
merged 4 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
25 changes: 12 additions & 13 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { StatusBar } from 'expo-status-bar';
import React, { useEffect, useState } from 'react';
import { ActivityIndicator, FlatList, Text, View, StyleSheet } from 'react-native';

Expand All @@ -10,14 +9,14 @@ export default function App() {
const [data, setData] = useState([]);


function fromHex(hex,str){
try{
str = decodeURIComponent(hex.replace(/(..)/g,'%$1'))
function fromHex(hex, str) {
try {
str = decodeURIComponent(hex.replace(/(..)/g, '%$1'))
str = JSON.parse(str)
setData(str)
setLoading(false)
}
catch(e){
catch (e) {
return
//str = hex
//console.log('invalid hex input: ' + hex)
Expand All @@ -34,12 +33,12 @@ export default function App() {
body: JSON.stringify({
jsonrpc: '2.0',
method: 'f_transaction_json',
params: {hash: transactions[tx].hash}
params: { hash: transactions[tx].hash }
})
})
.then((response) => response.json())
.then((json) => fromHex(json.result.tx.extra.substring(66)))
.catch((error) => console.error(error))
.then((response) => response.json())
.then((json) => fromHex(json.result.tx.extra.substring(66)))
.catch((error) => console.error(error))
}
}

Expand All @@ -49,7 +48,7 @@ export default function App() {
body: JSON.stringify({
jsonrpc: '2.0',
method: 'f_block_json',
params: {hash: blockHash}
params: { hash: blockHash }
})
})
.then((response) => response.json())
Expand All @@ -59,7 +58,7 @@ export default function App() {

const getBlockHashes = (blockCount) => {
let i;
for (i = 0; i < 100; i++) {
for (i = 0; i < 100; i++) {
fetch(nodeURL, {
method: 'POST',
body: JSON.stringify({
Expand All @@ -86,12 +85,12 @@ export default function App() {
.then((response) => response.json())
.then((json) => getBlockHashes(json.result.count))
.catch((error) => console.error(error))
//.finally(() => setLoading(false));
//.finally(() => setLoading(false));
}, []);

return (
<View style={{ flex: 1, padding: 24 }}>
{isLoading ? <ActivityIndicator/> : (
{isLoading ? <ActivityIndicator /> : (
<Text>{JSON.stringify(data)}</Text>
)}
</View>
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs')
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 20
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 33
supportLibVersion = "28.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@
"vm": "vm-browserify",
"tls": false
}
}
}
Loading
Loading