You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/build/guides/mobile/ios-quickstart.md
+84-87
Original file line number
Diff line number
Diff line change
@@ -56,14 +56,13 @@ For run in real device, there are a few steps to deal with signing:
56
56
57
57

58
58
59
-
60
59
## Connecting to a Wallet
61
60
62
61
To connect with wallets, there is native wallet discovery in the app. Once you click on connect, it will bring out the list of the wallets which support `HTTP/POST` or `WC/RPC` method.
63
62
64
63
### FCL Config
65
64
66
-
To make sure, the wallet can recognise your dApp, there is a few field you will need to config before connect to a wallet. The account proof config is optional. In addition, you will need to create a project id from [walletconnect](https://cloud.walletconnect.com/app) cloud before you can connect to the `WC/RPC` compatible wallet such as dapper self custody or lilico wallet.
65
+
To make sure, the wallet can recognise your dApp, there is a few field you will need to config before connect to a wallet. The account proof config is optional. In addition, you will need to create a project id from [walletconnect](https://cloud.walletconnect.com/app) cloud before you can connect to the `WC/RPC` compatible wallet such as [Flow Wallet](https://wallet.flow.com/).
67
66
68
67
```swift
69
68
importFCL
@@ -166,91 +165,90 @@ During development, you always can query your NFT with `fcl.query`. Here is an e
166
165
167
166
- Query cadence
168
167
169
-
```cadence
170
-
import NonFungibleToken from 0xNonFungibleToken
171
-
import MonsterMaker from 0xMonsterMaker
172
-
import MetadataViews from 0xMetadataViews
173
-
174
-
access(all) struct Monster {
175
-
access(all) let name: String
176
-
access(all) let description: String
177
-
access(all) let thumbnail: String
178
-
access(all) let itemID: UInt64
179
-
access(all) let resourceID: UInt64
180
-
access(all) let owner: Address
181
-
access(all) let component: MonsterMaker.MonsterComponent
182
-
183
-
init(
184
-
name: String,
185
-
description: String,
186
-
thumbnail: String,
187
-
itemID: UInt64,
188
-
resourceID: UInt64,
189
-
owner: Address,
190
-
component: MonsterMaker.MonsterComponent
191
-
) {
192
-
self.name = name
193
-
self.description = description
194
-
self.thumbnail = thumbnail
195
-
self.itemID = itemID
196
-
self.resourceID = resourceID
197
-
self.owner = owner
198
-
self.component = component
199
-
}
200
-
}
201
-
202
-
access(all) fun getMonsterById(address: Address, itemID: UInt64): Monster? {
203
-
204
-
if let collection = getAccount(address).capabilities.get<&MonsterMaker.Collection>(MonsterMaker.CollectionPublicPath).borrow() {
205
-
206
-
if let item = collection.borrowMonsterMaker(id: itemID) {
207
-
if let view = item.resolveView(Type<MetadataViews.Display>()) {
208
-
let display = view as! MetadataViews.Display
209
-
let owner: Address = item.owner!.address!
210
-
let thumbnail = display.thumbnail as! MetadataViews.HTTPFile
211
-
212
-
return Monster(
213
-
name: display.name,
214
-
description: display.description,
215
-
thumbnail: thumbnail.url,
216
-
itemID: itemID,
217
-
resourceID: item.uuid,
218
-
owner: address,
219
-
component: item.component
220
-
)
221
-
}
222
-
}
223
-
}
224
-
225
-
return nil
226
-
}
227
-
228
-
access(all) fun main(address: Address): [Monster] {
229
-
let account = getAccount(address)
230
-
let collectionRef = account.capabilities.get<&{NonFungibleToken.Collection}>(MonsterMaker.CollectionPublicPath).borrow()
231
-
?? panic("The account with address "
232
-
.concat(address.toString)
233
-
.concat(" does not have a NonFungibleToken Collection at ")
One of the easiest ways to connect to a wallet via a mobile native dApp is through Flow's new support for Wallet Connect 2.0. This is the pattern that Monster Maker uses to connect to the Dapper Self Custody wallet and Lilico. For more information on FCL Wallet Connect 2.0, check out this page:
272
+
One of the easiest ways to connect to a wallet via a mobile native dApp is through Flow's new support for Wallet Connect 2.0. This is the pattern that Monster Maker uses to connect to the [Flow Wallet](https://wallet.flow.com/). For more information on FCL Wallet Connect 2.0, check out this page:
@@ -59,7 +59,7 @@ Use the [Flow Testnet Faucet](https://faucet.flow.com/fund-account) to fund your
59
59
60
60
### [Flow Wallet](https://wallet.flow.com)
61
61
62
-
Flow Wallet is available on [Android](https://play.google.com/store/apps/details?id=io.outblock.lilico&hl=en_US&gl=US) and [iOS](https://apps.apple.com/ca/app/flow-core/id1644169603), with desktop support using the Flow Wallet [Chrome extension](https://chromewebstore.google.com/detail/flow-reference-wallet/hpclkefagolihohboafpheddmmgdffjm). In addition to being able to transact in both EVM and Cadence environments, Flow Wallet will also allow you to view and move assets between EVM and Cadence, making it possible to manage all your assets in one place.
62
+
Flow Wallet is available on [Android](https://play.google.com/store/apps/details?id=com.flowfoundation.wallet) and [iOS](https://apps.apple.com/ca/app/flow-wallet-nfts-and-crypto/id6478996750), with desktop support using the Flow Wallet [Chrome extension](https://chromewebstore.google.com/detail/flow-reference-wallet/hpclkefagolihohboafpheddmmgdffjm). In addition to being able to transact in both EVM and Cadence environments, Flow Wallet will also allow you to view and move assets between EVM and Cadence, making it possible to manage all your assets in one place.
Copy file name to clipboardexpand all lines: docs/tools/clients/fcl-js/index.md
+43-25
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,12 @@ It was created to make developing applications that connect to the Flow blockcha
11
11
While FCL itself is a concept and standard, FCL JS is the javascript implementation of FCL and can be used in both browser and server environments. All functionality for connecting and communicating with wallet providers is restricted to the browser. We also have FCL Swift implementation for iOS, see [FCL Swift](https://github.com/zed-io/fcl-swift) contributed by [@lmcmz](https://github.com/lmcmz).
12
12
13
13
---
14
+
14
15
## Getting Started
15
16
16
17
### Requirements
17
-
- Node version `v12.0.0 or higher`.
18
+
19
+
- Node version `v12.0.0 or higher`.
18
20
19
21
### Installation
20
22
@@ -27,45 +29,56 @@ npm i -S @onflow/fcl
27
29
```shell
28
30
yarn add @onflow/fcl
29
31
```
32
+
30
33
#### Importing
31
34
32
35
**ES6**
36
+
33
37
```js
34
-
import*asfclfrom"@onflow/fcl";
38
+
import*asfclfrom'@onflow/fcl';
35
39
```
40
+
36
41
**Node.js**
42
+
37
43
```js
38
-
constfcl=require("@onflow/fcl");
44
+
constfcl=require('@onflow/fcl');
39
45
```
46
+
40
47
---
48
+
41
49
## FCL for Dapps
50
+
42
51
#### Wallet Interactions
43
52
44
-
-*Wallet Discovery* and *Sign-up/Login*: Onboard users with ease. Never worry about supporting multiple wallets.
45
-
Authenticate users with any [FCL compatible wallet](./index.md#current-wallet-providers).
53
+
-_Wallet Discovery_ and _Sign-up/Login_: Onboard users with ease. Never worry about supporting multiple wallets.
54
+
Authenticate users with any [FCL compatible wallet](./index.md#current-wallet-providers).
55
+
46
56
```js
47
57
// in the browser
48
-
import*asfclfrom"@onflow/fcl"
58
+
import*asfclfrom'@onflow/fcl';
49
59
50
60
fcl.config({
51
-
"discovery.wallet":"https://fcl-discovery.onflow.org/testnet/authn", // Endpoint set to Testnet
52
-
})
61
+
'discovery.wallet':'https://fcl-discovery.onflow.org/testnet/authn', // Endpoint set to Testnet
62
+
});
53
63
54
-
fcl.authenticate()
64
+
fcl.authenticate();
55
65
```
66
+
56
67

57
68
58
69
> **Note**: A [Dapper Wallet](https://meetdapper.com/developers) developer account is required. To enable Dapper Wallet inside FCL, you need to [follow this guide](https://docs.meetdapper.com/quickstart).
59
70
60
-
-*Interact with smart contracts*: Authorize transactions via the user's chosen wallet
61
-
-*Prove ownership of a wallet address*: Signing and verifying user signed data
71
+
-_Interact with smart contracts_: Authorize transactions via the user's chosen wallet
72
+
-_Prove ownership of a wallet address_: Signing and verifying user signed data
62
73
63
74
[Learn more about wallet interactions >](./api.md#wallet-interactions)
64
75
65
76
#### Blockchain Interactions
66
-
-*Query the chain*: Send arbitrary Cadence scripts to the chain and receive back decoded values
77
+
78
+
-_Query the chain_: Send arbitrary Cadence scripts to the chain and receive back decoded values
79
+
67
80
```js
68
-
import*asfclfrom"@onflow/fcl";
81
+
import*asfclfrom'@onflow/fcl';
69
82
70
83
constresult=awaitfcl.query({
71
84
cadence:`
@@ -77,14 +90,16 @@ const result = await fcl.query({
[Learn more about utilities >](./api.md#pre-built-interactions)
113
129
114
-
115
130
## Next Steps
116
131
117
132
See the [Flow App Quick Start](../../../build/getting-started/fcl-quickstart.md).
@@ -122,28 +137,31 @@ Learn Flow's smart contract language to build any script or transactions: [Caden
122
137
123
138
Explore all of Flow [docs and tools](/).
124
139
125
-
126
140
---
141
+
127
142
## FCL for Wallet Providers
143
+
128
144
Wallet providers on Flow have the flexibility to build their user interactions and UI through a variety of ways:
145
+
129
146
- Front channel communication via Iframe, pop-up, tab, or extension
130
147
- Back channel communication via HTTP
131
148
132
149
FCL is agnostic to the communication channel and is configured to create both custodial and non-custodial wallets. This enables users to interact with wallet providers without needing to download an app or extension.
133
150
134
-
The communication channels involve responding to a set of pre-defined FCL messages to deliver the requested information to the dapp. Implementing a FCL compatible wallet on Flow is as simple as filling in the responses with the appropriate data when FCL requests them. If using any of the front-channel communication methods, FCL also provides a set of [wallet utilities](https://github.com/onflow/fcl-js/blob/master/packages/fcl/src/wallet-utils/index.js) to simplify this process.
135
-
151
+
The communication channels involve responding to a set of pre-defined FCL messages to deliver the requested information to the dapp. Implementing a FCL compatible wallet on Flow is as simple as filling in the responses with the appropriate data when FCL requests them. If using any of the front-channel communication methods, FCL also provides a set of [wallet utilities](https://github.com/onflow/fcl-js/blob/master/packages/fcl/src/wallet-utils/index.js) to simplify this process.
It can be difficult to get users to discover new wallets on a chain. To solve this, we created a wallet discovery service that can be configured and accessed through FCL to display all available Flow wallet providers to the user. This means:
164
+
147
165
- Dapps can display and support all FCL compatible wallets that launch on Flow without needing to change any code
148
166
- Users don't need to sign up for new wallets - they can carry over their existing one to any dapp that uses FCL for authentication and authorization.
0 commit comments