It is strongly discouraged to use private key or mnemonic import/generate function, if you use it, you need to secure the data yourself, Particle's SDK has no relationship with the imported/generated mnemonic or private key.
open ${your flutter project} /example/app/build.gradle. reference click here
2.1 add project config and update the minSdkVersion to 23
//Modify these configurations
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.particle_auth_test"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
//After modification:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.particle_auth_test"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 23 // required by particle sdk
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
//get from https://dashboard.particle.network/
manifestPlaceholders["PN_PROJECT_ID"] = "772f7499-1d2e-40f4-8e2c-7b6dd47db9de" //your project id
manifestPlaceholders["PN_PROJECT_CLIENT_KEY"] = "ctWeIc2UBA6sYTKJknT9cu9LBikF00fbk1vmQjsV" //your project client key
manifestPlaceholders["PN_APP_ID"] = "01a23ce8-d2e9-4b37-9eab-bf477279e53e" //your app id
}
//Modify these configurations
dependencies {
...
}
//After modification:
dependencies {
modules {
module("org.bouncycastle:bcprov-jdk15to18") {
replacedBy("org.bouncycastle:bcprov-jdk15on")
}
}
...
}
2.2 update Java Version to 11 and add dataBinding config
3.7. Configure your app scheme URL, select your app from TARGETS, under Info section, click + to add the URL types, and paste your scheme in URL Schemes
Your scheme URL should be "pn" + your project app uuid.
For example, if your project app id is "63bfa427-cf5f-4742-9ff1-e8f5a1b9828f", your scheme URL is "pn63bfa427-cf5f-4742-9ff1-e8f5a1b9828f".
3.8 In Xcode right-click your Info.plist file and choose "Open As Source Code".
Copy & Paste the XML snippet into the body of your file (<dict>...</dict>).
<key>LSApplicationQueriesSchemes</key>
<array>
<string>imtokenv2</string>
<string>metamask</string>
<string>phantom</string>
<string>bitkeep</string>
<string>trust</string>
<string>rainbow</string>
<string>zerion</string>
<string>mathwallet</string>
<string>1inch</string>
<string>awallet</string>
<string>okex</string>
</array>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access in order to open photos of barcodes</string>
<key>NSCameraUsageDescription</key>
<string>We use the camera to scan barcodes</string>
3.9 Edit Podfile, you should follow Podfile required to edit Podfile.
Initialize the SDK
Before using the SDK you have to call init(Required)
// Get your project id and client key from dashboard, // https://dashboard.particle.networkconst projectId =""; // your project idconst clientK =""; // your client key ParticleInfo.set(projectId, clientK);
Migrating to WalletConnect v2
Starting from version 0.14.0, WalletConnectV2 is supported.
// Init particle connect SDK,// dappInfo is your app info, will pass to wallet when wallet connect.final dappInfo =DappMetaData("your wallet connect project id","Particle Connect","https://connect.particle.network/icons/512.png","https://connect.particle.network","Particle Connect Flutter Demo");ParticleConnect.init(currChainInfo, dappInfo, Env.dev);// set wallet connect support chaininfos, if you dont call this method// default value is current chaininfo.List<ChainInfo> chainInfos =<ChainInfo>[ChainInfo.Ethereum,ChainInfo.Polygon ];ParticleConnect.setWalletConnectV2SupportChainInfos(chainInfos);
Connect
final account =awaitParticleConnect.connect(walletType);
Disconnect
String result =awaitParticleConnect.disconnect(walletType, getPublicAddress());