Skip to content

Commit

Permalink
An attempt at for-each
Browse files Browse the repository at this point in the history
  • Loading branch information
tjayrush committed Jun 28, 2024
1 parent 44c8e05 commit c18b87c
Show file tree
Hide file tree
Showing 9 changed files with 715 additions and 173 deletions.
4 changes: 4 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file"
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger"
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names"
"github.com/joho/godotenv"
)

Expand All @@ -27,6 +28,9 @@ type App struct {
}

func NewApp() *App {
// preload the names map
_, _ = names.LoadNamesMap("mainnet", names.Regular|names.Custom|names.Prefund, []string{})

app := App{
databases: make(map[string][]string),
}
Expand Down
24 changes: 14 additions & 10 deletions dalledress.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"strings"
"text/template"

"github.com/TrueBlocks/trueblocks-core/sdk"
)

type DalleDress struct {
Expand All @@ -29,16 +31,18 @@ func NewDalleDress(databases map[string][]string, address string) (*DalleDress,
}
return string(runes)
}
// if strings.HasSuffix(address, ".eth") {
// opts := sdk.NamesOptions{
// Terms: []string{address},
// }
// if names, _, err := opts.Names(); err != nil {
// return nil, fmt.Errorf("Error getting names for %s", address)
// } else {
// address = names[0].Address.Hex()
// }
// }
if strings.HasSuffix(address, ".eth") {
opts := sdk.NamesOptions{
Terms: []string{address},
}
if names, _, err := opts.Names(); err != nil {
return nil, fmt.Errorf("error getting names for %s", address)
} else {
if len(names) > 0 {
address = names[0].Address.Hex()
}
}
}
parts := strings.Split(address, ",")
seed := parts[0] + reverse(parts[0])
if len(seed) < 66 {
Expand Down
27 changes: 26 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ replace (

require (
git.sr.ht/~sbinet/gg v0.5.0
github.com/TrueBlocks/trueblocks-core/sdk v0.0.0-00010101000000-000000000000
github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240606085217-aac29013bb53
github.com/joho/godotenv v1.5.1
github.com/lucasb-eyer/go-colorful v1.2.0
Expand All @@ -19,19 +20,31 @@ require (

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/alecthomas/participle/v2 v2.0.0 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/bep/debounce v1.2.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/bykof/gostradamus v1.0.4 // indirect
github.com/campoy/embedmd v1.0.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/ethereum/go-ethereum v1.13.15 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -55,6 +68,7 @@ require (
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
Expand All @@ -71,6 +85,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
Expand All @@ -79,23 +94,33 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.9.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.10 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
github.com/wealdtech/go-ens/v3 v3.5.2 // indirect
github.com/wealdtech/go-multicodec v1.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

// replace github.com/wailsapp/wails/v2 v2.7.1 => /Users/jrush/go/pkg/mod
Loading

0 comments on commit c18b87c

Please sign in to comment.