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: embedded-wallets/connect-blockchain/solana/ios.mdx
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ description: 'Integrate Embedded Wallets with the Solana Blockchain in iOS | Emb
10
10
importTabItemfrom'@theme/TabItem'
11
11
importTabsfrom'@theme/Tabs'
12
12
13
-
While using the Embedded Wallets iOS SDK (formerly Web3Auth), you can retrieve the Ed25519 private key upon successful authentication. This private key can be used to derive the user's public address and interact with the [Solana](https://solana.org/) chain. We've highlighted a few methods here to get you started quickly.
13
+
While using the Embedded Wallets iOS SDK (formerly Web3Auth), you can retrieve the Ed25519 private key upon successful authentication. This private key can be used to derive the user's public address and interact with the [Solana](https://solana.org/) chain. We've highlighted a few methods here to get you started.
14
14
15
15
:::note
16
16
@@ -72,14 +72,14 @@ The SDKs are now branded as MetaMask Embedded Wallet SDKs (formerly Web3Auth Plu
72
72
73
73
To interact with the Solana blockchain in iOS, you can use any Solana compatible SDK. Here, we're using [SolanaSwift](https://github.com/p2p-org/solana-swift) to demonstrate how to interact with Solana chain using Web3Auth.
To install `SolanaSwift` through Swift Package Manager, follow the below steps:
85
85
@@ -97,7 +97,7 @@ Once finished, Xcode will automatically begin resolving and downloading your dep
97
97
98
98
</TabItem>
99
99
100
-
<TabItemvalue="cocoapods">
100
+
<TabItemvalue="cocoa-pods">
101
101
102
102
To install using CocoaPods, simply add the following line to your Podfile
103
103
@@ -116,7 +116,7 @@ pod install
116
116
117
117
## Initialize
118
118
119
-
To Initialize the `JSONRPCAPIClient` we require a RPC URL. The `JSONRPCAPIClient` instance will provide a gateway & protocol to interact with Solana cluster while sending requests and receving response. For this example, we are using the RPC URL for Devnet-beta. To interact with Testnet or Mainnet, change the RPC URL.
119
+
To Initialize the `JSONRPCAPIClient` we require a RPC URL. The `JSONRPCAPIClient` instance will provide a gateway & protocol to interact with Solana cluster while sending requests and receiving response. For this example, we are using the RPC URL for Devnet-beta. To interact with Testnet or Mainnet, change the RPC URL.
120
120
121
121
### Initializing the Solana SDK
122
122
@@ -136,7 +136,7 @@ let solanaJSONRPCClient = JSONRPCAPIClient(endpoint: endpoint)
136
136
137
137
### Initializing the Web3Auth SDK
138
138
139
-
In the following code block, we'll initialize the Web3Auth SDK and check whether the user has any Web3Auth session persisted or not. If the user is already authenticated, you can route them directly to home view, otherwise you can route them to login view for authentication purpose. For checking, if user is already authenticated, we can check whether `web3Auth.web3AuthResponse` is `nil` or not.
139
+
In the following code block, we'll initialize the Web3Auth SDK and check whether the user has any Web3Auth session persisted or not. If the user is already authenticated, you can route them directly to home view, otherwise you can route them to the sign-in view for authentication purpose. For checking, if user is already authenticated, we can check whether `web3Auth.web3AuthResponse` is `nil` or not.
140
140
141
141
By default, the session is persisted for 30 days. You can modify it using `sessionTime` parameter during initialization.
142
142
@@ -168,7 +168,7 @@ let isUserAuthenticated = web3Auth.web3AuthResponse != nil
168
168
169
169
## Get account
170
170
171
-
We can use `getEd25519PrivateKey` method in Web3Auth to retrive the priavte key for the Solana ecosystem. In the following code block, we'll use the Ed25519 private key to retive user's public address by creating `KeyPair`. The `KeyPair` struct from `SolanaSwift` SDK once created can be used to sign the Solana transactions.
171
+
We can use `getEd25519PrivateKey` method in Web3Auth to retrieve the private key for the Solana ecosystem. In the following code block, we'll use the Ed25519 private key to retrieve user's public address by creating `KeyPair`. The `KeyPair` struct from `SolanaSwift` SDK once created can be used to sign the Solana transactions.
172
172
173
173
```swift
174
174
let ed25519PrivateKey =try web3Auth.getEd25519PrivateKey()
@@ -180,7 +180,7 @@ let userAccount = keyPair.publicKey.base58EncodedString
180
180
181
181
## Get User balance
182
182
183
-
Once we have retrived userAccount, we can use it to fetch user balance. We'll use `getBalance` method from `JSONRPCAPIClient` instance to interact with Solana cluster and fetch user balance. The response of `getBalance` is UInt64, we will need to divide it by 10^9, because Solana's token decimals is 9. To help us with the calculation, the SDK also provides a `convertToBalance` function.
183
+
Once we have retrieved `userAccount`, we can use it to fetch user balance. We'll use `getBalance` method from `JSONRPCAPIClient` instance to interact with Solana cluster and fetch user balance. The response of `getBalance` is UInt64, we will need to divide it by 10^9, because Solana's token decimals is 9. To help us with the calculation, the SDK also provides a `convertToBalance` function.
184
184
185
185
```swift
186
186
// focus-start
@@ -197,7 +197,7 @@ let userBalance = return balanceResponse.convertToBalance(decimals: 9)
197
197
198
198
## Sign a transaction
199
199
200
-
Let's now go through how can we sign the transaction. In the below codeblock, we'll create a new function `perpareTransaction` which can be used to retrive the Base58 signature as well as broadcast transaction to the cluster. We'll use `BlockchainClient.prepareSendingNativeSOL` to create the transaction to self transfer 0.01 Sol and sign it. You can also checkout `prepareSendingSPLTokens`, and `prepareTransaction` for other types of transaction.
200
+
Let's now go through how can we sign the transaction. In the below code block, we'll create a new function `perpareTransaction` which can be used to retrieve the Base58 signature as well as broadcast transaction to the cluster. We'll use `BlockchainClient.prepareSendingNativeSOL` to create the transaction to self transfer 0.01 Sol and sign it. You can also checkout `prepareSendingSPLTokens`, and `prepareTransaction` for other types of transaction.
201
201
202
202
```swift
203
203
let blockchainClient =BlockchainClient(apiClient: solanaJSONRPCClient)
@@ -213,7 +213,7 @@ let blockchainClient = BlockchainClient(apiClient: solanaJSONRPCClient)
213
213
}
214
214
```
215
215
216
-
Once we have created `perpareTransaction` function, we'll use it to prepare, sign the transaction, and retrive Base58 signature. You can use `findSignature` to retrive the signature for the respective signer.
216
+
Once we have created `perpareTransaction` function, we'll use it to prepare, sign the transaction, and retrieve Base58 signature. You can use `findSignature` to retrieve the signature for the respective signer.
Copy file name to clipboardExpand all lines: embedded-wallets/sdk/ios/advanced/README.mdx
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ The constructor takes a `Web3AuthOptions` struct as input.
50
50
|`web3AuthNetwork`| Web3Auth Network: `.SAPPHIRE_MAINNET`, `.SAPPHIRE_DEVNET`, `.MAINNET`, `.CYAN`, `.AQUA`, or `.TESTNET`. Mandatory field of type `Web3AuthNetwork`. |
51
51
|`redirectUrl`| URL that Web3Auth will redirect API responses upon successful authentication. It's a mandatory field of type `String`. |
52
52
|`sessionTime?`| Session duration in seconds. Default is `86400 * 30` (30 days). Maximum is 30 days. |
53
-
|`useSFAKey?`| Use SFA key to get single factor auth key. Default is `false`. Useful for wallet pregeneration and SFA mode.|
53
+
|`useSFAKey?`| Use SFA key to get single factor auth key. Default is `false`. Useful for wallet pre-generation and SFA mode. |
54
54
|`defaultChainId?`| Default chain ID to use. Default is `"0x1"` (Ethereum mainnet). |
55
55
|`enableLogging?`| Enable SDK logging. Default is `false`. |
56
56
@@ -62,7 +62,7 @@ The constructor takes a `Web3AuthOptions` struct as input.
62
62
|`authConnectionConfig?`| Auth connection config for custom auth connections. Takes `[AuthConnectionConfig]` as a value. |
63
63
|`mfaSettings?`| Configure MFA settings for authentication. Takes `MfaSettings` as a value. |
64
64
|`chains?`| Custom chain configuration for blockchain networks. Takes `[Chains]` as a value. See [Chains configuration](#chains-configuration) below. |
65
-
|`walletServicesConfig?`| Configuration for wallet services including whitelabel options. Takes `WalletServicesConfig` as a value. |
65
+
|`walletServicesConfig?`| Configuration for Wallet Services including whitelabel options. Takes `WalletServicesConfig` as a value. |
66
66
67
67
</TabItem>
68
68
@@ -97,7 +97,6 @@ Control how long users stay authenticated and how sessions persist. The session
97
97
98
98
-`sessionTime` - Session duration in seconds. Controls how long users remain authenticated
|`confirmationStrategy?`| Controls how transaction confirmations are displayed. Accepts `ConfirmationStrategy`. Default is `.defaultStrategy`. |
183
-
|`whiteLabel?`| Whitelabel settings specific to the wallet services UI. When set, merged with the project-level whitelabel config. Accepts `WhiteLabelData`. |
182
+
|`whiteLabel?`| Whitelabel settings specific to the Wallet Services UI. When set, merged with the project-level whitelabel config. Accepts `WhiteLabelData`. |
184
183
185
184
```swift
186
185
web3Auth =tryawaitWeb3Auth(
@@ -207,7 +206,6 @@ Customize the Embedded Wallets sign-in screens to match your dapp's design.
207
206
For complete customization options, see
208
207
[Whitelabeling and UI customization](./whitelabel.mdx).
209
208
210
-
211
209
## Multi-Factor Authentication
212
210
213
211
Add security layers to protect user accounts with two-factor authentication.
0 commit comments