This commit is contained in:
bas-vk 2016-04-12 15:09:29 +00:00
commit ec4553ce5c
3 changed files with 174 additions and 2991 deletions

View file

@ -196,7 +196,7 @@ func (js *jsre) apiBindings() error {
} }
// load only supported API's in javascript runtime // load only supported API's in javascript runtime
shortcuts := "var eth = web3.eth; var personal = web3.personal; " shortcuts := "var eth = web3.eth; "
for _, apiName := range apiNames { for _, apiName := range apiNames {
if apiName == "web3" || apiName == "rpc" { if apiName == "web3" || apiName == "rpc" {
continue // manually mapped or ignore continue // manually mapped or ignore

File diff suppressed because it is too large Load diff

View file

@ -19,15 +19,48 @@ package rpc
var ( var (
// Holds geth specific RPC extends which can be used to extend web3 // Holds geth specific RPC extends which can be used to extend web3
WEB3Extensions = map[string]string{ WEB3Extensions = map[string]string{
"txpool": TxPool_JS, "admin": Admin_JS,
"admin": Admin_JS, "eth": Eth_JS,
"eth": Eth_JS, "miner": Miner_JS,
"miner": Miner_JS, "debug": Debug_JS,
"debug": Debug_JS, "net": Net_JS,
"net": Net_JS, "personal": Personal_JS,
"txpool": TxPool_JS,
} }
) )
const Personal_JS = `
web3._extend({
property: 'personal',
methods:
[
new web3._extend.Method({
name: 'newAccount',
call: 'personal_newAccount',
params: 1,
outputFormatter: web3._extend.utils.toAddress
}),
new web3._extend.Method({
name: 'unlockAccount',
call: 'personal_unlockAccount',
params: 3,
}),
new web3._extend.Method({
name: 'lockAccount',
call: 'personal_lockAccount',
params: 1
})
],
properties:
[
new web3._extend.Property({
name: 'listAccounts',
getter: 'personal_listAccounts'
})
]
});
`
const TxPool_JS = ` const TxPool_JS = `
web3._extend({ web3._extend({
property: 'txpool', property: 'txpool',