Installing Particle Connect
@particle-network/rn-connect
, @particle-network/rn-auth-core
, and @particle-network/rn-base
to your React Native application; this is a requirement before moving onto platform-specific configuration.Configuring Particle Connect
Access the Particle Dashboard
Create a new project or enter an existing project
Create a new iOS/Android application, or skip this step if you already have one
Retrieve the project ID, client key, and application ID
build.grade
file (which is generally found at ${project name}/android/app/build.gradle
). These directly link your application’s instance of Particle Connect with the dashboard.Specifically, within build.gradle
, you’ll need to set four different values:dataBinding
, this should be enabled with enabled = true
.manifestPlaceholders["PN_PROJECT_ID"]
, the project ID previously retrieved from the Particle dashboard.manifestPlaceholders["PN_PROJECT_CLIENT_KEY"]
, the client key previously retrieved from the Particle dashboard.manifestPlaceholders["PN_APP_ID"]
, the app ID previously retrieved from the Particle dashboard.ios/{project name}.xcworkspace
.Configuring ParticleNetwork-Info.plist
ParticleNetwork-Info.plist
. Ensure this is marked under “Target Membership.”From here, with a fresh ParticleNetwork-Info.plist
file, go ahead and fill it in with the aforementioned project keys (project ID, client key, and app ID):Configuring AppDelegate.swift
AppDelegate.swift
file to add an import of react_native_particle_connect
.application
method (as shown below), you’ll need to include a handler condition derived from ParticleConnectSchemeManager handleUrl:url
. This should be as simple as a YES
(true) return upon a true value of ParticleConnectSchemeManager handleUrl:url
.Setting your scheme URL
appId
is 63bfa427-cf5f-4742-9ff1-e8f5a1b9828f
, then the scheme URL would be pn63bfa427-cf5f-4742-9ff1-e8f5a1b9828f
—simply adding pn
to the beginning of the appId
.Configuring Info.plist
Info.plist
file and include the following snippet.Configuring your Podfile
particle_connect
is properly imported. Head over to the linked guide to complete this if you have not already.Initializing Particle Connect
init
method on particleConnect
. This takes the following parameters:chainInfo
, representing the primary chain you intend to use (for example, ChainInfo.Ethereum
, chainInfo.Polygon
).metadata
, a collection of information about your project.env
, affecting the information logged within your environment (Env.dev
, Env.production
, or Env.staging
).Facilitating connection
connectOptions
(such as ConnectOption.Email
, ConnectOption.Phone
, ConnectOption.Social
, ConnectOption.Wallet
).socialProviders
(such as EnableSocialProvider.Google
, EnableSocialProvider.Apple
, and so on).walletProviders
(such as EnableWallet.MetaMask, as shown below).additionalLayoutOptions
.logo
.particleConnect.connectWithConnectKitConfig
, initiating the resulting connection modal.particleConnect.connectWithConnectKitConfig
, in this case, that was saved to account
, which contains properties such as publicAddress
and walletType
.
To explicitly retrieve userInfo
(a collection of information regarding the login mechanism, attached addresses, and so on; more information can be found within its API reference), you’ll need to call particleAuthCore.getUserInfo
.
An example of both approaches can be found below.
EvmService.createTransaction
using standard parameters such as evmAddress
(from, or the sender), data
, value
, and receiverAddress
(to, or the recipient),
To execute the resulting transaction, you’ll need to initialize an instance of the active connected wallet; an example of doing this has been included in the snippet below.
Finally, using this instance, the transaction can be executed through ParticleConnect.signAndSendTransaction
, taking the sender’s address alongside the previously constructed transaction object.
@particle-network/rn-wallet
, you can open the (optional) embedded wallet interface at any time after a user connects, use particleWallet.setSupportChain
to set supported chains, then particleWallet.navigatorWallet
to open the interface.
particle_aa
SDK and refer to this documentation. Additionally, a demo repository can be found here.