Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
febab2ef
Commit
febab2ef
authored
Nov 23, 2020
by
aniket-engg
Committed by
Aniket
Nov 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some types and import export update
parent
3834ac09
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
26 deletions
+26
-26
txExecution.js
libs/remix-lib/src/execution/txExecution.js
+1
-1
package.json
libs/remix-simulator/package.json
+2
-2
index.ts
libs/remix-simulator/src/index.ts
+2
-2
accounts.ts
libs/remix-simulator/src/methods/accounts.ts
+6
-6
blocks.ts
libs/remix-simulator/src/methods/blocks.ts
+6
-6
transactions.ts
libs/remix-simulator/src/methods/transactions.ts
+4
-4
txProcess.ts
libs/remix-simulator/src/methods/txProcess.ts
+5
-5
No files found.
libs/remix-lib/src/execution/txExecution.js
View file @
febab2ef
...
@@ -43,7 +43,7 @@ module.exports = {
...
@@ -43,7 +43,7 @@ module.exports = {
* @param {Function} finalCallback - last callback.
* @param {Function} finalCallback - last callback.
*/
*/
callFunction
:
function
(
from
,
to
,
data
,
value
,
gasLimit
,
funAbi
,
txRunner
,
callbacks
,
finalCallback
)
{
callFunction
:
function
(
from
,
to
,
data
,
value
,
gasLimit
,
funAbi
,
txRunner
,
callbacks
,
finalCallback
)
{
const
useCall
=
funAbi
.
stateMutability
===
'view'
||
funAbi
.
stateMutability
===
'pure'
const
useCall
=
funAbi
.
stateMutability
===
'view'
||
funAbi
.
stateMutability
===
'pure'
||
funAbi
.
constant
const
tx
=
{
from
,
to
,
data
,
useCall
,
value
,
gasLimit
}
const
tx
=
{
from
,
to
,
data
,
useCall
,
value
,
gasLimit
}
txRunner
.
rawRun
(
tx
,
callbacks
.
confirmationCb
,
callbacks
.
gasEstimationForceSend
,
callbacks
.
promptCb
,
(
error
,
txResult
)
=>
{
txRunner
.
rawRun
(
tx
,
callbacks
.
confirmationCb
,
callbacks
.
gasEstimationForceSend
,
callbacks
.
promptCb
,
(
error
,
txResult
)
=>
{
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
...
...
libs/remix-simulator/package.json
View file @
febab2ef
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
"email"
:
"yann@ethdev.com"
"email"
:
"yann@ethdev.com"
}
}
],
],
"main"
:
"index.js"
,
"main"
:
"
src/
index.js"
,
"dependencies"
:
{
"dependencies"
:
{
"@remix-project/remix-lib"
:
"^0.4.31"
,
"@remix-project/remix-lib"
:
"^0.4.31"
,
"ansi-gray"
:
"^0.1.1"
,
"ansi-gray"
:
"^0.1.1"
,
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
"type"
:
"git"
,
"type"
:
"git"
,
"url"
:
"git+https://github.com/ethereum/remix-project.git"
"url"
:
"git+https://github.com/ethereum/remix-project.git"
},
},
"author"
:
"
remix t
eam"
,
"author"
:
"
Remix T
eam"
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"bugs"
:
{
"bugs"
:
{
"url"
:
"https://github.com/ethereum/remix-project/issues"
"url"
:
"https://github.com/ethereum/remix-project/issues"
...
...
libs/remix-simulator/src/index.ts
View file @
febab2ef
im
port
{
Provider
}
from
'./provider'
ex
port
{
Provider
}
from
'./provider'
export
{
Provider
}
//
export { Provider }
libs/remix-simulator/src/methods/accounts.ts
View file @
febab2ef
...
@@ -5,8 +5,8 @@ import * as crypto from 'crypto'
...
@@ -5,8 +5,8 @@ import * as crypto from 'crypto'
export
class
Accounts
{
export
class
Accounts
{
web3
web3
accounts
accounts
:
Record
<
string
,
unknown
>
accountsKeys
accountsKeys
:
Record
<
string
,
unknown
>
executionContext
executionContext
constructor
(
executionContext
)
{
constructor
(
executionContext
)
{
...
@@ -19,7 +19,7 @@ export class Accounts {
...
@@ -19,7 +19,7 @@ export class Accounts {
this
.
executionContext
.
init
({
get
:
()
=>
{
return
true
}
})
this
.
executionContext
.
init
({
get
:
()
=>
{
return
true
}
})
}
}
async
resetAccounts
()
{
async
resetAccounts
()
:
Promise
<
void
>
{
// TODO: setting this to {} breaks the app currently, unclear why still
// TODO: setting this to {} breaks the app currently, unclear why still
// this.accounts = {}
// this.accounts = {}
// this.accountsKeys = {}
// this.accountsKeys = {}
...
@@ -43,7 +43,7 @@ export class Accounts {
...
@@ -43,7 +43,7 @@ export class Accounts {
_addAccount
(
privateKey
,
balance
)
{
_addAccount
(
privateKey
,
balance
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
privateKey
=
Buffer
.
from
(
privateKey
,
'hex'
)
privateKey
=
Buffer
.
from
(
privateKey
,
'hex'
)
const
address
=
privateToAddress
(
privateKey
)
const
address
:
Buffer
=
privateToAddress
(
privateKey
)
this
.
accounts
[
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
))]
=
{
privateKey
,
nonce
:
0
}
this
.
accounts
[
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
))]
=
{
privateKey
,
nonce
:
0
}
this
.
accountsKeys
[
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
))]
=
'0x'
+
privateKey
.
toString
(
'hex'
)
this
.
accountsKeys
[
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
))]
=
'0x'
+
privateKey
.
toString
(
'hex'
)
...
@@ -62,7 +62,7 @@ export class Accounts {
...
@@ -62,7 +62,7 @@ export class Accounts {
}
}
newAccount
(
cb
)
{
newAccount
(
cb
)
{
let
privateKey
let
privateKey
:
Buffer
do
{
do
{
privateKey
=
crypto
.
randomBytes
(
32
)
privateKey
=
crypto
.
randomBytes
(
32
)
}
while
(
!
isValidPrivate
(
privateKey
))
}
while
(
!
isValidPrivate
(
privateKey
))
...
@@ -70,7 +70,7 @@ export class Accounts {
...
@@ -70,7 +70,7 @@ export class Accounts {
return
cb
(
null
,
'0x'
+
privateToAddress
(
privateKey
).
toString
(
'hex'
))
return
cb
(
null
,
'0x'
+
privateToAddress
(
privateKey
).
toString
(
'hex'
))
}
}
methods
()
{
methods
()
:
Record
<
string
,
unknown
>
{
return
{
return
{
eth_accounts
:
this
.
eth_accounts
.
bind
(
this
),
eth_accounts
:
this
.
eth_accounts
.
bind
(
this
),
eth_getBalance
:
this
.
eth_getBalance
.
bind
(
this
),
eth_getBalance
:
this
.
eth_getBalance
.
bind
(
this
),
...
...
libs/remix-simulator/src/methods/blocks.ts
View file @
febab2ef
export
class
Blocks
{
export
class
Blocks
{
executionContext
executionContext
coinbase
coinbase
:
string
blockNumber
blockNumber
:
number
constructor
(
executionContext
,
_options
)
{
constructor
(
executionContext
,
_options
)
{
this
.
executionContext
=
executionContext
this
.
executionContext
=
executionContext
...
@@ -10,7 +10,7 @@ export class Blocks {
...
@@ -10,7 +10,7 @@ export class Blocks {
this
.
blockNumber
=
0
this
.
blockNumber
=
0
}
}
methods
()
{
methods
()
:
Record
<
string
,
unknown
>
{
return
{
return
{
eth_getBlockByNumber
:
this
.
eth_getBlockByNumber
.
bind
(
this
),
eth_getBlockByNumber
:
this
.
eth_getBlockByNumber
.
bind
(
this
),
eth_gasPrice
:
this
.
eth_gasPrice
.
bind
(
this
),
eth_gasPrice
:
this
.
eth_gasPrice
.
bind
(
this
),
...
@@ -68,7 +68,7 @@ export class Blocks {
...
@@ -68,7 +68,7 @@ export class Blocks {
}
}
eth_getBlockByHash
(
payload
,
cb
)
{
eth_getBlockByHash
(
payload
,
cb
)
{
var
block
=
this
.
executionContext
.
blocks
[
payload
.
params
[
0
]]
const
block
=
this
.
executionContext
.
blocks
[
payload
.
params
[
0
]]
const
b
=
{
const
b
=
{
number
:
this
.
toHex
(
block
.
header
.
number
),
number
:
this
.
toHex
(
block
.
header
.
number
),
...
@@ -107,13 +107,13 @@ export class Blocks {
...
@@ -107,13 +107,13 @@ export class Blocks {
}
}
eth_getBlockTransactionCountByHash
(
payload
,
cb
)
{
eth_getBlockTransactionCountByHash
(
payload
,
cb
)
{
var
block
=
this
.
executionContext
.
blocks
[
payload
.
params
[
0
]]
const
block
=
this
.
executionContext
.
blocks
[
payload
.
params
[
0
]]
cb
(
null
,
block
.
transactions
.
length
)
cb
(
null
,
block
.
transactions
.
length
)
}
}
eth_getBlockTransactionCountByNumber
(
payload
,
cb
)
{
eth_getBlockTransactionCountByNumber
(
payload
,
cb
)
{
var
block
=
this
.
executionContext
.
blocks
[
payload
.
params
[
0
]]
const
block
=
this
.
executionContext
.
blocks
[
payload
.
params
[
0
]]
cb
(
null
,
block
.
transactions
.
length
)
cb
(
null
,
block
.
transactions
.
length
)
}
}
...
...
libs/remix-simulator/src/methods/transactions.ts
View file @
febab2ef
...
@@ -44,7 +44,7 @@ export class Transactions {
...
@@ -44,7 +44,7 @@ export class Transactions {
const
txBlock
=
this
.
executionContext
.
txs
[
receipt
.
hash
]
const
txBlock
=
this
.
executionContext
.
txs
[
receipt
.
hash
]
const
r
=
{
const
r
:
Record
<
string
,
unknown
>
=
{
transactionHash
:
receipt
.
hash
,
transactionHash
:
receipt
.
hash
,
transactionIndex
:
'0x00'
,
transactionIndex
:
'0x00'
,
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
...
@@ -118,7 +118,7 @@ export class Transactions {
...
@@ -118,7 +118,7 @@ export class Transactions {
const
txBlock
=
this
.
executionContext
.
txs
[
receipt
.
transactionHash
]
const
txBlock
=
this
.
executionContext
.
txs
[
receipt
.
transactionHash
]
// TODO: params to add later
// TODO: params to add later
const
r
=
{
const
r
:
Record
<
string
,
unknown
>
=
{
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockNumber
:
'0x'
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
blockNumber
:
'0x'
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
from
:
receipt
.
from
,
from
:
receipt
.
from
,
...
@@ -164,7 +164,7 @@ export class Transactions {
...
@@ -164,7 +164,7 @@ export class Transactions {
}
}
// TODO: params to add later
// TODO: params to add later
const
r
=
{
const
r
:
Record
<
string
,
unknown
>
=
{
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockNumber
:
'0x'
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
blockNumber
:
'0x'
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
from
:
receipt
.
from
,
from
:
receipt
.
from
,
...
@@ -206,7 +206,7 @@ export class Transactions {
...
@@ -206,7 +206,7 @@ export class Transactions {
}
}
// TODO: params to add later
// TODO: params to add later
const
r
=
{
const
r
:
Record
<
string
,
unknown
>
=
{
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockHash
:
'0x'
+
txBlock
.
hash
().
toString
(
'hex'
),
blockNumber
:
'0x'
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
blockNumber
:
'0x'
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
from
:
receipt
.
from
,
from
:
receipt
.
from
,
...
...
libs/remix-simulator/src/methods/txProcess.ts
View file @
febab2ef
const
RemixLib
=
require
(
'@remix-project/remix-lib'
)
import
{
execution
}
from
'@remix-project/remix-lib'
const
TxExecution
=
RemixLib
.
execution
.
txExecution
const
TxExecution
=
execution
.
txExecution
const
TxRunner
=
RemixLib
.
execution
.
txRunner
const
TxRunner
=
execution
.
txRunner
function
runCall
(
payload
,
from
,
to
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
function
runCall
(
payload
,
from
,
to
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
const
finalCallback
=
function
(
err
,
result
)
{
const
finalCallback
=
function
(
err
,
result
)
{
...
@@ -12,7 +12,7 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks,
...
@@ -12,7 +12,7 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks,
return
callback
(
null
,
toReturn
)
return
callback
(
null
,
toReturn
)
}
}
TxExecution
.
callFunction
(
from
,
to
,
data
,
value
,
gasLimit
,
{
constant
:
true
},
txRunner
,
callbacks
,
finalCallback
,
true
)
TxExecution
.
callFunction
(
from
,
to
,
data
,
value
,
gasLimit
,
{
constant
:
true
},
txRunner
,
callbacks
,
finalCallback
)
}
}
function
runTx
(
payload
,
from
,
to
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
function
runTx
(
payload
,
from
,
to
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
...
@@ -23,7 +23,7 @@ function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, c
...
@@ -23,7 +23,7 @@ function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, c
callback
(
null
,
result
.
transactionHash
)
callback
(
null
,
result
.
transactionHash
)
}
}
TxExecution
.
callFunction
(
from
,
to
,
data
,
value
,
gasLimit
,
{
constant
:
false
},
txRunner
,
callbacks
,
finalCallback
,
false
)
TxExecution
.
callFunction
(
from
,
to
,
data
,
value
,
gasLimit
,
{
constant
:
false
},
txRunner
,
callbacks
,
finalCallback
)
}
}
function
createContract
(
payload
,
from
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
function
createContract
(
payload
,
from
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
...
...
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