Skip to content

Commit a5f46e7

Browse files
committed
chore: parameterise availda HTTP api url
1 parent d3d53be commit a5f46e7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

availda/availda.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func New(configPath string) (*DAClient, error) {
7171
return nil, fmt.Errorf("cannot get config", err)
7272
}
7373

74-
a.API, err = gsrpc.NewSubstrateAPI(a.config.APIURL)
74+
a.API, err = gsrpc.NewSubstrateAPI(a.config.WsRpcURL)
7575
if err != nil {
7676
// log.Error("cannot get api:%w", zap.Error(err))
7777
return nil, fmt.Errorf("cannot get api", err)
@@ -212,7 +212,7 @@ out:
212212
// Look for our submitted extrinsic in the block
213213
if ext.Signature.Signature.AsEcdsa.Hex() == e.Signature.Signature.AsEcdsa.Hex() {
214214
extIndex = idx
215-
resp, err := http.Post("https://goldberg.avail.tools/api", "application/json",
215+
resp, err := http.Post(a.config.HttpApiURL, "application/json",
216216
strings.NewReader(fmt.Sprintf("{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"kate_queryDataProofV2\",\"params\":[%d, \"%#x\"]}", idx+1, blockHash))) //nolint: noctx
217217
if err != nil {
218218
return nil, nil, fmt.Errorf("cannot post query request", err)
@@ -294,7 +294,7 @@ func (b BatchDAData) IsEmpty() bool {
294294

295295
func (a *DAClient) GetAccountNextIndex() (types.UCompact, error) {
296296
// TODO: Add context to the request
297-
resp, err := http.Post("https://goldberg.avail.tools/api", "application/json", strings.NewReader(fmt.Sprintf("{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"system_accountNextIndex\",\"params\":[\"%v\"]}", a.KeyringPair.Address))) //nolint: noctx
297+
resp, err := http.Post(a.config.HttpApiURL, "application/json", strings.NewReader(fmt.Sprintf("{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"system_accountNextIndex\",\"params\":[\"%v\"]}", a.KeyringPair.Address))) //nolint: noctx
298298
if err != nil {
299299
return types.NewUCompactFromUInt(0), fmt.Errorf("cannot post account next index request", err)
300300
}
@@ -304,7 +304,6 @@ func (a *DAClient) GetAccountNextIndex() (types.UCompact, error) {
304304
if err != nil {
305305
return types.NewUCompactFromUInt(0), fmt.Errorf("cannot read body", err)
306306
}
307-
308307
var accountNextIndex AccountNextIndexRPCResponse
309308
err = json.Unmarshal(data, &accountNextIndex)
310309
if err != nil {
@@ -362,7 +361,8 @@ func (a *DAClient) GetData(blockNumber uint64, extHash string) ([]byte, error) {
362361

363362
type Config struct {
364363
Seed string `json:"seed"`
365-
APIURL string `json:"api_url"`
364+
WsRpcURL string `json:"wsRpcUrl"`
365+
HttpApiURL string `json:"httpApiUrl"`
366366
AppID int `json:"app_id"`
367367
DestinationDomain int `json:"destination_domain"`
368368
DestinationAddress string `json:"destination_address"`

0 commit comments

Comments
 (0)