Installing Particle Connect
particle_connect
to your Flutter application; this will need to be done 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.gradle
file, often found at the following file path: ${project name}/android/app/build.gradle
Within your build.gradle
file, you’ll need to add four new lines to ensure Particle Connect runs properly:minSdkVersion
. In most cases, this will be set to 23
.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.build.gradle
file, you’ll need to ensure that you’re using version 17 of Java in both compileOptions
and kotlinOptions
, alongside enabling dataBinding
.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 values previously retrieved from the Particle dashboard:Configuring AppDelegate.swift
AppDelegate.swift
file to add an import of ParticleConnect
.application
method (as shown below), you’ll need to include a handler condition derived from ParticleConnect.handleUrl
. This should be as simple as a true
return upon a truthy value of ParticleConnect.handleUrl
, and a super.application(app, open: url, options: options)
return upon a falsy value.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 haven’t already.Another important note before continuing.
Our SDK is a static library (XCFramework). When using the Particle Auth Flutter SDK, you’ll need to specify that you’re using a static framework through the following:
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
).dappMetaData
, derived from DappMetaData
env
, affecting the information logged within your environment (Env.dev
, Env.production
, or Env.staging
).Facilitating connection
connectKitConfig
instance specifying the:connectOptions
(such as .EMAIL
, .PHONE
, SOCIAL
, WALLET
).socialProviders
(such as .GOOGLE
, .APPLE
).walletProviders
(specified through an instance of EnableWalletProvider
, as shown below).additionalLayoutOptions
.logo
.ConnectKitConfig
), you’ll be able to call 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 receiverAddres
(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_wallet
within your pubspec.yaml
, 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.