mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
* add l1 config in genesis config (#249) * add l1 config in genesis config * fix lint * Update params/config.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> --------- Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * extend node configuration (#251) * extend node configuration * use block number instead of hash * accept safe, finalized and numbers for L1Confirmations * fix typos --------- Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io> * Fix/improve node config parsing (#260) * raise error on failed parsing * default value * add l1-message-type, transaction methods (#252) * add l1-message-type, transaction methods * goimports * Update core/types/transaction.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * txpool l1 check, pointer change, marhsal test * draft: start implementing l1message gas behavior * draft: start implementing l1message gas behavior * change to gas usage * error comment typo Co-authored-by: Haichen Shen <shenhaichen@gmail.com> * goimports * update nonce, add hash test (fails), marshal test * goimports * target addr cant be nil * change call msg * comment out test * lint --------- Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> Co-authored-by: Haichen Shen <shenhaichen@gmail.com> * Add L1 message database (#255) * add l1-message-type, transaction methods * goimports * Update core/types/transaction.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * add L1 message store to rawdb * remove comments * rename to l1_message * rename variables and add comments * write l1 msgs in a batch * add more comments * update tests * allow batched and non-batched writes * rename to accessors_l1_message * handle error * add range check * fix tests * update comments * nit * support blocks with 0 l1 messages --------- Co-authored-by: Max Wolff <maxcwolff@gmail.com> Co-authored-by: Max Wolff <max@scroll.io> * Fix L1Message Deep Copy, Complete Bridge Tx Hash test (#269) * deep copy value field, add tx hash test comment * typo * Rename nonce to queueindex, increment sender nonce on L1 message execution (#271) * change nonce to queueindex, increment nonce on L1 message * fix db acccessors * Update core/types/transaction_marshalling.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> --------- Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * Fix db inspect command (#276) fix db inspect command * Add l1 sync service (#256) * extend node configuration * add l1-message-type, transaction methods * goimports * Update core/types/transaction.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * use block number instead of hash * accept safe, finalized and numbers for L1Confirmations * add L1 message store to rawdb * remove comments * fix typos * add L1 message sync service * use l1 contract address and chain ID * use L1DeploymentBlock * add confirmation config * move bridge client to separate file * use uint64 block number * fix bigint comparison * rename constants * add more logs * rename to l1_message * rename variables and add comments * write l1 msgs in a batch * add more comments * update tests * allow batched and non-batched writes * rename to accessors_l1_message * handle error * check if config is provided * improve sync service DB batched writes * add range check * fix tests * update comments * nit * fix flush range and improve comments * solve circular dependency * update stress tests * initialize l1 client for geth * start sync service * add more comments * check nil correctly * address comments * fix merge * fix genesis l1config deserialization * add sync progress logs * initial sync * handle leveldb not found error * use errors.Is * address comments * update DefaultPollInterval --------- Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com> Co-authored-by: Max Wolff <maxcwolff@gmail.com> Co-authored-by: Max Wolff <max@scroll.io> * Add L1 message validation (#272) * add L1 message validation * add comments and better error handling * handle leveldb not found error * update incorrect condition for genesis block * typo * change inclusion index logic * disable L1 message check for legacy tests * set NumL1MessagesPerBlock to 0 in tests * update default genesis config * Add L1 msg validation tests (#303) add L1 msg validation tests * Update miner include l1 messages (#265) * add l1-message-type, transaction methods * goimports * Update core/types/transaction.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * add L1 message store to rawdb * add L1 message sync service * remove comments * use l1 contract address and chain ID * extend node configuration * use block number instead of hash * accept safe, finalized and numbers for L1Confirmations * fix typos * use L1DeploymentBlock * add confirmation config * move bridge client to separate file * use uint64 block number * fix bigint comparison * rename constants * add more logs * Fix/improve node config parsing (#260) * raise error on failed parsing * default value * rename to l1_message * rename variables and add comments * write l1 msgs in a batch * add more comments * update tests * allow batched and non-batched writes * rename to accessors_l1_message * handle error * check if config is provided * improve sync service DB batched writes * include l1 messages in blocks: part 1 * add l1-message-type, transaction methods (#252) * add l1-message-type, transaction methods * goimports * Update core/types/transaction.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * txpool l1 check, pointer change, marhsal test * draft: start implementing l1message gas behavior * draft: start implementing l1message gas behavior * change to gas usage * error comment typo Co-authored-by: Haichen Shen <shenhaichen@gmail.com> * goimports * update nonce, add hash test (fails), marshal test * goimports * target addr cant be nil * change call msg * comment out test * lint --------- Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> Co-authored-by: Haichen Shen <shenhaichen@gmail.com> * Add L1 message database (#255) * add l1-message-type, transaction methods * goimports * Update core/types/transaction.go Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * add L1 message store to rawdb * remove comments * rename to l1_message * rename variables and add comments * write l1 msgs in a batch * add more comments * update tests * allow batched and non-batched writes * rename to accessors_l1_message * handle error * add range check * fix tests * update comments * nit * support blocks with 0 l1 messages --------- Co-authored-by: Max Wolff <maxcwolff@gmail.com> Co-authored-by: Max Wolff <max@scroll.io> * build(docker): auto docker push when pushing git tags (#258) * build(docker): update docker trigger tag prefix (#259) * Fix L1Message Deep Copy, Complete Bridge Tx Hash test (#269) * deep copy value field, add tx hash test comment * typo * commitl1messages * lint * Revert "add L1 message sync service" This reverts commit 5305e8a5de14766ed249e1a7d64042c7a72cf5c2. * Revert "move bridge client to separate file" This reverts commit 0b220bee37de93c3250545e23430db2c401a2f90. * update branch * use commitMessages for l1Txs * little fix * fix config * fix test * comment fixes * fix * fix config check --------- Co-authored-by: Max Wolff <maxcwolff@gmail.com> Co-authored-by: Max Wolff <max@scroll.io> Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io> Co-authored-by: Haichen Shen <shenhaichen@gmail.com> Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> * Add ErrUnknownAncestor tests (#305) add ErrUnknownAncestor tests * worker test include l1 msgs (#306) * worker test include l1 msgs * move L1 message index update next to block insertion --------- Co-authored-by: Péter Garamvölgyi <peter@scroll.io> * exclude l1 messages from transaction count limit in block (#307) * exclude l1 messages from transaction count limit in block * fix comments * trigger ci * nit --------- Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io> * Expose queueIndex on Transaction (#316) expose queueIndex on Transaction * test that l1msg doesn't count in maxTxPerBlock limit (#312) * test that l1msg doesn't count in maxTxPerBlock limit * fix, comment * retrigger ci * change order inside test --------- Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <th307q@gmail.com> * reuse trace nonce field for queueIndex * expose scroll APIs on the geth console * add L1 message query APIs * Trigger new block on new l1 messages (#343) * trigger new block on new l1 messages * typo * initialize l1MsgCh * fix worker l1msg tests (#345) --------- Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com> * test(worker): ensure that l1 messages are included in the correct order (#346) test that l1msgs added in correct order * rename enqueueIndex --> queueIndex * move QueueIndex into transaction * improve l1 db interface * formatting * bump version * print l1config * add API to query latest included message queue index * clean up tx limit logic * add clarifying comments and todos to ValidateL1Messages * improve db comments and logs * clean up L1MessageTx type handling * format * format * improve L1 message block check * fix missing L1 event handling * fix TestL1MessageValidationFailure * simplify sync height resume logic * make l1Config.l1MessageQueueAddress non-pointer * improve command line flags * remove todo * use abigen tools for log filtering * cache block L1 message count * nit: fix variable name case * improve logs * flush pending writes to DB before shutdown --------- Co-authored-by: Nazarii Denha <dengaaa2002@gmail.com> Co-authored-by: Max Wolff <max@scroll.io> Co-authored-by: Haichen Shen <shenhaichen@gmail.com> Co-authored-by: Max Wolff <maxcwolff@gmail.com> Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Co-authored-by: HAOYUatHZ <haoyu@protonmail.com>
885 lines
19 KiB
Go
885 lines
19 KiB
Go
// Copyright 2015 The go-ethereum Authors
|
|
// This file is part of the go-ethereum library.
|
|
//
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// package web3ext contains geth specific web3.js extensions.
|
|
package web3ext
|
|
|
|
var Modules = map[string]string{
|
|
"admin": AdminJs,
|
|
"clique": CliqueJs,
|
|
"ethash": EthashJs,
|
|
"debug": DebugJs,
|
|
"eth": EthJs,
|
|
"miner": MinerJs,
|
|
"net": NetJs,
|
|
"personal": PersonalJs,
|
|
"rpc": RpcJs,
|
|
"txpool": TxpoolJs,
|
|
"les": LESJs,
|
|
"vflux": VfluxJs,
|
|
"scroll": ScrollJs,
|
|
}
|
|
|
|
const CliqueJs = `
|
|
web3._extend({
|
|
property: 'clique',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'getSnapshot',
|
|
call: 'clique_getSnapshot',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSnapshotAtHash',
|
|
call: 'clique_getSnapshotAtHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSigners',
|
|
call: 'clique_getSigners',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSignersAtHash',
|
|
call: 'clique_getSignersAtHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'propose',
|
|
call: 'clique_propose',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'discard',
|
|
call: 'clique_discard',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'status',
|
|
call: 'clique_status',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSigner',
|
|
call: 'clique_getSigner',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'proposals',
|
|
getter: 'clique_proposals'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const EthashJs = `
|
|
web3._extend({
|
|
property: 'ethash',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'getWork',
|
|
call: 'ethash_getWork',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHashrate',
|
|
call: 'ethash_getHashrate',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'submitWork',
|
|
call: 'ethash_submitWork',
|
|
params: 3,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'submitHashrate',
|
|
call: 'ethash_submitHashrate',
|
|
params: 2,
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const AdminJs = `
|
|
web3._extend({
|
|
property: 'admin',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'addPeer',
|
|
call: 'admin_addPeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'removePeer',
|
|
call: 'admin_removePeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'addTrustedPeer',
|
|
call: 'admin_addTrustedPeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'removeTrustedPeer',
|
|
call: 'admin_removeTrustedPeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'exportChain',
|
|
call: 'admin_exportChain',
|
|
params: 3,
|
|
inputFormatter: [null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'importChain',
|
|
call: 'admin_importChain',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'sleepBlocks',
|
|
call: 'admin_sleepBlocks',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startHTTP',
|
|
call: 'admin_startHTTP',
|
|
params: 5,
|
|
inputFormatter: [null, null, null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopHTTP',
|
|
call: 'admin_stopHTTP'
|
|
}),
|
|
// This method is deprecated.
|
|
new web3._extend.Method({
|
|
name: 'startRPC',
|
|
call: 'admin_startRPC',
|
|
params: 5,
|
|
inputFormatter: [null, null, null, null, null]
|
|
}),
|
|
// This method is deprecated.
|
|
new web3._extend.Method({
|
|
name: 'stopRPC',
|
|
call: 'admin_stopRPC'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startWS',
|
|
call: 'admin_startWS',
|
|
params: 4,
|
|
inputFormatter: [null, null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopWS',
|
|
call: 'admin_stopWS'
|
|
}),
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'nodeInfo',
|
|
getter: 'admin_nodeInfo'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'peers',
|
|
getter: 'admin_peers'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'datadir',
|
|
getter: 'admin_datadir'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const DebugJs = `
|
|
web3._extend({
|
|
property: 'debug',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'accountRange',
|
|
call: 'debug_accountRange',
|
|
params: 6,
|
|
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'printBlock',
|
|
call: 'debug_printBlock',
|
|
params: 1,
|
|
outputFormatter: console.log
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHeaderRlp',
|
|
call: 'debug_getHeaderRlp',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBlockRlp',
|
|
call: 'debug_getBlockRlp',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'testSignCliqueBlock',
|
|
call: 'debug_testSignCliqueBlock',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setHead',
|
|
call: 'debug_setHead',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'seedHash',
|
|
call: 'debug_seedHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'dumpBlock',
|
|
call: 'debug_dumpBlock',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'chaindbProperty',
|
|
call: 'debug_chaindbProperty',
|
|
params: 1,
|
|
outputFormatter: console.log
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'chaindbCompact',
|
|
call: 'debug_chaindbCompact',
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'verbosity',
|
|
call: 'debug_verbosity',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'vmodule',
|
|
call: 'debug_vmodule',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'backtraceAt',
|
|
call: 'debug_backtraceAt',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stacks',
|
|
call: 'debug_stacks',
|
|
params: 1,
|
|
inputFormatter: [null],
|
|
outputFormatter: console.log
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'freeOSMemory',
|
|
call: 'debug_freeOSMemory',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setGCPercent',
|
|
call: 'debug_setGCPercent',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'memStats',
|
|
call: 'debug_memStats',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'gcStats',
|
|
call: 'debug_gcStats',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'cpuProfile',
|
|
call: 'debug_cpuProfile',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startCPUProfile',
|
|
call: 'debug_startCPUProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopCPUProfile',
|
|
call: 'debug_stopCPUProfile',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'goTrace',
|
|
call: 'debug_goTrace',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startGoTrace',
|
|
call: 'debug_startGoTrace',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopGoTrace',
|
|
call: 'debug_stopGoTrace',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'blockProfile',
|
|
call: 'debug_blockProfile',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setBlockProfileRate',
|
|
call: 'debug_setBlockProfileRate',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'writeBlockProfile',
|
|
call: 'debug_writeBlockProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'mutexProfile',
|
|
call: 'debug_mutexProfile',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setMutexProfileFraction',
|
|
call: 'debug_setMutexProfileFraction',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'writeMutexProfile',
|
|
call: 'debug_writeMutexProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'writeMemProfile',
|
|
call: 'debug_writeMemProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlock',
|
|
call: 'debug_traceBlock',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlockFromFile',
|
|
call: 'debug_traceBlockFromFile',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBadBlock',
|
|
call: 'debug_traceBadBlock',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'standardTraceBadBlockToFile',
|
|
call: 'debug_standardTraceBadBlockToFile',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'intermediateRoots',
|
|
call: 'debug_intermediateRoots',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'standardTraceBlockToFile',
|
|
call: 'debug_standardTraceBlockToFile',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlockByNumber',
|
|
call: 'debug_traceBlockByNumber',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlockByHash',
|
|
call: 'debug_traceBlockByHash',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceTransaction',
|
|
call: 'debug_traceTransaction',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceCall',
|
|
call: 'debug_traceCall',
|
|
params: 3,
|
|
inputFormatter: [null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'preimage',
|
|
call: 'debug_preimage',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBadBlocks',
|
|
call: 'debug_getBadBlocks',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'storageRangeAt',
|
|
call: 'debug_storageRangeAt',
|
|
params: 5,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getModifiedAccountsByNumber',
|
|
call: 'debug_getModifiedAccountsByNumber',
|
|
params: 2,
|
|
inputFormatter: [null, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getModifiedAccountsByHash',
|
|
call: 'debug_getModifiedAccountsByHash',
|
|
params: 2,
|
|
inputFormatter:[null, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'freezeClient',
|
|
call: 'debug_freezeClient',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getAccessibleState',
|
|
call: 'debug_getAccessibleState',
|
|
params: 2,
|
|
inputFormatter:[web3._extend.formatters.inputBlockNumberFormatter, web3._extend.formatters.inputBlockNumberFormatter],
|
|
}),
|
|
],
|
|
properties: []
|
|
});
|
|
`
|
|
|
|
const EthJs = `
|
|
web3._extend({
|
|
property: 'eth',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'chainId',
|
|
call: 'eth_chainId',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'sign',
|
|
call: 'eth_sign',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'resend',
|
|
call: 'eth_resend',
|
|
params: 3,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'signTransaction',
|
|
call: 'eth_signTransaction',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'estimateGas',
|
|
call: 'eth_estimateGas',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
|
|
outputFormatter: web3._extend.utils.toDecimal
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'submitTransaction',
|
|
call: 'eth_submitTransaction',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'fillTransaction',
|
|
call: 'eth_fillTransaction',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHeaderByNumber',
|
|
call: 'eth_getHeaderByNumber',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHeaderByHash',
|
|
call: 'eth_getHeaderByHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBlockByNumber',
|
|
call: 'eth_getBlockByNumber',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBlockByHash',
|
|
call: 'eth_getBlockByHash',
|
|
params: 2,
|
|
inputFormatter: [null, function (val) { return !!val; }]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawTransaction',
|
|
call: 'eth_getRawTransactionByHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawTransactionFromBlock',
|
|
call: function(args) {
|
|
return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
|
|
},
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getProof',
|
|
call: 'eth_getProof',
|
|
params: 3,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'createAccessList',
|
|
call: 'eth_createAccessList',
|
|
params: 2,
|
|
inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'feeHistory',
|
|
call: 'eth_feeHistory',
|
|
params: 3,
|
|
inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter, null]
|
|
}),
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'pendingTransactions',
|
|
getter: 'eth_pendingTransactions',
|
|
outputFormatter: function(txs) {
|
|
var formatted = [];
|
|
for (var i = 0; i < txs.length; i++) {
|
|
formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
|
|
formatted[i].blockHash = null;
|
|
}
|
|
return formatted;
|
|
}
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'maxPriorityFeePerGas',
|
|
getter: 'eth_maxPriorityFeePerGas',
|
|
outputFormatter: web3._extend.utils.toBigNumber
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const MinerJs = `
|
|
web3._extend({
|
|
property: 'miner',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'start',
|
|
call: 'miner_start',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stop',
|
|
call: 'miner_stop'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setEtherbase',
|
|
call: 'miner_setEtherbase',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setExtra',
|
|
call: 'miner_setExtra',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setGasPrice',
|
|
call: 'miner_setGasPrice',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.utils.fromDecimal]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setGasLimit',
|
|
call: 'miner_setGasLimit',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.utils.fromDecimal]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setRecommitInterval',
|
|
call: 'miner_setRecommitInterval',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHashrate',
|
|
call: 'miner_getHashrate'
|
|
}),
|
|
],
|
|
properties: []
|
|
});
|
|
`
|
|
|
|
const NetJs = `
|
|
web3._extend({
|
|
property: 'net',
|
|
methods: [],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'version',
|
|
getter: 'net_version'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const PersonalJs = `
|
|
web3._extend({
|
|
property: 'personal',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'importRawKey',
|
|
call: 'personal_importRawKey',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'sign',
|
|
call: 'personal_sign',
|
|
params: 3,
|
|
inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'ecRecover',
|
|
call: 'personal_ecRecover',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'openWallet',
|
|
call: 'personal_openWallet',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'deriveAccount',
|
|
call: 'personal_deriveAccount',
|
|
params: 3
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'signTransaction',
|
|
call: 'personal_signTransaction',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'unpair',
|
|
call: 'personal_unpair',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'initializeWallet',
|
|
call: 'personal_initializeWallet',
|
|
params: 1
|
|
})
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'listWallets',
|
|
getter: 'personal_listWallets'
|
|
}),
|
|
]
|
|
})
|
|
`
|
|
|
|
const RpcJs = `
|
|
web3._extend({
|
|
property: 'rpc',
|
|
methods: [],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'modules',
|
|
getter: 'rpc_modules'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const TxpoolJs = `
|
|
web3._extend({
|
|
property: 'txpool',
|
|
methods: [],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'content',
|
|
getter: 'txpool_content'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'inspect',
|
|
getter: 'txpool_inspect'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'status',
|
|
getter: 'txpool_status',
|
|
outputFormatter: function(status) {
|
|
status.pending = web3._extend.utils.toDecimal(status.pending);
|
|
status.queued = web3._extend.utils.toDecimal(status.queued);
|
|
return status;
|
|
}
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'contentFrom',
|
|
call: 'txpool_contentFrom',
|
|
params: 1,
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const LESJs = `
|
|
web3._extend({
|
|
property: 'les',
|
|
methods:
|
|
[
|
|
new web3._extend.Method({
|
|
name: 'getCheckpoint',
|
|
call: 'les_getCheckpoint',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'clientInfo',
|
|
call: 'les_clientInfo',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'priorityClientInfo',
|
|
call: 'les_priorityClientInfo',
|
|
params: 3
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setClientParams',
|
|
call: 'les_setClientParams',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setDefaultParams',
|
|
call: 'les_setDefaultParams',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'addBalance',
|
|
call: 'les_addBalance',
|
|
params: 2
|
|
}),
|
|
],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'latestCheckpoint',
|
|
getter: 'les_latestCheckpoint'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'checkpointContractAddress',
|
|
getter: 'les_getCheckpointContractAddress'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'serverInfo',
|
|
getter: 'les_serverInfo'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const VfluxJs = `
|
|
web3._extend({
|
|
property: 'vflux',
|
|
methods:
|
|
[
|
|
new web3._extend.Method({
|
|
name: 'distribution',
|
|
call: 'vflux_distribution',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'timeout',
|
|
call: 'vflux_timeout',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'value',
|
|
call: 'vflux_value',
|
|
params: 2
|
|
}),
|
|
],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'requestStats',
|
|
getter: 'vflux_requestStats'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const ScrollJs = `
|
|
web3._extend({
|
|
property: 'scroll',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'getBlockTraceByNumberOrHash',
|
|
call: 'scroll_getBlockTraceByNumberOrHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getL1MessageByIndex',
|
|
call: 'scroll_getL1MessageByIndex',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getFirstQueueIndexNotInL2Block',
|
|
call: 'scroll_getFirstQueueIndexNotInL2Block',
|
|
params: 1
|
|
})
|
|
],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'l1SyncHeight',
|
|
getter: 'scroll_getL1SyncHeight'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'latestRelayedQueueIndex',
|
|
getter: 'scroll_getLatestRelayedQueueIndex'
|
|
})
|
|
]
|
|
});
|
|
`
|