• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MinaProtocol / mina / 2845

31 Oct 2024 09:52AM UTC coverage: 33.163% (-27.7%) from 60.847%
2845

push

buildkite

web-flow
Merge pull request #15891 from MinaProtocol/dkijania/update_badges_comp

[Compatible] Update badges and logo

22200 of 66943 relevant lines covered (33.16%)

21864.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/lib/graphql_lib/signature_lib/graphql_scalars.ml
1
open Graphql_basic_scalars.Utils
2✔
2
open Graphql_basic_scalars.Testing
3

4
module Make (Schema : Schema) = struct
5
  module type Json_intf =
6
    Json_intf_any_typ with type ('a, 'b) typ := ('a, 'b) Schema.typ
7

8
  (* for ITN GraphQL server, don't use elsewhere! *)
9
  module PrivateKey : Json_intf with type t = Signature_lib.Private_key.t =
10
  struct
11
    type t = Signature_lib.Private_key.t
12

13
    let parse json =
14
      Yojson.Basic.Util.to_string json
×
15
      |> Signature_lib.Private_key.of_base58_check_exn
16

17
    let serialize key = `String (Signature_lib.Private_key.to_base58_check key)
×
18

19
    let typ () =
20
      Schema.scalar "PrivateKey" ~doc:"Base58Check-encoded private key string"
1✔
21
        ~coerce:serialize
22
  end
23

24
  module PublicKey :
25
    Json_intf with type t = Signature_lib.Public_key.Compressed.t = struct
26
    type t = Signature_lib.Public_key.Compressed.t
27

28
    let parse json =
29
      Yojson.Basic.Util.to_string json
×
30
      |> Signature_lib.Public_key.of_base58_check_decompress_exn
31

32
    let serialize key =
33
      `String (Signature_lib.Public_key.Compressed.to_base58_check key)
×
34

35
    let typ () =
36
      Schema.scalar "PublicKey" ~doc:"Base58Check-encoded public key string"
1✔
37
        ~coerce:serialize
38
  end
39
end
40

41
include Make (Schema)
42

43
let%test_module "Roundtrip tests" =
44
  ( module struct
45
    include Make (Test_schema)
46

47
    let%test_module "PrivateKey" =
48
      (module Make_test (PrivateKey) (Signature_lib.Private_key))
49

50
    let%test_module "PublicKey" =
51
      (module Make_test (PublicKey) (Signature_lib.Public_key.Compressed))
52
  end )
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc