mirror of
https://github.com/status-im/status-go.git
synced 2026-08-31 17:11:23 +00:00
Part of the Go project layout migration, item 31. Pure move plus import-path rewrite across 687 files. No API or behaviour change. The services keep their grouping under pkg/services/<name> rather than being promoted to pkg/<name>: 27 top-level directories in pkg/ would read worse than what we have, and the grouping is what makes "an RPC service" identifiable at a glance. Paths that follow the move: the logosstorage test target and generate step, the two wallet token-list tools, the migration-order check (and the pre-rebase hook symlinked to it), and the storage env helper. refs #7067
29 lines
653 B
Go
29 lines
653 B
Go
package wallet
|
|
|
|
import (
|
|
"github.com/status-im/status-go/pkg/services/wallet/thirdparty"
|
|
"github.com/status-im/status-go/pkg/services/wallet/thirdparty/decoder/fourbyte"
|
|
"github.com/status-im/status-go/pkg/services/wallet/thirdparty/decoder/fourbytegithub"
|
|
)
|
|
|
|
type Decoder struct {
|
|
Main *fourbytegithub.Client
|
|
Fallback *fourbyte.Client
|
|
}
|
|
|
|
func NewDecoder() *Decoder {
|
|
return &Decoder{
|
|
Main: fourbytegithub.NewClient(),
|
|
Fallback: fourbyte.NewClient(),
|
|
}
|
|
}
|
|
|
|
func (d *Decoder) Decode(data string) (*thirdparty.DataParsed, error) {
|
|
parsed, err := d.Main.Run(data)
|
|
if err == nil {
|
|
return parsed, nil
|
|
}
|
|
|
|
return d.Fallback.Run(data)
|
|
}
|