mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
fix: lazyLoad on rddl-claim-service-client
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
b0f8516cd6
commit
df5bd023c4
@ -16,13 +16,18 @@ import (
|
||||
|
||||
var ClaimServiceClient IRCClient
|
||||
|
||||
func init() {
|
||||
func lazyLoad() IRCClient {
|
||||
if ClaimServiceClient != nil {
|
||||
return ClaimServiceClient
|
||||
}
|
||||
cfg := config.GetConfig()
|
||||
ClaimServiceClient = NewRCClient(cfg.ClaimHost, &http.Client{})
|
||||
return ClaimServiceClient
|
||||
}
|
||||
|
||||
func PostClaim(ctx context.Context, beneficiary string, amount uint64, id uint64) (txID string, err error) {
|
||||
res, err := ClaimServiceClient.PostClaim(ctx, PostClaimRequest{Beneficiary: beneficiary, Amount: amount, ClaimID: int(id)})
|
||||
client := lazyLoad()
|
||||
res, err := client.PostClaim(ctx, PostClaimRequest{Beneficiary: beneficiary, Amount: amount, ClaimID: int(id)})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user