Skip to content

Releases: onflow/fcl-js

@onflow/[email protected]

26 Sep 19:47
Compare
Choose a tag to compare

Minor Changes

  • #1352 e33fa8df Thanks @gregsantos! - 0.1.0 Release

    Initial alpha release of WalletConnect Adapter package for FCL.

    EXPECT BREAKING CHANGES

    Usage

    The package exports initFclWc and getSdkError util.
    Currently, a WalletConnect projectId is required and can be obtained @ https://cloud.walletconnect.com. Metadata is optional.

    Initialization returns FclConnectServicePlugin and client. The client can be used to subscribe to events, disconnect, and query session and pairing status.
    Passing FclConnectServicePlugin to fcl.pluginRegistry.add() will enable "WC/RPC" service strategy and add new and existing services to FCL Discovery UI/API.

    Note
    Setting flow.network in FCL config is required to enable "WC/RPC" service strategy to request correct chain permissions.

    import {config} from '@onflow/config'
    
    config({
        flow.network: 'testnet'
    })
    import * as fcl from "@onflow/fcl"
    import {initFclWc} from "@onflow/fcl-wc"
    
    const {FclConnectServicePlugin, client} = await initFclWc({
      projectId: PROJECT_ID,
      metadata: {
        name: "FCL Connect",
        description: "FCL DApp with support for WalletConnect",
        url: "https://flow.com/",
        icons: ["https://avatars.githubusercontent.com/u/62387156?s=280&v=4"],
      },
    })
    
    fcl.pluginRegistry.add(FclConnectServicePlugin)

    Using the client

    import {getSdkError} from "@onflow/fcl-wc"
    
    client.on("session_update", ({topic, params}) => {
      const session = client.session.get(topic)
      console.log("EVENT", "session_update", {topic, params, session})
    })
    
    await client.disconnect({
      topic: session.topic,
      reason: getSdkError("USER_DISCONNECTED"),
    })

Patch Changes

  • #1396 8475d5a4 Thanks @gregsantos! - ### fcl

    • Added sending supportedStrategies to Discovery (UI/API) on client.config

    fcl-wc

    • updated initFclWC export/name to init
    • Added sessionRequestHook and injectedWallets opts, updated pairing match to use service.uid.
  • #1427 27bc599c Thanks @gregsantos! - Update request types and make wallets from WalletConnect API opt-in

  • #1396 8475d5a4 Thanks @gregsantos! - Updates ServicePlugin spec to include serviceStrategy

  • #1411 3c7a1bd6 Thanks @gregsantos! - Adds additional options to init for pairingModalOverride and wcRequestHook

    import * as fcl from "@onflow/fcl"
    import {init} from "@onflow/fcl-wc"
    // example using pairing data from wcRequestHook and providing a custom pairing modal
    const {FclWcServicePlugin, client} = await init({
      projectId: PROJECT_ID,
      metadata: PROJECT_METADATA,
      includeBaseWC: false,
      wallets: [],
      wcRequestHook: (data: WcRequestData) => {
        const peerMetadata = data?.pairing?.peerMetadata
        setSessionRequestData(peerMetadata)
        setShowRequestModal(true)
      },
      pairingModalOverride: (
        uri: string = "",
        rejectPairingRequest: () => void
      ) => {
        openCustomPairingModal(uri)
        // call rejectPairingRequest() to manually reject pairing request from client
      },
    })
    
    fcl.pluginRegistry.add(FclWcServicePlugin)
    interface WcRequestData {
      type: string // 'session_request' | 'pairing_request'
      session: SessionTypes.Struct | undefined // https://www.npmjs.com/package/@walletconnect/types
      pairing: PairingTypes.Struct | undefined // https://www.npmjs.com/package/@walletconnect/types
      method: string // "flow_authn" | "flow_authz" | "flow_user_sign"
      uri: string | undefined
    }
  • Updated dependencies [8475d5a4, 2a5fa910, 9ea98850, e33fa8df, 3fdcc3be, 6708494d, 15d77220, f14b730c, 0a9c9677, 17a7f1e4, 5e6d114a, ecbd77b2, 75d06938, 8475d5a4, 1982c00b, f9f1dab7]:

@onflow/[email protected]

26 Sep 19:47
Compare
Choose a tag to compare

Minor Changes

Patch Changes

  • #1366 ec6f6a65 Thanks @jribbink! - Set inlineDynamicImports to true as dynamic imports would cause build to fail

@onflow/[email protected]

16 Sep 22:49
2e182c3
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #1413 5e6d114a Thanks @JeffreyDoyle! - PKG -- [fcl] Adds mainnet Interaction Template Audit contract to Interaction Template Utils

@onflow/[email protected]

15 Sep 22:15
d32015a
Compare
Choose a tag to compare
Pre-release

Patch Changes

@onflow/[email protected]

15 Sep 22:15
d32015a
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #1411 3c7a1bd6 Thanks @gregsantos! - Adds additional options to init for pairingModalOverride and wcRequestHook

    import * as fcl from "@onflow/fcl"
    import {init} from "@onflow/fcl-wc"
    // example using pairing data from wcRequestHook and providing a custom pairing modal
    const {FclWcServicePlugin, client} = await init({
      projectId: PROJECT_ID,
      metadata: PROJECT_METADATA,
      includeBaseWC: false,
      wallets: [],
      wcRequestHook: (data: WcRequestData) => {
        const peerMetadata = data?.pairing?.peerMetadata
        setSessionRequestData(peerMetadata)
        setShowRequestModal(true)
      },
      pairingModalOverride: (
        uri: string = "",
        rejectPairingRequest: () => void
      ) => {
        openCustomPairingModal(uri)
        // call rejectPairingRequest() to manually reject pairing request from client
      },
    })
    
    fcl.pluginRegistry.add(FclWcServicePlugin)
    interface WcRequestData {
      type: string // 'session_request' | 'pairing_request'
      session: SessionTypes.Struct | undefined // https://www.npmjs.com/package/@walletconnect/types
      pairing: PairingTypes.Struct | undefined // https://www.npmjs.com/package/@walletconnect/types
      method: string // "flow_authn" | "flow_authz" | "flow_user_sign"
      uri: string | undefined
    }
  • Updated dependencies [15d77220, 75d06938]:

@onflow/[email protected]

07 Sep 23:19
4f598b4
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #1404 f9f1dab7 Thanks @chasefleming! - Fixes issue where Discovery API was not loading for server side rendered applications on Safari or Chrome Incognito.

@onflow/[email protected]

07 Sep 18:39
Compare
Choose a tag to compare
Pre-release

Patch Changes

@onflow/[email protected]

06 Sep 21:28
Compare
Choose a tag to compare

Added HTTP Post to the unchangeable services array

@onflow/[email protected]

01 Sep 22:11
aacaafc
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #1396 8475d5a4 Thanks @gregsantos! - ### fcl

    • Added sending supportedStrategies to Discovery (UI/API) on client.config

    fcl-wc

    • updated initFclWC export/name to init
    • Added sessionRequestHook and injectedWallets opts, updated pairing match to use service.uid.
  • #1396 8475d5a4 Thanks @gregsantos! - Updates Service Plugin validation to match spec, adds required serviceStrategy: {method: string, exec: () => {})

@onflow/[email protected]

01 Sep 22:11
aacaafc
Compare
Choose a tag to compare
Pre-release

Patch Changes

  • #1396 8475d5a4 Thanks @gregsantos! - ### fcl

    • Added sending supportedStrategies to Discovery (UI/API) on client.config

    fcl-wc

    • updated initFclWC export/name to init
    • Added sessionRequestHook and injectedWallets opts, updated pairing match to use service.uid.
  • #1396 8475d5a4 Thanks @gregsantos! - Updates ServicePlugin spec to include serviceStrategy

  • Updated dependencies [8475d5a4, 8475d5a4]: