[{"name":"JsonRpc","comment":" Send JSON-RPC 2.0 requests over HTTP.\n\nThe implementation is guided by the following specifications:\n\n  - [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification)\n  - [JSON-RPC 2.0 Transport: HTTP](http://www.simple-is-better.org/json-rpc/transport_http.html)\n\n\n# Construct a request\n\n@docs Request, Params, Param, noParams, positionalParams, namedParams\n\n\n# Send a request\n\n@docs send\n\n\n# Send a request with a custom identifier\n\n@docs Id, intId, stringId, sendWithId\n\n\n# Advanced\n\n@docs HttpOptions, defaultHttpOptions, sendCustom\n\n\n# Error\n\n@docs Error, HttpError, Kind\n\n","unions":[{"name":"Error","comment":" A request can fail in multiple ways.\n\n  - `HttpError` means there was an error trying to reach the server and the\n    underlying [`HttpError`](#HttpError) will tell you why.\n  - `UnexpectedStatus` means the [successful HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#successful_responses)\n    returned by the server was not 200. In other words, it was in the 200 to 299\n    range, maybe it was 202 or 204 but not 200.\n  - `DecodeError` means the [Response object](https://www.jsonrpc.org/specification#response_object)\n    returned by the server was malformed.\n  - `MismatchedIds` means the _id_ of the [Request object](https://www.jsonrpc.org/specification#request_object)\n    is not the same as the _id_ of the [Response object](https://www.jsonrpc.org/specification#response_object).\n  - `JsonRpcError` means the RPC call encountered an error. The `maybeData`\n    field may contain detailed error information as defined by the server.\n\n","args":[],"cases":[["HttpError",["JsonRpc.HttpError"]],["UnexpectedStatus",["Http.Metadata","String.String"]],["DecodeError",["Json.Decode.Error"]],["MismatchedIds",["{ requestId : String.String, responseId : String.String }"]],["JsonRpcError",["{ kind : JsonRpc.Kind, code : Basics.Int, message : String.String, maybeData : Maybe.Maybe Json.Encode.Value, responseId : String.String }"]]]},{"name":"HttpError","comment":" The HTTP transport can fail in multiple ways.\n\n  - `BadUrl` means you did not provide a valid URL.\n  - `Timeout` means it took too long to get a response.\n  - `NetworkError` means the user turned off their wifi, went in a cave, etc.\n  - `BadStatus` means you got a response back, but the status code indicates\n    failure.\n\n","args":[],"cases":[["BadUrl",["String.String"]],["Timeout",[]],["NetworkError",[]],["BadStatus",["Http.Metadata","String.String"]]]},{"name":"Id","comment":" An identifier established by you.\n","args":[],"cases":[]},{"name":"Kind","comment":" This data type categorizes the error code of a failed RPC call.\n\nThe categories are derived from the specification as given by the table under\nthe [Error object](https://www.jsonrpc.org/specification#error_object) section.\n\n","args":[],"cases":[["ParseError",[]],["InvalidRequest",[]],["MethodNotFound",[]],["InvalidParams",[]],["InternalError",[]],["ServerError",[]],["ReservedError",[]],["ApplicationError",[]]]},{"name":"Params","comment":" A JSON Array or Object that holds the parameter values to be used during\ninvocation of an RPC method.\n","args":[],"cases":[]}],"aliases":[{"name":"HttpOptions","comment":" The HTTP options you're allowed to modify.\n\n  - `headers` are the extra HTTP headers you'd like to add. The\n    `Content-Type: application/json`, `Content-Length: ...`,\n    and `Accept: application/json` headers are always automatically added.\n  - `timeout` is the number of milliseconds you are willing to wait before giving\n    up.\n  - `tracker` lets you [cancel](https://package.elm-lang.org/packages/elm/http/2.0.0/Http#cancel)\n    and [track](https://package.elm-lang.org/packages/elm/http/2.0.0/Http#track)\n    requests.\n\n","args":[],"type":"{ headers : List.List Http.Header, timeout : Maybe.Maybe Basics.Float, tracker : Maybe.Maybe String.String }"},{"name":"Param","comment":" A JSON value.\n","args":[],"type":"Json.Encode.Value"},{"name":"Request","comment":" An RPC call is represented by sending a [Request object](https://www.jsonrpc.org/specification#request_object)\nto a server. This [`Request`](#Request) record is used to create a Request object.\n\n  - `method` contains the name of the method to be invoked.\n  - `params` holds the parameter values to be used during the invocation of the\n    method.\n  - `result` is the JSON decoder used to decode the _result_ field of a successful\n    [Response object](https://www.jsonrpc.org/specification#response_object).\n\nFor example, the following `Request` record:\n\n    import Json.Decode as JD\n    import Json.Encode as JE\n    import JsonRpc\n\n    getBalance : JsonRpc.Request String\n    getBalance =\n        { method = \"eth_getBalance\"\n        , params =\n            JsonRpc.positionalParams\n                [ JE.string \"0x0000000000000000000000000000000000000000\"\n                , JE.string \"latest\"\n                ]\n        , result = JD.string\n        }\n\ncorresponds to the following Request object:\n\n    {\n        \"jsonrpc\": \"2.0\",\n        \"method\": \"eth_getBalance\",\n        \"params\": [ \"0x0000000000000000000000000000000000000000\", \"latest\" ],\n        \"id\": ...\n    }\n\nAnd, on a successful response the _result_ field is expected to contain a\n`String`.\n\n**Note:** The _id_ field is set when sending the request.\n\n","args":["result"],"type":"{ method : String.String, params : JsonRpc.Params, result : Json.Decode.Decoder result }"}],"values":[{"name":"defaultHttpOptions","comment":" The default HTTP options used by [`send`](#send) and [`sendWithId`](#sendWithId).\n\n    { headers = []\n    , timeout = Nothing\n    , tracker = Nothing\n    }\n\n","type":"JsonRpc.HttpOptions"},{"name":"intId","comment":" An integer identifier.\n","type":"Basics.Int -> JsonRpc.Id"},{"name":"namedParams","comment":" A JSON Object with member names that match the server expected parameter\nnames.\n\nFor example, the following:\n\n    import Json.Encode as JE\n    import JsonRpc\n\n    JsonRpc.namedParams\n        [ ( \"apiKey\", JE.string \"YOUR API KEY\"\n        , ( \"n\", JE.int 5 )\n        , ( \"min\", JE.int 1 )\n        , ( \"max\", JE.int 10 )\n        ]\n        [ ( \"replacement\", Just False )\n        ]\n\nrepresents the JSON Object:\n\n    {\n        \"apiKey\": \"YOUR API KEY\",\n        \"n\": 5,\n        \"min\": 1,\n        \"max\": 10,\n        \"replacement\": false\n    }\n\n","type":"List.List ( String.String, JsonRpc.Param ) -> List.List ( String.String, Maybe.Maybe JsonRpc.Param ) -> JsonRpc.Params"},{"name":"noParams","comment":" An empty JSON Array.\n","type":"JsonRpc.Params"},{"name":"positionalParams","comment":" A JSON Array containing the parameter values in the server expected order.\n\nFor example, the following:\n\n    import Json.Encode as JE\n    import JsonRpc\n\n    JsonRpc.positionalParams\n        [ JE.string \"0x0000000000000000000000000000000000000000\"\n        , JE.string \"latest\"\n        ]\n\nrepresents the JSON Array:\n\n    [ \"0x0000000000000000000000000000000000000000\", \"latest\" ]\n\n","type":"List.List JsonRpc.Param -> JsonRpc.Params"},{"name":"send","comment":" Sends a [Request object](https://www.jsonrpc.org/specification#request_object)\nover HTTP to a JSON-RPC server with a default request identifier of 1.\n\n    import JsonRpc\n\n    type Msg\n        = GotBalance (Result JsonRpc.Error String)\n\n    let\n        rpcUrl =\n            \"https://eth-goerli.public.blastapi.io\"\n    in\n    JsonRpc.send rpcUrl GotBalance getBalance\n\nThe Request object:\n\n    {\n        \"jsonrpc\": \"2.0\",\n        \"method\": \"eth_getBalance\",\n        \"params\": [ \"0x0000000000000000000000000000000000000000\", \"latest\" ],\n        \"id\": 1\n    }\n\nwill be sent over HTTP to the JSON-RPC server at the endpoint\n`https://eth-goerli.public.blastapi.io`.\n\n","type":"String.String -> (Result.Result JsonRpc.Error result -> msg) -> JsonRpc.Request result -> Platform.Cmd.Cmd msg"},{"name":"sendCustom","comment":" Just like [`sendWithId`](#sendWithId), but it allows you to customize the\nHTTP options.\n\n    import JsonRpc exposing (defaultHttpOptions)\n\n    type Msg\n        = GotBalance (Result JsonRpc.Error String)\n\n    let\n        httpOptions =\n            -- wait 1 minute\n            { defaultHttpOptions | timeout = Just 60000 }\n\n        rpcUrl =\n            \"https://eth-goerli.public.blastapi.io\"\n\n        id =\n            JsonRpc.stringId \"abc123\"\n    in\n    JsonRpc.sendCustom httpOptions rpcUrl GotBalance id getBalance\n\n","type":"JsonRpc.HttpOptions -> String.String -> (Result.Result JsonRpc.Error result -> msg) -> JsonRpc.Id -> JsonRpc.Request result -> Platform.Cmd.Cmd msg"},{"name":"sendWithId","comment":" Just like [`send`](#send), but it allows you to set the identifier.\n","type":"String.String -> (Result.Result JsonRpc.Error result -> msg) -> JsonRpc.Id -> JsonRpc.Request result -> Platform.Cmd.Cmd msg"},{"name":"stringId","comment":" A string identifier. Maybe you'd want to use a UUID as your identifier.\n\n    import JsonRpc\n\n    JsonRpc.stringId \"789e08a1-6156-4046-88b6-5b96a87a2eba\"\n\n","type":"String.String -> JsonRpc.Id"}],"binops":[]}]