mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-26 07:25:46 +00:00
26 lines
654 B
Go
26 lines
654 B
Go
package clients
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/planetmint/planetmint-go/config"
|
|
"github.com/rddl-network/rddl-claim-service/client"
|
|
"github.com/rddl-network/rddl-claim-service/types"
|
|
)
|
|
|
|
var ClaimServiceClient client.IRCClient
|
|
|
|
func init() {
|
|
cfg := config.GetConfig()
|
|
ClaimServiceClient = client.NewRCClient(cfg.ClaimHost, &http.Client{})
|
|
}
|
|
|
|
func PostClaim(ctx context.Context, beneficiary string, amount uint64, id uint64) (txID string, err error) {
|
|
res, err := ClaimServiceClient.PostClaim(ctx, types.PostClaimRequest{Beneficiary: beneficiary, Amount: amount, ClaimID: int(id)})
|
|
if err != nil {
|
|
return
|
|
}
|
|
return res.TxID, nil
|
|
}
|