This commit is contained in:
lash 2025-01-21 15:30:22 +00:00
parent e0b5398098
commit ee574908d4
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 25 additions and 28 deletions

View File

@ -71,4 +71,3 @@ func LoadConfig() error {
CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix) CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix)
return nil return nil
} }

View File

@ -8,12 +8,12 @@ import (
const ( const (
// TODO: integrate with sarafu-vise-events // TODO: integrate with sarafu-vise-events
EventTokenTransferTag = "TOKEN_TRANSFER" EventTokenTransferTag = "TOKEN_TRANSFER"
EventTokenMintTag = "TOKEN_MINT" EventTokenMintTag = "TOKEN_MINT"
EventRegistrationTag = "CUSTODIAL_REGISTRATION" EventRegistrationTag = "CUSTODIAL_REGISTRATION"
) )
type Msg struct { type Msg struct {
Typ string Typ string
Item any Item any
} }
@ -26,17 +26,17 @@ type EventCustodialRegistration struct {
// fields used for handling token transfer event. // fields used for handling token transfer event.
type EventTokenTransfer struct { type EventTokenTransfer struct {
To string To string
Value int Value int
VoucherAddress string VoucherAddress string
TxHash string TxHash string
From string From string
} }
type EventTokenMint struct { type EventTokenMint struct {
To string To string
Value int Value int
TxHash string TxHash string
VoucherAddress string VoucherAddress string
} }

View File

@ -4,8 +4,8 @@ import (
"context" "context"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
"git.grassecon.net/grassrootseconomics/sarafu-api/models" "git.grassecon.net/grassrootseconomics/sarafu-api/models"
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
) )
var ( var (
@ -14,52 +14,50 @@ var (
const ( const (
AliceChecksum = "0xeae046BF396e91f5A8D74f863dC57c107c8a4a70" AliceChecksum = "0xeae046BF396e91f5A8D74f863dC57c107c8a4a70"
BobChecksum = "0xB3117202371853e24B725d4169D87616A7dDb127" BobChecksum = "0xB3117202371853e24B725d4169D87616A7dDb127"
AliceSession = "5553425" AliceSession = "5553425"
) )
type MockApi struct { type MockApi struct {
TransactionsContent []dataserviceapi.Last10TxResponse TransactionsContent []dataserviceapi.Last10TxResponse
VouchersContent []dataserviceapi.TokenHoldings VouchersContent []dataserviceapi.TokenHoldings
VoucherDataContent *models.VoucherDataResult VoucherDataContent *models.VoucherDataResult
} }
func(m MockApi) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error) { func (m MockApi) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error) {
return nil, nil return nil, nil
} }
func(m MockApi) CreateAccount(ctx context.Context) (*models.AccountResult, error) { func (m MockApi) CreateAccount(ctx context.Context) (*models.AccountResult, error) {
return nil, nil return nil, nil
} }
func(m MockApi) TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error) { func (m MockApi) TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error) {
return nil, nil return nil, nil
} }
func(m MockApi) FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error) { func (m MockApi) FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error) {
logg.DebugCtxf(ctx, "mockapi fetchvouchers", "key", publicKey) logg.DebugCtxf(ctx, "mockapi fetchvouchers", "key", publicKey)
return m.VouchersContent, nil return m.VouchersContent, nil
} }
func(m MockApi) FetchTransactions(ctx context.Context, publicKey string) ([]dataserviceapi.Last10TxResponse, error) { func (m MockApi) FetchTransactions(ctx context.Context, publicKey string) ([]dataserviceapi.Last10TxResponse, error) {
logg.DebugCtxf(ctx, "mockapi fetchtransactions", "key", publicKey) logg.DebugCtxf(ctx, "mockapi fetchtransactions", "key", publicKey)
return m.TransactionsContent, nil return m.TransactionsContent, nil
} }
func(m MockApi) VoucherData(ctx context.Context, address string) (*models.VoucherDataResult, error) { func (m MockApi) VoucherData(ctx context.Context, address string) (*models.VoucherDataResult, error) {
return m.VoucherDataContent, nil return m.VoucherDataContent, nil
} }
func(m MockApi) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) { func (m MockApi) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) {
return nil, nil return nil, nil
} }
func(m MockApi) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { func (m MockApi) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) {
return nil, nil return nil, nil
} }
func(m MockApi) TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) { func (m MockApi) TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) {
return nil, nil return nil, nil
} }

View File

@ -53,7 +53,7 @@ func (m *MockAccountService) CheckAliasAddress(ctx context.Context, alias string
return args.Get(0).(*models.AliasAddress), args.Error(1) return args.Get(0).(*models.AliasAddress), args.Error(1)
} }
func(m MockAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { func (m MockAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) {
args := m.Called(publicKey, hint) args := m.Called(publicKey, hint)
return args.Get(0).(*models.RequestAliasResult), args.Error(1) return args.Get(0).(*models.RequestAliasResult), args.Error(1)
} }