Skip to content

Commit

Permalink
Merge branch 'release-typescript' into nialexsan/ts-conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nialexsan authored Oct 25, 2023
2 parents 70c78c0 + 14b110e commit 7701141
Show file tree
Hide file tree
Showing 21 changed files with 102 additions and 44 deletions.
6 changes: 5 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
"@onflow/util-template": "1.2.0",
"@onflow/util-uid": "1.2.0"
},
"changesets": []
"changesets": [
"six-cherries-clap",
"slow-peaches-vanish",
"tough-fishes-live"
]
}
5 changes: 5 additions & 0 deletions .changeset/six-cherries-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/fcl": minor
---

Send suggested features to discovery
5 changes: 5 additions & 0 deletions .changeset/slow-peaches-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/fcl": minor
---

Use localStorage as default & export LOCAL_STORAGE/SESSION_STORAGE as helpers for fcl.storage.default configuration key
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @onflow/config

## 1.3.0-typescript.0

### Minor Changes

- [#1731](https://github.com/onflow/fcl-js/pull/1731) [`fb3bd37e`](https://github.com/onflow/fcl-js/commit/fb3bd37e02bf0de046ea164e6c2f1a0c27e515c1) Thanks [@jribbink](https://github.com/jribbink)! - Add Typescript to @onflow/config

## 1.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onflow/config",
"version": "1.2.0",
"version": "1.3.0-typescript.0",
"description": "Config for FCL-JS",
"license": "Apache-2.0",
"author": "Dapper Labs <[email protected]>",
Expand Down
8 changes: 8 additions & 0 deletions packages/fcl-wc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @onflow/fcl-wc

## 5.0.0-typescript.0

### Patch Changes

- Updated dependencies [[`e0d0d144`](https://github.com/onflow/fcl-js/commit/e0d0d1449524f4c65e3f7a263b5c0a3ab5ac4a89), [`3d037e84`](https://github.com/onflow/fcl-js/commit/3d037e8470d56935bbc07ad7177ac40907def660), [`fb3bd37e`](https://github.com/onflow/fcl-js/commit/fb3bd37e02bf0de046ea164e6c2f1a0c27e515c1)]:
- @onflow/fcl@1.7.0-typescript.0
- @onflow/config@1.3.0-typescript.0

## 4.0.0

### Minor Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/fcl-wc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onflow/fcl-wc",
"version": "4.0.0",
"version": "5.0.0-typescript.0",
"description": "WalletConnect adapter for FCL",
"license": "Apache-2.0",
"author": "Dapper Labs <[email protected]>",
Expand Down Expand Up @@ -31,7 +31,7 @@
},
"dependencies": {
"@babel/runtime": "^7.18.9",
"@onflow/config": "^1.2.0",
"@onflow/config": "^1.3.0-typescript.0",
"@onflow/util-invariant": "^1.2.0",
"@onflow/util-logger": "^1.3.0",
"@walletconnect/modal": "^2.4.7",
Expand All @@ -40,6 +40,6 @@
"@walletconnect/utils": "^2.8.1"
},
"peerDependencies": {
"@onflow/fcl": "^1.6.0"
"@onflow/fcl": "^1.7.0-typescript.0"
}
}
14 changes: 14 additions & 0 deletions packages/fcl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @onflow/fcl

## 1.7.0-typescript.0

### Minor Changes

- [#1775](https://github.com/onflow/fcl-js/pull/1775) [`e0d0d144`](https://github.com/onflow/fcl-js/commit/e0d0d1449524f4c65e3f7a263b5c0a3ab5ac4a89) Thanks [@chasefleming](https://github.com/chasefleming)! - Send suggested features to discovery

- [#1782](https://github.com/onflow/fcl-js/pull/1782) [`3d037e84`](https://github.com/onflow/fcl-js/commit/3d037e8470d56935bbc07ad7177ac40907def660) Thanks [@jribbink](https://github.com/jribbink)! - Use localStorage as default & export LOCAL_STORAGE/SESSION_STORAGE as helpers for fcl.storage.default configuration key

### Patch Changes

- Updated dependencies [[`fb3bd37e`](https://github.com/onflow/fcl-js/commit/fb3bd37e02bf0de046ea164e6c2f1a0c27e515c1)]:
- @onflow/config@1.3.0-typescript.0
- @onflow/sdk@1.3.1-typescript.0

## 1.6.0

### Minor Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/fcl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onflow/fcl",
"version": "1.6.0",
"version": "1.7.0-typescript.0",
"description": "Flow Client Library",
"license": "Apache-2.0",
"author": "Dapper Labs <[email protected]>",
Expand Down Expand Up @@ -57,10 +57,10 @@
},
"dependencies": {
"@babel/runtime": "^7.18.6",
"@onflow/config": "^1.2.0",
"@onflow/config": "^1.3.0-typescript.0",
"@onflow/interaction": "0.0.11",
"@onflow/rlp": "^1.2.0",
"@onflow/sdk": "^1.3.0",
"@onflow/sdk": "^1.3.1-typescript.0",
"@onflow/types": "^1.2.0",
"@onflow/util-actor": "^1.3.0",
"@onflow/util-address": "^1.2.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/fcl/src/current-user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ async function getAccountProofData() {
return accountProofData
}

const makeConfig = async ({discoveryAuthnInclude}) => {
const makeConfig = async ({discoveryAuthnInclude, discoveryFeaturesSuggested}) => {
return {
client: {
discoveryAuthnInclude,
discoveryFeaturesSuggested,
clientServices: await makeDiscoveryServices(),
supportedStrategies: getServiceRegistry().getStrategies(),
},
Expand Down
3 changes: 3 additions & 0 deletions packages/fcl/src/discovery/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export async function getServices({types}) {
type: types,
fclVersion: VERSION,
include,
features: {
suggested: await config.get("discovery.features.suggested", [])
},
clientServices: await makeDiscoveryServices(),
supportedStrategies: getServiceRegistry().getStrategies(),
userAgent: window?.navigator?.userAgent,
Expand Down
2 changes: 2 additions & 0 deletions packages/fcl/src/discovery/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const makeDiscoveryServices = async () => {

export async function getDiscoveryService(service) {
const discoveryAuthnInclude = await config.get("discovery.authn.include", [])
const discoveryFeaturesSuggested = await config.get("discovery.features.suggested", [])
const discoveryWalletMethod = await config.first([
"discovery.wallet.method",
"discovery.wallet.method.default",
Expand All @@ -32,5 +33,6 @@ export async function getDiscoveryService(service) {
endpoint,
method,
discoveryAuthnInclude,
discoveryFeaturesSuggested,
}
}
2 changes: 2 additions & 0 deletions packages/fcl/src/fcl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const logIn = (opts = {}) => currentUser().authenticate(opts)

export const authz = currentUser().authorization

export {LOCAL_STORAGE, SESSION_STORAGE} from "./utils/web"

import {config} from "@onflow/config"
import {getDefaultConfig, coreStrategies} from "./utils/web"
import {initServiceRegistry} from "./current-user/exec-service/plugins"
Expand Down
17 changes: 2 additions & 15 deletions packages/fcl/src/utils/web/default-config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
const isServerSide = () => typeof window === "undefined"

const getSessionStorage = () => {
try {
const SESSION_STORAGE = {
can: !isServerSide(),
get: async key => JSON.parse(sessionStorage.getItem(key)),
put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)),
}
return SESSION_STORAGE
} catch (error) {
return null
}
}
import {LOCAL_STORAGE} from "./storage"

export const getDefaultConfig = () => {
return {
"discovery.wallet.method.default": "IFRAME/RPC",
"fcl.storage.default": getSessionStorage(),
"fcl.storage.default": LOCAL_STORAGE,
}
}
11 changes: 6 additions & 5 deletions packages/fcl/src/utils/web/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export {renderFrame} from './render-frame'
export {renderPop} from './render-pop'
export {renderTab} from './render-tab'
export {getDefaultConfig} from './default-config'
export {coreStrategies} from './coreStrategies'
export {renderFrame} from "./render-frame"
export {renderPop} from "./render-pop"
export {renderTab} from "./render-tab"
export {getDefaultConfig} from "./default-config"
export {coreStrategies} from "./coreStrategies"
export {LOCAL_STORAGE, SESSION_STORAGE} from "./storage"
13 changes: 13 additions & 0 deletions packages/fcl/src/utils/web/storage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const isServerSide = () => typeof window === "undefined"

export const SESSION_STORAGE = {
can: !isServerSide(),
get: async key => JSON.parse(sessionStorage.getItem(key)),
put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)),
}

export const LOCAL_STORAGE = {
can: !isServerSide(),
get: async key => JSON.parse(localStorage.getItem(key)),
put: async (key, value) => localStorage.setItem(key, JSON.stringify(value)),
}
7 changes: 7 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @onflow/sdk

## 1.3.1-typescript.0

### Patch Changes

- Updated dependencies [[`fb3bd37e`](https://github.com/onflow/fcl-js/commit/fb3bd37e02bf0de046ea164e6c2f1a0c27e515c1)]:
- @onflow/config@1.3.0-typescript.0

## 1.3.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onflow/sdk",
"version": "1.3.0",
"version": "1.3.1-typescript.0",
"description": "Flow SDK",
"license": "Apache-2.0",
"author": "Dapper Labs <[email protected]>",
Expand Down Expand Up @@ -41,7 +41,7 @@
},
"dependencies": {
"@babel/runtime": "^7.18.6",
"@onflow/config": "^1.2.0",
"@onflow/config": "^1.3.0-typescript.0",
"@onflow/rlp": "^1.2.0",
"@onflow/transport-http": "^1.8.0",
"@onflow/util-actor": "^1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/transport-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@onflow/fcl-bundle": "^1.4.0",
"@onflow/sdk": "^1.3.0",
"@onflow/sdk": "^1.3.1-typescript.0",
"jest": "^29.5.0"
},
"source": "src/sdk-send-grpc.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/transport-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"devDependencies": {
"@onflow/fcl-bundle": "^1.4.0",
"@onflow/rlp": "^1.2.0",
"@onflow/sdk": "^1.3.0",
"@onflow/sdk": "^1.3.1-typescript.0",
"@onflow/types": "^1.2.0",
"jest": "^29.5.0"
},
Expand Down

0 comments on commit 7701141

Please sign in to comment.