Skip to content

Commit

Permalink
some more renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Sep 12, 2024
1 parent 172684b commit 233dde4
Show file tree
Hide file tree
Showing 110 changed files with 1,036 additions and 934 deletions.
4 changes: 2 additions & 2 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ inputs:
description: The type of CI to run.
required: true
relay-endpoint:
description: 'The endpoint of the relay e.g. relay.walletconnect.com'
description: 'The endpoint of the relay e.g. relay.walletconnect.org'
required: false
default: 'wss://relay.walletconnect.com'
default: 'wss://relay.walletconnect.org'
project-id:
description: 'Reown project id'
required: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ on:
workflow_dispatch:
inputs:
relay-endpoint:
description: 'The endpoint of the relay e.g. relay.walletconnect.com'
description: 'The endpoint of the relay e.g. relay.walletconnect.org'
required: false
default: 'wss://relay.walletconnect.com'
default: 'wss://relay.walletconnect.org'
project-id:
description: 'Reown project id'
required: true
Expand Down
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ The communications protocol for web3, Reown brings the ecosystem together by ena

Reown is released under the Apache 2.0 license. [See LICENSE](/LICENSE) for details.

### Run
### Generate project dependencies

1. Run `sh scripts/generate_all.sh` in the root folder to generate dependencies.
2. Run `cd packages/reown_walletkit/example`
3. Run `flutter run --dart-define=PROJECT_ID=0123... --flavor internal --debug`
- Run `sh scripts/generate_all.sh` in the root folder to generate dependencies.

### Run WalletKit Sample

1. Run `cd packages/reown_walletkit/example`
2. Run `flutter run --dart-define=PROJECT_ID=0123... --flavor internal --debug`

You can add your own keys for testing purposes as follows:

Expand All @@ -33,3 +36,18 @@ You can add your own keys for testing purposes as follows:
`--dart-define=POLKADOT_MNEMONIC=your mnemonic phrase....`

`--dart-define=POLKADOT_ADDRESS=DbfmtKwL.........`

_NB: WalletKit sample is intended to be used just as an explanatory project_


### Run AppKit Sample

AppKit has two samples, `base`, which is made with `ReownAppKit` UI-less SDK, and `modal`, which is made with `ReownAppKitModal`

1. Run `cd packages/reown_appkit/example/base`
2. Run `flutter run --dart-define=PROJECT_ID=0123... --flavor internal --debug`

or

1. Run `cd packages/reown_appkit/example/modal`
2. Run `flutter run --dart-define=PROJECT_ID=0123... --debug`

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets('getPlatformVersion test', (WidgetTester tester) async {
// final AppKitModal plugin = AppKitModal();
// final ReownAppKitModal plugin = ReownAppKitModal();
// final String? version = await plugin.getPlatformVersion();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
Expand Down

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions packages/reown_appkit/example/modal/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MyHomePage extends StatefulWidget {

class _MyHomePageState extends State<MyHomePage> {
final overlay = OverlayController(const Duration(milliseconds: 200));
late AppKitModal _appKitModal;
late ReownAppKitModal _appKitModal;
late SIWESampleWebService _siweTestService;
bool _initialized = false;

Expand Down Expand Up @@ -212,15 +212,15 @@ class _MyHomePageState extends State<MyHomePage> {
final siweAuthValue = prefs.getBool('appkit_siwe_auth') ?? true;

// See https://docs.walletconnect.com/appkit/flutter/core/custom-chains
final eip155Chains = AppKitModalNetworks.supported['eip155']!;
final eip155Tests = AppKitModalNetworks.test['eip155']!;
AppKitModalNetworks.supported['eip155'] = [
final eip155Chains = ReownAppKitModalNetworks.supported['eip155']!;
final eip155Tests = ReownAppKitModalNetworks.test['eip155']!;
ReownAppKitModalNetworks.supported['eip155'] = [
...eip155Chains,
...eip155Tests,
];

try {
_appKitModal = AppKitModal(
_appKitModal = ReownAppKitModal(
context: context,
projectId: DartDefines.projectId,
logLevel: LogLevel.error,
Expand All @@ -245,7 +245,7 @@ class _MyHomePageState extends State<MyHomePage> {
// MORE WALLETS https://explorer.walletconnect.com/?type=wallet&chains=eip155%3A1
);
setState(() => _initialized = true);
} on AppKitModalException catch (e) {
} on ReownAppKitModalException catch (e) {
debugPrint('⛔️ ${e.message}');
return;
}
Expand Down Expand Up @@ -377,12 +377,12 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppKitModalTheme.colorsOf(context).background125,
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background125,
appBar: AppBar(
elevation: 0.0,
title: const Text(StringConstants.pageTitle),
backgroundColor: AppKitModalTheme.colorsOf(context).background175,
foregroundColor: AppKitModalTheme.colorsOf(context).foreground100,
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background175,
foregroundColor: ReownAppKitModalTheme.colorsOf(context).foreground100,
),
body: !_initialized
? const SizedBox.shrink()
Expand All @@ -400,7 +400,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
endDrawer: Drawer(
backgroundColor: AppKitModalTheme.colorsOf(context).background125,
backgroundColor: ReownAppKitModalTheme.colorsOf(context).background125,
child: DebugDrawer(
toggleOverlay: _toggleOverlay,
toggleBrightness: widget.toggleBrightness,
Expand Down Expand Up @@ -440,7 +440,7 @@ class _MyHomePageState extends State<MyHomePage> {

class _ButtonsView extends StatelessWidget {
const _ButtonsView({required this.appKit});
final AppKitModal appKit;
final ReownAppKitModal appKit;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -468,10 +468,10 @@ class _ButtonsView extends StatelessWidget {
// custom: ElevatedButton(
// onPressed: () {
// // TODO document openModalView
// // appKit.openModalView(AppKitModalQRCodePage());
// // appKit.openModalView(AppKitModalSelectNetworkPage());
// // appKit.openModalView(AppKitModalAllWalletsPage());
// // appKit.openModalView(AppKitModalMainWalletsPage());
// // appKit.openModalView(ReownAppKitModalQRCodePage());
// // appKit.openModalView(ReownAppKitModalSelectNetworkPage());
// // appKit.openModalView(ReownAppKitModalAllWalletsPage());
// // appKit.openModalView(ReownAppKitModalMainWalletsPage());
// },
// child: appKit.isConnected
// ? Text('${appKit.session!.address!.substring(0, 7)}...')
Expand All @@ -485,7 +485,7 @@ class _ButtonsView extends StatelessWidget {

class _ConnectedView extends StatelessWidget {
const _ConnectedView({required this.appKit});
final AppKitModal appKit;
final ReownAppKitModal appKit;

@override
Widget build(BuildContext context) {
Expand Down
12 changes: 6 additions & 6 deletions packages/reown_appkit/example/modal/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MyApp extends StatefulWidget {

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
bool _isDarkMode = false;
AppKitModalThemeData? _themeData;
ReownAppKitModalThemeData? _themeData;

@override
void initState() {
Expand Down Expand Up @@ -62,7 +62,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return AppKitModalTheme(
return ReownAppKitModalTheme(
isDarkMode: _isDarkMode,
themeData: _themeData,
child: MaterialApp(
Expand Down Expand Up @@ -96,8 +96,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
_isDarkMode = !_isDarkMode;
});

AppKitModalThemeData get _customTheme => AppKitModalThemeData(
lightColors: AppKitModalColors.lightMode.copyWith(
ReownAppKitModalThemeData get _customTheme => ReownAppKitModalThemeData(
lightColors: ReownAppKitModalColors.lightMode.copyWith(
accent100: const Color.fromARGB(255, 30, 59, 236),
background100: const Color.fromARGB(255, 161, 183, 231),
// Main Modal's background color
Expand All @@ -110,7 +110,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// Secondary Modal's text
foreground150: const Color.fromARGB(255, 22, 18, 19),
),
darkColors: AppKitModalColors.darkMode.copyWith(
darkColors: ReownAppKitModalColors.darkMode.copyWith(
accent100: const Color.fromARGB(255, 161, 183, 231),
background100: const Color.fromARGB(255, 30, 59, 236),
// Main Modal's background color
Expand All @@ -123,6 +123,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// Secondary Modal's text
foreground150: const Color.fromARGB(255, 233, 237, 236),
),
radiuses: AppKitModalRadiuses.square,
radiuses: ReownAppKitModalRadiuses.square,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum ChainType {
class ChainMetadata {
final Color color;
final ChainType type;
final AppKitModalNetworkInfo appKitNetworkInfo;
final ReownAppKitModalNetworkInfo appKitNetworkInfo;

const ChainMetadata({
required this.color,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class EIP155 {
}

static Future<dynamic> callMethod({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String topic,
required EIP155UIMethods method,
required String chainId,
Expand Down Expand Up @@ -120,7 +120,7 @@ class EIP155 {
}

static Future<dynamic> requestAccounts({
required AppKitModal appKit,
required ReownAppKitModal appKit,
}) async {
return await appKit.request(
topic: appKit.session!.topic,
Expand All @@ -133,7 +133,7 @@ class EIP155 {
}

static Future<dynamic> personalSign({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String message,
}) async {
final bytes = utf8.encode(message);
Expand All @@ -153,7 +153,7 @@ class EIP155 {
}

static Future<dynamic> ethSignTypedData({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String data,
}) async {
return await appKit.request(
Expand All @@ -170,7 +170,7 @@ class EIP155 {
}

static Future<dynamic> ethSignTypedDataV3({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String data,
}) async {
return await appKit.request(
Expand All @@ -187,7 +187,7 @@ class EIP155 {
}

static Future<dynamic> ethSignTypedDataV4({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String data,
}) async {
return await appKit.request(
Expand All @@ -204,7 +204,7 @@ class EIP155 {
}

static Future<dynamic> ethSendOrSignTransaction({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required Transaction transaction,
required EIP155UIMethods method,
}) async {
Expand All @@ -221,7 +221,7 @@ class EIP155 {
}

static Future<dynamic> walletWatchAsset({
required AppKitModal appKit,
required ReownAppKitModal appKit,
}) async {
return await appKit.request(
topic: appKit.session!.topic,
Expand All @@ -244,7 +244,7 @@ class EIP155 {

// Example of calling `transfer` function from AAVE token Smart Contract
static Future<dynamic> callTestSmartContract({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String action,
}) async {
// Create DeployedContract object using contract's ABI and address
Expand Down Expand Up @@ -327,7 +327,7 @@ class EIP155 {

// Example of calling `transfer` function from USDT token Smart Contract
static Future<dynamic> callUSDTSmartContract({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required String action,
}) async {
// Create DeployedContract object using contract's ABI and address
Expand Down Expand Up @@ -378,7 +378,7 @@ class EIP155 {
}

static Future<dynamic> _readSmartContract({
required AppKitModal appKit,
required ReownAppKitModal appKit,
required DeployedContract contract,
}) async {
final results = await Future.wait([
Expand Down
21 changes: 12 additions & 9 deletions packages/reown_appkit/example/modal/lib/utils/styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import 'package:flutter/material.dart';
import 'package:reown_appkit/reown_appkit.dart';

ButtonStyle buttonStyle(BuildContext context) {
final themeColors = AppKitModalTheme.colorsOf(context);
final themeColors = ReownAppKitModalTheme.colorsOf(context);
return ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(states) {
if (states.contains(MaterialState.disabled)) {
return AppKitModalTheme.colorsOf(context).background225;
return ReownAppKitModalTheme.colorsOf(context).background225;
}
return AppKitModalTheme.colorsOf(context).accent100;
return ReownAppKitModalTheme.colorsOf(context).accent100;
},
),
shape: MaterialStateProperty.resolveWith<RoundedRectangleBorder>(
Expand All @@ -24,25 +24,28 @@ ButtonStyle buttonStyle(BuildContext context) {
),
textStyle: MaterialStateProperty.resolveWith<TextStyle>(
(states) {
return AppKitModalTheme.getDataOf(context).textStyles.small600.copyWith(
return ReownAppKitModalTheme.getDataOf(context)
.textStyles
.small600
.copyWith(
color: (states.contains(MaterialState.disabled))
? AppKitModalTheme.colorsOf(context).foreground300
: AppKitModalTheme.colorsOf(context).inverse100,
? ReownAppKitModalTheme.colorsOf(context).foreground300
: ReownAppKitModalTheme.colorsOf(context).inverse100,
);
},
),
foregroundColor: MaterialStateProperty.resolveWith<Color>(
(states) {
return (states.contains(MaterialState.disabled))
? AppKitModalTheme.colorsOf(context).foreground300
: AppKitModalTheme.colorsOf(context).inverse100;
? ReownAppKitModalTheme.colorsOf(context).foreground300
: ReownAppKitModalTheme.colorsOf(context).inverse100;
},
),
);
}

BorderRadiusGeometry borderRadius(BuildContext context) {
final radiuses = AppKitModalTheme.radiusesOf(context);
final radiuses = ReownAppKitModalTheme.radiusesOf(context);
return radiuses.isSquare()
? const BorderRadius.all(Radius.zero)
: radiuses.isCircular()
Expand Down
Loading

0 comments on commit 233dde4

Please sign in to comment.