mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-19 05:04:21 +01:00
Add admin APIs to manage wallet (#226)
* Add admin rpcs to manage wallet * Fix * Fixes * Add sleeping time * Increase sleeping time
This commit is contained in:
committed by
GitHub
parent
fb8a127f4f
commit
1c67c56d9d
@@ -12,7 +12,36 @@ type mockedWallet struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// BroadcastTransaction implements ports.WalletService.
|
||||
func (m *mockedWallet) GenSeed(ctx context.Context) (string, error) {
|
||||
args := m.Called(ctx)
|
||||
|
||||
var res string
|
||||
if a := args.Get(0); a != nil {
|
||||
res = a.(string)
|
||||
}
|
||||
return res, args.Error(1)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) Create(ctx context.Context, seed, password string) error {
|
||||
args := m.Called(ctx, seed, password)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) Restore(ctx context.Context, seed, password string) error {
|
||||
args := m.Called(ctx, seed, password)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) Unlock(ctx context.Context, password string) error {
|
||||
args := m.Called(ctx, password)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) Lock(ctx context.Context, password string) error {
|
||||
args := m.Called(ctx, password)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) BroadcastTransaction(ctx context.Context, txHex string) (string, error) {
|
||||
args := m.Called(ctx, txHex)
|
||||
|
||||
@@ -23,12 +52,10 @@ func (m *mockedWallet) BroadcastTransaction(ctx context.Context, txHex string) (
|
||||
return res, args.Error(1)
|
||||
}
|
||||
|
||||
// Close implements ports.WalletService.
|
||||
func (m *mockedWallet) Close() {
|
||||
m.Called()
|
||||
}
|
||||
|
||||
// DeriveAddresses implements ports.WalletService.
|
||||
func (m *mockedWallet) DeriveAddresses(ctx context.Context, num int) ([]string, error) {
|
||||
args := m.Called(ctx, num)
|
||||
|
||||
@@ -39,7 +66,6 @@ func (m *mockedWallet) DeriveAddresses(ctx context.Context, num int) ([]string,
|
||||
return res, args.Error(1)
|
||||
}
|
||||
|
||||
// DeriveConnectorAddress implements ports.WalletService.
|
||||
func (m *mockedWallet) DeriveConnectorAddress(ctx context.Context) (string, error) {
|
||||
args := m.Called(ctx)
|
||||
|
||||
@@ -50,7 +76,6 @@ func (m *mockedWallet) DeriveConnectorAddress(ctx context.Context) (string, erro
|
||||
return res, args.Error(1)
|
||||
}
|
||||
|
||||
// GetPubkey implements ports.WalletService.
|
||||
func (m *mockedWallet) GetPubkey(ctx context.Context) (*secp256k1.PublicKey, error) {
|
||||
args := m.Called(ctx)
|
||||
|
||||
@@ -61,7 +86,6 @@ func (m *mockedWallet) GetPubkey(ctx context.Context) (*secp256k1.PublicKey, err
|
||||
return res, args.Error(1)
|
||||
}
|
||||
|
||||
// SignTransaction implements ports.WalletService.
|
||||
func (m *mockedWallet) SignTransaction(ctx context.Context, pset string, extractRawTx bool) (string, error) {
|
||||
args := m.Called(ctx, pset, extractRawTx)
|
||||
|
||||
@@ -72,7 +96,6 @@ func (m *mockedWallet) SignTransaction(ctx context.Context, pset string, extract
|
||||
return res, args.Error(1)
|
||||
}
|
||||
|
||||
// Status implements ports.WalletService.
|
||||
func (m *mockedWallet) Status(ctx context.Context) (ports.WalletStatus, error) {
|
||||
args := m.Called(ctx)
|
||||
|
||||
@@ -179,11 +202,31 @@ func (m *mockedWallet) WaitForSync(ctx context.Context, txid string) error {
|
||||
}
|
||||
|
||||
func (m *mockedWallet) ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
panic("not implemented")
|
||||
args := m.Called(ctx)
|
||||
|
||||
var res uint64
|
||||
if a := args.Get(0); a != nil {
|
||||
res = a.(uint64)
|
||||
}
|
||||
var res2 uint64
|
||||
if a := args.Get(1); a != nil {
|
||||
res2 = a.(uint64)
|
||||
}
|
||||
return res, res2, args.Error(2)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) MainAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
panic("not implemented")
|
||||
args := m.Called(ctx)
|
||||
|
||||
var res uint64
|
||||
if a := args.Get(0); a != nil {
|
||||
res = a.(uint64)
|
||||
}
|
||||
var res2 uint64
|
||||
if a := args.Get(1); a != nil {
|
||||
res2 = a.(uint64)
|
||||
}
|
||||
return res, res2, args.Error(2)
|
||||
}
|
||||
|
||||
type mockedInput struct {
|
||||
|
||||
Reference in New Issue
Block a user