Skip to content

Commit

Permalink
Return all addresses in ListAddresses & Fix Transfer rpc (#27)
Browse files Browse the repository at this point in the history
* Return also internal addresses in ListAddresses rpc

* Fix bcScanner GetUtxos

* Update Input type & fix Transfer rpc

* Fix test
  • Loading branch information
altafan authored Nov 11, 2022
1 parent 7566221 commit 8576dc5
Show file tree
Hide file tree
Showing 13 changed files with 429 additions and 278 deletions.
258 changes: 146 additions & 112 deletions api-spec/protobuf/gen/go/ocean/v1/types.pb.go

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions api-spec/protobuf/gen/python/ocean/v1/types_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api-spec/protobuf/ocean/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ message Input {
string txid = 1;
// Previous tx output index.
uint32 index = 2;
// Prevout script.
string script = 3;
// Input scriptsig size.
uint64 scriptsig_size = 4;
// Input witness size.
uint64 witness_size = 5;
}

message UnblindedInput {
Expand Down
5 changes: 1 addition & 4 deletions internal/core/application/account_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (as *AccountService) ListAddressesForAccount(
return nil, err
}

addressesInfo, err := w.AllDerivedExternalAddressesForAccount(accountName)
addressesInfo, err := w.AllDerivedAddressesForAccount(accountName)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -198,9 +198,6 @@ func (as *AccountService) registerHandlerForWalletEvents() {
as.repoManager.RegisterHandlerForWalletEvent(
domain.WalletUnlocked, func(event domain.WalletEvent) {
w, _ := as.repoManager.WalletRepository().GetWallet(context.Background())
for key, acc := range w.AccountsByKey {
fmt.Printf("%s %+v\n", key, acc)
}

for accountName := range w.AccountKeysByName {
accountKey := w.AccountKeysByName[accountName]
Expand Down
2 changes: 1 addition & 1 deletion internal/core/application/account_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestAccountService(t *testing.T) {

addresses, err = svc.ListAddressesForAccount(ctx, accountName)
require.NoError(t, err)
require.Len(t, addresses, 2)
require.GreaterOrEqual(t, len(addresses), 2)

utxos, err := svc.ListUtxosForAccount(ctx, accountName)
require.NoError(t, err)
Expand Down
8 changes: 2 additions & 6 deletions internal/core/application/mocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func (m *mockBcScanner) GetBlockHeight(hash []byte) (uint32, error) {
return res, args.Error(1)
}

func (m *mockBcScanner) GetUtxos(utxoKeys []domain.UtxoKey) ([]*domain.Utxo, error) {
args := m.Called(utxoKeys)
func (m *mockBcScanner) GetUtxos(utxos []domain.Utxo) ([]*domain.Utxo, error) {
args := m.Called(utxos)
var res []*domain.Utxo
if a := args.Get(0); a != nil {
res = a.([]*domain.Utxo)
Expand Down Expand Up @@ -249,10 +249,6 @@ func randomIntInRange(min, max int) int {
return int(int(n.Int64())) + min
}

func b2h(buf []byte) string {
return hex.EncodeToString(buf)
}

func h2b(str string) []byte {
buf, _ := hex.DecodeString(str)
return buf
Expand Down
Loading

0 comments on commit 8576dc5

Please sign in to comment.