Skip to main content

serviceEndpoint

Creates a URL object from a service endpoint with additional parameters including the application origin and service-specific parameters. This function is used internally by FCL strategies to construct the complete URL for service communication.

Import

You can import the entire package and access the function:


_10
import * as fcl from "@onflow/fcl-core"
_10
_10
fcl.serviceEndpoint(service)

Or import directly the specific function:


_10
import { serviceEndpoint } from "@onflow/fcl-core"
_10
_10
serviceEndpoint(service)

Usage


_11
// Create URL from service
_11
const service = {
_11
endpoint: "https://wallet.example.com/authn",
_11
params: {
_11
appName: "MyApp",
_11
nonce: "abc123"
_11
}
_11
}
_11
const url = serviceEndpoint(service)
_11
console.log(url.toString())
_11
// https://wallet.example.com/authn?l6n=https://myapp.com&appName=MyApp&nonce=abc123

Parameters

service

  • Type: Service
  • Description: The service object containing endpoint and optional parameters

Returns

URL

URL object with all parameters appended as query string parameters


Rate this page