Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hive
vessel
Commits
67a39553
Commit
67a39553
authored
May 29, 2021
by
Rishi Panthee
Browse files
Basic testnet support
parent
0234ee1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/actions/account.js
View file @
67a39553
...
...
@@ -309,11 +309,14 @@ export function refreshAccountData(accounts: Array) {
export
function
transfer
(
wif
,
params
)
{
return
(
dispatch
:
()
=>
void
)
=>
{
var
{
from
,
to
,
amount
,
memo
}
=
params
;
// amount = amount.replace("HIVE", "STEEM");
// amount = amount.replace("HBD", "SBD");
dispatch
({
type
:
ACCOUNT_TRANSFER_STARTED
});
if
(
hive
.
config
.
get
(
'
address_prefix
'
)
===
'
TST
'
)
{
//if testnet
amount
=
amount
.
replace
(
"
HIVE
"
,
"
TESTS
"
);
amount
=
amount
.
replace
(
"
HBD
"
,
"
TBD
"
);
}
hive
.
broadcast
.
transfer
(
wif
,
from
,
to
,
amount
,
memo
,
(
err
,
result
)
=>
{
if
(
err
)
{
dispatch
({
...
...
app/routes.js
View file @
67a39553
...
...
@@ -21,14 +21,13 @@ import ServerStatus from './containers/ServerStatus';
import
*
as
HiveActions
from
'
./actions/hive
'
;
class
Routes
extends
Component
{
isURL
(
str
)
{
var
pattern
=
new
RegExp
(
'
^(https?:
\\
/
\\
/)?
'
+
// protocol
'
((([a-z
\\
d]([a-z
\\
d-]*[a-z
\\
d])*)
\\
.?)+[a-z]{2,}|
'
+
// domain name
'
((
\\
d{1,3}
\\
.){3}
\\
d{1,3}))
'
+
// OR ip (v4) address
'
(
\\
:
\\
d+)?(
\\
/[-a-z
\\
d%_.~+]*)*
'
+
// port and path
'
(
\\
?[;&a-z
\\
d%_.~+=-]*)?
'
+
// query string
'
(
\\
#[-a-z
\\
d_]*)?$
'
,
'
i
'
);
// fragment locator
const
pattern
=
new
RegExp
(
'
^(https?:
\\
/
\\
/)?
'
// protocol
+
'
((([a-z
\\
d]([a-z
\\
d-]*[a-z
\\
d])*)
\\
.?)+[a-z]{2,}|
'
// domain name
+
'
((
\\
d{1,3}
\\
.){3}
\\
d{1,3}))
'
// OR ip (v4) address
+
'
(
\\
:
\\
d+)?(
\\
/[-a-z
\\
d%_.~+]*)*
'
// port and path
+
'
(
\\
?[;&a-z
\\
d%_.~+=-]*)?
'
// query string
+
'
(
\\
#[-a-z
\\
d_]*)?$
'
,
'
i
'
);
// fragment locator
return
pattern
.
test
(
str
);
}
...
...
@@ -36,38 +35,42 @@ class Routes extends Component {
if
(
url
&&
this
.
isURL
(
url
))
{
// If it's a valid URL, set
hive
.
api
.
setOptions
({
url
});
hive
.
api
.
getConfig
((
err
,
result
)
=>
{
hive
.
config
.
set
(
'
chain_id
'
,
result
.
HIVE_CHAIN_ID
);
hive
.
config
.
set
(
'
address_prefix
'
,
result
.
HIVE_ADDRESS_PREFIX
);
});
}
else
{
// Otherwise set to the api.hive.blog node
hive
.
api
.
setOptions
({
url
:
'
https://api.hive.blog
'
});
}
hive
.
config
.
set
(
'
rebranded_api
'
,
'
true
'
);
hive
.
broadcast
.
updateOperations
();
// Necessary to update the already loaded operations
// Force a refresh immediately after change
this
.
props
.
actions
.
refreshGlobalProps
();
}
componentWillMount
()
{
if
(
this
.
props
.
preferences
&&
this
.
props
.
preferences
.
hived_node
)
{
this
.
changeNode
(
this
.
props
.
preferences
.
hived_node
)
this
.
changeNode
(
this
.
props
.
preferences
.
hived_node
)
;
}
}
componentWillReceiveProps
(
nextProps
)
{
const
nextNode
=
nextProps
.
preferences
.
hived_node
const
thisNode
=
this
.
props
.
preferences
.
hived_node
const
nextNode
=
nextProps
.
preferences
.
hived_node
;
const
thisNode
=
this
.
props
.
preferences
.
hived_node
;
if
(
nextNode
!==
thisNode
)
{
this
.
changeNode
(
nextNode
)
this
.
changeNode
(
nextNode
)
;
}
}
render
()
{
var
parse
=
require
(
'
url-parse
'
);
const
parsed
=
parse
(
window
.
location
.
href
,
true
)
const
parse
=
require
(
'
url-parse
'
);
const
parsed
=
parse
(
window
.
location
.
href
,
true
)
;
if
(
parsed
&&
parsed
.
query
&&
parsed
.
query
.
action
&&
parsed
.
query
.
action
===
'
promptOperation
'
)
{
return
(
<
App
>
<
DecryptPrompt
/>
<
PromptOperation
query
=
{
parsed
.
query
}
/
>
<
/App
>
)
)
;
}
return
(
<
App
>
...
...
@@ -79,11 +82,10 @@ class Routes extends Component {
path
=
"
/
"
render
=
{
(
props
)
=>
{
if
(
this
.
props
.
keys
.
isUser
)
{
if
(
this
.
props
.
keys
.
isUser
)
{
return
<
TransactionsPage
/>
;
}
else
{
return
<
WelcomePage
/>
;
}
return
<
WelcomePage
/>
;
}
}
/
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment