WIP refactor models usage

This commit is contained in:
lash
2024-10-31 01:28:37 +00:00
parent 4e81e2d869
commit 1e638238ed
10 changed files with 229 additions and 176 deletions

View File

@@ -1,10 +1,6 @@
package models
type AccountResponse struct {
Ok bool `json:"ok"`
Description string `json:"description"` // Include the description field
Result struct {
PublicKey string `json:"publicKey"`
TrackingId string `json:"trackingId"`
} `json:"result"`
type AccountResult struct {
PublicKey string `json:"publicKey"`
TrackingId string `json:"trackingId"`
}

View File

@@ -3,10 +3,15 @@ package models
import "encoding/json"
type BalanceResponse struct {
Ok bool `json:"ok"`
Result struct {
Balance string `json:"balance"`
Nonce json.Number `json:"nonce"`
} `json:"result"`
//type BalanceResponse struct {
// Ok bool `json:"ok"`
// Result struct {
// Balance string `json:"balance"`
// Nonce json.Number `json:"nonce"`
// } `json:"result"`
//}
//
type BalanceResult struct {
Balance string `json:"balance"`
Nonce json.Number `json:"nonce"`
}

View File

@@ -4,23 +4,18 @@ import (
"encoding/json"
"time"
)
type Transaction struct {
//type Transaction struct {
// CreatedAt time.Time `json:"createdAt"`
// Status string `json:"status"`
// TransferValue json.Number `json:"transferValue"`
// TxHash string `json:"txHash"`
// TxType string `json:"txType"`
//}
type TrackStatusResult struct {
CreatedAt time.Time `json:"createdAt"`
Status string `json:"status"`
TransferValue json.Number `json:"transferValue"`
TxHash string `json:"txHash"`
TxType string `json:"txType"`
}
type TrackStatusResponse struct {
Ok bool `json:"ok"`
Result struct {
Transaction struct {
CreatedAt time.Time `json:"createdAt"`
Status string `json:"status"`
TransferValue json.Number `json:"transferValue"`
TxHash string `json:"txHash"`
TxType string `json:"txType"`
}
} `json:"result"`
}

View File

@@ -1,14 +1 @@
package models
import dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
type VoucherHoldingResponse struct {
Ok bool `json:"ok"`
Description string `json:"description"`
Result VoucherResult `json:"result"`
}
// VoucherResult holds the list of token holdings
type VoucherResult struct {
Holdings []dataserviceapi.TokenHoldings `json:"holdings"`
}