mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 06:36:32 +00:00
4c6ca00520
* feat(connector)_: impl `eth_requestAccounts` for browser plugin * feat(connector)_: add impl for `wallet_switchEthereumChain` and `eth_chainId` * feat(connector)_: add impl for `eth_sendTransaction` * feat(connector)_: add a signal and an endpoint for wallet ui side * chore_: refactor connector tests * feat(connector)_: impl `eth_requestAccounts` with signal * chore(connector)_: Add test, covering full transaction flow And polish impl & test for connector endpoints * fix(connector)_: temporary allow all origins for ws connection * chore_: review fixes * fix(connector)_: make user select chain id for dApp * fix(connector)_: add requestID and fine tune endpoints * chore(connector)_: naming fixes and tests improvments
23 lines
550 B
Go
23 lines
550 B
Go
package connector
|
|
|
|
import "github.com/status-im/status-go/services/connector/commands"
|
|
|
|
type CommandRegistry struct {
|
|
commands map[string]commands.RPCCommand
|
|
}
|
|
|
|
func NewCommandRegistry() *CommandRegistry {
|
|
return &CommandRegistry{
|
|
commands: make(map[string]commands.RPCCommand),
|
|
}
|
|
}
|
|
|
|
func (r *CommandRegistry) Register(method string, command commands.RPCCommand) {
|
|
r.commands[method] = command
|
|
}
|
|
|
|
func (r *CommandRegistry) GetCommand(method string) (commands.RPCCommand, bool) {
|
|
command, exists := r.commands[method]
|
|
return command, exists
|
|
}
|