This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.8.9; | |
| // Import this file to use console.log | |
| import "hardhat/console.sol"; /// remove this if you are not using hardhat | |
| contract Lock { | |
| uint public unlockTime; | |
| address payable public owner; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ethers } from "hardhat"; | |
| async function main() { | |
| const currentTimestampInSeconds = Math.round(Date.now() / 1000); | |
| const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60; | |
| const unlockTime = currentTimestampInSeconds + ONE_YEAR_IN_SECS; | |
| const lockedAmount = ethers.utils.parseEther("1"); | |
| const Lock = await ethers.getContractFactory("Lock"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:http/http.dart'; | |
| import 'package:lock/contracts/Lock.g.dart'; | |
| import 'package:web3dart/web3dart.dart'; | |
| void main(List<String> args) async { | |
| const rpcUrl = 'http://127.0.0.1:8545'; | |
| final client = Web3Client(rpcUrl, Client()); | |
| final credentials = EthPrivateKey.fromHex( | |
| '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', /// This is generated by hardhat, not a real account |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:gap/gap.dart'; | |
| enum GraphObjType { square, rect } | |
| class GraphObj { | |
| const GraphObj({ | |
| required this.offset, | |
| required this.type, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:io'; | |
| import 'package:dart_frog/dart_frog.dart'; | |
| import 'package:tweety/request_handler.dart'; | |
| import 'package:tweety/tweety_core.dart'; | |
| Future<Response> onRequest(RequestContext context) async { | |
| return requestHandler( | |
| () async { | |
| final param = context.request.uri.queryParameters.entries.first; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:io'; | |
| import 'package:dart_frog/dart_frog.dart'; | |
| /// Handle Errors from Requests | |
| Future<Response> requestHandler( | |
| Future<Response?> Function() handler, | |
| ) async { | |
| try { | |
| return (await handler()) ?? Response.json(body: {}); | |
| } catch (e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:puppeteer/puppeteer.dart'; | |
| import 'package:puppeteer/src/devices.dart'; | |
| /// TweetyCore provides access to puppeteer apis and | |
| class TweetyCore { | |
| /// A puppeteer [Browser] instance. | |
| late Browser browser; | |
| /// A puppeteer [Page] instance. | |
| late Page page; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:dart_frog/dart_frog.dart'; | |
| import 'package:tweety/tweety_core.dart'; | |
| Handler middleware(Handler handler) { | |
| final tweetyCore = TweetyCore(); | |
| return handler.use(provider<TweetyCore>((context) => tweetyCore)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:quill/core/model.dart'; | |
| import 'package:http/http.dart' as http; | |
| import 'package:riverpod_annotation/riverpod_annotation.dart'; | |
| part 'api_provider.g.dart'; // part of code used with dart:build to generate the api_provider.g.dart file | |
| @riverpod // this function is a provider | |
| Future<QuillBotModel> fetchQuillMessage( | |
| FetchQuillMessageRef ref, { | |
| // message to be sent to the quillbot api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/cupertino.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart'; | |
| import 'package:hooks_riverpod/hooks_riverpod.dart'; | |
| import 'package:quill/core/model.dart'; | |
| import 'package:quill/core/providers/api_provider.dart'; | |
| import 'package:quill/widgets/touchable_opacity.dart'; | |
| class HomePage extends StatefulHookConsumerWidget { | |
| const HomePage({super.key}); |