Releases: onflow/fcl-js
@onflow/[email protected]
Minor Changes
-
#1352
e33fa8df
Thanks @gregsantos! - 0.1.0 ReleaseInitial alpha release of WalletConnect Adapter package for FCL.
EXPECT BREAKING CHANGES
Usage
The package exports
initFclWc
andgetSdkError
util.
Currently, a WalletConnectprojectId
is required and can be obtained @ https://cloud.walletconnect.com. Metadata is optional.Initialization returns
FclConnectServicePlugin
andclient
. Theclient
can be used to subscribe to events, disconnect, and query session and pairing status.
PassingFclConnectServicePlugin
tofcl.pluginRegistry.add()
will enable"WC/RPC"
service strategy and add new and existing services to FCL Discovery UI/API.Note
Settingflow.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 toinit
- Added
sessionRequestHook
andinjectedWallets
opts, updated pairing match to use service.uid.
- Added sending
-
#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 toinit
forpairingModalOverride
andwcRequestHook
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]
@onflow/[email protected]
@onflow/[email protected]
Patch Changes
- #1413
5e6d114a
Thanks @JeffreyDoyle! - PKG -- [fcl] Adds mainnet Interaction Template Audit contract to Interaction Template Utils
@onflow/[email protected]
Patch Changes
-
#1409
15d77220
Thanks @JeffreyDoyle! - Hotfix to generate template interface id util -
#1407
75d06938
Thanks @JeffreyDoyle! - Fix circular dep in FCL prep-template-opts
@onflow/[email protected]
Patch Changes
-
#1411
3c7a1bd6
Thanks @gregsantos! - Adds additional options toinit
forpairingModalOverride
andwcRequestHook
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]
@onflow/[email protected]
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]
Patch Changes
-
#1397
f14b730c
Thanks @JeffreyDoyle! - Adds interaction template message getter utils -
#1403
0a9c9677
Thanks @JeffreyDoyle! - Hotfix to FCL query mutate prep ops
@onflow/[email protected]
Added HTTP Post to the unchangeable services array
@onflow/[email protected]
Patch Changes
-
#1396
8475d5a4
Thanks @gregsantos! - ### fcl- Added sending
supportedStrategies
to Discovery (UI/API) on client.config
fcl-wc
- updated
initFclWC
export/name toinit
- Added
sessionRequestHook
andinjectedWallets
opts, updated pairing match to use service.uid.
- Added sending
-
#1396
8475d5a4
Thanks @gregsantos! - Updates Service Plugin validation to match spec, adds required serviceStrategy: {method: string, exec: () => {})
@onflow/[email protected]
Patch Changes
-
#1396
8475d5a4
Thanks @gregsantos! - ### fcl- Added sending
supportedStrategies
to Discovery (UI/API) on client.config
fcl-wc
- updated
initFclWC
export/name toinit
- Added
sessionRequestHook
andinjectedWallets
opts, updated pairing match to use service.uid.
- Added sending
-
#1396
8475d5a4
Thanks @gregsantos! - Updates ServicePlugin spec to include serviceStrategy -
Updated dependencies [
8475d5a4
,8475d5a4
]:- @onflow/[email protected]