Skip to content

Commit

Permalink
Merge pull request #129 from TrueBlocks/develop
Browse files Browse the repository at this point in the history
Updates go.mod
  • Loading branch information
tjayrush authored Sep 24, 2024
2 parents 6f9ded5 + c84d7e7 commit cf6685b
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 9 deletions.
5 changes: 5 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger"
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output"
coreTypes "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types"
sdk "github.com/TrueBlocks/trueblocks-sdk/v3"
"github.com/joho/godotenv"
"github.com/wailsapp/wails/v2/pkg/runtime"
)
Expand All @@ -37,6 +38,7 @@ type App struct {
historyMap map[base.Address]types.HistoryContainer
balanceMap sync.Map
meta coreTypes.MetaData
globals sdk.Globals

// Summaries
abis types.AbiContainer
Expand All @@ -60,6 +62,9 @@ func NewApp() *App {
historyMap: make(map[base.Address]types.HistoryContainer),
Documents: make([]types.Document, 10),
}
a.globals = sdk.Globals{
Chain: "mainnet",
}
a.monitors.MonitorMap = make(map[base.Address]coreTypes.Monitor)
a.names.NamesMap = make(map[base.Address]coreTypes.Name)
a.CurrentDoc = &a.Documents[0]
Expand Down
4 changes: 3 additions & 1 deletion app/data_abis.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ func (a *App) loadAbis(wg *sync.WaitGroup, errorChan chan error) error {
return nil
}

opts := sdk.AbisOptions{}
opts := sdk.AbisOptions{
Globals: a.globals,
}
if count, meta, err := opts.AbisCount(); err != nil {
if errorChan != nil {
errorChan <- err
Expand Down
4 changes: 3 additions & 1 deletion app/data_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (a *App) HistoryPage(addr string, first, pageSize int) types.HistoryContain
Globals: sdk.Globals{
Cache: true,
Ether: true,
Chain: a.globals.Chain,
},
}

Expand Down Expand Up @@ -165,7 +166,8 @@ func (a *App) getHistoryCnt(addr string) int {
}

opts := sdk.ListOptions{
Addrs: []string{addr},
Addrs: []string{addr},
Globals: a.globals,
}
appearances, meta, err := opts.ListCount()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions app/data_indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (a *App) loadIndex(wg *sync.WaitGroup, errorChan chan error) error {
opts := sdk.ChunksOptions{
Globals: sdk.Globals{
Verbose: true,
Chain: a.globals.Chain,
},
}
if chunks, meta, err := opts.ChunksStats(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions app/data_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (a *App) loadManifest(wg *sync.WaitGroup, errorChan chan error) error {
opts := sdk.ChunksOptions{
Globals: sdk.Globals{
Verbose: true,
Chain: a.globals.Chain,
},
}
if manifests, meta, err := opts.ChunksManifest(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions app/data_monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (a *App) loadMonitors(wg *sync.WaitGroup, errorChan chan error) error {
Staged: true,
Globals: sdk.Globals{
Verbose: true,
Chain: a.globals.Chain,
},
}
if monitors, meta, err := opts.MonitorsList(); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions app/data_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ func (a *App) loadNames(wg *sync.WaitGroup, errorChan chan error) error {
messages.SendInfo(a.ctx, "Reloading names")
names.ClearCustomNames()

chain := "mainnet"
parts := coreTypes.Regular | coreTypes.Custom | coreTypes.Prefund | coreTypes.Baddress
if namesMap, err := names.LoadNamesMap(chain, parts, nil); err != nil {
if namesMap, err := names.LoadNamesMap(a.globals.Chain, parts, nil); err != nil {
if errorChan != nil {
errorChan <- err
}
Expand Down Expand Up @@ -115,7 +114,9 @@ func (a *App) ModifyName(op string, address base.Address) error {
messages.SendInfo(a.ctx, fmt.Sprintf("%s-%v", opFromString(op), *cd))

if _, ok := a.names.NamesMap[address]; ok {
opts := sdk.NamesOptions{}
opts := sdk.NamesOptions{
Globals: a.globals,
}
if _, _, err := opts.ModifyName(opFromString(op), cd); err != nil {
messages.SendError(a.ctx, err)
return err
Expand Down
4 changes: 3 additions & 1 deletion app/data_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ func (a *App) loadStatus(wg *sync.WaitGroup, errorChan chan error) error {
logger.SetLoggerWriter(io.Discard)
defer logger.SetLoggerWriter(w)

opts := sdk.StatusOptions{}
opts := sdk.StatusOptions{
Globals: a.globals,
}
if statusArray, meta, err := opts.StatusAll(); err != nil {
if errorChan != nil {
errorChan <- err
Expand Down
3 changes: 2 additions & 1 deletion app/util_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func (a *App) ConvertToAddress(addr string) (base.Address, bool) {

// Try to get an ENS or return the same input
opts := sdk.NamesOptions{
Terms: []string{addr},
Terms: []string{addr},
Globals: a.globals,
}
if names, meta, err := opts.Names(); err != nil {
messages.Send(a.ctx, messages.Error, messages.NewErrorMsg(err))
Expand Down
1 change: 1 addition & 0 deletions app/util_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func (a *App) getBalance(address base.Address) string {
Globals: sdk.Globals{
Ether: true,
Cache: true,
Chain: a.globals.Chain,
},
}
if balances, meta, err := opts.State(); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ replace (
)

require (
github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240906195947-7a9af20ce595
github.com/TrueBlocks/trueblocks-sdk/v3 v3.3.2
github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240923025630-c4c09cafc138
github.com/TrueBlocks/trueblocks-sdk/v3 v3.5.0
github.com/joho/godotenv v1.5.1
github.com/wailsapp/wails/v2 v2.8.2
)
Expand Down

0 comments on commit cf6685b

Please sign in to comment.