Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fcl-wc] - Adds support for pre-authz method #1497

Merged
merged 3 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiny-lies-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/fcl-wc": minor
---

Add support for pre-authz method
1 change: 1 addition & 0 deletions packages/fcl-wc/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const FLOW_METHODS = {
FLOW_AUTHN: "flow_authn",
FLOW_PRE_AUTHZ: "flow_pre_authz",
FLOW_AUTHZ: "flow_authz",
FLOW_USER_SIGN: "flow_user_sign",
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fcl-wc/src/fcl-wc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const initClient = async ({projectId, metadata}) => {
}

export const init = async ({
projectId,
metadata,
projectId = null,
metadata = {},
includeBaseWC = false,
wcRequestHook = null,
pairingModalOverride = null,
Expand Down
3 changes: 2 additions & 1 deletion packages/fcl-wc/src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ async function connectWc({
flow: {
methods: [
FLOW_METHODS.FLOW_AUTHN,
FLOW_METHODS.FLOW_PRE_AUTHZ,
FLOW_METHODS.FLOW_AUTHZ,
FLOW_METHODS.FLOW_USER_SIGN,
],
Expand Down Expand Up @@ -292,6 +293,6 @@ const makeBaseWalletConnectService = includeBaseWC => {
async function makeWcServices({projectId, includeBaseWC, wallets}) {
const wcBaseService = makeBaseWalletConnectService(includeBaseWC)
const flowWcWalletServices = (await fetchFlowWallets(projectId)) ?? []
const injectedWalletServices = CONFIGURED_NETWORK === "testnet" ? wallets : []
const injectedWalletServices = CONFIGURED_NETWORK !== "mainnet" ? wallets : []
return [wcBaseService, ...flowWcWalletServices, ...injectedWalletServices]
}
4 changes: 2 additions & 2 deletions packages/fcl-wc/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export let CONFIGURED_NETWORK = null
export const setConfiguredNetwork = async () => {
CONFIGURED_NETWORK = await config.get("flow.network")
invariant(
CONFIGURED_NETWORK === "mainnet" || CONFIGURED_NETWORK === "testnet",
"FCL Configuration value for 'flow.network' is required (testnet || mainnet)"
CONFIGURED_NETWORK,
"FCL Configuration value for 'flow.network' is required"
)
}

Expand Down