(path string)
| 104 | } |
| 105 | |
| 106 | func NewClientImpl(path string) (*ClientImpl, error) { |
| 107 | cli := &ClientImpl{ |
| 108 | path: path, |
| 109 | accAddrs: make(map[string]*AccountData), |
| 110 | accLabels: make(map[string]*AccountData), |
| 111 | unlockAccs: make(map[string]*unlockAccountInfo), |
| 112 | walletData: NewWalletData(), |
| 113 | } |
| 114 | if common.FileExisted(path) { |
| 115 | err := cli.load() |
| 116 | if err != nil { |
| 117 | return nil, err |
| 118 | } |
| 119 | } |
| 120 | return cli, nil |
| 121 | } |
| 122 | |
| 123 | func (this *ClientImpl) load() error { |
| 124 | err := this.walletData.Load(this.path) |