From f341c308dc09ac064f96d1a366d97d58b83703f6 Mon Sep 17 00:00:00 2001 From: Peter Anyaogu Date: Fri, 14 Jun 2024 17:40:55 +0100 Subject: [PATCH] surpport new version of web3_signers --- CHANGELOG.md | 5 ++ example/pubspec.lock | 10 ++-- lib/src/4337/factory.dart | 6 +-- lib/src/common/logger.dart | 98 -------------------------------------- lib/variance_dart.dart | 1 + pubspec.lock | 24 +++++----- pubspec.yaml | 14 +++--- 7 files changed, 33 insertions(+), 125 deletions(-) delete mode 100644 lib/src/common/logger.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 925052f..d0b7f10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.1.2 + +* Update web3-signers +* export logger from web3-signers + ## 0.1.1 * Remove chainId verification in the bundler provider diff --git a/example/pubspec.lock b/example/pubspec.lock index 436ebf2..ef71a61 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: blockchain_utils - sha256: b0d73432f145ba6f9299c362ea6d8ea9804d5422c34180abee7854b7adcb869d + sha256: "699d72427447814bd574b95b0d3baf9b2c0ec9c9b82deef3c6264c6f5efa4406" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "3.0.0" boolean_selector: dependency: transitive description: @@ -707,7 +707,7 @@ packages: path: ".." relative: true source: path - version: "0.1.0" + version: "0.1.2" vector_math: dependency: transitive description: @@ -744,10 +744,10 @@ packages: dependency: "direct main" description: name: web3_signers - sha256: a8f520f32e858cf482b1e04f38ccef225fe2b6ca2ccf56ed0c5a087b7f6c0701 + sha256: de57dbdde9bbaa3c503adb169b082f6342f502b7492420a7365d5fa979283ab0 url: "https://pub.dev" source: hosted - version: "0.0.7" + version: "0.0.12" web3dart: dependency: "direct main" description: diff --git a/lib/src/4337/factory.dart b/lib/src/4337/factory.dart index a1eac09..f049f40 100644 --- a/lib/src/4337/factory.dart +++ b/lib/src/4337/factory.dart @@ -179,9 +179,9 @@ class SmartWalletFactory implements SmartWalletFactoryBase { 'uint256' ], [ recoveryAddress ?? Constants.zeroAddress, - hexToBytes(pkp.credentialHex), - pkp.publicKey.item1.value, - pkp.publicKey.item2.value, + hexToBytes(pkp.authData.hexCredential), + pkp.authData.publicKey.item1.value, + pkp.authData.publicKey.item2.value, ]); final initCalldata = _p256Accountfactory.self diff --git a/lib/src/common/logger.dart b/lib/src/common/logger.dart deleted file mode 100644 index 8659048..0000000 --- a/lib/src/common/logger.dart +++ /dev/null @@ -1,98 +0,0 @@ -import 'dart:developer'; - -/// A class that provides logging functionality with colored output for warnings and errors. -class Logger { - /// The ANSI escape code for red color. - static final _errorColor = '\x1B[31m'; - - /// The ANSI escape code for yellow color. - static final _warningColor = '\x1B[33m'; - - /// The ANSI escape code to reset the color. - static final _resetColor = '\x1B[0m'; - - /// Logs an error message if a condition is met. - /// - /// [condition] is the condition to check. - /// [message] is the error message to be logged if the condition is true. - /// [error] is an optional error object associated with the error message. - /// [stackTrace] is an optional stack trace associated with the error message. - static void conditionalError(bool condition, String message, - [Object? error, StackTrace? stackTrace]) { - if (condition) { - _logError('ERROR', _errorColor, message, error, stackTrace); - } - } - - /// Logs a warning message if a condition is met. - /// - /// [condition] is the condition to check. - /// [message] is the warning message to be logged if the condition is true. - static void conditionalWarning(bool condition, String message) { - if (condition) { - _logMessage('WARNING', _warningColor, message); - } - } - - /// Logs an error message. - /// - /// [message] is the error message to be logged. - /// [error] is an optional error object associated with the error message. - /// [stackTrace] is an optional stack trace associated with the error message. - static void error(String message, [Object? error, StackTrace? stackTrace]) { - _logError('ERROR', _errorColor, message, error, stackTrace); - } - - /// Logs a warning message. - /// - /// [message] is the warning message to be logged. - static void warning(String message) { - _logMessage('WARNING', _warningColor, message); - } - - /// Logs a message with the specified level, color, and timestamp. - /// - /// [level] is the log level (e.g., WARNING, ERROR). - /// [color] is the ANSI escape code for the color. - /// [message] is the message to be logged. - static void _log(String level, String color, String message) { - final now = DateTime.now(); - final formattedTime = '${now.year.toString().padLeft(4, '0')}-' - '${now.month.toString().padLeft(2, '0')}-' - '${now.day.toString().padLeft(2, '0')} ' - '${now.hour.toString().padLeft(2, '0')}:' - '${now.minute.toString().padLeft(2, '0')}:' - '${now.second.toString().padLeft(2, '0')}'; - - final logMessage = '$formattedTime [$color$level$_resetColor] $message'; - log(logMessage); - } - - /// Logs an error message with additional error and stack trace information. - /// - /// [level] is the log level (e.g., WARNING, ERROR). - /// [color] is the ANSI escape code for the color. - /// [message] is the error message to be logged. - /// [error] is an optional error object associated with the error message. - /// [stackTrace] is an optional stack trace associated with the error message. - static void _logError(String level, String color, String message, - [Object? error, StackTrace? stackTrace]) { - String errorMessage = message; - if (error != null) { - errorMessage += '\nError: $error'; - } - if (stackTrace != null) { - errorMessage += '\nStackTrace: $stackTrace'; - } - _log(level, color, errorMessage); - } - - /// Logs a message with the specified level and color. - /// - /// [level] is the log level (e.g., WARNING, ERROR). - /// [color] is the ANSI escape code for the color. - /// [message] is the message to be logged. - static void _logMessage(String level, String color, String message) { - _log(level, color, message); - } -} diff --git a/lib/variance_dart.dart b/lib/variance_dart.dart index 4f72856..ceae157 100644 --- a/lib/variance_dart.dart +++ b/lib/variance_dart.dart @@ -13,6 +13,7 @@ import 'package:web3dart/web3dart.dart'; import 'src/abis/abis.dart'; import 'src/interfaces/interfaces.dart'; +export 'package:web3_signers/web3_signers.dart' show Logger; export 'src/abis/abis.dart' show ContractAbis; part 'src/4337/chains.dart'; diff --git a/pubspec.lock b/pubspec.lock index a799288..9f17a7d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: blockchain_utils - sha256: b0d73432f145ba6f9299c362ea6d8ea9804d5422c34180abee7854b7adcb869d + sha256: "699d72427447814bd574b95b0d3baf9b2c0ec9c9b82deef3c6264c6f5efa4406" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "3.0.0" boolean_selector: dependency: transitive description: @@ -93,10 +93,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "1414d6d733a85d8ad2f1dfcb3ea7945759e35a123cb99ccfac75d0758f75edfa" + sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" url: "https://pub.dev" source: hosted - version: "2.4.10" + version: "2.4.11" build_runner_core: dependency: transitive description: @@ -234,10 +234,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "4.0.0" flutter_web_plugins: dependency: transitive description: flutter @@ -335,10 +335,10 @@ packages: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" logging: dependency: transitive description: @@ -660,10 +660,10 @@ packages: dependency: "direct main" description: name: web3_signers - sha256: a8f520f32e858cf482b1e04f38ccef225fe2b6ca2ccf56ed0c5a087b7f6c0701 + sha256: de57dbdde9bbaa3c503adb169b082f6342f502b7492420a7365d5fa979283ab0 url: "https://pub.dev" source: hosted - version: "0.0.7" + version: "0.0.12" web3dart: dependency: "direct main" description: @@ -676,10 +676,10 @@ packages: dependency: "direct dev" description: name: web3dart_builders - sha256: "19593770eb7a45a72087c7e3a0e1185ff58cc8827a68114eef6ed265e2ee9b54" + sha256: "8a7f62ae5c348741ad829aa5e4599ff482a128210dff620a6ee3f895db9c0db8" url: "https://pub.dev" source: hosted - version: "0.0.7" + version: "0.1.2" web_socket: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 85a7fa9..5d76728 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: variance_dart description: An Account Abstraction (4337) Development kit, for quickly building mobile web3 apps and smart wallets. -version: 0.1.1 +version: 0.1.2 documentation: https://docs.variance.space homepage: https://variance.space repository: https://github.com/vaariance/variance-dart @@ -18,14 +18,14 @@ platforms: dependencies: flutter: sdk: flutter - web3dart: ^2.7.2 - http: ^1.1.0 - web3_signers: ^0.0.7 + web3dart: ^2.7.3 + http: ^1.2.0 + web3_signers: ^0.0.12 dev_dependencies: - web3dart_builders: ^0.0.7 - build_runner: ^2.4.6 - flutter_lints: ^3.0.0 + web3dart_builders: ^0.1.2 + build_runner: ^2.4.11 + flutter_lints: ^4.0.0 mockito: ^5.4.2 topics: