Skip to content
Merged
5 changes: 5 additions & 0 deletions .changeset/little-buses-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/fcl": patch
---

Add deprecation warning when "env" is used instead of "flow.network" in config
2 changes: 1 addition & 1 deletion docs/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ addStuff().then((d) => console.log(d)); // 13 (5 + 7 + 1)
| `discovery.authn.endpoint` | `https://fcl-discovery.onflow.org/api/testnet/authn` | Endpoint for alternative configurable Wallet Discovery mechanism. Read more on [discovery](#discovery) |
| `discovery.wallet` **(required)** | `https://fcl-discovery.onflow.org/testnet/authn` | Points FCL at the Wallet or Wallet Discovery mechanism. |
| `fcl.limit` | `100` | Specifies fallback compute limit if not provided in transaction. Provided as integer. |
| `flow.network` | `testnet` | Used in conjunction with stored interactions. Possible values: `local`, `canarynet`, `testnet`, `mainnet` |
| `flow.network` | `testnet` | Used in conjunction with stored interactions and provides FCLCryptoContract address for `testnet` and `mainnet`. Possible values: `local`, `canarynet`, `testnet`, `mainnet`. |

### Address replacement in scripts and transactions

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/configure-fcl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ addStuff().then(d => console.log(d)) // 13 (5 + 7 + 1)
- `app.detail.icon` - **(INTRODUCED `@onflow/fcl@0.0.68`)** Url for your applications icon, can be requested by wallets and other services.
- `challenge.handshake` -- **(DEPRECATED `@onflow/fcl@0.0.68`)** Points FCL at the Wallet or Wallet Discovery mechanism.
- `discovery.wallet` -- **(INTRODUCED `@onflow/fcl@0.0.68`)** Points FCL at the Wallet or Wallet Discovery mechanism.
- `env` -- Used in conjunction with stored interactions. Possible values: `local`, `canarynet`, `testnet`, `mainnet`
- `env` -- **(DEPRECATED `@onflow/fcl@1.0.0`)** Used in conjunction with stored interactions. Possible values: `local`, `canarynet`, `testnet`, `mainnet`
- `fcl.limit` -- Specifies fallback compute limit if not provided in transaction. Provided as integer.
- `flow.network` -- **(INTRODUCED `@onflow/fcl@1.0.0`)** Used in conjunction with stored interactions and provides FCLCryptoContract address for `testnet` and `mainnet`. Possible values: `local`, `canarynet`, `testnet`, `mainnet`.
- `service.OpenID.scopes` - **(INTRODUCED `@onflow/fcl@0.0.68`)** Open ID Connect claims for Wallets and OpenID services.

## Address replacement in scripts and transactions
Expand Down
9 changes: 9 additions & 0 deletions packages/fcl/TRANSITIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Transitions

## 0001 Deprecate `env` config key
- **Date:** May 26th 2022
- **Type:** Deprecation of `env` in config

When specifying which flow network for FCL to use, use the `flow.network` config key instead of `env` (e.g. `fcl.config.put("flow.network", "testnet")`). Permitted values are currently `local`, `canarynet`, `testnet`, `mainnet`.

FCL currently falls back to `env` for the `flow.network` field but this will be removed in a future update.
14 changes: 13 additions & 1 deletion packages/fcl/src/app-utils/verify-signatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {sansPrefix} from "@onflow/util-address"
import {query} from "../exec/query"
import {encodeAccountProof} from "../wallet-utils"
import {isString} from "../exec/utils/is"
import {deprecate} from "../utils/deprecate"

const ACCOUNT_PROOF = "ACCOUNT_PROOF"
const USER_SIGNATURE = "USER_SIGNATURE"
Expand Down Expand Up @@ -55,7 +56,18 @@ const getVerifySignaturesScript = async (sig, opts) => {
? "verifyAccountProofSignatures"
: "verifyUserSignatures"

const network = await config.first(["env", "flow.network"])
let network = await config.get("flow.network")
if (!network) {
network = await config.get("env")
if (network)
deprecate({
title: "FCL Deprecation Notice",
message: `Using the "env" configuration key for specifying the flow network has been deprecated in favor of "flow.network" and will not be supported in future versions of the FCL.
You can learn more (including a guide on common transition paths) here: https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0001-deprecate-env-config-key`,
level: logger.LEVELS.warn,
})
}

let fclCryptoContract

invariant(
Expand Down