Skip to content

Commit c22a7ae

Browse files
author
=
committed
fix: add thirdwebContractApi to config
1 parent 893fe93 commit c22a7ae

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

configs/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ type BasicAuthConfig struct {
109109
}
110110

111111
type APIConfig struct {
112-
Host string `mapstructure:"host"`
113-
BasicAuth BasicAuthConfig `mapstructure:"basicAuth"`
114-
AbiDecodingEnabled bool `mapstructure:"abiDecodingEnabled"`
112+
Host string `mapstructure:"host"`
113+
BasicAuth BasicAuthConfig `mapstructure:"basicAuth"`
114+
ThirdwebContractApi string `mapstructure:"thirdwebContractApi"`
115+
AbiDecodingEnabled bool `mapstructure:"abiDecodingEnabled"`
115116
}
116117

117118
type Config struct {

internal/common/abi.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66
"regexp"
77
"strings"
88

9+
config "github.com/thirdweb-dev/indexer/configs"
10+
911
"github.com/ethereum/go-ethereum/accounts/abi"
1012
)
1113

12-
var contractApi string = "https://contract.thirdweb.com"
13-
1414
func GetABIForContractWithCache(chainId string, contract string, abiCache map[string]*abi.ABI) *abi.ABI {
1515
abi, ok := abiCache[contract]
1616
if !ok {
@@ -27,7 +27,7 @@ func GetABIForContractWithCache(chainId string, contract string, abiCache map[st
2727
}
2828

2929
func GetABIForContract(chainId string, contract string) (*abi.ABI, error) {
30-
url := fmt.Sprintf("%s/abi/%s/%s", contractApi, chainId, contract)
30+
url := fmt.Sprintf("%s/abi/%s/%s", config.Cfg.API.ThirdwebContractApi, chainId, contract)
3131

3232
resp, err := http.Get(url)
3333
if err != nil {

0 commit comments

Comments
 (0)