Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Token-Factory
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
Token-Factory
Commits
669dcc55
Commit
669dcc55
authored
Apr 01, 2016
by
Simon de la Rouviere
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes.
parent
efe0c6b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
15 deletions
+35
-15
bootstrap.js
app/javascripts/bootstrap.js
+9
-1
tokenpage.jsx
app/javascripts/tokenpage.jsx
+1
-0
txform.jsx
app/javascripts/txform.jsx
+25
-14
No files found.
app/javascripts/bootstrap.js
View file @
669dcc55
...
...
@@ -4,15 +4,23 @@ var Pudding = require("ether-pudding");
var
exported
=
null
;
// Bootstrap
//hack it. Wait for 2 seconds.
if
(
typeof
web3
!==
'undefined'
)
{
// Use the Mist/wallet provider.
exported
=
new
Web3
(
web3
.
currentProvider
);
var
other_web3
=
new
Web3
(
new
Web3
.
providers
.
HttpProvider
(
'http://127.0.0.1:8547'
));
window
.
web_l
=
other_web3
;
}
else
{
// Use the provider from the config.
// ENV and WEB3_PROVIDER_LOCATION are rewritten by webpack during build
if
(
ENV
==
"development"
)
{
//exported = new Web3(new Web3.providers.HttpProvider(WEB3_PROVIDER_LOCATION));
exported
=
new
Web3
(
new
Web3
.
providers
.
HttpProvider
(
'http://127.0.0.1:8545'
));
console
.
log
(
"Setting local web3"
);
exported
=
new
Web3
(
new
Web3
.
providers
.
HttpProvider
(
'http://127.0.0.1:8546'
));
window
.
web3
=
exported
;
//exported = new Web3(new Web3.providers.HttpProvider('https://rawtestrpc.metamask.io/'));
}
}
...
...
app/javascripts/tokenpage.jsx
View file @
669dcc55
...
...
@@ -19,6 +19,7 @@ var TokenPage = React.createClass({
this
.
setState
({
contract_address
:
this
.
props
.
params
.
contract_address
});
//var web3_token = web3_rab.eth.contract(Standard_Token.abi).at(this.props.params.contract_address); //for reflux-tx
var
web3_token
=
web3
.
eth
.
contract
(
Standard_Token
.
abi
).
at
(
this
.
props
.
params
.
contract_address
);
//for reflux-tx
window
.
token_c
=
web3_token
;
this
.
setState
({
web3_token
:
web3_token
});
var
that
=
this
;
web3
.
eth
.
getAccounts
(
function
(
err
,
accounts
){
...
...
app/javascripts/txform.jsx
View file @
669dcc55
...
...
@@ -2,6 +2,8 @@ import React from "react";
import
InputForm
from
"./inputform.jsx"
;
import
{
TXActions
}
from
'reflux-tx'
;
window
.
txa
=
TXActions
;
var
TxForm
=
React
.
createClass
({
getInitialState
:
function
()
{
return
{
...
...
@@ -17,6 +19,7 @@ var TxForm = React.createClass({
for
(
var
i
=
0
;
i
<
this
.
props
.
confirmed
.
length
;
i
+=
1
)
{
if
(
this
.
props
.
confirmed
[
i
].
receipt
.
transactionHash
==
this
.
state
.
txHash
)
{
console
.
log
(
this
.
props
.
confirmed
[
i
].
receipt
);
//console.log(web_l.eth.blockNumber);
this
.
setState
({
processing
:
false
});
console
.
log
(
'processed'
);
this
.
props
.
successful
(
this
.
state
.
txArgs
,
this
.
props
.
confirmed
[
i
].
receipt
);
//successful transaction with these arguments
...
...
@@ -24,10 +27,11 @@ var TxForm = React.createClass({
}
}
else
{
if
(
this
.
props
.
pending
.
length
>
0
)
{
console
.
log
(
this
.
props
.
pending
);
this
.
setState
({
processing
:
true
});
//this seems dangerous! Assumes only 1 tx at a time.
//revise
this
.
setState
({
txHash
:
this
.
props
.
pending
[
0
].
receipt
.
transactionH
ash
});
this
.
setState
({
txHash
:
this
.
props
.
pending
[
0
].
data
.
h
ash
});
}
else
if
(
this
.
props
.
received
.
length
>
0
)
{
this
.
setState
({
processing
:
true
});
this
.
setState
({
txHash
:
this
.
props
.
received
[
0
].
receipt
.
transactionHash
});
...
...
@@ -61,8 +65,13 @@ var TxForm = React.createClass({
var
addr
=
accounts
[
0
];
console
.
log
(
addr
);
console
.
log
(
ST
);
console
.
log
(
Standard_Token
.
abi
);
console
.
log
(
"0x"
+
Standard_Token
.
prototype
.
binary
);
ST
.
new
(
args
[
0
],
{
from
:
addr
,
data
:
"0x"
+
Standard_Token
.
prototype
.
binary
,
gas
:
3100000
},
function
(
err
,
result
)
{
//TODO: change gas price
var
creation_data
=
ST
.
new
.
getData
(
args
[
0
],
{
from
:
addr
,
data
:
"0x"
+
Standard_Token
.
prototype
.
binary
,
gasPrice
:
50000000000
,
gas
:
3100000
});
console
.
log
(
creation_data
);
console
.
log
(
args
[
0
]);
ST
.
new
(
args
[
0
],
{
from
:
addr
,
data
:
"0x"
+
Standard_Token
.
prototype
.
binary
,
gasPrice
:
50000000000
,
gas
:
3100000
},
function
(
err
,
result
)
{
//NOTE: This callback fires twice. Once tx hash comes in. Then when mined.
if
(
err
)
{
console
.
log
(
err
);
...
...
@@ -87,22 +96,24 @@ var TxForm = React.createClass({
this
.
props
.
successful
(
result
,
args
);
//fires callback function.
}
else
if
(
this
.
props
.
txStyle
==
"transaction"
)
{
args
.
push
(
function
(
err
,
result
)
{
if
(
!
err
)
{
console
.
log
(
result
);
if
(
result
!=
null
)
{
var
tx_hash
=
result
;
that
.
setState
({
txArgs
:
args
});
//need to keep transaction arguments for success function.
that
.
submitTransaction
(
tx_hash
,
that
.
props
.
txType
);
}
}
});
var
that
=
this
;
args
.
push
({
gas
:
30
00000
});
args
.
push
({
gas
:
3
00000
});
web3
.
eth
.
getAccounts
(
function
(
err
,
accounts
){
var
addr
=
accounts
[
0
];
args
.
push
({
from
:
addr
});
this
.
props
.
web3_token
[
this
.
props
.
abiFunction
].
sendTransaction
.
apply
(
this
,
args
);
//the callback (must be after part)
args
.
push
(
function
(
err
,
result
)
{
if
(
!
err
)
{
console
.
log
(
result
);
if
(
result
!=
null
)
{
var
tx_hash
=
result
;
that
.
setState
({
txArgs
:
args
});
//need to keep transaction arguments for success function.
that
.
submitTransaction
(
tx_hash
,
that
.
props
.
txType
);
}
}
});
console
.
log
(
args
);
that
.
props
.
web3_token
[
that
.
props
.
abiFunction
].
sendTransaction
.
apply
(
that
,
args
);
});
}
}
...
...
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