solana_wallet_provider

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

solana wallet provider

Provides access to solana_web3 and solana_wallet_adapter in the widget tree and creates UI wrappers around Mobile Wallet Adapter Specification method calls.



Solana Wallet Provider Example App

API #

connect - authorizes the application with an available wallet or presents a list of download options.
disconnect - presents the authorized accounts and a disconnect button to deauthorize the application.
signTransactions - signs transactions with the authorized account.
signAndSendTransactions - signs transactions with the authorized account then broadcasts them to the network.
signMessages - signs messages with the authorized account.


Convenience Widget #

SolanaWalletButton - A button widget that toggles authorization of the application with a wallet.


Dapp Identity Verification #
Wallet endpoints will use your AppIdentity information to decide whether to extend trust to your dapp.
AppIdentity(
uri: Uri.parse('https://<YOUR_DOMAIN>'),
icon: Uri.parse('favicon.png'),
name: '<APP_NAME>'
)
copied to clipboard
Android Setup #

Get your application id.

// FILE: /android/app/build.gradle
defaultConfig {
applicationId "<APPLICATION_ID>"
}
copied to clipboard

Generate your application's sha256 fingerprint.

$ cd android
$ ./gradlew app:signingReport

// Output:
// ...
// SHA-256: <SHA256_FINGERPRINT>
// ...
copied to clipboard

Host a Digital Asset Links file with the following contents:

// GET: https:://<YOUR_DOMAIN>/.well-known/assetlinks.json
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "<APPLICATION_ID>",
"sha256_cert_fingerprints": ["<SHA256_FINGERPRINT>"]
}
}]
copied to clipboard

Theme #
Add SolanaWalletThemeExtension as a ThemeData extension to customize the provider's appearance.
ThemeData(
extensions: const [
SolanaWalletThemeExtension(
cardTheme: SolanaWalletCardTheme(
color: Colors.indigo,
),
),
],
);
copied to clipboard

Example: Connect #
Uses the provider to authorize the application with a Solana wallet.
import 'package:flutter/material.dart';
import 'package:solana_wallet_provider/solana_wallet_provider.dart';

void main() {
runApp(const App());
}

class App extends StatelessWidget {
const App({super.key});
@override
Widget build(final BuildContext context) {
// 1. Wrap application with SolanaWalletProvider.
return SolanaWalletProvider.create(
identity: const AppIdentity(),
child: MaterialApp(
home: Scaffold(
body: FutureBuilder(
// 2. Initialize SolanaWalletProvider before use.
future: SolanaWalletProvider.initialize(),
builder: ((context, snapshot) {
// 3. Access SolanaWalletProvider.
final provider = SolanaWalletProvider.of(context);
return TextButton(
onPressed: () => provider.connect(context),
child: const Center(
child: Text('Example App'),
),
);
}),
),
),
),
);
}
}
copied to clipboard

Bugs #
Report a bug by opening an issue.
Feature Requests #
Request a feature by raising a ticket.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.