简体   繁体   English

如何使用深度链接将 Phantom 钱包连接到 Flutter 应用程序?

[英]How to connect Phantom wallet to a Flutter app using deep links?

I'm making a flutter mobile app where I want to connect the user to the Phantom wallet using the connect deep link and then set the redirect_link as a Firebase dynamic link for the app, however I am not getting a response from the Phantom wallet as a query parameters.我正在制作一个 flutter 移动应用程序,我想在其中使用连接深层链接将用户连接到 Phantom 钱包,然后将redirect_link设置为该应用程序的 Firebase 动态链接,但是我没有收到来自 Phantom 钱包的响应一个查询参数。 Any help will be highly appreciated.任何帮助将不胜感激。 Thanks.谢谢。

Install uni_links and url_luncher pakage安装uni_linksurl_luncher 包

add this intent to androidManifest将此意图添加到 androidManifest

  <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with https://YOUR_HOST -->
    <data
      android:scheme="https"
      android:host="[YOUR_HOST]" />
  </intent-filter>

then create queryParameter like然后创建查询参数,如

 Map<String, dynamic> queryParameters = {
  "dapp_encryption_public_key":
      base58.encode(Uint8List.fromList(keypair.publicKey)),
  "cluster": "devnet",
  "app_url": "https://google.com",
  "redirect_link":
      "app://flutterdapp?handleQuery=onConnect}",
};

then lunchUrl然后是午餐网址

final url =Uri(
  scheme: "https",
  host: "phantom.app",
  path: "/ul/v1/onConnect",
  queryParameters: queryParameters,
);

 launchUrl(
  url,
  mode: LaunchMode.externalNonBrowserApplication,
 );

and recive data from phantom like并从幻像中接收数据

StreamSubscription _sub;

 Future<void> initUniLinks() async {
 // ... check initialLink

// Attach a listener to the stream
_sub = linkStream.listen((String? link) {
  // Parse the link and warn the user, if it is not correct
}, onError: (err) {
  // Handle exception by warning the user their action did not succeed
});

// NOTE: Don't forget to call _sub.cancel() in dispose()
 }

 // ...

hope help you希望能帮到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为 flutter 应用程序创建和连接 firebase 中的存储内容? - how to create and connect a storage content in firebase for flutter app? 使用 Firebase 重定向 URL 动态/深层链接正在丢失查询参数 - Redirect URL using Firebase Dynamic / Deep Links is losing query parameters 永远不要让我的 flutter 应用程序进入深度睡眠模式 - Never allow my flutter app to deep sleep mode Flutter Web 如何提供文件资产链接。json 用于 ZE84E30B9390CDB64DB6DB2C9AB878 应用程序验证 - Flutter Web how to serve file assetlinks.json for Android App Links verification 如何使用 Firestore 从 flutter 应用程序操作 SQL 服务器 - How to manipulate SQL server from flutter app by using Firestore 如何更新存储在 firestore 中的发布者信息,并使用 flutter 应用程序 - How to update the Information of publisher stored in firestore, and using a flutter app 如何使用 Firebase 身份验证保持用户登录 Flutter web 应用程序 - How to keep a user logged in Flutter web app using Firebase Authentication Firebase 深层链接的 APNS 推送通知结构 - APNS Push Notification Structure for Firebase Deep Links Flutter - 如何在 flutter 应用程序上实施新闻计数 - Flutter - How to implement News Count on a flutter app 如何使用 android 应用连接 Crashlytics - How to connect with Crashlytics with android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM