[英]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_links和url_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.