/
merchant.go
78 lines (62 loc) · 2.17 KB
/
merchant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright 2018 The openwallet Authors
* This file is part of the openwallet library.
*
* The openwallet 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 openwallet 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.
*/
package bytom
import (
"github.com/nbit99/openwallet/v2/common/file"
"github.com/nbit99/openwallet/v2/openwallet"
"path/filepath"
)
//CreateMerchantWallet 创建钱包
func (w *WalletManager) CreateMerchantWallet(alias string, password string) (*openwallet.Wallet, error) {
wallet, err := CreateNewWallet(alias, password)
if err != nil {
return nil, err
}
//创建钱包第一个账户
account, err := CreateNormalAccount(wallet.PublicKey, alias)
if err != nil {
return nil, err
}
//创建钱包资源文件夹
walletDataFolder := filepath.Join(dbPath, account.FileName()+".db")
file.MkdirAll(walletDataFolder)
owWallet := openwallet.Wallet{
Alias: account.Alias,
RootPub: wallet.PublicKey,
DBFile: walletDataFolder,
}
return &owWallet, nil
}
//GetMerchantWalletList 获取钱包列表
func (w *WalletManager) GetMerchantWalletList() ([]*openwallet.Wallet, error) {
return nil, nil
}
//ConfigMerchantWallet 钱包工具配置接口
func (w *WalletManager) ConfigMerchantWallet(wallet *openwallet.Wallet) error {
return nil
}
//ImportMerchantAddress 导入地址
func (w *WalletManager) ImportMerchantAddress(addresses []*openwallet.Address) error {
//写入到数据库中
return nil
}
//CreateMerchantAddress 创建钱包地址
func (w *WalletManager) CreateMerchantAddress(walletID string, count int) ([]*openwallet.Address, error) {
return nil, nil
}
//GetMerchantAddressList 获取钱包地址
func (w *WalletManager) GetMerchantAddressList(walletID string, offset uint64, limit uint64) ([]*openwallet.Address, error) {
return nil, nil
}