code.vegaprotocol.io/vega@v0.79.0/core/nodewallets/eth/wallet.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package eth 17 18 import ( 19 "code.vegaprotocol.io/vega/core/nodewallets/registry" 20 "code.vegaprotocol.io/vega/libs/crypto" 21 ) 22 23 //go:generate go run github.com/golang/mock/mockgen -destination mocks/mocks.go -package mocks code.vegaprotocol.io/vega/core/nodewallets/eth EthereumWallet 24 type EthereumWallet interface { 25 Cleanup() error 26 Name() string 27 Chain() string 28 Sign(data []byte) ([]byte, error) 29 Algo() string 30 Version() (string, error) 31 PubKey() crypto.PublicKey 32 Reload(details registry.EthereumWalletDetails) error 33 } 34 35 type Wallet struct { 36 w EthereumWallet 37 } 38 39 func NewWallet(w EthereumWallet) *Wallet { 40 return &Wallet{w} 41 } 42 43 func (w *Wallet) Cleanup() error { 44 return w.w.Cleanup() 45 } 46 47 func (w *Wallet) Name() string { 48 return w.w.Name() 49 } 50 51 func (w *Wallet) Chain() string { 52 return w.w.Chain() 53 } 54 55 func (w *Wallet) Sign(data []byte) ([]byte, error) { 56 return w.w.Sign(data) 57 } 58 59 func (w *Wallet) Algo() string { 60 return w.w.Algo() 61 } 62 63 func (w *Wallet) Version() (string, error) { 64 return w.w.Version() 65 } 66 67 func (w *Wallet) PubKey() crypto.PublicKey { 68 return w.w.PubKey() 69 } 70 71 func (w *Wallet) Reload(details registry.EthereumWalletDetails) error { 72 return w.w.Reload(details) 73 }