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
34bc1cd6
Commit
34bc1cd6
authored
Dec 02, 2020
by
aniket-engg
Committed by
Aniket
Dec 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
providers, init, util, txRunner
parent
142d6478
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
103 additions
and
99 deletions
+103
-99
execution-context.ts
libs/remix-lib/src/execution/execution-context.ts
+1
-0
txRunner.ts
libs/remix-lib/src/execution/txRunner.ts
+1
-1
init.ts
libs/remix-lib/src/init.ts
+27
-31
util.ts
libs/remix-lib/src/util.ts
+0
-0
dummyProvider.ts
libs/remix-lib/src/web3Provider/dummyProvider.ts
+43
-38
web3Providers.ts
libs/remix-lib/src/web3Provider/web3Providers.ts
+31
-29
web3VmProvider.ts
libs/remix-lib/src/web3Provider/web3VmProvider.ts
+0
-0
No files found.
libs/remix-lib/src/execution/execution-context.ts
View file @
34bc1cd6
...
@@ -9,6 +9,7 @@ const Web3VMProvider = require('../web3Provider/web3VmProvider')
...
@@ -9,6 +9,7 @@ const Web3VMProvider = require('../web3Provider/web3VmProvider')
const
LogsManager
=
require
(
'./logsManager.js'
)
const
LogsManager
=
require
(
'./logsManager.js'
)
declare
let
ethereum
:
any
;
let
web3
let
web3
if
(
typeof
window
!==
'undefined'
&&
typeof
window
[
'ethereum'
]
!==
'undefined'
)
{
if
(
typeof
window
!==
'undefined'
&&
typeof
window
[
'ethereum'
]
!==
'undefined'
)
{
var
injectedProvider
=
window
[
'ethereum'
]
var
injectedProvider
=
window
[
'ethereum'
]
...
...
libs/remix-lib/src/execution/txRunner.ts
View file @
34bc1cd6
'use strict'
'use strict'
import
{
Transaction
}
from
'ethereumjs-tx'
import
{
Transaction
}
from
'ethereumjs-tx'
import
{
Block
}
from
'ethereumjs-block'
import
{
Block
}
from
'ethereumjs-block'
import
{
BN
}
from
'ethereumjs-util'
import
{
BN
,
bufferToHex
}
from
'ethereumjs-util'
import
{
ExecutionContext
}
from
'./execution-context'
import
{
ExecutionContext
}
from
'./execution-context'
const
EventManager
=
require
(
'../eventManager'
)
const
EventManager
=
require
(
'../eventManager'
)
...
...
libs/remix-lib/src/init.ts
View file @
34bc1cd6
'use strict'
'use strict'
const
Web3
=
require
(
'web3'
)
import
Web3
from
'web3'
module
.
exports
=
{
export
function
loadWeb3
(
url
=
'http://localhost:8545'
)
{
loadWeb3
:
function
(
url
)
{
const
web3
=
new
Web3
()
if
(
!
url
)
url
=
'http://localhost:8545'
web3
.
setProvider
(
new
Web3
.
providers
.
HttpProvider
(
url
))
const
web3
=
new
Web3
()
this
.
extend
(
web3
)
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
url
))
return
web3
this
.
extend
(
web3
)
}
return
web3
},
extendWeb3
:
function
(
web3
)
{
export
function
extendWeb3
(
web3
)
{
this
.
extend
(
web3
)
this
.
extend
(
web3
)
},
}
setProvider
:
function
(
web3
,
url
)
{
export
function
setProvider
(
web3
,
url
)
{
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
url
))
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
url
))
},
}
web3DebugNode
:
function
(
network
)
{
export
function
web3DebugNode
(
network
)
{
if
(
web3DebugNodes
[
network
])
{
const
web3DebugNodes
=
{
return
this
.
loadWeb3
(
web3DebugNodes
[
network
])
'Main'
:
'https://gethmainnet.komputing.org'
,
}
'Rinkeby'
:
'https://remix-rinkeby.ethdevops.io'
,
return
null
'Ropsten'
:
'https://remix-ropsten.ethdevops.io'
,
},
'Goerli'
:
'https://remix-goerli.ethdevops.io'
,
'Kovan'
:
'https://remix-kovan.ethdevops.io'
}
if
(
web3DebugNodes
[
network
])
{
return
this
.
loadWeb3
(
web3DebugNodes
[
network
])
}
return
null
}
extend
:
function
(
web3
)
{
export
function
extend
(
web3
)
{
if
(
!
web3
.
extend
)
{
if
(
!
web3
.
extend
)
{
return
return
}
}
...
@@ -65,12 +70,3 @@ module.exports = {
...
@@ -65,12 +70,3 @@ module.exports = {
})
})
}
}
}
}
}
const
web3DebugNodes
=
{
'Main'
:
'https://gethmainnet.komputing.org'
,
'Rinkeby'
:
'https://remix-rinkeby.ethdevops.io'
,
'Ropsten'
:
'https://remix-ropsten.ethdevops.io'
,
'Goerli'
:
'https://remix-goerli.ethdevops.io'
,
'Kovan'
:
'https://remix-kovan.ethdevops.io'
}
libs/remix-lib/src/util.ts
View file @
34bc1cd6
This diff is collapsed.
Click to expand it.
libs/remix-lib/src/web3Provider/dummyProvider.ts
View file @
34bc1cd6
function
dummyProvider
()
{
export
class
dummyProvider
{
this
.
eth
=
{}
eth
this
.
debug
=
{}
debug
this
.
eth
.
getCode
=
(
address
,
cb
)
=>
{
return
this
.
getCode
(
address
,
cb
)
}
providers
this
.
eth
.
getTransaction
=
(
hash
,
cb
)
=>
{
return
this
.
getTransaction
(
hash
,
cb
)
}
currentProvider
this
.
eth
.
getTransactionFromBlock
=
(
blockNumber
,
txIndex
,
cb
)
=>
{
return
this
.
getTransactionFromBlock
(
blockNumber
,
txIndex
,
cb
)
}
this
.
eth
.
getBlockNumber
=
(
cb
)
=>
{
return
this
.
getBlockNumber
(
cb
)
}
constructor
()
{
this
.
debug
.
traceTransaction
=
(
hash
,
options
,
cb
)
=>
{
return
this
.
traceTransaction
(
hash
,
options
,
cb
)
}
this
.
eth
=
{}
this
.
debug
.
storageRangeAt
=
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
=>
{
return
this
.
storageRangeAt
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
}
this
.
debug
=
{}
this
.
providers
=
{
'HttpProvider'
:
function
(
url
)
{}
}
this
.
eth
.
getCode
=
(
address
,
cb
)
=>
{
return
this
.
getCode
(
address
,
cb
)
}
this
.
currentProvider
=
{
'host'
:
''
}
this
.
eth
.
getTransaction
=
(
hash
,
cb
)
=>
{
return
this
.
getTransaction
(
hash
,
cb
)
}
}
this
.
eth
.
getTransactionFromBlock
=
(
blockNumber
,
txIndex
,
cb
)
=>
{
return
this
.
getTransactionFromBlock
(
blockNumber
,
txIndex
,
cb
)
}
this
.
eth
.
getBlockNumber
=
(
cb
)
=>
{
return
this
.
getBlockNumber
(
cb
)
}
this
.
debug
.
traceTransaction
=
(
hash
,
options
,
cb
)
=>
{
return
this
.
traceTransaction
(
hash
,
options
,
cb
)
}
this
.
debug
.
storageRangeAt
=
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
=>
{
return
this
.
storageRangeAt
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
}
this
.
providers
=
{
'HttpProvider'
:
function
(
url
)
{}
}
this
.
currentProvider
=
{
'host'
:
''
}
}
dummyProvider
.
prototype
.
getCode
=
function
(
address
,
cb
)
{
getCode
(
address
,
cb
)
{
cb
(
null
,
''
)
cb
(
null
,
''
)
}
}
dummyProvider
.
prototype
.
setProvider
=
function
(
provider
)
{}
setProvider
(
provider
)
{}
dummyProvider
.
prototype
.
traceTransaction
=
function
(
txHash
,
options
,
cb
)
{
traceTransaction
(
txHash
,
options
,
cb
)
{
if
(
cb
)
{
if
(
cb
)
{
cb
(
null
,
{})
cb
(
null
,
{})
}
return
{}
}
}
return
{}
}
dummyProvider
.
prototype
.
storageRangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
{
storageRangeAt
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
{
if
(
cb
)
{
if
(
cb
)
{
cb
(
null
,
{})
cb
(
null
,
{})
}
return
{}
}
}
return
{}
}
dummyProvider
.
prototype
.
getBlockNumber
=
function
(
cb
)
{
cb
(
null
,
''
)
}
getBlockNumber
(
cb
)
{
cb
(
null
,
''
)
}
dummyProvider
.
prototype
.
getTransaction
=
function
(
txHash
,
cb
)
{
getTransaction
(
txHash
,
cb
)
{
if
(
cb
)
{
if
(
cb
)
{
cb
(
null
,
{})
cb
(
null
,
{})
}
return
{}
}
}
return
{}
}
dummyProvider
.
prototype
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
cb
)
{
getTransactionFromBlock
(
blockNumber
,
txIndex
,
cb
)
{
if
(
cb
)
{
if
(
cb
)
{
cb
(
null
,
{})
cb
(
null
,
{})
}
return
{}
}
}
return
{}
}
}
module
.
exports
=
dummyProvider
libs/remix-lib/src/web3Provider/web3Providers.ts
View file @
34bc1cd6
const
Web3VMProvider
=
require
(
'./web3VmProvider'
)
import
{
Web3VmProvider
}
from
'./web3VmProvider'
const
init
=
require
(
'../init'
)
import
{
loadWeb3
,
extendWeb3
}
from
'../init'
function
Web3Providers
()
{
export
class
Web3Providers
{
this
.
modes
=
{}
}
Web3Providers
.
prototype
.
addProvider
=
function
(
type
,
obj
)
{
modes
if
(
type
===
'INTERNAL'
)
{
constructor
()
{
const
web3
=
init
.
loadWeb3
()
this
.
modes
=
{}
this
.
addWeb3
(
type
,
web3
)
}
else
if
(
type
===
'vm'
)
{
this
.
addVM
(
type
,
obj
)
}
else
{
init
.
extendWeb3
(
obj
)
this
.
addWeb3
(
type
,
obj
)
}
}
}
Web3Providers
.
prototype
.
get
=
function
(
type
,
cb
)
{
addProvider
(
type
,
obj
)
{
if
(
this
.
modes
[
type
])
{
if
(
type
===
'INTERNAL'
)
{
return
cb
(
null
,
this
.
modes
[
type
])
const
web3
=
loadWeb3
()
this
.
addWeb3
(
type
,
web3
)
}
else
if
(
type
===
'vm'
)
{
this
.
addVM
(
type
,
obj
)
}
else
{
extendWeb3
(
obj
)
this
.
addWeb3
(
type
,
obj
)
}
}
}
cb
(
'error: this provider has not been setup ('
+
type
+
')'
,
null
)
}
Web3Providers
.
prototype
.
addWeb3
=
function
(
type
,
web3
)
{
get
(
type
,
cb
)
{
this
.
modes
[
type
]
=
web3
if
(
this
.
modes
[
type
])
{
}
return
cb
(
null
,
this
.
modes
[
type
])
}
cb
(
'error: this provider has not been setup ('
+
type
+
')'
,
null
)
}
Web3Providers
.
prototype
.
addVM
=
function
(
type
,
vm
)
{
addWeb3
(
type
,
web3
)
{
const
vmProvider
=
new
Web3VMProvider
()
this
.
modes
[
type
]
=
web3
vmProvider
.
setVM
(
vm
)
}
this
.
modes
[
type
]
=
vmProvider
}
module
.
exports
=
Web3Providers
addVM
(
type
,
vm
)
{
const
vmProvider
=
new
Web3VmProvider
()
vmProvider
.
setVM
(
vm
)
this
.
modes
[
type
]
=
vmProvider
}
}
libs/remix-lib/src/web3Provider/web3VmProvider.ts
View file @
34bc1cd6
This diff is collapsed.
Click to expand it.
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