Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pls-pnv
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
plaasio
pls-pnv
Commits
039c50dd
Commit
039c50dd
authored
Jan 29, 2020
by
plaasio
👷🏽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pnv.js
parent
14d5cad7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
26 deletions
+19
-26
pnv.js
pnv.js
+19
-26
No files found.
pnv.js
View file @
039c50dd
...
...
@@ -58,25 +58,27 @@ PythonShell.run(src, options, async function (err, results) {
async
function
init
(){
var
pressed
=
await
getPySrc
(
'btns.py'
,
[]);
//
var pressed = await getPySrc('btns.py', []);
console
.
log
(
pressed
);
await
getPySrc
(
'lcd.py'
,
[
'READY'
,
'scan contract..'
]);
getPySrc
(
'lcd.py'
,
[
'READY'
,
'scan contract..'
]);
var
read
=
await
getPySrc
(
'rd-rfid.py'
,
[]);
//var write = await getPySrc('wt-rfid.py', ['value1', 'value2', 'value3']);
await
getPySrc
(
'lcd.py'
,
[
'scanning cont..'
,
read
]);
var
action
=
new
Promise
.
race
([
getPySrc
(
'rd-rfid.py'
,
[]),
getPySrc
(
'btns.py'
,
[])]);
// if
getPySrc
(
'lcd.py'
,
[
'scanning cont..'
,
read
]);
var
shared
=
await
sendShare
(
''
,
''
,
read
);
console
.
log
(
shared
);
var
shared
=
await
sendShare
(
''
,
''
,
read
)
console
.
log
(
shared
)
}
function
sendShare
(
pub
,
priv
,
share
){
// incoming object. tk = {adr:'0x..',cAdr:'0x..',fiat:'kes',amount:'300'}
// transaction hash. res = '0x..'
// TO-DO
// support other tokens currently supporting eth only/kenya shillings
// only supporting bits tokens transactions
///
return
new
Promise
(
function
(
resolve
,
reject
)
{
...
...
@@ -109,25 +111,16 @@ var provider = new SignerProvider(ethHost, {
signTransaction
:
(
rawTx
,
cb
)
=>
cb
(
null
,
sign
(
rawTx
,
vAddressPrivate
)),
accounts
:
(
cb
)
=>
cb
(
null
,
[
vAddressPublic
]),
});
var
eth
=
new
Eth
(
provider
);
trnDat
.
value
=
'0x0'
;
trnDat
.
to
=
plaasTokenAddress
;
var
eth
=
new
Eth
(
provider
);
trnDat
.
value
=
'0x0'
;
trnDat
.
to
=
plaasTokenAddress
;
var
contract
=
web3
.
eth
.
contract
(
JSON
.
parse
(
abi
));
var
instance
=
contract
.
at
(
plaasTokenAddress
);
instance
.
decimals
(
function
(
e
,
r
){
var
instance
=
contract
.
at
(
plaasTokenAddress
);
instance
.
decimals
(
function
(
e
,
r
){
var
amount
=
(
shareFee
*
Math
.
pow
(
10
,
r
.
toNumber
()));
var
amount
=
(
shareFee
*
Math
.
pow
(
10
,
r
.
toNumber
()));
amount
=
parseInt
(
amount
.
toFixed
());
...
...
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