satellite/console: make Etherscan URL more configurable
make the block explorer URL (e.g. https://etherscan.io) configurable (default to using https://etherscan.io/) Issue: https://github.com/storj/storj/issues/6357 Change-Id: I1c9f14eb4653763318fd96c242130a9c0a7d24c5
This commit is contained in:
parent
ee33cb1289
commit
356eb43a9f
@ -23,6 +23,7 @@ type Config struct {
|
||||
ProjectInvitationExpiration time.Duration `help:"duration that project member invitations are valid for" default:"168h"`
|
||||
UserBalanceForUpgrade int64 `help:"amount of base units of US micro dollars needed to upgrade user's tier status" default:"10000000"`
|
||||
PlacementEdgeURLOverrides PlacementEdgeURLOverrides `help:"placement-specific edge service URL overrides in the format {\"placementID\": {\"authService\": \"...\", \"publicLinksharing\": \"...\", \"internalLinksharing\": \"...\"}, \"placementID2\": ...}"`
|
||||
BlockExplorerURL string `help:"url of the transaction block explorer" default:"https://etherscan.io/"`
|
||||
UsageLimits UsageLimitsConfig
|
||||
Captcha CaptchaConfig
|
||||
Session SessionConfig
|
||||
|
@ -3156,8 +3156,13 @@ type WalletPayments struct {
|
||||
}
|
||||
|
||||
// EtherscanURL creates etherscan transaction URI.
|
||||
func EtherscanURL(tx string) string {
|
||||
return "https://etherscan.io/tx/" + tx
|
||||
func (payment Payments) EtherscanURL(tx string) string {
|
||||
url := payment.service.config.BlockExplorerURL
|
||||
if !strings.HasSuffix(url, "/") {
|
||||
url += "/"
|
||||
}
|
||||
|
||||
return url + "tx/" + tx
|
||||
}
|
||||
|
||||
// ErrWalletNotClaimed shows that no address is claimed by the user.
|
||||
@ -3248,7 +3253,7 @@ func (payment Payments) WalletPayments(ctx context.Context) (_ WalletPayments, e
|
||||
Wallet: walletPayment.To.Hex(),
|
||||
Amount: walletPayment.USDValue,
|
||||
Status: string(walletPayment.Status),
|
||||
Link: EtherscanURL(walletPayment.Transaction.Hex()),
|
||||
Link: payment.EtherscanURL(walletPayment.Transaction.Hex()),
|
||||
Timestamp: walletPayment.Timestamp,
|
||||
})
|
||||
}
|
||||
@ -3279,7 +3284,7 @@ func (payment Payments) WalletPayments(ctx context.Context) (_ WalletPayments, e
|
||||
Wallet: address.Hex(),
|
||||
Amount: txn.Amount,
|
||||
Status: string(txn.Status),
|
||||
Link: EtherscanURL(meta.ReferenceID),
|
||||
Link: payment.EtherscanURL(meta.ReferenceID),
|
||||
Timestamp: txn.Timestamp,
|
||||
})
|
||||
}
|
||||
|
@ -1703,7 +1703,7 @@ func TestPaymentsWalletPayments(t *testing.T) {
|
||||
Wallet: pmnt.To.Hex(),
|
||||
Amount: pmnt.USDValue,
|
||||
Status: string(pmnt.Status),
|
||||
Link: console.EtherscanURL(pmnt.Transaction.Hex()),
|
||||
Link: sat.API.Console.Service.Payments().EtherscanURL(pmnt.Transaction.Hex()),
|
||||
Timestamp: pmnt.Timestamp,
|
||||
})
|
||||
}
|
||||
@ -1745,7 +1745,7 @@ func TestPaymentsWalletPayments(t *testing.T) {
|
||||
Wallet: meta.Wallet,
|
||||
Amount: txn.Amount,
|
||||
Status: string(txn.Status),
|
||||
Link: console.EtherscanURL(meta.ReferenceID),
|
||||
Link: sat.API.Console.Service.Payments().EtherscanURL(meta.ReferenceID),
|
||||
Timestamp: txn.Timestamp,
|
||||
})
|
||||
}
|
||||
|
3
scripts/testdata/satellite-config.yaml.lock
vendored
3
scripts/testdata/satellite-config.yaml.lock
vendored
@ -205,6 +205,9 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0
|
||||
# url link for for beta satellite support
|
||||
# console.beta-satellite-support-url: ""
|
||||
|
||||
# url of the transaction block explorer
|
||||
# console.block-explorer-url: https://etherscan.io/
|
||||
|
||||
# The maximum body size allowed to be received by the API
|
||||
# console.body-size-limit: 100.00 KB
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user