diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..883a09b Binary files /dev/null and b/.DS_Store differ diff --git a/hello_world/.metadata b/hello_world/.metadata index fd70cab..3c3e4b5 100644 --- a/hello_world/.metadata +++ b/hello_world/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b + revision: 5464c5bac742001448fe4fc0597be939379f88ea channel: stable project_type: app diff --git a/hello_world/README.md b/hello_world/README.md index 9871acf..521d2a5 100644 --- a/hello_world/README.md +++ b/hello_world/README.md @@ -1,15 +1,16 @@ - +# hello_world -# Project 1 -## Hello World (Flutter + Blockchain) -A basic blockchain and flutter based project. +A new Flutter project. -| | | -|----------------------------------------------------------|:----------------------------------------------------:| -| | | - - +## Getting Started ---- +This project is a starting point for a Flutter application. -For tutorial of Hello World Dapp check [https://aniketambore.netlify.app/Developement/hello_world_dapp/](https://aniketambore.netlify.app/Developement/hello_world_dapp/) +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/hello_world/analysis_options.yaml b/hello_world/analysis_options.yaml index 61b6c4d..ad58b88 100644 --- a/hello_world/analysis_options.yaml +++ b/hello_world/analysis_options.yaml @@ -7,23 +7,7 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml - +include: package:very_good_analysis/analysis_options.2.4.0.yaml linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options + public_member_api_docs: false diff --git a/hello_world/android/build.gradle b/hello_world/android/build.gradle index 24047dc..4256f91 100644 --- a/hello_world/android/build.gradle +++ b/hello_world/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.10' repositories { google() mavenCentral() diff --git a/hello_world/contracts/HelloWorld.sol b/hello_world/contracts/HelloWorld.sol index 2d7f927..df16490 100644 --- a/hello_world/contracts/HelloWorld.sol +++ b/hello_world/contracts/HelloWorld.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: MIT -pragma solidity >=0.4.16 <0.9.0 ; + +pragma solidity ^0.8.7; contract HelloWorld { - string public yourName ; + string public yourName; - constructor(){ - yourName = "Unknown" ; + constructor() { + yourName = "Unknown"; } - function setName(string memory name) public { - yourName = name; + function setName(string memory nm) public{ + yourName = nm; } - -} \ No newline at end of file +} diff --git a/hello_world/ios/Runner/Info.plist b/hello_world/ios/Runner/Info.plist index ec54cb2..7f37405 100644 --- a/hello_world/ios/Runner/Info.plist +++ b/hello_world/ios/Runner/Info.plist @@ -42,6 +42,6 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + diff --git a/hello_world/lib/contract_linking.dart b/hello_world/lib/contract_linking.dart index 1a80e33..6d2ca8a 100644 --- a/hello_world/lib/contract_linking.dart +++ b/hello_world/lib/contract_linking.dart @@ -1,82 +1,89 @@ +// ignore_for_file: public_member_api_docs + +import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:http/http.dart'; -import 'package:dart_web3/dart_web3.dart'; +import 'package:http/http.dart' as http; +import 'package:web3dart/web3dart.dart'; import 'package:web_socket_channel/io.dart'; class ContractLinking extends ChangeNotifier { - final String _rpcURl = "http://10.0.2.2:7545"; - final String _wsURl = "ws://10.0.2.2:7545/"; + ContractLinking() { + initialSetup(); + } + + final String _rpcUrl = 'http://127.0.0.1:7545'; + final String _wsUrl = 'ws://10.0.2.2:7545/'; final String _privateKey = - "a3a3229cdc4e6cc94e79c7f5d34f2e7d761fc4116707e82b0e6bbe296b51c153"; + 'f7c4e01b7af6c36ef6f50d21926f2e90c5f0305350e6a74b6bdc8d0c27693270'; + bool isLoading = true; late Web3Client _client; late String _abiCode; - late EthereumAddress _contractAddress; late Credentials _credentials; - late DeployedContract _contract; late ContractFunction _yourName; late ContractFunction _setName; + late String deployedName; - bool isLoading = true; - String? deployedName; - - ContractLinking() { - initialSetup(); - } - - initialSetup() async { + Future initialSetup() async { // establish a connection to the ethereum rpc node. The socketConnector // property allows more efficient event streams over websocket instead of // http-polls. However, the socketConnector property is experimental. - _client = Web3Client(_rpcURl, Client(), socketConnector: () { - return IOWebSocketChannel.connect(_wsURl).cast(); - }); + _client = Web3Client( + _rpcUrl, + http.Client(), + socketConnector: () { + return IOWebSocketChannel.connect(_wsUrl).cast(); + }, + ); await getAbi(); - await getCredentials(); + getCredentials(); await getDeployedContract(); } Future getAbi() async { // Reading the contract abi - String abiStringFile = - await rootBundle.loadString("src/artifacts/HelloWorld.json"); - var jsonAbi = jsonDecode(abiStringFile); - _abiCode = jsonEncode(jsonAbi["abi"]); - // print(_abiCode); - - _contractAddress = - EthereumAddress.fromHex(jsonAbi["networks"]["5777"]["address"]); - // print(_contractAddress); + final abiStringFile = + await rootBundle.loadString('src/artifacts/HelloWorld.json'); + final jsonAbi = jsonDecode(abiStringFile) as Map; + _abiCode = jsonEncode(jsonAbi['abi']); + + _contractAddress = EthereumAddress.fromHex( + // ignore: avoid_dynamic_calls + jsonAbi['networks']['5777']['address'] as String, + ); } - Future getCredentials() async { + void getCredentials() { _credentials = EthPrivateKey.fromHex(_privateKey); - // print(_credentials); } Future getDeployedContract() async { // Telling Web3dart where our contract is declared. _contract = DeployedContract( - ContractAbi.fromJson(_abiCode, "HelloWorld"), _contractAddress); + ContractAbi.fromJson(_abiCode, 'HelloWorld'), + _contractAddress, + ); // Extracting the functions, declared in contract. - _yourName = _contract.function("yourName"); - _setName = _contract.function("setName"); - getName(); + _yourName = _contract.function('yourName'); + _setName = _contract.function('setName'); + await getName(); } Future getName() async { // Getting the current name declared in the smart contract. - var currentName = await _client - .call(contract: _contract, function: _yourName, params: []); - // print(currentName); - deployedName = currentName[0]; + final currentName = await _client.call( + contract: _contract, + function: _yourName, + params: [], + ); + deployedName = currentName[0] as String; isLoading = false; notifyListeners(); } @@ -86,15 +93,13 @@ class ContractLinking extends ChangeNotifier { isLoading = true; notifyListeners(); await _client.sendTransaction( - _credentials, - Transaction.callContract( - contract: _contract, - function: _setName, - parameters: [nameToSet], - // gasPrice: EtherAmount.inWei(BigInt.one), - // maxGas: 100000, - // value: EtherAmount.fromUnitAndValue(EtherUnit.ether, 1), - )); - getName(); + _credentials, + Transaction.callContract( + contract: _contract, + function: _setName, + parameters: [nameToSet], + ), + ); + await getName(); } } diff --git a/hello_world/lib/hello.dart b/hello_world/lib/hello.dart new file mode 100644 index 0000000..c418728 --- /dev/null +++ b/hello_world/lib/hello.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; +import 'package:hello_world/contract_linking.dart'; +import 'package:provider/provider.dart'; + +class Hello extends StatelessWidget { + const Hello({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // Getting the value and object or contract_linking + final contractLink = Provider.of(context); + final yourNameController = TextEditingController(); + + return Scaffold( + appBar: AppBar( + title: const Text('Hello World !'), + centerTitle: true, + ), + body: Container( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Center( + child: contractLink.isLoading + ? const CircularProgressIndicator() + : SingleChildScrollView( + child: Form( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Flexible( + child: Text( + 'Hello ', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 32, + ), + ), + ), + Flexible( + child: Text( + contractLink.deployedName, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 32, + color: Colors.tealAccent, + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 29), + child: TextFormField( + controller: yourNameController, + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Your Name', + hintText: 'What is your name ?', + icon: Icon(Icons.drive_file_rename_outline), + ), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 30), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Colors.green, + ), + onPressed: () { + contractLink.setName(yourNameController.text); + yourNameController.clear(); + }, + child: const Text( + 'Set Name', + style: TextStyle(fontSize: 30), + ), + ), + ) + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/hello_world/lib/main.dart b/hello_world/lib/main.dart index 075cef2..a9631d8 100644 --- a/hello_world/lib/main.dart +++ b/hello_world/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hello_world/contract_linking.dart'; +import 'package:hello_world/hello.dart'; import 'package:provider/provider.dart'; void main() { @@ -9,106 +10,21 @@ void main() { class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); - ThemeData _buildAppTheme() { - final ThemeData base = ThemeData.dark(); - return base.copyWith( - brightness: Brightness.dark, - textTheme: const TextTheme( - headline1: TextStyle(fontSize: 72, fontWeight: FontWeight.bold), - )); - } - @override Widget build(BuildContext context) { - return ChangeNotifierProvider( + // Inserting Provider as a parent of HelloUI() + return ChangeNotifierProvider( create: (_) => ContractLinking(), child: MaterialApp( - title: 'Hello World Dapp', - theme: _buildAppTheme(), - home: const HelloWorld()), - ); - } -} - -class HelloWorld extends StatefulWidget { - const HelloWorld({Key? key}) : super(key: key); - - @override - State createState() => _HelloWorldState(); -} - -class _HelloWorldState extends State { - TextEditingController yourNameController = TextEditingController(); - - @override - Widget build(BuildContext context) { - // Getting the value and object or contract_linking - var contractLink = Provider.of(context); - - return Scaffold( - appBar: AppBar( - title: const Text("Hello World !"), - centerTitle: true, - ), - body: Container( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Center( - child: contractLink.isLoading - ? const CircularProgressIndicator() - : SingleChildScrollView( - child: Form( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "Hello ", - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 52), - ), - Text( - contractLink.deployedName!, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 52, - color: Colors.tealAccent), - ), - ], - ), - Padding( - padding: const EdgeInsets.only(top: 29), - child: TextFormField( - controller: yourNameController, - decoration: const InputDecoration( - border: OutlineInputBorder(), - labelText: "Your Name", - hintText: "What is your name ?", - icon: Icon(Icons.drive_file_rename_outline)), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 30), - child: ElevatedButton( - child: const Text( - 'Set Name', - style: TextStyle(fontSize: 30), - ), - style: ElevatedButton.styleFrom( - primary: Colors.green, - ), - onPressed: () async { - await contractLink - .setName(yourNameController.text); - yourNameController.clear(); - }, - ), - ) - ], - ), - ), - ), + title: 'Hello World', + theme: ThemeData( + colorScheme: ColorScheme.fromSwatch().copyWith( + secondary: Colors.deepOrange[200], + brightness: Brightness.dark, + primary: Colors.cyan[400], + ), ), + home: const Hello(), ), ); } diff --git a/hello_world/macos/.gitignore b/hello_world/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/hello_world/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/hello_world/macos/Flutter/Flutter-Debug.xcconfig b/hello_world/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/hello_world/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/hello_world/macos/Flutter/Flutter-Release.xcconfig b/hello_world/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/hello_world/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/hello_world/macos/Flutter/GeneratedPluginRegistrant.swift b/hello_world/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..cccf817 --- /dev/null +++ b/hello_world/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/hello_world/macos/Runner.xcodeproj/project.pbxproj b/hello_world/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..849acf3 --- /dev/null +++ b/hello_world/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,572 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* hello_world.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "hello_world.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* hello_world.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* hello_world.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/hello_world/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/hello_world/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/hello_world/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/hello_world/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/hello_world/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..0c4e30b --- /dev/null +++ b/hello_world/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hello_world/macos/Runner.xcworkspace/contents.xcworkspacedata b/hello_world/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/hello_world/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/hello_world/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/hello_world/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/hello_world/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/hello_world/macos/Runner/AppDelegate.swift b/hello_world/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..d53ef64 --- /dev/null +++ b/hello_world/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..3c4935a Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..ed4cc16 Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..483be61 Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bcbf36d Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..9c0a652 Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..e71a726 Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..8a31fe2 Binary files /dev/null and b/hello_world/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/hello_world/macos/Runner/Base.lproj/MainMenu.xib b/hello_world/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/hello_world/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hello_world/macos/Runner/Configs/AppInfo.xcconfig b/hello_world/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..69d22db --- /dev/null +++ b/hello_world/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = hello_world + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.helloWorld + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. diff --git a/hello_world/macos/Runner/Configs/Debug.xcconfig b/hello_world/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/hello_world/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/hello_world/macos/Runner/Configs/Release.xcconfig b/hello_world/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/hello_world/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/hello_world/macos/Runner/Configs/Warnings.xcconfig b/hello_world/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/hello_world/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/hello_world/macos/Runner/DebugProfile.entitlements b/hello_world/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/hello_world/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/hello_world/macos/Runner/Info.plist b/hello_world/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/hello_world/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/hello_world/macos/Runner/MainFlutterWindow.swift b/hello_world/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..2722837 --- /dev/null +++ b/hello_world/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController.init() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/hello_world/macos/Runner/Release.entitlements b/hello_world/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/hello_world/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/hello_world/migrations/2_deploy_contracts.js b/hello_world/migrations/2_deploy_contracts.js index 8f90109..11c4a7f 100644 --- a/hello_world/migrations/2_deploy_contracts.js +++ b/hello_world/migrations/2_deploy_contracts.js @@ -1,5 +1,5 @@ const HelloWorld = artifacts.require("HelloWorld"); module.exports = function (deployer) { - deployer.deploy(HelloWorld); + deployer.deploy(HelloWorld); }; diff --git a/hello_world/pubspec.lock b/hello_world/pubspec.lock index 469462c..2f144c9 100644 --- a/hello_world/pubspec.lock +++ b/hello_world/pubspec.lock @@ -7,21 +7,21 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "34.0.0" + version: "39.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "3.2.0" + version: "4.0.0" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.1" async: dependency: transitive description: @@ -42,7 +42,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "2.3.0" build_config: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.1.4" + version: "8.3.0" characters: dependency: transitive description: @@ -85,13 +85,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.5" clock: dependency: transitive description: @@ -126,7 +119,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" cupertino_icons: dependency: "direct main" description: @@ -140,14 +133,7 @@ packages: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" - dart_web3: - dependency: "direct main" - description: - name: dart_web3 - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.3" + version: "2.2.3" fake_async: dependency: transitive description: @@ -168,7 +154,7 @@ packages: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" flutter: dependency: "direct main" description: flutter @@ -213,14 +199,14 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "4.5.0" json_rpc_2: dependency: transitive description: @@ -249,6 +235,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: @@ -283,7 +276,7 @@ packages: name: pointycastle url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.6.0" provider: dependency: "direct main" description: @@ -297,7 +290,7 @@ packages: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" pubspec_parse: dependency: transitive description: @@ -358,7 +351,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.8" typed_data: dependency: transitive description: @@ -372,7 +365,7 @@ packages: name: uuid url: "https://pub.dartlang.org" source: hosted - version: "3.0.5" + version: "3.0.6" vector_math: dependency: transitive description: @@ -380,6 +373,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + very_good_analysis: + dependency: "direct main" + description: + name: very_good_analysis + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" watcher: dependency: transitive description: @@ -387,20 +387,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" + web3dart: + dependency: "direct main" + description: + name: web3dart + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.5" web_socket_channel: dependency: "direct main" description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.0" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.1.1" sdks: - dart: ">=2.15.1 <3.0.0" + dart: ">=2.16.2 <3.0.0" flutter: ">=1.16.0" diff --git a/hello_world/pubspec.yaml b/hello_world/pubspec.yaml index 39e7f6c..58501c7 100644 --- a/hello_world/pubspec.yaml +++ b/hello_world/pubspec.yaml @@ -1,21 +1,20 @@ name: hello_world description: A new Flutter project. - publish_to: 'none' - version: 1.0.0+1 environment: - sdk: ">=2.15.1 <3.0.0" + sdk: ">=2.16.2 <3.0.0" dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 provider: ^6.0.2 + web3dart: ^2.3.5 http: ^0.13.4 - web_socket_channel: ^2.1.0 - dart_web3: ^0.0.3 + very_good_analysis: ^2.4.0 + web_socket_channel: ^2.2.0 dev_dependencies: flutter_test: @@ -24,5 +23,19 @@ dev_dependencies: flutter: uses-material-design: true + + # To add assets to your application, add an assets section, like this: assets: - - src/artifacts/HelloWorld.json \ No newline at end of file + - src/artifacts/HelloWorld.json + + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 diff --git a/hello_world/src/artifacts/HelloWorld.json b/hello_world/src/artifacts/HelloWorld.json index 46eaf70..e6f65c0 100644 --- a/hello_world/src/artifacts/HelloWorld.json +++ b/hello_world/src/artifacts/HelloWorld.json @@ -24,7 +24,7 @@ "inputs": [ { "internalType": "string", - "name": "name", + "name": "nm", "type": "string" } ], @@ -34,9 +34,9 @@ "type": "function" } ], - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"yourName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/HelloWorld.sol\":\"HelloWorld\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/HelloWorld.sol\":{\"keccak256\":\"0x4e1abe3d01a36be648f4cd71cb07d17419ca44ffdb443439f1776c289c030238\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ef5716ae28c31f876adebc3fd020050736be61e742879c67a3511bb022559563\",\"dweb:/ipfs/QmVGUJKf6rMvkV3ZKuRDmPTyBAo2qVxaVuigDMYup1NHUg\"]}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040518060400160405280600781526020017f556e6b6e6f776e000000000000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610166565b82805461006e90610134565b90600052602060002090601f01602090048101928261009057600085556100d7565b82601f106100a957805160ff19168380011785556100d7565b828001600101855582156100d7579182015b828111156100d65782518255916020019190600101906100bb565b5b5090506100e491906100e8565b5090565b5b808211156101015760008160009055506001016100e9565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061014c57607f821691505b602082108114156101605761015f610105565b5b50919050565b6104c1806101756000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063c47f002714610058578063d97d663014610074575b600080fd5b610072600480360381019061006d9190610337565b610092565b005b61007c6100ac565b6040516100899190610408565b60405180910390f35b80600090805190602001906100a892919061013a565b5050565b600080546100b990610459565b80601f01602080910402602001604051908101604052809291908181526020018280546100e590610459565b80156101325780601f1061010757610100808354040283529160200191610132565b820191906000526020600020905b81548152906001019060200180831161011557829003601f168201915b505050505081565b82805461014690610459565b90600052602060002090601f01602090048101928261016857600085556101af565b82601f1061018157805160ff19168380011785556101af565b828001600101855582156101af579182015b828111156101ae578251825591602001919060010190610193565b5b5090506101bc91906101c0565b5090565b5b808211156101d95760008160009055506001016101c1565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610244826101fb565b810181811067ffffffffffffffff821117156102635761026261020c565b5b80604052505050565b60006102766101dd565b9050610282828261023b565b919050565b600067ffffffffffffffff8211156102a2576102a161020c565b5b6102ab826101fb565b9050602081019050919050565b82818337600083830152505050565b60006102da6102d584610287565b61026c565b9050828152602081018484840111156102f6576102f56101f6565b5b6103018482856102b8565b509392505050565b600082601f83011261031e5761031d6101f1565b5b813561032e8482602086016102c7565b91505092915050565b60006020828403121561034d5761034c6101e7565b5b600082013567ffffffffffffffff81111561036b5761036a6101ec565b5b61037784828501610309565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103ba57808201518184015260208101905061039f565b838111156103c9576000848401525b50505050565b60006103da82610380565b6103e4818561038b565b93506103f481856020860161039c565b6103fd816101fb565b840191505092915050565b6000602082019050818103600083015261042281846103cf565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061047157607f821691505b602082108114156104855761048461042a565b5b5091905056fea2646970667358221220ea8214b11a5c7922800f9e597e779cb6b8e59e6f5d4bd873868ac1a65e952b5164736f6c634300080b0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063c47f002714610058578063d97d663014610074575b600080fd5b610072600480360381019061006d9190610337565b610092565b005b61007c6100ac565b6040516100899190610408565b60405180910390f35b80600090805190602001906100a892919061013a565b5050565b600080546100b990610459565b80601f01602080910402602001604051908101604052809291908181526020018280546100e590610459565b80156101325780601f1061010757610100808354040283529160200191610132565b820191906000526020600020905b81548152906001019060200180831161011557829003601f168201915b505050505081565b82805461014690610459565b90600052602060002090601f01602090048101928261016857600085556101af565b82601f1061018157805160ff19168380011785556101af565b828001600101855582156101af579182015b828111156101ae578251825591602001919060010190610193565b5b5090506101bc91906101c0565b5090565b5b808211156101d95760008160009055506001016101c1565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610244826101fb565b810181811067ffffffffffffffff821117156102635761026261020c565b5b80604052505050565b60006102766101dd565b9050610282828261023b565b919050565b600067ffffffffffffffff8211156102a2576102a161020c565b5b6102ab826101fb565b9050602081019050919050565b82818337600083830152505050565b60006102da6102d584610287565b61026c565b9050828152602081018484840111156102f6576102f56101f6565b5b6103018482856102b8565b509392505050565b600082601f83011261031e5761031d6101f1565b5b813561032e8482602086016102c7565b91505092915050565b60006020828403121561034d5761034c6101e7565b5b600082013567ffffffffffffffff81111561036b5761036a6101ec565b5b61037784828501610309565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103ba57808201518184015260208101905061039f565b838111156103c9576000848401525b50505050565b60006103da82610380565b6103e4818561038b565b93506103f481856020860161039c565b6103fd816101fb565b840191505092915050565b6000602082019050818103600083015261042281846103cf565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061047157607f821691505b602082108114156104855761048461042a565b5b5091905056fea2646970667358221220ea8214b11a5c7922800f9e597e779cb6b8e59e6f5d4bd873868ac1a65e952b5164736f6c634300080b0033", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"nm\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"yourName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/HelloWorld.sol\":\"HelloWorld\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/HelloWorld.sol\":{\"keccak256\":\"0xc0b72586b6983c4a64d3ca232be7e710e166620129da4ff8aef9d1aadfbe9a3d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1ee991e8843a199f84915d3802c6842973c00f50a4cb7a63954ac5b4220c173\",\"dweb:/ipfs/QmR67ax5bQSc2KWkWP5oYc8of12NfzPjogPERtEb3hpqvS\"]}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040518060400160405280600781526020017f556e6b6e6f776e000000000000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610165565b82805461006e90610134565b90600052602060002090601f01602090048101928261009057600085556100d7565b82601f106100a957805160ff19168380011785556100d7565b828001600101855582156100d7579182015b828111156100d65782518255916020019190600101906100bb565b5b5090506100e491906100e8565b5090565b5b808211156101015760008160009055506001016100e9565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061014c57607f821691505b60208210810361015f5761015e610105565b5b50919050565b6104c0806101746000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063c47f002714610058578063d97d663014610074575b600080fd5b610072600480360381019061006d9190610337565b610092565b005b61007c6100ac565b6040516100899190610408565b60405180910390f35b80600090805190602001906100a892919061013a565b5050565b600080546100b990610459565b80601f01602080910402602001604051908101604052809291908181526020018280546100e590610459565b80156101325780601f1061010757610100808354040283529160200191610132565b820191906000526020600020905b81548152906001019060200180831161011557829003601f168201915b505050505081565b82805461014690610459565b90600052602060002090601f01602090048101928261016857600085556101af565b82601f1061018157805160ff19168380011785556101af565b828001600101855582156101af579182015b828111156101ae578251825591602001919060010190610193565b5b5090506101bc91906101c0565b5090565b5b808211156101d95760008160009055506001016101c1565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610244826101fb565b810181811067ffffffffffffffff821117156102635761026261020c565b5b80604052505050565b60006102766101dd565b9050610282828261023b565b919050565b600067ffffffffffffffff8211156102a2576102a161020c565b5b6102ab826101fb565b9050602081019050919050565b82818337600083830152505050565b60006102da6102d584610287565b61026c565b9050828152602081018484840111156102f6576102f56101f6565b5b6103018482856102b8565b509392505050565b600082601f83011261031e5761031d6101f1565b5b813561032e8482602086016102c7565b91505092915050565b60006020828403121561034d5761034c6101e7565b5b600082013567ffffffffffffffff81111561036b5761036a6101ec565b5b61037784828501610309565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103ba57808201518184015260208101905061039f565b838111156103c9576000848401525b50505050565b60006103da82610380565b6103e4818561038b565b93506103f481856020860161039c565b6103fd816101fb565b840191505092915050565b6000602082019050818103600083015261042281846103cf565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061047157607f821691505b6020821081036104845761048361042a565b5b5091905056fea26469706673582212206957246afafed15af5ea9c7630e10bf15df541d895fc80395ea5da43f7ac729664736f6c634300080d0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b5060043610610053576000357c010000000000000000000000000000000000000000000000000000000090048063c47f002714610058578063d97d663014610074575b600080fd5b610072600480360381019061006d9190610337565b610092565b005b61007c6100ac565b6040516100899190610408565b60405180910390f35b80600090805190602001906100a892919061013a565b5050565b600080546100b990610459565b80601f01602080910402602001604051908101604052809291908181526020018280546100e590610459565b80156101325780601f1061010757610100808354040283529160200191610132565b820191906000526020600020905b81548152906001019060200180831161011557829003601f168201915b505050505081565b82805461014690610459565b90600052602060002090601f01602090048101928261016857600085556101af565b82601f1061018157805160ff19168380011785556101af565b828001600101855582156101af579182015b828111156101ae578251825591602001919060010190610193565b5b5090506101bc91906101c0565b5090565b5b808211156101d95760008160009055506001016101c1565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610244826101fb565b810181811067ffffffffffffffff821117156102635761026261020c565b5b80604052505050565b60006102766101dd565b9050610282828261023b565b919050565b600067ffffffffffffffff8211156102a2576102a161020c565b5b6102ab826101fb565b9050602081019050919050565b82818337600083830152505050565b60006102da6102d584610287565b61026c565b9050828152602081018484840111156102f6576102f56101f6565b5b6103018482856102b8565b509392505050565b600082601f83011261031e5761031d6101f1565b5b813561032e8482602086016102c7565b91505092915050565b60006020828403121561034d5761034c6101e7565b5b600082013567ffffffffffffffff81111561036b5761036a6101ec565b5b61037784828501610309565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156103ba57808201518184015260208101905061039f565b838111156103c9576000848401525b50505050565b60006103da82610380565b6103e4818561038b565b93506103f481856020860161039c565b6103fd816101fb565b840191505092915050565b6000602082019050818103600083015261042281846103cf565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061047157607f821691505b6020821081036104845761048361042a565b5b5091905056fea26469706673582212206957246afafed15af5ea9c7630e10bf15df541d895fc80395ea5da43f7ac729664736f6c634300080d0033", "immutableReferences": {}, "generatedSources": [ { @@ -3000,10 +3000,10 @@ "name": "#utility.yul" } ], - "sourceMap": "70:203:0:-:0;;;129:53;;;;;;;;;;153:20;;;;;;;;;;;;;;;;;:8;:20;;;;;;;;;;;;:::i;:::-;;70:203;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:180:2:-;55:77;52:1;45:88;152:4;149:1;142:15;176:4;173:1;166:15;193:320;237:6;274:1;268:4;264:12;254:22;;321:1;315:4;311:12;342:18;332:81;;398:4;390:6;386:17;376:27;;332:81;460:2;452:6;449:14;429:18;426:38;423:84;;;479:18;;:::i;:::-;423:84;244:269;193:320;;;:::o;70:203:0:-;;;;;;;", - "deployedSourceMap": "70:203:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;190:78;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;97:22;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;190:78;256:4;245:8;:15;;;;;;;;;;;;:::i;:::-;;190:78;:::o;97:22::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;-1:-1:-1:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:75:2:-;40:6;73:2;67:9;57:19;;7:75;:::o;88:117::-;197:1;194;187:12;211:117;320:1;317;310:12;334:117;443:1;440;433:12;457:117;566:1;563;556:12;580:102;621:6;672:2;668:7;663:2;656:5;652:14;648:28;638:38;;580:102;;;:::o;688:180::-;736:77;733:1;726:88;833:4;830:1;823:15;857:4;854:1;847:15;874:281;957:27;979:4;957:27;:::i;:::-;949:6;945:40;1087:6;1075:10;1072:22;1051:18;1039:10;1036:34;1033:62;1030:88;;;1098:18;;:::i;:::-;1030:88;1138:10;1134:2;1127:22;917:238;874:281;;:::o;1161:129::-;1195:6;1222:20;;:::i;:::-;1212:30;;1251:33;1279:4;1271:6;1251:33;:::i;:::-;1161:129;;;:::o;1296:308::-;1358:4;1448:18;1440:6;1437:30;1434:56;;;1470:18;;:::i;:::-;1434:56;1508:29;1530:6;1508:29;:::i;:::-;1500:37;;1592:4;1586;1582:15;1574:23;;1296:308;;;:::o;1610:154::-;1694:6;1689:3;1684;1671:30;1756:1;1747:6;1742:3;1738:16;1731:27;1610:154;;;:::o;1770:412::-;1848:5;1873:66;1889:49;1931:6;1889:49;:::i;:::-;1873:66;:::i;:::-;1864:75;;1962:6;1955:5;1948:21;2000:4;1993:5;1989:16;2038:3;2029:6;2024:3;2020:16;2017:25;2014:112;;;2045:79;;:::i;:::-;2014:112;2135:41;2169:6;2164:3;2159;2135:41;:::i;:::-;1854:328;1770:412;;;;;:::o;2202:340::-;2258:5;2307:3;2300:4;2292:6;2288:17;2284:27;2274:122;;2315:79;;:::i;:::-;2274:122;2432:6;2419:20;2457:79;2532:3;2524:6;2517:4;2509:6;2505:17;2457:79;:::i;:::-;2448:88;;2264:278;2202:340;;;;:::o;2548:509::-;2617:6;2666:2;2654:9;2645:7;2641:23;2637:32;2634:119;;;2672:79;;:::i;:::-;2634:119;2820:1;2809:9;2805:17;2792:31;2850:18;2842:6;2839:30;2836:117;;;2872:79;;:::i;:::-;2836:117;2977:63;3032:7;3023:6;3012:9;3008:22;2977:63;:::i;:::-;2967:73;;2763:287;2548:509;;;;:::o;3063:99::-;3115:6;3149:5;3143:12;3133:22;;3063:99;;;:::o;3168:169::-;3252:11;3286:6;3281:3;3274:19;3326:4;3321:3;3317:14;3302:29;;3168:169;;;;:::o;3343:307::-;3411:1;3421:113;3435:6;3432:1;3429:13;3421:113;;;3520:1;3515:3;3511:11;3505:18;3501:1;3496:3;3492:11;3485:39;3457:2;3454:1;3450:10;3445:15;;3421:113;;;3552:6;3549:1;3546:13;3543:101;;;3632:1;3623:6;3618:3;3614:16;3607:27;3543:101;3392:258;3343:307;;;:::o;3656:364::-;3744:3;3772:39;3805:5;3772:39;:::i;:::-;3827:71;3891:6;3886:3;3827:71;:::i;:::-;3820:78;;3907:52;3952:6;3947:3;3940:4;3933:5;3929:16;3907:52;:::i;:::-;3984:29;4006:6;3984:29;:::i;:::-;3979:3;3975:39;3968:46;;3748:272;3656:364;;;;:::o;4026:313::-;4139:4;4177:2;4166:9;4162:18;4154:26;;4226:9;4220:4;4216:20;4212:1;4201:9;4197:17;4190:47;4254:78;4327:4;4318:6;4254:78;:::i;:::-;4246:86;;4026:313;;;;:::o;4345:180::-;4393:77;4390:1;4383:88;4490:4;4487:1;4480:15;4514:4;4511:1;4504:15;4531:320;4575:6;4612:1;4606:4;4602:12;4592:22;;4659:1;4653:4;4649:12;4680:18;4670:81;;4736:4;4728:6;4724:17;4714:27;;4670:81;4798:2;4790:6;4787:14;4767:18;4764:38;4761:84;;;4817:18;;:::i;:::-;4761:84;4582:269;4531:320;;;:::o", - "source": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.4.16 <0.9.0 ;\r\n\r\ncontract HelloWorld {\r\n string public yourName ;\r\n\r\n constructor(){\r\n yourName = \"Unknown\" ;\r\n }\r\n\r\n function setName(string memory name) public {\r\n yourName = name;\r\n }\r\n\r\n}", - "sourcePath": "E:\\FlutterMyLocalProjects\\hello_world\\contracts\\HelloWorld.sol", + "sourceMap": "58:179:0:-:0;;;113:51;;;;;;;;;;137:20;;;;;;;;;;;;;;;;;:8;:20;;;;;;;;;;;;:::i;:::-;;58:179;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:180:2:-;55:77;52:1;45:88;152:4;149:1;142:15;176:4;173:1;166:15;193:320;237:6;274:1;268:4;264:12;254:22;;321:1;315:4;311:12;342:18;332:81;;398:4;390:6;386:17;376:27;;332:81;460:2;452:6;449:14;429:18;426:38;423:84;;479:18;;:::i;:::-;423:84;244:269;193:320;;;:::o;58:179:0:-;;;;;;;", + "deployedSourceMap": "58:179:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;170:65;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;84:22;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;170:65;226:2;215:8;:13;;;;;;;;;;;;:::i;:::-;;170:65;:::o;84:22::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;-1:-1:-1:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:75:2:-;40:6;73:2;67:9;57:19;;7:75;:::o;88:117::-;197:1;194;187:12;211:117;320:1;317;310:12;334:117;443:1;440;433:12;457:117;566:1;563;556:12;580:102;621:6;672:2;668:7;663:2;656:5;652:14;648:28;638:38;;580:102;;;:::o;688:180::-;736:77;733:1;726:88;833:4;830:1;823:15;857:4;854:1;847:15;874:281;957:27;979:4;957:27;:::i;:::-;949:6;945:40;1087:6;1075:10;1072:22;1051:18;1039:10;1036:34;1033:62;1030:88;;;1098:18;;:::i;:::-;1030:88;1138:10;1134:2;1127:22;917:238;874:281;;:::o;1161:129::-;1195:6;1222:20;;:::i;:::-;1212:30;;1251:33;1279:4;1271:6;1251:33;:::i;:::-;1161:129;;;:::o;1296:308::-;1358:4;1448:18;1440:6;1437:30;1434:56;;;1470:18;;:::i;:::-;1434:56;1508:29;1530:6;1508:29;:::i;:::-;1500:37;;1592:4;1586;1582:15;1574:23;;1296:308;;;:::o;1610:154::-;1694:6;1689:3;1684;1671:30;1756:1;1747:6;1742:3;1738:16;1731:27;1610:154;;;:::o;1770:412::-;1848:5;1873:66;1889:49;1931:6;1889:49;:::i;:::-;1873:66;:::i;:::-;1864:75;;1962:6;1955:5;1948:21;2000:4;1993:5;1989:16;2038:3;2029:6;2024:3;2020:16;2017:25;2014:112;;;2045:79;;:::i;:::-;2014:112;2135:41;2169:6;2164:3;2159;2135:41;:::i;:::-;1854:328;1770:412;;;;;:::o;2202:340::-;2258:5;2307:3;2300:4;2292:6;2288:17;2284:27;2274:122;;2315:79;;:::i;:::-;2274:122;2432:6;2419:20;2457:79;2532:3;2524:6;2517:4;2509:6;2505:17;2457:79;:::i;:::-;2448:88;;2264:278;2202:340;;;;:::o;2548:509::-;2617:6;2666:2;2654:9;2645:7;2641:23;2637:32;2634:119;;;2672:79;;:::i;:::-;2634:119;2820:1;2809:9;2805:17;2792:31;2850:18;2842:6;2839:30;2836:117;;;2872:79;;:::i;:::-;2836:117;2977:63;3032:7;3023:6;3012:9;3008:22;2977:63;:::i;:::-;2967:73;;2763:287;2548:509;;;;:::o;3063:99::-;3115:6;3149:5;3143:12;3133:22;;3063:99;;;:::o;3168:169::-;3252:11;3286:6;3281:3;3274:19;3326:4;3321:3;3317:14;3302:29;;3168:169;;;;:::o;3343:307::-;3411:1;3421:113;3435:6;3432:1;3429:13;3421:113;;;3520:1;3515:3;3511:11;3505:18;3501:1;3496:3;3492:11;3485:39;3457:2;3454:1;3450:10;3445:15;;3421:113;;;3552:6;3549:1;3546:13;3543:101;;;3632:1;3623:6;3618:3;3614:16;3607:27;3543:101;3392:258;3343:307;;;:::o;3656:364::-;3744:3;3772:39;3805:5;3772:39;:::i;:::-;3827:71;3891:6;3886:3;3827:71;:::i;:::-;3820:78;;3907:52;3952:6;3947:3;3940:4;3933:5;3929:16;3907:52;:::i;:::-;3984:29;4006:6;3984:29;:::i;:::-;3979:3;3975:39;3968:46;;3748:272;3656:364;;;;:::o;4026:313::-;4139:4;4177:2;4166:9;4162:18;4154:26;;4226:9;4220:4;4216:20;4212:1;4201:9;4197:17;4190:47;4254:78;4327:4;4318:6;4254:78;:::i;:::-;4246:86;;4026:313;;;;:::o;4345:180::-;4393:77;4390:1;4383:88;4490:4;4487:1;4480:15;4514:4;4511:1;4504:15;4531:320;4575:6;4612:1;4606:4;4602:12;4592:22;;4659:1;4653:4;4649:12;4680:18;4670:81;;4736:4;4728:6;4724:17;4714:27;;4670:81;4798:2;4790:6;4787:14;4767:18;4764:38;4761:84;;4817:18;;:::i;:::-;4761:84;4582:269;4531:320;;;:::o", + "source": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.7;\n\ncontract HelloWorld {\n string public yourName;\n\n constructor() {\n yourName = \"Unknown\";\n }\n\n function setName(string memory nm) public{\n\t\tyourName = nm;\n }\n}\n", + "sourcePath": "/Users/alejandroferrero/development/web3/hello_world/contracts/HelloWorld.sol", "ast": { "absolutePath": "project:/contracts/HelloWorld.sol", "exportedSymbols": { @@ -3019,15 +3019,12 @@ "id": 1, "literals": [ "solidity", - ">=", - "0.4", - ".16", - "<", - "0.9", - ".0" + "^", + "0.8", + ".7" ], "nodeType": "PragmaDirective", - "src": "33:33:0" + "src": "33:23:0" }, { "abstract": false, @@ -3041,7 +3038,7 @@ 22 ], "name": "HelloWorld", - "nameLocation": "79:10:0", + "nameLocation": "67:10:0", "nodeType": "ContractDefinition", "nodes": [ { @@ -3050,10 +3047,10 @@ "id": 3, "mutability": "mutable", "name": "yourName", - "nameLocation": "111:8:0", + "nameLocation": "98:8:0", "nodeType": "VariableDeclaration", "scope": 22, - "src": "97:22:0", + "src": "84:22:0", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { @@ -3064,7 +3061,7 @@ "id": 2, "name": "string", "nodeType": "ElementaryTypeName", - "src": "97:6:0", + "src": "84:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" @@ -3076,7 +3073,7 @@ "body": { "id": 10, "nodeType": "Block", - "src": "142:40:0", + "src": "127:37:0", "statements": [ { "expression": { @@ -3091,7 +3088,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3, - "src": "153:8:0", + "src": "137:8:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" @@ -3108,14 +3105,14 @@ "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "164:9:0", + "src": "148:9:0", "typeDescriptions": { "typeIdentifier": "t_stringliteral_6ff165d3fe0272c13129fc9e1aecd998364a5fdcad04c6ae84a7d1dfc3d06a17", "typeString": "literal_string \"Unknown\"" }, "value": "Unknown" }, - "src": "153:20:0", + "src": "137:20:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" @@ -3123,7 +3120,7 @@ }, "id": 9, "nodeType": "ExpressionStatement", - "src": "153:20:0" + "src": "137:20:0" } ] }, @@ -3138,16 +3135,16 @@ "id": 4, "nodeType": "ParameterList", "parameters": [], - "src": "140:2:0" + "src": "124:2:0" }, "returnParameters": { "id": 5, "nodeType": "ParameterList", "parameters": [], - "src": "142:0:0" + "src": "127:0:0" }, "scope": 22, - "src": "129:53:0", + "src": "113:51:0", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" @@ -3156,7 +3153,7 @@ "body": { "id": 20, "nodeType": "Block", - "src": "234:34:0", + "src": "211:24:0", "statements": [ { "expression": { @@ -3171,7 +3168,7 @@ "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3, - "src": "245:8:0", + "src": "215:8:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" @@ -3181,17 +3178,17 @@ "operator": "=", "rightHandSide": { "id": 17, - "name": "name", + "name": "nm", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 13, - "src": "256:4:0", + "src": "226:2:0", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string memory" } }, - "src": "245:15:0", + "src": "215:13:0", "typeDescriptions": { "typeIdentifier": "t_string_storage", "typeString": "string storage ref" @@ -3199,7 +3196,7 @@ }, "id": 19, "nodeType": "ExpressionStatement", - "src": "245:15:0" + "src": "215:13:0" } ] }, @@ -3209,7 +3206,7 @@ "kind": "function", "modifiers": [], "name": "setName", - "nameLocation": "199:7:0", + "nameLocation": "179:7:0", "nodeType": "FunctionDefinition", "parameters": { "id": 14, @@ -3219,11 +3216,11 @@ "constant": false, "id": 13, "mutability": "mutable", - "name": "name", - "nameLocation": "221:4:0", + "name": "nm", + "nameLocation": "201:2:0", "nodeType": "VariableDeclaration", "scope": 21, - "src": "207:18:0", + "src": "187:16:0", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { @@ -3234,7 +3231,7 @@ "id": 12, "name": "string", "nodeType": "ElementaryTypeName", - "src": "207:6:0", + "src": "187:6:0", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" @@ -3243,303 +3240,42 @@ "visibility": "internal" } ], - "src": "206:20:0" + "src": "186:18:0" }, "returnParameters": { "id": 15, "nodeType": "ParameterList", "parameters": [], - "src": "234:0:0" + "src": "211:0:0" }, "scope": 22, - "src": "190:78:0", + "src": "170:65:0", "stateMutability": "nonpayable", "virtual": false, "visibility": "public" } ], "scope": 23, - "src": "70:203:0", + "src": "58:179:0", "usedErrors": [] } ], - "src": "33:240:0" - }, - "legacyAST": { - "absolutePath": "project:/contracts/HelloWorld.sol", - "exportedSymbols": { - "HelloWorld": [ - 22 - ] - }, - "id": 23, - "license": "MIT", - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 1, - "literals": [ - "solidity", - ">=", - "0.4", - ".16", - "<", - "0.9", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "33:33:0" - }, - { - "abstract": false, - "baseContracts": [], - "canonicalName": "HelloWorld", - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": true, - "id": 22, - "linearizedBaseContracts": [ - 22 - ], - "name": "HelloWorld", - "nameLocation": "79:10:0", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "functionSelector": "d97d6630", - "id": 3, - "mutability": "mutable", - "name": "yourName", - "nameLocation": "111:8:0", - "nodeType": "VariableDeclaration", - "scope": 22, - "src": "97:22:0", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string" - }, - "typeName": { - "id": 2, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "97:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "visibility": "public" - }, - { - "body": { - "id": 10, - "nodeType": "Block", - "src": "142:40:0", - "statements": [ - { - "expression": { - "id": 8, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 6, - "name": "yourName", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "153:8:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "hexValue": "556e6b6e6f776e", - "id": 7, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "164:9:0", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_6ff165d3fe0272c13129fc9e1aecd998364a5fdcad04c6ae84a7d1dfc3d06a17", - "typeString": "literal_string \"Unknown\"" - }, - "value": "Unknown" - }, - "src": "153:20:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" - } - }, - "id": 9, - "nodeType": "ExpressionStatement", - "src": "153:20:0" - } - ] - }, - "id": 11, - "implemented": true, - "kind": "constructor", - "modifiers": [], - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 4, - "nodeType": "ParameterList", - "parameters": [], - "src": "140:2:0" - }, - "returnParameters": { - "id": 5, - "nodeType": "ParameterList", - "parameters": [], - "src": "142:0:0" - }, - "scope": 22, - "src": "129:53:0", - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - }, - { - "body": { - "id": 20, - "nodeType": "Block", - "src": "234:34:0", - "statements": [ - { - "expression": { - "id": 18, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 16, - "name": "yourName", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 3, - "src": "245:8:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 17, - "name": "name", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 13, - "src": "256:4:0", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string memory" - } - }, - "src": "245:15:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage", - "typeString": "string storage ref" - } - }, - "id": 19, - "nodeType": "ExpressionStatement", - "src": "245:15:0" - } - ] - }, - "functionSelector": "c47f0027", - "id": 21, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "setName", - "nameLocation": "199:7:0", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 14, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 13, - "mutability": "mutable", - "name": "name", - "nameLocation": "221:4:0", - "nodeType": "VariableDeclaration", - "scope": 21, - "src": "207:18:0", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" - }, - "typeName": { - "id": 12, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "207:6:0", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "visibility": "internal" - } - ], - "src": "206:20:0" - }, - "returnParameters": { - "id": 15, - "nodeType": "ParameterList", - "parameters": [], - "src": "234:0:0" - }, - "scope": 22, - "src": "190:78:0", - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - } - ], - "scope": 23, - "src": "70:203:0", - "usedErrors": [] - } - ], - "src": "33:240:0" + "src": "33:205:0" }, "compiler": { "name": "solc", - "version": "0.8.11+commit.d7f03943.Emscripten.clang" + "version": "0.8.13+commit.abaa5c0e.Emscripten.clang" }, "networks": { "5777": { "events": {}, "links": {}, - "address": "0xB5CF2cff52A1A947542e1D43e3D0aD822B1fC4f9", - "transactionHash": "0x1fcff7c4e1eddaa1976db33a9160c417788a4186f965c7ae1d1f169af4604753" + "address": "0xc8Ab4Be7f68FfD11f6446D20221Ea07C20c0F607", + "transactionHash": "0x2ea795008eb550ffeceeafd38d252be171a228a38e9a9cfaa07dbfc3bb778a69" } }, - "schemaVersion": "3.4.4", - "updatedAt": "2022-02-06T07:55:29.710Z", + "schemaVersion": "3.4.7", + "updatedAt": "2022-05-15T09:44:03.019Z", "networkType": "ethereum", "devdoc": { "kind": "dev", diff --git a/hello_world/src/artifacts/Migrations.json b/hello_world/src/artifacts/Migrations.json index 1649ebb..a177ba4 100644 --- a/hello_world/src/artifacts/Migrations.json +++ b/hello_world/src/artifacts/Migrations.json @@ -43,9 +43,9 @@ "type": "function" } ], - "metadata": "{\"compiler\":{\"version\":\"0.8.11+commit.d7f03943\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Migrations.sol\":{\"keccak256\":\"0x7eaedbb1a3e4e0f585d9063393872f88ded247ca3c3c3c8492ea18e7629a6411\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a3eb571cee910095df65a06a1c1d3f89187c72a3c184ef87a7538d9aa39ad07\",\"dweb:/ipfs/QmdqR3vrSSGR49qFGZr49Mb39z7dgD6tSzEDoaqtM31o61\"]}},\"version\":1}", - "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b50610344806100606000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063445df0ac146100635780638da5cb5b14610081578063fdacd5761461009f575b600080fd5b61006b6100bb565b6040516100789190610196565b60405180910390f35b6100896100c1565b60405161009691906101f2565b60405180910390f35b6100b960048036038101906100b4919061023e565b6100e5565b005b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016a906102ee565b60405180910390fd5b8060018190555050565b6000819050919050565b6101908161017d565b82525050565b60006020820190506101ab6000830184610187565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101dc826101b1565b9050919050565b6101ec816101d1565b82525050565b600060208201905061020760008301846101e3565b92915050565b600080fd5b61021b8161017d565b811461022657600080fd5b50565b60008135905061023881610212565b92915050565b6000602082840312156102545761025361020d565b5b600061026284828501610229565b91505092915050565b600082825260208201905092915050565b7f546869732066756e6374696f6e206973207265737472696374656420746f207460008201527f686520636f6e74726163742773206f776e657200000000000000000000000000602082015250565b60006102d860338361026b565b91506102e38261027c565b604082019050919050565b60006020820190508181036000830152610307816102cb565b905091905056fea2646970667358221220211fdd55f9a3775927a472c51df0b57ff916ac1c7f98856a5a637595c084346364736f6c634300080b0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063445df0ac146100635780638da5cb5b14610081578063fdacd5761461009f575b600080fd5b61006b6100bb565b6040516100789190610196565b60405180910390f35b6100896100c1565b60405161009691906101f2565b60405180910390f35b6100b960048036038101906100b4919061023e565b6100e5565b005b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016a906102ee565b60405180910390fd5b8060018190555050565b6000819050919050565b6101908161017d565b82525050565b60006020820190506101ab6000830184610187565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101dc826101b1565b9050919050565b6101ec816101d1565b82525050565b600060208201905061020760008301846101e3565b92915050565b600080fd5b61021b8161017d565b811461022657600080fd5b50565b60008135905061023881610212565b92915050565b6000602082840312156102545761025361020d565b5b600061026284828501610229565b91505092915050565b600082825260208201905092915050565b7f546869732066756e6374696f6e206973207265737472696374656420746f207460008201527f686520636f6e74726163742773206f776e657200000000000000000000000000602082015250565b60006102d860338361026b565b91506102e38261027c565b604082019050919050565b60006020820190508181036000830152610307816102cb565b905091905056fea2646970667358221220211fdd55f9a3775927a472c51df0b57ff916ac1c7f98856a5a637595c084346364736f6c634300080b0033", + "metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/Migrations.sol\":{\"keccak256\":\"0x7eaedbb1a3e4e0f585d9063393872f88ded247ca3c3c3c8492ea18e7629a6411\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4a3eb571cee910095df65a06a1c1d3f89187c72a3c184ef87a7538d9aa39ad07\",\"dweb:/ipfs/QmdqR3vrSSGR49qFGZr49Mb39z7dgD6tSzEDoaqtM31o61\"]}},\"version\":1}", + "bytecode": "0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b50610344806100606000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063445df0ac146100635780638da5cb5b14610081578063fdacd5761461009f575b600080fd5b61006b6100bb565b6040516100789190610196565b60405180910390f35b6100896100c1565b60405161009691906101f2565b60405180910390f35b6100b960048036038101906100b4919061023e565b6100e5565b005b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016a906102ee565b60405180910390fd5b8060018190555050565b6000819050919050565b6101908161017d565b82525050565b60006020820190506101ab6000830184610187565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101dc826101b1565b9050919050565b6101ec816101d1565b82525050565b600060208201905061020760008301846101e3565b92915050565b600080fd5b61021b8161017d565b811461022657600080fd5b50565b60008135905061023881610212565b92915050565b6000602082840312156102545761025361020d565b5b600061026284828501610229565b91505092915050565b600082825260208201905092915050565b7f546869732066756e6374696f6e206973207265737472696374656420746f207460008201527f686520636f6e74726163742773206f776e657200000000000000000000000000602082015250565b60006102d860338361026b565b91506102e38261027c565b604082019050919050565b60006020820190508181036000830152610307816102cb565b905091905056fea2646970667358221220b73240a48907a5973c97174c1a904e16630fe3c68a8bd8c13a7fb038ec1ba4b464736f6c634300080d0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061005e576000357c010000000000000000000000000000000000000000000000000000000090048063445df0ac146100635780638da5cb5b14610081578063fdacd5761461009f575b600080fd5b61006b6100bb565b6040516100789190610196565b60405180910390f35b6100896100c1565b60405161009691906101f2565b60405180910390f35b6100b960048036038101906100b4919061023e565b6100e5565b005b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610173576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016a906102ee565b60405180910390fd5b8060018190555050565b6000819050919050565b6101908161017d565b82525050565b60006020820190506101ab6000830184610187565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006101dc826101b1565b9050919050565b6101ec816101d1565b82525050565b600060208201905061020760008301846101e3565b92915050565b600080fd5b61021b8161017d565b811461022657600080fd5b50565b60008135905061023881610212565b92915050565b6000602082840312156102545761025361020d565b5b600061026284828501610229565b91505092915050565b600082825260208201905092915050565b7f546869732066756e6374696f6e206973207265737472696374656420746f207460008201527f686520636f6e74726163742773206f776e657200000000000000000000000000602082015250565b60006102d860338361026b565b91506102e38261027c565b604082019050919050565b60006020820190508181036000830152610307816102cb565b905091905056fea2646970667358221220b73240a48907a5973c97174c1a904e16630fe3c68a8bd8c13a7fb038ec1ba4b464736f6c634300080d0033", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [ @@ -1508,7 +1508,7 @@ "sourceMap": "66:352:1:-:0;;;113:10;90:33;;;;;;;;;;;;;;;;;;;;66:352;;;;;;;;;;;;;;;;", "deployedSourceMap": "66:352:1:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;127:36;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;90:33;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;313:103;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;127:36;;;;:::o;90:33::-;;;;;;;;;;;;:::o;313:103::-;225:5;;;;;;;;;;211:19;;:10;:19;;;196:101;;;;;;;;;;;;:::i;:::-;;;;;;;;;402:9:::1;375:24;:36;;;;313:103:::0;:::o;7:77:2:-;44:7;73:5;62:16;;7:77;;;:::o;90:118::-;177:24;195:5;177:24;:::i;:::-;172:3;165:37;90:118;;:::o;214:222::-;307:4;345:2;334:9;330:18;322:26;;358:71;426:1;415:9;411:17;402:6;358:71;:::i;:::-;214:222;;;;:::o;442:126::-;479:7;519:42;512:5;508:54;497:65;;442:126;;;:::o;574:96::-;611:7;640:24;658:5;640:24;:::i;:::-;629:35;;574:96;;;:::o;676:118::-;763:24;781:5;763:24;:::i;:::-;758:3;751:37;676:118;;:::o;800:222::-;893:4;931:2;920:9;916:18;908:26;;944:71;1012:1;1001:9;997:17;988:6;944:71;:::i;:::-;800:222;;;;:::o;1109:117::-;1218:1;1215;1208:12;1355:122;1428:24;1446:5;1428:24;:::i;:::-;1421:5;1418:35;1408:63;;1467:1;1464;1457:12;1408:63;1355:122;:::o;1483:139::-;1529:5;1567:6;1554:20;1545:29;;1583:33;1610:5;1583:33;:::i;:::-;1483:139;;;;:::o;1628:329::-;1687:6;1736:2;1724:9;1715:7;1711:23;1707:32;1704:119;;;1742:79;;:::i;:::-;1704:119;1862:1;1887:53;1932:7;1923:6;1912:9;1908:22;1887:53;:::i;:::-;1877:63;;1833:117;1628:329;;;;:::o;1963:169::-;2047:11;2081:6;2076:3;2069:19;2121:4;2116:3;2112:14;2097:29;;1963:169;;;;:::o;2138:238::-;2278:34;2274:1;2266:6;2262:14;2255:58;2347:21;2342:2;2334:6;2330:15;2323:46;2138:238;:::o;2382:366::-;2524:3;2545:67;2609:2;2604:3;2545:67;:::i;:::-;2538:74;;2621:93;2710:3;2621:93;:::i;:::-;2739:2;2734:3;2730:12;2723:19;;2382:366;;;:::o;2754:419::-;2920:4;2958:2;2947:9;2943:18;2935:26;;3007:9;3001:4;2997:20;2993:1;2982:9;2978:17;2971:47;3035:131;3161:4;3035:131;:::i;:::-;3027:139;;2754:419;;;:::o", "source": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\ncontract Migrations {\n address public owner = msg.sender;\n uint public last_completed_migration;\n\n modifier restricted() {\n require(\n msg.sender == owner,\n \"This function is restricted to the contract's owner\"\n );\n _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n}\n", - "sourcePath": "E:\\FlutterMyLocalProjects\\hello_world\\contracts\\Migrations.sol", + "sourcePath": "/Users/alejandroferrero/development/web3/hello_world/contracts/Migrations.sol", "ast": { "absolutePath": "project:/contracts/Migrations.sol", "exportedSymbols": { @@ -1906,417 +1906,20 @@ ], "src": "32:387:1" }, - "legacyAST": { - "absolutePath": "project:/contracts/Migrations.sol", - "exportedSymbols": { - "Migrations": [ - 55 - ] - }, - "id": 56, - "license": "MIT", - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 24, - "literals": [ - "solidity", - ">=", - "0.4", - ".22", - "<", - "0.9", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "32:32:1" - }, - { - "abstract": false, - "baseContracts": [], - "canonicalName": "Migrations", - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": true, - "id": 55, - "linearizedBaseContracts": [ - 55 - ], - "name": "Migrations", - "nameLocation": "75:10:1", - "nodeType": "ContractDefinition", - "nodes": [ - { - "constant": false, - "functionSelector": "8da5cb5b", - "id": 28, - "mutability": "mutable", - "name": "owner", - "nameLocation": "105:5:1", - "nodeType": "VariableDeclaration", - "scope": 55, - "src": "90:33:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 25, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "90:7:1", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "value": { - "expression": { - "id": 26, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 4294967281, - "src": "113:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 27, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "113:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "public" - }, - { - "constant": false, - "functionSelector": "445df0ac", - "id": 30, - "mutability": "mutable", - "name": "last_completed_migration", - "nameLocation": "139:24:1", - "nodeType": "VariableDeclaration", - "scope": 55, - "src": "127:36:1", - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 29, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "127:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "public" - }, - { - "body": { - "id": 41, - "nodeType": "Block", - "src": "190:119:1", - "statements": [ - { - "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "id": 36, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "expression": { - "id": 33, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 4294967281, - "src": "211:3:1", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 34, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "211:10:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "nodeType": "BinaryOperation", - "operator": "==", - "rightExpression": { - "id": 35, - "name": "owner", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 28, - "src": "225:5:1", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "src": "211:19:1", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - { - "hexValue": "546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572", - "id": 37, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "238:53:1", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", - "typeString": "literal_string \"This function is restricted to the contract's owner\"" - }, - "value": "This function is restricted to the contract's owner" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - { - "typeIdentifier": "t_stringliteral_f60fe2d9d123295bf92ecf95167f1fa709e374da35e4c083bd39dc2d82acd8b1", - "typeString": "literal_string \"This function is restricted to the contract's owner\"" - } - ], - "id": 32, - "name": "require", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 4294967278, - 4294967278 - ], - "referencedDeclaration": 4294967278, - "src": "196:7:1", - "typeDescriptions": { - "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", - "typeString": "function (bool,string memory) pure" - } - }, - "id": 38, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "196:101:1", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 39, - "nodeType": "ExpressionStatement", - "src": "196:101:1" - }, - { - "id": 40, - "nodeType": "PlaceholderStatement", - "src": "303:1:1" - } - ] - }, - "id": 42, - "name": "restricted", - "nameLocation": "177:10:1", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 31, - "nodeType": "ParameterList", - "parameters": [], - "src": "187:2:1" - }, - "src": "168:141:1", - "virtual": false, - "visibility": "internal" - }, - { - "body": { - "id": 53, - "nodeType": "Block", - "src": "369:47:1", - "statements": [ - { - "expression": { - "id": 51, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 49, - "name": "last_completed_migration", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 30, - "src": "375:24:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 50, - "name": "completed", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 44, - "src": "402:9:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "375:36:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 52, - "nodeType": "ExpressionStatement", - "src": "375:36:1" - } - ] - }, - "functionSelector": "fdacd576", - "id": 54, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "id": 47, - "kind": "modifierInvocation", - "modifierName": { - "id": 46, - "name": "restricted", - "nodeType": "IdentifierPath", - "referencedDeclaration": 42, - "src": "358:10:1" - }, - "nodeType": "ModifierInvocation", - "src": "358:10:1" - } - ], - "name": "setCompleted", - "nameLocation": "322:12:1", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 45, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 44, - "mutability": "mutable", - "name": "completed", - "nameLocation": "340:9:1", - "nodeType": "VariableDeclaration", - "scope": 54, - "src": "335:14:1", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 43, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "335:4:1", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "334:16:1" - }, - "returnParameters": { - "id": 48, - "nodeType": "ParameterList", - "parameters": [], - "src": "369:0:1" - }, - "scope": 55, - "src": "313:103:1", - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - } - ], - "scope": 56, - "src": "66:352:1", - "usedErrors": [] - } - ], - "src": "32:387:1" - }, "compiler": { "name": "solc", - "version": "0.8.11+commit.d7f03943.Emscripten.clang" + "version": "0.8.13+commit.abaa5c0e.Emscripten.clang" }, "networks": { "5777": { "events": {}, "links": {}, - "address": "0x453911214C05a2fd516b15aC54782229331ee48c", - "transactionHash": "0x8f3655490ff9219647c693ff9358c0730eed6f5763e2349c5a9fa7a7ca3c2a9b" + "address": "0xD3F3d6e3520A5020988954b89E00BC6fb04CC6Bd", + "transactionHash": "0xb916e275770573f5be23ae04d18cf03fa2ac00eee045aa674d18d537a28084b6" } }, - "schemaVersion": "3.4.4", - "updatedAt": "2022-02-06T07:55:29.725Z", + "schemaVersion": "3.4.7", + "updatedAt": "2022-05-15T09:44:03.021Z", "networkType": "ethereum", "devdoc": { "kind": "dev", diff --git a/hello_world/test/helloWorld.js b/hello_world/test/helloWorld.js index aaa0143..036c43d 100644 --- a/hello_world/test/helloWorld.js +++ b/hello_world/test/helloWorld.js @@ -1,10 +1,10 @@ -const HelloWorld = artifacts.require("HelloWorld") ; +const HelloWorld = artifacts.require("HelloWorld"); -contract("HelloWorld" , () => { - it("Hello World Testing" , async () => { - const helloWorld = await HelloWorld.deployed() ; - await helloWorld.setName("User Name") ; - const result = await helloWorld.yourName() ; - assert(result === "User Name") ; - }); -}); \ No newline at end of file +contract("HelloWorld", () => { + it("Hello World Testing", async () => { + const helloWorld = await HelloWorld.deployed(); + await helloWorld.setName("User Name"); + const result = await helloWorld.yourName(); + assert(result === "User Name"); + }); +}); diff --git a/hello_world/truffle-config.js b/hello_world/truffle-config.js index b079072..3703276 100644 --- a/hello_world/truffle-config.js +++ b/hello_world/truffle-config.js @@ -1,22 +1,26 @@ module.exports = { -networks: { + networks: { development: { - host: "127.0.0.1", // Localhost (default: none) - port: 7545, // Standard Ethereum port (default: none) - network_id: "*", // Any network (default: none) + host: "127.0.0.1", // Localhost (default: none) + port: 7545, // Standard Ethereum port (default: none) + network_id: "*", // Any network (default: none) }, }, - contracts_build_directory: "./src/artifacts/", - + contracts_build_directory: "./src/artifacts/", + // Configure your compilers compilers: { - solc: { - version: "0.8.11", // Fetch exact version from solc-bin (default: truffle's version) - optimizer: { - enabled: false, - runs: 200 - }, - evmVersion: "byzantium" + solc: { + version: "^0.8.7", + + // See the solidity docs for advice + // about optimization and evmVersion + optimizer: { + enabled: false, + runs: 200 + }, + evmVersion: "byzantium" } - }, -}; + } + }; + \ No newline at end of file diff --git a/hello_world/windows/.gitignore b/hello_world/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/hello_world/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/hello_world/windows/CMakeLists.txt b/hello_world/windows/CMakeLists.txt new file mode 100644 index 0000000..9a77858 --- /dev/null +++ b/hello_world/windows/CMakeLists.txt @@ -0,0 +1,95 @@ +cmake_minimum_required(VERSION 3.14) +project(hello_world LANGUAGES CXX) + +set(BINARY_NAME "hello_world") + +cmake_policy(SET CMP0063 NEW) + +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Configure build options. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() + +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") + +# Flutter library and tool build rules. +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build +add_subdirectory("runner") + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/hello_world/windows/flutter/CMakeLists.txt b/hello_world/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..b2e4bd8 --- /dev/null +++ b/hello_world/windows/flutter/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + windows-x64 $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/hello_world/windows/flutter/generated_plugin_registrant.cc b/hello_world/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..8b6d468 --- /dev/null +++ b/hello_world/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void RegisterPlugins(flutter::PluginRegistry* registry) { +} diff --git a/hello_world/windows/flutter/generated_plugin_registrant.h b/hello_world/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/hello_world/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/hello_world/windows/flutter/generated_plugins.cmake b/hello_world/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..4d10c25 --- /dev/null +++ b/hello_world/windows/flutter/generated_plugins.cmake @@ -0,0 +1,15 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) diff --git a/hello_world/windows/runner/CMakeLists.txt b/hello_world/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..de2d891 --- /dev/null +++ b/hello_world/windows/runner/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) +apply_standard_settings(${BINARY_NAME}) +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/hello_world/windows/runner/Runner.rc b/hello_world/windows/runner/Runner.rc new file mode 100644 index 0000000..3904caa --- /dev/null +++ b/hello_world/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#ifdef FLUTTER_BUILD_NUMBER +#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#else +#define VERSION_AS_NUMBER 1,0,0 +#endif + +#ifdef FLUTTER_BUILD_NAME +#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "hello_world" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "hello_world" "\0" + VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "hello_world.exe" "\0" + VALUE "ProductName", "hello_world" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/hello_world/windows/runner/flutter_window.cpp b/hello_world/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..b43b909 --- /dev/null +++ b/hello_world/windows/runner/flutter_window.cpp @@ -0,0 +1,61 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/hello_world/windows/runner/flutter_window.h b/hello_world/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/hello_world/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/hello_world/windows/runner/main.cpp b/hello_world/windows/runner/main.cpp new file mode 100644 index 0000000..be80bb1 --- /dev/null +++ b/hello_world/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.CreateAndShow(L"hello_world", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/hello_world/windows/runner/resource.h b/hello_world/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/hello_world/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/hello_world/windows/runner/resources/app_icon.ico b/hello_world/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/hello_world/windows/runner/resources/app_icon.ico differ diff --git a/hello_world/windows/runner/runner.exe.manifest b/hello_world/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..c977c4a --- /dev/null +++ b/hello_world/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/hello_world/windows/runner/utils.cpp b/hello_world/windows/runner/utils.cpp new file mode 100644 index 0000000..d19bdbb --- /dev/null +++ b/hello_world/windows/runner/utils.cpp @@ -0,0 +1,64 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr); + if (target_length == 0) { + return std::string(); + } + std::string utf8_string; + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, utf8_string.data(), + target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/hello_world/windows/runner/utils.h b/hello_world/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/hello_world/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/hello_world/windows/runner/win32_window.cpp b/hello_world/windows/runner/win32_window.cpp new file mode 100644 index 0000000..c10f08d --- /dev/null +++ b/hello_world/windows/runner/win32_window.cpp @@ -0,0 +1,245 @@ +#include "win32_window.h" + +#include + +#include "resource.h" + +namespace { + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + FreeLibrary(user32_module); + } +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + return OnCreate(); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} diff --git a/hello_world/windows/runner/win32_window.h b/hello_world/windows/runner/win32_window.h new file mode 100644 index 0000000..17ba431 --- /dev/null +++ b/hello_world/windows/runner/win32_window.h @@ -0,0 +1,98 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates and shows a win32 window with |title| and position and size using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size to will treat the width height passed in to this function + // as logical pixels and scale to appropriate for the default monitor. Returns + // true if the window was created successfully. + bool CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responsponds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_