├── .DS_Store ├── .gitmodules ├── README.md ├── bundler ├── .gitignore ├── README.md ├── package.json ├── src │ ├── chain │ │ ├── abis.ts │ │ ├── index.ts │ │ └── provider.ts │ └── index.ts ├── tsconfig.json ├── types.d.ts └── yarn.lock ├── docker ├── geth │ └── commands.md └── optimism │ ├── Dockerfile │ ├── README.md │ └── commands.md ├── frontend ├── .DS_Store └── ReactNativeWallet │ ├── .bundle │ └── config │ ├── .eslintrc.js │ ├── .gitignore │ ├── .node-version │ ├── .prettierrc.js │ ├── .ruby-version │ ├── .watchmanconfig │ ├── App.tsx │ ├── Gemfile │ ├── Gemfile.lock │ ├── __tests__ │ └── App-test.tsx │ ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── reactnativewallet │ │ │ │ └── ReactNativeFlipper.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── reactnativewallet │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── release │ │ │ └── java │ │ │ └── com │ │ │ └── reactnativewallet │ │ │ └── ReactNativeFlipper.java │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle │ ├── app.json │ ├── assets │ ├── aave-logo.png │ ├── apps.png │ ├── browser.png │ ├── done.png │ ├── eth-logo.png │ ├── faceid-logo.png │ ├── failed.png │ ├── follow-link-white.png │ ├── follow-link.png │ ├── guard.png │ ├── logo.png │ ├── op-logo.png │ ├── profile.png │ ├── sent.png │ ├── uni-logo-white.png │ ├── uni-logo.png │ └── wallet.png │ ├── babel.config.js │ ├── chain │ ├── accountStore.ts │ └── index.ts │ ├── components │ ├── AppsButton.tsx │ ├── BrowserButton.tsx │ ├── GuardButton.tsx │ ├── SendButton.tsx │ └── WalletButton.tsx │ ├── context │ └── AppContext.tsx │ ├── index.d.ts │ ├── index.js │ ├── ios │ ├── .xcode.env │ ├── EnclaveModule.m │ ├── EnclaveModule.swift │ ├── EnclaveModuleErrors.swift │ ├── Podfile │ ├── Podfile.lock │ ├── ReactNativeWallet-Bridging-Header.h │ ├── ReactNativeWallet.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── ReactNativeWallet.xcscheme │ ├── ReactNativeWallet.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── ReactNativeWallet │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ ├── ReactNativeWallet.entitlements │ │ └── main.m │ └── ReactNativeWalletTests │ │ ├── Info.plist │ │ └── ReactNativeWalletTests.m │ ├── lib │ ├── enclave.ts │ ├── index.ts │ ├── provider.ts │ └── userOperation.ts │ ├── metro.config.js │ ├── navigation │ ├── NavMain.tsx │ └── NavTab.tsx │ ├── package.json │ ├── screens │ ├── Application.tsx │ ├── Landing.tsx │ ├── NotAvailable.tsx │ ├── Send.tsx │ ├── Wallet.tsx │ └── style.ts │ ├── tsconfig.json │ └── yarn.lock ├── go.work ├── go.work.sum └── precompiles ├── crypto ├── secp256r1 │ └── secp256.go ├── signature_r1.go └── signature_r1_test.go ├── ecverify.go ├── ecverify_test.go ├── go.mod └── go.sum /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/.DS_Store -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "opclave-scaling2023_op-geth"] 2 | path = opclave-scaling2023_op-geth 3 | url = https://github.com/itublockchain/opclave-scaling2023_op-geth.git 4 | [submodule "bio-account/lib/forge-std"] 5 | path = bio-account/lib/forge-std 6 | url = https://github.com/foundry-rs/forge-std 7 | [submodule "lib/forge-std"] 8 | branch = v1.5.1 9 | [submodule "opclave-contracts"] 10 | path = opclave-contracts 11 | url = https://github.com/itublockchain/opclave-contracts 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # opclave-scaling2023 2 | 3 | 4 | 5 | [Showcase page](https://ethglobal.com/showcase/opclave-opstack-impr-erc4337-and-apple-sign-94def) 6 | 7 | Opclave is an OP Stack improvement with ERC-4337 compatible SC accounts that uses signatures abstracted with AppleEnclave which allows users to create and use non-custodial wallets with touch/face id without having seed phrases and improved with AttestationStationSDK. 8 | 9 | [ETHGlobal Scaling 2023 Hackathon](https://ethglobal.com/events/scaling2023) project 10 | 11 |
12 | 13 | | Team Member | Role | 14 | | ----------------------------------------------- | --------------- | 15 | | [0xulas.eth](https://twitter.com/ulerdogan) | Client | 16 | | [tahos.eth](https://twitter.com/0xTahos) | Smart Contracts | 17 | | [zetsub0ii.eth](https://twitter.com/zetsuboii_) | Wallet | 18 | | [0xdogan.eth](https://twitter.com/doganeth) | Research | 19 | | [buzagi.eth](https://twitter.com/thebuzagi) | Design | 20 | 21 |
22 | 23 | Project Base: 24 | ``` 25 | opclave-scaling2023/ 26 | ├── bundler/ 27 | ├── docker/ 28 | ├── frontend/ 29 | ├── opclave-contracts/ (S) 30 | ├──── opclave-scaling2023_opgeth/ (S) 31 | └──── precompiles/ 32 | 33 | bundler: bundler app for the AA 34 | docker: docker configs and commands 35 | frontend: mobile wallet app 36 | opclave-contracts: submodule of smarts contracts / wallet for AA 37 | scaling2023_opgeth: submodule of customized op-geth 38 | precompiles: go scripts of precompile contract 39 | ``` -------------------------------------------------------------------------------- /bundler/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | 4 | .env -------------------------------------------------------------------------------- /bundler/README.md: -------------------------------------------------------------------------------- 1 | # Bundler Mock 2 | 3 | In order to send ERC4337 transactions we have to have a mechanism to 4 | bundle `UserOperation`s. For the purpose of the demo, this is a simple Express 5 | server mocking its behaviour. 6 | 7 | ## Operations 8 | 9 | - POST `/broadcast-txs`: Broadcast a transaction 10 | 11 | ### Input: 12 | ```js 13 | txs: { 14 | sender: string; 15 | nonce: number; 16 | initCode: Uint8Array; 17 | callData: string; 18 | callGasLimit: number; 19 | verificationGasLimit: number; 20 | preVerificationGas: number; 21 | maxFeePerGas: number; 22 | maxPriorityPerGas: number; 23 | paymasterAndData: string; 24 | chainId: number; 25 | entryPoint: string; 26 | signature: string; 27 | hash: string; 28 | }[] 29 | ``` 30 | 31 | ### Output: 32 | ```js 33 | { 34 | status: boolean; 35 | jobId: string; 36 | } 37 | ``` 38 | 39 | -------------------------------------------------------------------------------- /bundler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dumb-bundler", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "dotenv": "^16.0.3", 8 | "ethers": "5.7.2", 9 | "express": "^4.18.2", 10 | "nodemon": "^2.0.22", 11 | "typescript": "^5.0.2" 12 | }, 13 | "devDependencies": { 14 | "@types/express": "^4.17.17" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bundler/src/chain/abis.ts: -------------------------------------------------------------------------------- 1 | export const ENTRYPOINT = [ 2 | { 3 | inputs: [ 4 | { 5 | components: [ 6 | { 7 | internalType: "address", 8 | name: "sender", 9 | type: "address", 10 | }, 11 | { 12 | internalType: "uint256", 13 | name: "nonce", 14 | type: "uint256", 15 | }, 16 | { 17 | internalType: "bytes", 18 | name: "initCode", 19 | type: "bytes", 20 | }, 21 | { 22 | internalType: "bytes", 23 | name: "callData", 24 | type: "bytes", 25 | }, 26 | { 27 | internalType: "uint256", 28 | name: "callGasLimit", 29 | type: "uint256", 30 | }, 31 | { 32 | internalType: "uint256", 33 | name: "verificationGasLimit", 34 | type: "uint256", 35 | }, 36 | { 37 | internalType: "uint256", 38 | name: "preVerificationGas", 39 | type: "uint256", 40 | }, 41 | { 42 | internalType: "uint256", 43 | name: "maxFeePerGas", 44 | type: "uint256", 45 | }, 46 | { 47 | internalType: "uint256", 48 | name: "maxPriorityFeePerGas", 49 | type: "uint256", 50 | }, 51 | { 52 | internalType: "bytes", 53 | name: "paymasterAndData", 54 | type: "bytes", 55 | }, 56 | { 57 | internalType: "bytes", 58 | name: "signature", 59 | type: "bytes", 60 | }, 61 | ], 62 | internalType: "struct UserOperation[]", 63 | name: "ops", 64 | type: "tuple[]", 65 | }, 66 | { 67 | internalType: "address payable", 68 | name: "beneficiary", 69 | type: "address", 70 | }, 71 | ], 72 | name: "handleOps", 73 | outputs: [], 74 | stateMutability: "nonpayable", 75 | type: "function", 76 | }, 77 | ]; 78 | -------------------------------------------------------------------------------- /bundler/src/chain/index.ts: -------------------------------------------------------------------------------- 1 | export * as abi from './abis'; 2 | export * from './provider'; -------------------------------------------------------------------------------- /bundler/src/chain/provider.ts: -------------------------------------------------------------------------------- 1 | import { providers, Wallet } from "ethers"; 2 | import dotenv from "dotenv"; 3 | 4 | dotenv.config(); 5 | 6 | const PROVIDER_REQUIRED_ENVS = ["PROVIDER_URL", "SIGNER_PRIVATE_KEY"]; 7 | for (const env of PROVIDER_REQUIRED_ENVS) { 8 | if (!process.env[env]) { 9 | throw new Error(`Missing env: ${env}`); 10 | } 11 | } 12 | 13 | const PROVIDER_URL = process.env.PROVIDER_URL || ""; 14 | const SIGNER_PRIVATE_KEY = process.env.SIGNER_PRIVATE_KEY || ""; 15 | 16 | const provider = new providers.JsonRpcProvider(PROVIDER_URL); 17 | const signer = new Wallet(SIGNER_PRIVATE_KEY, provider); 18 | 19 | export { provider, signer }; 20 | -------------------------------------------------------------------------------- /bundler/src/index.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import { Contract, ethers, utils } from "ethers"; 3 | import { abi, signer } from "./chain"; 4 | 5 | const app = express(); 6 | const port = process.env.PORT ?? 3000; 7 | 8 | app.use(express.json()); 9 | 10 | /* POST: /broadcast-tx */ 11 | 12 | const BROADCAST_TX_REQUIRED_FIELDS = [ 13 | "sender", 14 | "nonce", 15 | "initCode", 16 | "callData", 17 | "callGasLimit", 18 | "verificationGasLimit", 19 | "preVerificationGas", 20 | "maxFeePerGas", 21 | "maxPriorityFeePerGas", 22 | "paymasterAndData", 23 | "chainId", 24 | "entryPoint", 25 | "signature", 26 | ]; 27 | 28 | app.post("/broadcast-txs", async (req, res) => { 29 | try { 30 | if (req.body?.txs == null) { 31 | return res.status(400).send({ 32 | status: false, 33 | error: "Missing field txs", 34 | }); 35 | } 36 | 37 | for (const txIdx in req.body.txs as API.UserOperation[]) { 38 | const tx = req.body.txs[txIdx]; 39 | for (const field of BROADCAST_TX_REQUIRED_FIELDS) { 40 | if (tx[field] == undefined) { 41 | return res.status(400).send({ 42 | status: false, 43 | error: `Missing field ${field} on tx #${txIdx}`, 44 | }); 45 | } 46 | } 47 | } 48 | 49 | const userOps: API.UserOperation[] = req.body.txs; 50 | 51 | const entryPointInterface = new utils.Interface(abi.ENTRYPOINT); 52 | const entryPointAddress = "0x7C2641de9b8ECED9C3796B0bf99Ead1BeD5407A5"; 53 | const entryPoint = new Contract(entryPointAddress, entryPointInterface, signer); 54 | 55 | console.log("Handling operations", userOps); 56 | 57 | const handleTx = await entryPoint.handleOps(userOps, signer.address); 58 | const randomId = Buffer.from(ethers.utils.randomBytes(10)).toString("hex"); 59 | 60 | console.log(`Handle transaction complete: ${handleTx.hash}`); 61 | 62 | res.send({ 63 | status: true, 64 | jobId: randomId, 65 | }); 66 | } catch (e: any) { 67 | console.log(e); 68 | res.status(500).send({ 69 | status: false, 70 | error: e.message, 71 | }); 72 | } 73 | }); 74 | 75 | app.listen(port, () => { 76 | console.log(`Bundler mock listening at http://localhost:${port}`); 77 | }); 78 | -------------------------------------------------------------------------------- /bundler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | /* Projects */ 5 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 6 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 7 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 8 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 9 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 10 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 11 | /* Language and Environment */ 12 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 13 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 14 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 15 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ 16 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 17 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 18 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 19 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 20 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 21 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 22 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 23 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 24 | /* Modules */ 25 | "module": "commonjs", /* Specify what module code is generated. */ 26 | // "rootDir": "./", /* Specify the root folder within your source files. */ 27 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ 28 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 29 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 30 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 31 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 32 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 33 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 34 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 35 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ 36 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ 37 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ 38 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ 39 | // "resolveJsonModule": true, /* Enable importing .json files. */ 40 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ 41 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 42 | /* JavaScript Support */ 43 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 44 | "checkJs": false, /* Enable error reporting in type-checked JavaScript files. */ 45 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 46 | /* Emit */ 47 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 52 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 53 | "outDir": "./dist", /* Specify an output folder for all emitted files. */ 54 | // "removeComments": true, /* Disable emitting comments. */ 55 | // "noEmit": true, /* Disable emitting files from a compilation. */ 56 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 57 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 58 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 59 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 60 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | /* Interop Constraints */ 71 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 72 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 77 | /* Type Checking */ 78 | "strict": false, /* Enable all strict type-checking options. */ 79 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 80 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 81 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 82 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 83 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 84 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 85 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 86 | "alwaysStrict": false, /* Ensure 'use strict' is always emitted. */ 87 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 88 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 89 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 90 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 91 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 92 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 93 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 94 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 95 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 96 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 97 | /* Completeness */ 98 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 99 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /bundler/types.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | 3 | /** 4 | * 5 | * Inject export type UserOperation = { 6 | sender: string; 7 | nonce: number; 8 | initCode: Uint8Array; 9 | callData: string; 10 | callGasLimit: number; 11 | verificationGasLimit: number; 12 | preVerificationGas: number; 13 | maxFeePerGas: number; 14 | maxPriorityPerGas: number; 15 | paymasterAndData: string; 16 | chainId: number; 17 | entryPoint: string; 18 | signature: string; 19 | }; 20 | to the global namespace 21 | */ 22 | declare global { 23 | namespace API { 24 | export type UserOperation = { 25 | sender: string; 26 | nonce: number; 27 | initCode: string; 28 | callData: string; 29 | callGasLimit: number; 30 | verificationGasLimit: number; 31 | preVerificationGas: number; 32 | maxFeePerGas: number; 33 | maxPriorityPerGas: number; 34 | paymasterAndData: string; 35 | chainId: number; 36 | entryPoint: string; 37 | signature: string; 38 | }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /docker/geth/commands.md: -------------------------------------------------------------------------------- 1 | ``` bash 2 | make geth 3 | 4 | cd build/bin 5 | 6 | ./geth --datadir ../geth-test init genesis.json 7 | 8 | geth account new --datadir ../geth-test 9 | 10 | ./geth --datadir ../geth-test --networkid 42069 --http --http.port 8545 --http.corsdomain '*' --http.vhosts '*' console 11 | 12 | ``` 13 | 14 | ``` javascript 15 | miner.setEtherbase(eth.accounts[0]) 16 | miner.start(1) 17 | ``` -------------------------------------------------------------------------------- /docker/optimism/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | RUN apt update 6 | 7 | # Install essentials to build the node 8 | RUN apt install -y wget 9 | RUN apt install -y curl 10 | RUN apt install -y git 11 | RUN apt install -y pkg-config 12 | RUN apt install -y build-essential 13 | RUN apt install -y vim 14 | 15 | # Install make 16 | RUN apt install -y make 17 | # Install go 18 | RUN apt update 19 | RUN wget https://go.dev/dl/go1.20.linux-amd64.tar.gz 20 | RUN tar xvzf go1.20.linux-amd64.tar.gz 21 | RUN cp go/bin/go /usr/bin/go 22 | RUN mv go /usr/lib 23 | RUN rm /go1.20.linux-amd64.tar.gz 24 | 25 | ENV GOROOT="/usr/lib/go" 26 | 27 | # Install nodejs 28 | RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - 29 | RUN apt-get install -y nodejs 30 | 31 | # Install yarn 32 | RUN npm install -g yarn 33 | 34 | # Install foundry 35 | RUN curl -L https://foundry.paradigm.xyz | bash 36 | ENV PATH="$PATH:/root/.foundry/bin" 37 | RUN foundryup 38 | 39 | # Build optimism monorepo 40 | COPY optimism /usr/optimism 41 | WORKDIR /usr/optimism 42 | 43 | RUN yarn 44 | RUN make op-node op-batcher 45 | RUN yarn build 46 | 47 | # Copy deployed contracts 48 | COPY deployments /usr/optimism/packages/contracts-bedrock/deployments/getting-started 49 | 50 | # Copy network config 51 | COPY network-config.json /usr/optimism/packages/contracts-bedrock/deploy-config/getting-started.json 52 | 53 | # Build op-geth 54 | COPY op-geth /usr/op-geth 55 | WORKDIR /usr/op-geth 56 | 57 | RUN make geth 58 | 59 | ENV L1_RPC_URL=https://goerli.infura.io/v3/5f6507414db54d61b6cfe765b8b231c1 60 | 61 | # Generate L2 config 62 | WORKDIR /usr/optimism/op-node 63 | 64 | RUN go run cmd/main.go genesis l2 \ 65 | --deploy-config ../packages/contracts-bedrock/deploy-config/getting-started.json \ 66 | --deployment-dir ../packages/contracts-bedrock/deployments/getting-started/ \ 67 | --outfile.l2 genesis.json \ 68 | --outfile.rollup rollup.json \ 69 | --l1-rpc $L1_RPC_URL 70 | 71 | RUN openssl rand -hex 32 > jwt.txt 72 | RUN cp genesis.json /usr/op-geth 73 | RUN cp jwt.txt /usr/op-geth 74 | 75 | # Init op-geth 76 | WORKDIR /usr/op-geth 77 | ARG SEQUENCER_KEY=8fe44e41d1c7fbbbe78f1a3c693bde6c39cd16b035e221f51042286e4fe44dea 78 | 79 | RUN mkdir datadir 80 | RUN echo "pwd" > datadir/password 81 | RUN echo $SEQUENCER_KEY > datadir/block-signer-key 82 | RUN ./build/bin/geth account import --datadir=datadir --password=datadir/password datadir/block-signer-key 83 | RUN ./build/bin/geth init --datadir=datadir genesis.json 84 | 85 | WORKDIR /usr -------------------------------------------------------------------------------- /docker/optimism/README.md: -------------------------------------------------------------------------------- 1 | # Optimism Dockerfile 2 | 3 | Sets up the environment required to run Optimism 4 | 5 | ## Build 6 | 7 | ```bash 8 | # On M1/M2 proccessors 9 | docker build --platform linux/x86_64 -t opclave . 10 | 11 | # Linux 12 | docker build -t opclave . 13 | ``` 14 | 15 | ## Run 16 | 17 | ```bash 18 | # On M1/M2 proccessors 19 | docker run --name opclave --platform linux/x86_64 -p 8545:8545 -it opclave bash 20 | 21 | # Linux 22 | docker run -it --rm opclave bash 23 | ``` 24 | 25 | `-it` makes the session interactive 26 | `--rm` removes the container after it is closed 27 | 28 | -------------------------------------------------------------------------------- /docker/optimism/commands.md: -------------------------------------------------------------------------------- 1 | https://goerli.infura.io/v3/5f6507414db54d61b6cfe765b8b231c1 2 | 3 | Mnemonic: public despair debris whip door tourist assume document frown crucial gap city 4 | 5 | Admin: 0xa5f24b0bf7211c7751d024c2d7503b0f9e8e409e 6 | Private Key: 2ea41d68643f95225af873d5acea41d3d1eaf1bf11c4da0ad15d115b6a5c4424 7 | 8 | Proposer: 0x7c14c7c5760ed296b9f50137b5020cac24244edc 9 | Private Key: 1adaca393738f4fcc95d08ecdfe21e2f959eb9ea5eee3b4d881b8d8978e68e89 10 | 11 | Batcher: 0xcd2e9e0375eeee42a9de7bdb25cc6e93106407dc 12 | Private Key: cdf35f135a71f22bd8eadf7fb76c30d02f7d5d480861d1eeba006f8612959c93 13 | 14 | Sequencer: 0x6824bcdc10de5718d0f4d35b42288219144db666 15 | Private Key: 8fe44e41d1c7fbbbe78f1a3c693bde6c39cd16b035e221f51042286e4fe44dea 16 | 17 | hash 0xb6386454730cc120d79c7a1956e4b64f9c1917a02145c6d52b8b73bcfd718fe4 18 | number 8661082 19 | timestamp 1678912608 20 | 21 | sed -i s/ADMIN/0xa5f24b0bf7211c7751d024c2d7503b0f9e8e409e/g deploy-config/getting-started.json 22 | sed -i s/PROPOSER/0x7c14c7c5760ed296b9f50137b5020cac24244edc/g deploy-config/getting-started.json 23 | sed -i s/BATCHER/0xcd2e9e0375eeee42a9de7bdb25cc6e93106407dc/g deploy-config/getting-started.json 24 | sed -i s/SEQUENCER/0x6824bcdc10de5718d0f4d35b42288219144db666/g deploy-config/getting-started.json 25 | sed -i s/BLOCKHASH/0xb6386454730cc120d79c7a1956e4b64f9c1917a02145c6d52b8b73bcfd718fe4/g deploy-config/getting-started.json 26 | sed -i s/\”TIMESTAMP\”/1678912608/g deploy-config/getting-started.json 27 | 28 | ./build/bin/geth \ 29 | --datadir ./datadir \ 30 | --http \ 31 | --http.corsdomain="*" \ 32 | --http.vhosts="*" \ 33 | --http.addr=0.0.0.0 \ 34 | --http.api=web3,debug,eth,txpool,net,engine \ 35 | --ws \ 36 | --ws.addr=0.0.0.0 \ 37 | --ws.port=8546 \ 38 | --ws.origins="*" \ 39 | --ws.api=debug,eth,txpool,net,engine \ 40 | --syncmode=full \ 41 | --gcmode=full \ 42 | --nodiscover \ 43 | --maxpeers=0 \ 44 | --networkid=42069 \ 45 | --authrpc.vhosts="*" \ 46 | --authrpc.addr=0.0.0.0 \ 47 | --authrpc.port=8551 \ 48 | --authrpc.jwtsecret=./jwt.txt \ 49 | --rollup.disabletxpoolgossip=true \ 50 | --password=./datadir/password \ 51 | --allow-insecure-unlock \ 52 | --mine \ 53 | --miner.etherbase=0x6824bcdc10de5718d0f4d35b42288219144db666 \ 54 | --unlock=0x6824bcdc10de5718d0f4d35b42288219144db666 55 | 56 | 57 | ./bin/op-node \ 58 | --l2=http://localhost:8551 \ 59 | --l2.jwt-secret=./jwt.txt \ 60 | --sequencer.enabled \ 61 | --sequencer.l1-confs=3 \ 62 | --verifier.l1-confs=3 \ 63 | --rollup.config=./rollup.json \ 64 | --rpc.addr=0.0.0.0 \ 65 | --rpc.port=8547 \ 66 | --p2p.listen.ip=0.0.0.0 \ 67 | --p2p.listen.tcp=9003 \ 68 | --p2p.listen.udp=9003 \ 69 | --rpc.enable-admin \ 70 | --p2p.sequencer.key=8fe44e41d1c7fbbbe78f1a3c693bde6c39cd16b035e221f51042286e4fe44dea \ 71 | --l1=$L1_RPC_URL \ 72 | --l1.rpckind=basic \ 73 | —-l1.trustrpc=true 74 | 75 | ./bin/op-batcher \ 76 | --l2-eth-rpc=http://localhost:8545 \ 77 | --rollup-rpc=http://localhost:8547 \ 78 | --poll-interval=1s \ 79 | --sub-safety-margin=6 \ 80 | --num-confirmations=1 \ 81 | --safe-abort-nonce-too-low-count=3 \ 82 | --resubmission-timeout=30s \ 83 | --rpc.addr=0.0.0.0 \ 84 | --rpc.port=8548 \ 85 | --target-l1-tx-size-bytes=2048 \ 86 | --l1-eth-rpc=$L1_RPC_URL \ 87 | --private-key=cdf35f135a71f22bd8eadf7fb76c30d02f7d5d480861d1eeba006f8612959c93 88 | -------------------------------------------------------------------------------- /frontend/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/.DS_Store -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | ios/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | *.keystore 35 | !debug.keystore 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | **/fastlane/report.xml 51 | **/fastlane/Preview.html 52 | **/fastlane/screenshots 53 | **/fastlane/test_output 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # Ruby / CocoaPods 59 | /ios/Pods/ 60 | /vendor/bundle/ 61 | 62 | # Temporary files created by Metro to check the health of the file watcher 63 | .metro-health-check* 64 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.node-version: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: false, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.6 2 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {SafeAreaView} from 'react-native-safe-area-context'; 3 | import {AppContextProvider} from './context/AppContext'; 4 | import NavConfig from './navigation/NavMain'; 5 | import {Colors} from './screens/style'; 6 | 7 | function App(): JSX.Element { 8 | return ( 9 | 10 | 11 | 12 | 13 | 14 | ); 15 | } 16 | 17 | export default App; 18 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby File.read(File.join(__dir__, '.ruby-version')).strip 5 | 6 | gem 'cocoapods', '~> 1.11', '>= 1.11.3' 7 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.6) 5 | rexml 6 | activesupport (7.0.4.3) 7 | concurrent-ruby (~> 1.0, >= 1.0.2) 8 | i18n (>= 1.6, < 2) 9 | minitest (>= 5.1) 10 | tzinfo (~> 2.0) 11 | addressable (2.8.1) 12 | public_suffix (>= 2.0.2, < 6.0) 13 | algoliasearch (1.27.5) 14 | httpclient (~> 2.8, >= 2.8.3) 15 | json (>= 1.5.1) 16 | atomos (0.1.3) 17 | claide (1.1.0) 18 | cocoapods (1.12.0) 19 | addressable (~> 2.8) 20 | claide (>= 1.0.2, < 2.0) 21 | cocoapods-core (= 1.12.0) 22 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 23 | cocoapods-downloader (>= 1.6.0, < 2.0) 24 | cocoapods-plugins (>= 1.0.0, < 2.0) 25 | cocoapods-search (>= 1.0.0, < 2.0) 26 | cocoapods-trunk (>= 1.6.0, < 2.0) 27 | cocoapods-try (>= 1.1.0, < 2.0) 28 | colored2 (~> 3.1) 29 | escape (~> 0.0.4) 30 | fourflusher (>= 2.3.0, < 3.0) 31 | gh_inspector (~> 1.0) 32 | molinillo (~> 0.8.0) 33 | nap (~> 1.0) 34 | ruby-macho (>= 2.3.0, < 3.0) 35 | xcodeproj (>= 1.21.0, < 2.0) 36 | cocoapods-core (1.12.0) 37 | activesupport (>= 5.0, < 8) 38 | addressable (~> 2.8) 39 | algoliasearch (~> 1.0) 40 | concurrent-ruby (~> 1.1) 41 | fuzzy_match (~> 2.0.4) 42 | nap (~> 1.0) 43 | netrc (~> 0.11) 44 | public_suffix (~> 4.0) 45 | typhoeus (~> 1.0) 46 | cocoapods-deintegrate (1.0.5) 47 | cocoapods-downloader (1.6.3) 48 | cocoapods-plugins (1.0.0) 49 | nap 50 | cocoapods-search (1.0.1) 51 | cocoapods-trunk (1.6.0) 52 | nap (>= 0.8, < 2.0) 53 | netrc (~> 0.11) 54 | cocoapods-try (1.2.0) 55 | colored2 (3.1.2) 56 | concurrent-ruby (1.2.2) 57 | escape (0.0.4) 58 | ethon (0.16.0) 59 | ffi (>= 1.15.0) 60 | ffi (1.15.5) 61 | fourflusher (2.3.1) 62 | fuzzy_match (2.0.4) 63 | gh_inspector (1.1.3) 64 | httpclient (2.8.3) 65 | i18n (1.12.0) 66 | concurrent-ruby (~> 1.0) 67 | json (2.6.3) 68 | minitest (5.18.0) 69 | molinillo (0.8.0) 70 | nanaimo (0.3.0) 71 | nap (1.1.0) 72 | netrc (0.11.0) 73 | public_suffix (4.0.7) 74 | rexml (3.2.5) 75 | ruby-macho (2.5.1) 76 | typhoeus (1.4.0) 77 | ethon (>= 0.9.0) 78 | tzinfo (2.0.6) 79 | concurrent-ruby (~> 1.0) 80 | xcodeproj (1.22.0) 81 | CFPropertyList (>= 2.3.3, < 4.0) 82 | atomos (~> 0.1.3) 83 | claide (>= 1.0.2, < 2.0) 84 | colored2 (~> 3.1) 85 | nanaimo (~> 0.3.0) 86 | rexml (~> 3.2.4) 87 | 88 | PLATFORMS 89 | ruby 90 | 91 | DEPENDENCIES 92 | cocoapods (~> 1.11, >= 1.11.3) 93 | 94 | RUBY VERSION 95 | ruby 2.7.6p219 96 | 97 | BUNDLED WITH 98 | 2.1.4 99 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/__tests__/App-test.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "com.facebook.react" 3 | 4 | import com.android.build.OutputFile 5 | 6 | /** 7 | * This is the configuration block to customize your React Native Android app. 8 | * By default you don't need to apply any configuration, just uncomment the lines you need. 9 | */ 10 | react { 11 | /* Folders */ 12 | // The root of your project, i.e. where "package.json" lives. Default is '..' 13 | // root = file("../") 14 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native 15 | // reactNativeDir = file("../node_modules/react-native") 16 | // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen 17 | // codegenDir = file("../node_modules/react-native-codegen") 18 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 19 | // cliFile = file("../node_modules/react-native/cli.js") 20 | 21 | /* Variants */ 22 | // The list of variants to that are debuggable. For those we're going to 23 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 24 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 25 | // debuggableVariants = ["liteDebug", "prodDebug"] 26 | 27 | /* Bundling */ 28 | // A list containing the node command and its flags. Default is just 'node'. 29 | // nodeExecutableAndArgs = ["node"] 30 | // 31 | // The command to run when bundling. By default is 'bundle' 32 | // bundleCommand = "ram-bundle" 33 | // 34 | // The path to the CLI configuration file. Default is empty. 35 | // bundleConfig = file(../rn-cli.config.js) 36 | // 37 | // The name of the generated asset file containing your JS bundle 38 | // bundleAssetName = "MyApplication.android.bundle" 39 | // 40 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 41 | // entryFile = file("../js/MyApplication.android.js") 42 | // 43 | // A list of extra flags to pass to the 'bundle' commands. 44 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 45 | // extraPackagerArgs = [] 46 | 47 | /* Hermes Commands */ 48 | // The hermes compiler command to run. By default it is 'hermesc' 49 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 50 | // 51 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 52 | // hermesFlags = ["-O", "-output-source-map"] 53 | } 54 | 55 | /** 56 | * Set this to true to create four separate APKs instead of one, 57 | * one for each native architecture. This is useful if you don't 58 | * use App Bundles (https://developer.android.com/guide/app-bundle/) 59 | * and want to have separate APKs to upload to the Play Store. 60 | */ 61 | def enableSeparateBuildPerCPUArchitecture = false 62 | 63 | /** 64 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 65 | */ 66 | def enableProguardInReleaseBuilds = false 67 | 68 | /** 69 | * The preferred build flavor of JavaScriptCore (JSC) 70 | * 71 | * For example, to use the international variant, you can use: 72 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 73 | * 74 | * The international variant includes ICU i18n library and necessary data 75 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 76 | * give correct results when using with locales other than en-US. Note that 77 | * this variant is about 6MiB larger per architecture than default. 78 | */ 79 | def jscFlavor = 'org.webkit:android-jsc:+' 80 | 81 | /** 82 | * Private function to get the list of Native Architectures you want to build. 83 | * This reads the value from reactNativeArchitectures in your gradle.properties 84 | * file and works together with the --active-arch-only flag of react-native run-android. 85 | */ 86 | def reactNativeArchitectures() { 87 | def value = project.getProperties().get("reactNativeArchitectures") 88 | return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] 89 | } 90 | 91 | android { 92 | ndkVersion rootProject.ext.ndkVersion 93 | 94 | compileSdkVersion rootProject.ext.compileSdkVersion 95 | 96 | namespace "com.reactnativewallet" 97 | defaultConfig { 98 | applicationId "com.reactnativewallet" 99 | minSdkVersion rootProject.ext.minSdkVersion 100 | targetSdkVersion rootProject.ext.targetSdkVersion 101 | versionCode 1 102 | versionName "1.0" 103 | } 104 | 105 | splits { 106 | abi { 107 | reset() 108 | enable enableSeparateBuildPerCPUArchitecture 109 | universalApk false // If true, also generate a universal APK 110 | include (*reactNativeArchitectures()) 111 | } 112 | } 113 | signingConfigs { 114 | debug { 115 | storeFile file('debug.keystore') 116 | storePassword 'android' 117 | keyAlias 'androiddebugkey' 118 | keyPassword 'android' 119 | } 120 | } 121 | buildTypes { 122 | debug { 123 | signingConfig signingConfigs.debug 124 | } 125 | release { 126 | // Caution! In production, you need to generate your own keystore file. 127 | // see https://reactnative.dev/docs/signed-apk-android. 128 | signingConfig signingConfigs.debug 129 | minifyEnabled enableProguardInReleaseBuilds 130 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 131 | } 132 | } 133 | 134 | // applicationVariants are e.g. debug, release 135 | applicationVariants.all { variant -> 136 | variant.outputs.each { output -> 137 | // For each separate APK per architecture, set a unique version code as described here: 138 | // https://developer.android.com/studio/build/configure-apk-splits.html 139 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. 140 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 141 | def abi = output.getFilter(OutputFile.ABI) 142 | if (abi != null) { // null for the universal-debug, universal-release variants 143 | output.versionCodeOverride = 144 | defaultConfig.versionCode * 1000 + versionCodes.get(abi) 145 | } 146 | 147 | } 148 | } 149 | } 150 | 151 | dependencies { 152 | // The version of react-native is set by the React Native Gradle Plugin 153 | implementation("com.facebook.react:react-android") 154 | 155 | implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") 156 | 157 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") 158 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 159 | exclude group:'com.squareup.okhttp3', module:'okhttp' 160 | } 161 | 162 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") 163 | if (hermesEnabled.toBoolean()) { 164 | implementation("com.facebook.react:hermes-android") 165 | } else { 166 | implementation jscFlavor 167 | } 168 | } 169 | 170 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 171 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/debug.keystore -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/debug/java/com/reactnativewallet/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.reactnativewallet; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 21 | import com.facebook.react.ReactInstanceEventListener; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | /** 28 | * Class responsible of loading Flipper inside your React Native application. This is the debug 29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup. 30 | */ 31 | public class ReactNativeFlipper { 32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 33 | if (FlipperUtils.shouldEnableFlipper(context)) { 34 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 35 | 36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 37 | client.addPlugin(new DatabasesFlipperPlugin(context)); 38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 39 | client.addPlugin(CrashReporterPlugin.getInstance()); 40 | 41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 42 | NetworkingModule.setCustomClientBuilder( 43 | new NetworkingModule.CustomClientBuilder() { 44 | @Override 45 | public void apply(OkHttpClient.Builder builder) { 46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 47 | } 48 | }); 49 | client.addPlugin(networkFlipperPlugin); 50 | client.start(); 51 | 52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 53 | // Hence we run if after all native modules have been initialized 54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 55 | if (reactContext == null) { 56 | reactInstanceManager.addReactInstanceEventListener( 57 | new ReactInstanceEventListener() { 58 | @Override 59 | public void onReactContextInitialized(ReactContext reactContext) { 60 | reactInstanceManager.removeReactInstanceEventListener(this); 61 | reactContext.runOnNativeModulesQueueThread( 62 | new Runnable() { 63 | @Override 64 | public void run() { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | }); 68 | } 69 | }); 70 | } else { 71 | client.addPlugin(new FrescoFlipperPlugin()); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/java/com/reactnativewallet/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactnativewallet; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.facebook.react.ReactActivityDelegate; 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate; 7 | 8 | public class MainActivity extends ReactActivity { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | @Override 15 | protected String getMainComponentName() { 16 | return "ReactNativeWallet"; 17 | } 18 | 19 | /** 20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link 21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React 22 | * (aka React 18) with two boolean flags. 23 | */ 24 | @Override 25 | protected ReactActivityDelegate createReactActivityDelegate() { 26 | return new DefaultReactActivityDelegate( 27 | this, 28 | getMainComponentName(), 29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer. 30 | DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled 31 | // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). 32 | DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/java/com/reactnativewallet/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.reactnativewallet; 2 | 3 | import android.app.Application; 4 | import com.facebook.react.PackageList; 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; 9 | import com.facebook.react.defaults.DefaultReactNativeHost; 10 | import com.facebook.soloader.SoLoader; 11 | import java.util.List; 12 | 13 | public class MainApplication extends Application implements ReactApplication { 14 | 15 | private final ReactNativeHost mReactNativeHost = 16 | new DefaultReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | @SuppressWarnings("UnnecessaryLocalVariable") 25 | List packages = new PackageList(this).getPackages(); 26 | // Packages that cannot be autolinked yet can be added manually here, for example: 27 | // packages.add(new MyReactNativePackage()); 28 | return packages; 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | 36 | @Override 37 | protected boolean isNewArchEnabled() { 38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; 39 | } 40 | 41 | @Override 42 | protected Boolean isHermesEnabled() { 43 | return BuildConfig.IS_HERMES_ENABLED; 44 | } 45 | }; 46 | 47 | @Override 48 | public ReactNativeHost getReactNativeHost() { 49 | return mReactNativeHost; 50 | } 51 | 52 | @Override 53 | public void onCreate() { 54 | super.onCreate(); 55 | SoLoader.init(this, /* native exopackage */ false); 56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 57 | // If you opted-in for the New Architecture, we load the native entry point for this app. 58 | DefaultNewArchitectureEntryPoint.load(); 59 | } 60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ReactNativeWallet 3 | 4 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/app/src/release/java/com/reactnativewallet/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.reactnativewallet; 8 | 9 | import android.content.Context; 10 | import com.facebook.react.ReactInstanceManager; 11 | 12 | /** 13 | * Class responsible of loading Flipper inside your React Native application. This is the release 14 | * flavor of it so it's empty as we don't want to load Flipper. 15 | */ 16 | public class ReactNativeFlipper { 17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 18 | // Do nothing as we don't want to initialize Flipper on Release. 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "33.0.0" 6 | minSdkVersion = 21 7 | compileSdkVersion = 33 8 | targetSdkVersion = 33 9 | 10 | // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. 11 | ndkVersion = "23.1.7779620" 12 | } 13 | repositories { 14 | google() 15 | mavenCentral() 16 | } 17 | dependencies { 18 | classpath("com.android.tools.build:gradle:7.3.1") 19 | classpath("com.facebook.react:react-native-gradle-plugin") 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.125.0 29 | 30 | # Use this property to specify which architecture you want to build. 31 | # You can also override it from the CLI using 32 | # ./gradlew -PreactNativeArchitectures=x86_64 33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 34 | 35 | # Use this property to enable support to the new architecture. 36 | # This will allow you to use TurboModules and the Fabric render in 37 | # your application. You should enable this flag either if you want 38 | # to write custom TurboModules/Fabric components OR use libraries that 39 | # are providing them. 40 | newArchEnabled=false 41 | 42 | # Use this property to enable or disable the Hermes JS engine. 43 | # If set to false, you will be using JSC instead. 44 | hermesEnabled=true 45 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ReactNativeWallet' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../node_modules/react-native-gradle-plugin') 5 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeWallet", 3 | "displayName": "ReactNativeWallet" 4 | } -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/aave-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/aave-logo.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/apps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/apps.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/browser.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/done.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/eth-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/eth-logo.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/faceid-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/faceid-logo.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/failed.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/follow-link-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/follow-link-white.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/follow-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/follow-link.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/guard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/guard.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/logo.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/op-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/op-logo.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/profile.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/sent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/sent.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/uni-logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/uni-logo-white.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/uni-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/uni-logo.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/assets/wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itublockchain/opclave-scaling2023/96318677cd26fafde054825992dd18531016f669/frontend/ReactNativeWallet/assets/wallet.png -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | 'module:metro-react-native-babel-preset', 4 | ], 5 | }; 6 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/chain/accountStore.ts: -------------------------------------------------------------------------------- 1 | import AsyncStorage from '@react-native-async-storage/async-storage'; 2 | 3 | export async function getAccount(): Promise { 4 | try { 5 | const account = await AsyncStorage.getItem('com.itu.opclave.account'); 6 | return account; 7 | } catch { 8 | return null; 9 | } 10 | } 11 | 12 | export async function setAccount(account: string): Promise { 13 | await AsyncStorage.setItem('com.itu.opclave.account', account); 14 | } 15 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/chain/index.ts: -------------------------------------------------------------------------------- 1 | export type Token = { 2 | name: string; 3 | symbol: string; 4 | decimals: number; 5 | logo: any; 6 | address?: string; 7 | priceEth: number; 8 | }; 9 | 10 | import EthLogo from '../assets/eth-logo.png'; 11 | import OpLogo from '../assets/op-logo.png'; 12 | 13 | export const deployments = { 14 | account: '0x5154de6CC9bb544a1A12079018F628eF63456574', 15 | paymaster: '0x0bb7B5e7E3B7Da3D45fEa583E467D1c4944D7A1f', 16 | opToken: '0xBB3E66eE258ef9Cc7b4e5d84F765071658A5215D', 17 | entryPoint: '0x7C2641de9b8ECED9C3796B0bf99Ead1BeD5407A5', 18 | } as const; 19 | 20 | export const tokens: Token[] = [ 21 | { 22 | name: 'Ether', 23 | symbol: 'ETH', 24 | logo: EthLogo, 25 | decimals: 18, 26 | priceEth: 1 27 | }, 28 | { 29 | name: 'OP Token', 30 | symbol: 'OP', 31 | logo: OpLogo, 32 | decimals: 18, 33 | address: deployments.opToken, 34 | priceEth: 775 35 | }, 36 | ]; 37 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/components/AppsButton.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Image, View} from 'react-native'; 3 | 4 | import AppIcon from '../assets/apps.png'; 5 | 6 | const AppsButton = () => { 7 | return ( 8 | 16 | 20 | 21 | ); 22 | }; 23 | 24 | export default AppsButton; 25 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/components/BrowserButton.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Image, View} from 'react-native'; 3 | 4 | import BrowserIcon from '../assets/browser.png'; 5 | 6 | const BrowserLogo = () => { 7 | return ( 8 | 10 | 14 | 15 | ); 16 | }; 17 | 18 | export default BrowserLogo; 19 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/components/GuardButton.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Image, View} from 'react-native'; 3 | import GuardIcon from '../assets/guard.png'; 4 | 5 | const GuardLogo = () => { 6 | return ( 7 | 9 | 13 | 14 | ); 15 | }; 16 | 17 | export default GuardLogo; 18 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/components/SendButton.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React from 'react'; 3 | import {Text, View} from 'react-native'; 4 | import {Colors, Fonts} from '../screens/style'; 5 | 6 | const TransferButton = () => { 7 | return ( 8 | 9 | 10 | ); 11 | }; 12 | 13 | export default TransferButton; 14 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/components/WalletButton.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React from 'react'; 3 | import {Text, View} from 'react-native'; 4 | import { Fonts } from '../screens/style'; 5 | 6 | const WalletLogo = () => { 7 | return ( 8 | 19 | 25 | Transfer 26 | 27 | 28 | ); 29 | }; 30 | 31 | export default WalletLogo; -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/context/AppContext.tsx: -------------------------------------------------------------------------------- 1 | import React, {Context} from 'react'; 2 | 3 | type AppContextProps = { 4 | displayData: { 5 | username: string; 6 | balance: string; 7 | }; 8 | setDisplayData: React.Dispatch< 9 | React.SetStateAction<{ 10 | username: string; 11 | balance: string; 12 | }> 13 | >; 14 | 15 | dummyData: { 16 | ethBalance: number; 17 | opBalance: number; 18 | }; 19 | setDummyData: React.Dispatch< 20 | React.SetStateAction<{ 21 | ethBalance: number; 22 | opBalance: number; 23 | }> 24 | >; 25 | }; 26 | 27 | export const AppContext = React.createContext({} as AppContextProps); 28 | 29 | export function AppContextProvider(props: any) { 30 | const [displayData, setDisplayData] = React.useState({ 31 | username: 'zetsub0ii.eth', 32 | balance: '0.00', 33 | }); 34 | 35 | const [dummyData, setDummyData] = React.useState({ 36 | ethBalance: 5.328, 37 | opBalance: 57.4, 38 | }); 39 | 40 | const context: AppContextProps = { 41 | displayData, 42 | setDisplayData, 43 | dummyData, 44 | setDummyData, 45 | }; 46 | 47 | return ( 48 | {props.children} 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/index.d.ts: -------------------------------------------------------------------------------- 1 | // This is to support PNG imports 2 | declare module '*.png'; 3 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/EnclaveModule.m: -------------------------------------------------------------------------------- 1 | // 2 | // EnclaveModule.m 3 | // ReactNativeWallet 4 | // 5 | // Created by zetsuboii on 14.03.2023. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | 14 | @interface RCT_EXTERN_MODULE(EnclaveModule, NSObject) 15 | 16 | // getPublicKey 17 | RCT_EXTERN_METHOD(getPublicKey:(NSString)alias 18 | resolver:(RCTPromiseResolveBlock)resolve 19 | rejecter:(RCTPromiseRejectBlock)reject) 20 | 21 | // generateKeyPair 22 | RCT_EXTERN_METHOD(generateKeyPair:(NSString)alias 23 | resolver:(RCTPromiseResolveBlock)resolve 24 | rejecter:(RCTPromiseRejectBlock)reject) 25 | 26 | // deleteKeyPair 27 | RCT_EXTERN_METHOD(deleteKeyPair:(NSString)alias 28 | resolver:(RCTPromiseResolveBlock)resolve 29 | rejecter:(RCTPromiseRejectBlock)reject) 30 | 31 | // signMessage 32 | RCT_EXTERN_METHOD(signMessage:(NSString)alias 33 | message:(NSString)message 34 | resolver:(RCTPromiseResolveBlock)resolve 35 | rejecter:(RCTPromiseRejectBlock)reject) 36 | 37 | 38 | - (id)init 39 | { 40 | if (self = [super init]) { 41 | [[NSNotificationCenter defaultCenter] addObserver:self 42 | selector:@selector(cameraChanged:) 43 | name:@"AVCaptureDeviceDidStartRunn ingNotification" 44 | object:nil]; 45 | } 46 | return self; 47 | } 48 | 49 | // Please add this one 50 | + (BOOL)requiresMainQueueSetup 51 | { 52 | return NO; 53 | } 54 | 55 | @end 56 | 57 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/EnclaveModule.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EnclaveModule.swift 3 | // ReactNativeWallet 4 | // 5 | // Created by zetsuboii on 14.03.2023. 6 | // 7 | 8 | import Foundation 9 | 10 | @objc(EnclaveModule) 11 | class EnclaveModule: NSObject { 12 | 13 | /// Signing algorithm used by Enclave 14 | static var algorithm: SecKeyAlgorithm = .ecdsaSignatureMessageX962SHA256 15 | 16 | /// Internal function to get an enclave key handle using key alias 17 | private func getKeyHandle(alias: String) -> SecKey? { 18 | let tag = alias.data(using: .utf8)! 19 | 20 | // Build query to get security key 21 | let query: [String: Any] = [ 22 | kSecClass as String : kSecClassKey, 23 | kSecAttrApplicationTag as String : tag, 24 | kSecAttrKeyType as String : kSecAttrKeyTypeEC, 25 | kSecReturnRef as String : true 26 | ] 27 | 28 | // Get key using the query 29 | var item: CFTypeRef? 30 | let status = SecItemCopyMatching(query as CFDictionary, &item) 31 | guard status == errSecSuccess else { 32 | print("[EnclaveModule] No key found") 33 | return nil 34 | } 35 | 36 | return (item as! SecKey) 37 | } 38 | 39 | /// Internal function to sign a message key handle 40 | private func sign(_ message: String, _ keyHandle: SecKey) throws -> String { 41 | let messageData = message.data(using: .utf8)! as CFData 42 | 43 | guard SecKeyIsAlgorithmSupported( 44 | keyHandle, 45 | .sign, 46 | EnclaveModule.algorithm 47 | ) else { 48 | throw EnclaveError.message("Algorithm not supported on this Device") 49 | } 50 | 51 | var error: Unmanaged? 52 | 53 | let signedMessage = SecKeyCreateSignature( 54 | keyHandle, 55 | EnclaveModule.algorithm, 56 | messageData, 57 | &error 58 | ) 59 | 60 | guard signedMessage != nil else { 61 | print(error!) 62 | throw EnclaveError.message("Can't sign message") 63 | } 64 | 65 | return (signedMessage! as Data).base64EncodedString() 66 | } 67 | 68 | /// Returns public key if alias exists, throws otherwise 69 | @objc(getPublicKey:resolver:rejecter:) 70 | func getPublicKey( 71 | _ alias: NSString, 72 | resolver resolve: RCTPromiseResolveBlock, 73 | rejecter reject: RCTPromiseRejectBlock 74 | ) -> Void { 75 | print("[EnclaveModule] getPublicKey called") 76 | let keyHandle = getKeyHandle(alias: alias as String) 77 | 78 | // Check if key handle is not nil 79 | guard keyHandle != nil else { 80 | reject(nil, "Can't get the key handle", nil) 81 | return 82 | } 83 | 84 | // Try to copy public key 85 | var error: Unmanaged? 86 | guard let pubKey = SecKeyCopyPublicKey(keyHandle!) else { 87 | reject(nil, "Can't copy public key", nil) 88 | return 89 | } 90 | 91 | // Get the external representation of the public key 92 | guard let pubExt = SecKeyCopyExternalRepresentation(pubKey, &error) else { 93 | reject(nil, "Can't export public key", nil) 94 | print(error!) 95 | return 96 | } 97 | 98 | let publicKeyDER = prependCurveHeader(pubKeyData: pubExt as Data) 99 | 100 | print("[EnclaveModule] Loaded keypair") 101 | resolve(publicKeyDER.base64EncodedString()); 102 | } 103 | 104 | /// Generates a new key pair 105 | @objc(generateKeyPair:resolver:rejecter:) 106 | func generateKeyPair( 107 | _ alias: NSString, 108 | resolver resolve: RCTPromiseResolveBlock, 109 | rejecter reject: RCTPromiseRejectBlock 110 | ) -> Void { 111 | print("[EnclaveModule] generateKeyPair called") 112 | let flags: SecAccessControlCreateFlags = .biometryAny; 113 | 114 | let access = SecAccessControlCreateWithFlags( 115 | kCFAllocatorDefault, 116 | kSecAttrAccessibleWhenUnlockedThisDeviceOnly, 117 | flags, 118 | nil 119 | )! 120 | 121 | let tag = (alias as String).data(using: .utf8)! 122 | let attributes: [String: Any] = [ 123 | kSecClass as String : kSecClassKey, 124 | kSecAttrKeyType as String : kSecAttrKeyTypeEC, 125 | kSecAttrKeySizeInBits as String : 256, 126 | kSecPrivateKeyAttrs as String : [ 127 | kSecAttrIsPermanent as String : true, 128 | kSecAttrApplicationTag as String : tag, 129 | kSecAttrAccessControl as String : access, 130 | kSecUseAuthenticationUI as String : kSecUseAuthenticationUIAllow 131 | ] 132 | ] 133 | 134 | var error: Unmanaged? 135 | 136 | guard let privateKey = SecKeyCreateRandomKey( 137 | attributes as CFDictionary, 138 | &error 139 | ) else { 140 | let err = error!.takeRetainedValue() as Error 141 | reject(nil, "Can't generate keypair", err) 142 | print(err) 143 | return 144 | } 145 | 146 | guard let publicKey = SecKeyCopyPublicKey(privateKey) else { 147 | reject(nil, "Can't get public key", nil) 148 | return 149 | } 150 | 151 | guard let pubExt = SecKeyCopyExternalRepresentation( 152 | publicKey, 153 | &error 154 | ) else { 155 | reject(nil, "Can't export public key", nil) 156 | return 157 | } 158 | 159 | let publicKeyDER = prependCurveHeader(pubKeyData: pubExt as Data) 160 | 161 | print("[EnclaveModule] Created keypair") 162 | resolve(publicKeyDER.base64EncodedString()); 163 | } 164 | 165 | @objc(deleteKeyPair:resolver:rejecter:) 166 | func deleteKeyPair( 167 | _ alias: NSString, 168 | resolver resolve: RCTPromiseResolveBlock, 169 | rejecter reject: RCTPromiseRejectBlock 170 | ) -> Void { 171 | print("[EnclaveModule] deleteKeyPair called") 172 | let tag = (alias as String).data(using: .utf8)! 173 | 174 | let query: [String: Any] = [ 175 | kSecClass as String : kSecClassKey, 176 | kSecAttrApplicationTag as String : tag, 177 | kSecAttrKeyType as String : kSecAttrKeyTypeEC, 178 | kSecReturnRef as String : true 179 | ] 180 | 181 | let status = SecItemDelete(query as CFDictionary) 182 | 183 | guard status == errSecSuccess else { 184 | reject(status.description, "Can't delete keypair", nil) 185 | return; 186 | } 187 | 188 | print("[EnclaveModule] Deleted keypair") 189 | resolve(true); 190 | } 191 | 192 | /// Signs a message using Enclave 193 | @objc(signMessage:message:resolver:rejecter:) 194 | func signMessage( 195 | _ alias: NSString, 196 | _ message: NSString, 197 | resolver resolve: RCTPromiseResolveBlock, 198 | rejecter reject: RCTPromiseRejectBlock 199 | ) -> Void { 200 | print("[EnclaveModule] signMessage called") 201 | 202 | // Get the key handle 203 | let keyHandle = getKeyHandle(alias: alias as String)! 204 | 205 | // Try to sign the message 206 | do { 207 | let signature = try sign(message as String, keyHandle) 208 | resolve(signature) 209 | print("[EnclaveModule] Signed message") 210 | } catch EnclaveError.message(let message) { 211 | reject(nil, message, nil) 212 | } catch { 213 | reject(nil, "Unknown error", nil) 214 | } 215 | } 216 | } 217 | 218 | /// Adds SECP256R1 curve header to the public key 219 | func prependCurveHeader(pubKeyData: Data) -> Data { 220 | let secp256r1Header = Data(_: [ 221 | 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 222 | 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 223 | 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 224 | 0x01, 0x07, 0x03, 0x42, 0x00 225 | ]) 226 | 227 | return secp256r1Header + pubKeyData 228 | } 229 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/EnclaveModuleErrors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EnclaveModuleErrors.swift 3 | // ReactNativeWallet 4 | // 5 | // Created by zetsuboii on 14.03.2023. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Error to be thrown if something goes wrong with Enclave functions 11 | enum EnclaveError: Error { 12 | case message(String) 13 | } 14 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, min_ios_version_supported 5 | prepare_react_native_project! 6 | 7 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. 8 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded 9 | # 10 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js` 11 | # ```js 12 | # module.exports = { 13 | # dependencies: { 14 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), 15 | # ``` 16 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled 17 | 18 | linkage = ENV['USE_FRAMEWORKS'] 19 | if linkage != nil 20 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 21 | use_frameworks! :linkage => linkage.to_sym 22 | end 23 | 24 | target 'ReactNativeWallet' do 25 | config = use_native_modules! 26 | 27 | # Flags change depending on the env values. 28 | flags = get_default_flags() 29 | 30 | use_react_native!( 31 | :path => config[:reactNativePath], 32 | # Hermes is now enabled by default. Disable by setting this flag to false. 33 | # Upcoming versions of React Native may rely on get_default_flags(), but 34 | # we make it explicit here to aid in the React Native upgrade process. 35 | :hermes_enabled => flags[:hermes_enabled], 36 | :fabric_enabled => flags[:fabric_enabled], 37 | # Enables Flipper. 38 | # 39 | # Note that if you have use_frameworks! enabled, Flipper will not work and 40 | # you should disable the next line. 41 | :flipper_configuration => flipper_config, 42 | # An absolute path to your application root. 43 | :app_path => "#{Pod::Config.instance.installation_root}/.." 44 | ) 45 | 46 | target 'ReactNativeWalletTests' do 47 | inherit! :complete 48 | # Pods for testing 49 | end 50 | 51 | post_install do |installer| 52 | react_native_post_install( 53 | installer, 54 | # Set `mac_catalyst_enabled` to `true` in order to apply patches 55 | # necessary for Mac Catalyst builds 56 | :mac_catalyst_enabled => false 57 | ) 58 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost (1.76.0) 3 | - CocoaAsyncSocket (7.6.5) 4 | - DoubleConversion (1.1.6) 5 | - FBLazyVector (0.71.4) 6 | - FBReactNativeSpec (0.71.4): 7 | - RCT-Folly (= 2021.07.22.00) 8 | - RCTRequired (= 0.71.4) 9 | - RCTTypeSafety (= 0.71.4) 10 | - React-Core (= 0.71.4) 11 | - React-jsi (= 0.71.4) 12 | - ReactCommon/turbomodule/core (= 0.71.4) 13 | - Flipper (0.125.0): 14 | - Flipper-Folly (~> 2.6) 15 | - Flipper-RSocket (~> 1.4) 16 | - Flipper-Boost-iOSX (1.76.0.1.11) 17 | - Flipper-DoubleConversion (3.2.0.1) 18 | - Flipper-Fmt (7.1.7) 19 | - Flipper-Folly (2.6.10): 20 | - Flipper-Boost-iOSX 21 | - Flipper-DoubleConversion 22 | - Flipper-Fmt (= 7.1.7) 23 | - Flipper-Glog 24 | - libevent (~> 2.1.12) 25 | - OpenSSL-Universal (= 1.1.1100) 26 | - Flipper-Glog (0.5.0.5) 27 | - Flipper-PeerTalk (0.0.4) 28 | - Flipper-RSocket (1.4.3): 29 | - Flipper-Folly (~> 2.6) 30 | - FlipperKit (0.125.0): 31 | - FlipperKit/Core (= 0.125.0) 32 | - FlipperKit/Core (0.125.0): 33 | - Flipper (~> 0.125.0) 34 | - FlipperKit/CppBridge 35 | - FlipperKit/FBCxxFollyDynamicConvert 36 | - FlipperKit/FBDefines 37 | - FlipperKit/FKPortForwarding 38 | - SocketRocket (~> 0.6.0) 39 | - FlipperKit/CppBridge (0.125.0): 40 | - Flipper (~> 0.125.0) 41 | - FlipperKit/FBCxxFollyDynamicConvert (0.125.0): 42 | - Flipper-Folly (~> 2.6) 43 | - FlipperKit/FBDefines (0.125.0) 44 | - FlipperKit/FKPortForwarding (0.125.0): 45 | - CocoaAsyncSocket (~> 7.6) 46 | - Flipper-PeerTalk (~> 0.0.4) 47 | - FlipperKit/FlipperKitHighlightOverlay (0.125.0) 48 | - FlipperKit/FlipperKitLayoutHelpers (0.125.0): 49 | - FlipperKit/Core 50 | - FlipperKit/FlipperKitHighlightOverlay 51 | - FlipperKit/FlipperKitLayoutTextSearchable 52 | - FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0): 53 | - FlipperKit/Core 54 | - FlipperKit/FlipperKitHighlightOverlay 55 | - FlipperKit/FlipperKitLayoutHelpers 56 | - YogaKit (~> 1.18) 57 | - FlipperKit/FlipperKitLayoutPlugin (0.125.0): 58 | - FlipperKit/Core 59 | - FlipperKit/FlipperKitHighlightOverlay 60 | - FlipperKit/FlipperKitLayoutHelpers 61 | - FlipperKit/FlipperKitLayoutIOSDescriptors 62 | - FlipperKit/FlipperKitLayoutTextSearchable 63 | - YogaKit (~> 1.18) 64 | - FlipperKit/FlipperKitLayoutTextSearchable (0.125.0) 65 | - FlipperKit/FlipperKitNetworkPlugin (0.125.0): 66 | - FlipperKit/Core 67 | - FlipperKit/FlipperKitReactPlugin (0.125.0): 68 | - FlipperKit/Core 69 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0): 70 | - FlipperKit/Core 71 | - FlipperKit/SKIOSNetworkPlugin (0.125.0): 72 | - FlipperKit/Core 73 | - FlipperKit/FlipperKitNetworkPlugin 74 | - fmt (6.2.1) 75 | - glog (0.3.5) 76 | - hermes-engine (0.71.4): 77 | - hermes-engine/Pre-built (= 0.71.4) 78 | - hermes-engine/Pre-built (0.71.4) 79 | - libevent (2.1.12) 80 | - OpenSSL-Universal (1.1.1100) 81 | - RCT-Folly (2021.07.22.00): 82 | - boost 83 | - DoubleConversion 84 | - fmt (~> 6.2.1) 85 | - glog 86 | - RCT-Folly/Default (= 2021.07.22.00) 87 | - RCT-Folly/Default (2021.07.22.00): 88 | - boost 89 | - DoubleConversion 90 | - fmt (~> 6.2.1) 91 | - glog 92 | - RCT-Folly/Futures (2021.07.22.00): 93 | - boost 94 | - DoubleConversion 95 | - fmt (~> 6.2.1) 96 | - glog 97 | - libevent 98 | - RCTRequired (0.71.4) 99 | - RCTTypeSafety (0.71.4): 100 | - FBLazyVector (= 0.71.4) 101 | - RCTRequired (= 0.71.4) 102 | - React-Core (= 0.71.4) 103 | - React (0.71.4): 104 | - React-Core (= 0.71.4) 105 | - React-Core/DevSupport (= 0.71.4) 106 | - React-Core/RCTWebSocket (= 0.71.4) 107 | - React-RCTActionSheet (= 0.71.4) 108 | - React-RCTAnimation (= 0.71.4) 109 | - React-RCTBlob (= 0.71.4) 110 | - React-RCTImage (= 0.71.4) 111 | - React-RCTLinking (= 0.71.4) 112 | - React-RCTNetwork (= 0.71.4) 113 | - React-RCTSettings (= 0.71.4) 114 | - React-RCTText (= 0.71.4) 115 | - React-RCTVibration (= 0.71.4) 116 | - React-callinvoker (0.71.4) 117 | - React-Codegen (0.71.4): 118 | - FBReactNativeSpec 119 | - hermes-engine 120 | - RCT-Folly 121 | - RCTRequired 122 | - RCTTypeSafety 123 | - React-Core 124 | - React-jsi 125 | - React-jsiexecutor 126 | - ReactCommon/turbomodule/bridging 127 | - ReactCommon/turbomodule/core 128 | - React-Core (0.71.4): 129 | - glog 130 | - hermes-engine 131 | - RCT-Folly (= 2021.07.22.00) 132 | - React-Core/Default (= 0.71.4) 133 | - React-cxxreact (= 0.71.4) 134 | - React-hermes 135 | - React-jsi (= 0.71.4) 136 | - React-jsiexecutor (= 0.71.4) 137 | - React-perflogger (= 0.71.4) 138 | - Yoga 139 | - React-Core/CoreModulesHeaders (0.71.4): 140 | - glog 141 | - hermes-engine 142 | - RCT-Folly (= 2021.07.22.00) 143 | - React-Core/Default 144 | - React-cxxreact (= 0.71.4) 145 | - React-hermes 146 | - React-jsi (= 0.71.4) 147 | - React-jsiexecutor (= 0.71.4) 148 | - React-perflogger (= 0.71.4) 149 | - Yoga 150 | - React-Core/Default (0.71.4): 151 | - glog 152 | - hermes-engine 153 | - RCT-Folly (= 2021.07.22.00) 154 | - React-cxxreact (= 0.71.4) 155 | - React-hermes 156 | - React-jsi (= 0.71.4) 157 | - React-jsiexecutor (= 0.71.4) 158 | - React-perflogger (= 0.71.4) 159 | - Yoga 160 | - React-Core/DevSupport (0.71.4): 161 | - glog 162 | - hermes-engine 163 | - RCT-Folly (= 2021.07.22.00) 164 | - React-Core/Default (= 0.71.4) 165 | - React-Core/RCTWebSocket (= 0.71.4) 166 | - React-cxxreact (= 0.71.4) 167 | - React-hermes 168 | - React-jsi (= 0.71.4) 169 | - React-jsiexecutor (= 0.71.4) 170 | - React-jsinspector (= 0.71.4) 171 | - React-perflogger (= 0.71.4) 172 | - Yoga 173 | - React-Core/RCTActionSheetHeaders (0.71.4): 174 | - glog 175 | - hermes-engine 176 | - RCT-Folly (= 2021.07.22.00) 177 | - React-Core/Default 178 | - React-cxxreact (= 0.71.4) 179 | - React-hermes 180 | - React-jsi (= 0.71.4) 181 | - React-jsiexecutor (= 0.71.4) 182 | - React-perflogger (= 0.71.4) 183 | - Yoga 184 | - React-Core/RCTAnimationHeaders (0.71.4): 185 | - glog 186 | - hermes-engine 187 | - RCT-Folly (= 2021.07.22.00) 188 | - React-Core/Default 189 | - React-cxxreact (= 0.71.4) 190 | - React-hermes 191 | - React-jsi (= 0.71.4) 192 | - React-jsiexecutor (= 0.71.4) 193 | - React-perflogger (= 0.71.4) 194 | - Yoga 195 | - React-Core/RCTBlobHeaders (0.71.4): 196 | - glog 197 | - hermes-engine 198 | - RCT-Folly (= 2021.07.22.00) 199 | - React-Core/Default 200 | - React-cxxreact (= 0.71.4) 201 | - React-hermes 202 | - React-jsi (= 0.71.4) 203 | - React-jsiexecutor (= 0.71.4) 204 | - React-perflogger (= 0.71.4) 205 | - Yoga 206 | - React-Core/RCTImageHeaders (0.71.4): 207 | - glog 208 | - hermes-engine 209 | - RCT-Folly (= 2021.07.22.00) 210 | - React-Core/Default 211 | - React-cxxreact (= 0.71.4) 212 | - React-hermes 213 | - React-jsi (= 0.71.4) 214 | - React-jsiexecutor (= 0.71.4) 215 | - React-perflogger (= 0.71.4) 216 | - Yoga 217 | - React-Core/RCTLinkingHeaders (0.71.4): 218 | - glog 219 | - hermes-engine 220 | - RCT-Folly (= 2021.07.22.00) 221 | - React-Core/Default 222 | - React-cxxreact (= 0.71.4) 223 | - React-hermes 224 | - React-jsi (= 0.71.4) 225 | - React-jsiexecutor (= 0.71.4) 226 | - React-perflogger (= 0.71.4) 227 | - Yoga 228 | - React-Core/RCTNetworkHeaders (0.71.4): 229 | - glog 230 | - hermes-engine 231 | - RCT-Folly (= 2021.07.22.00) 232 | - React-Core/Default 233 | - React-cxxreact (= 0.71.4) 234 | - React-hermes 235 | - React-jsi (= 0.71.4) 236 | - React-jsiexecutor (= 0.71.4) 237 | - React-perflogger (= 0.71.4) 238 | - Yoga 239 | - React-Core/RCTSettingsHeaders (0.71.4): 240 | - glog 241 | - hermes-engine 242 | - RCT-Folly (= 2021.07.22.00) 243 | - React-Core/Default 244 | - React-cxxreact (= 0.71.4) 245 | - React-hermes 246 | - React-jsi (= 0.71.4) 247 | - React-jsiexecutor (= 0.71.4) 248 | - React-perflogger (= 0.71.4) 249 | - Yoga 250 | - React-Core/RCTTextHeaders (0.71.4): 251 | - glog 252 | - hermes-engine 253 | - RCT-Folly (= 2021.07.22.00) 254 | - React-Core/Default 255 | - React-cxxreact (= 0.71.4) 256 | - React-hermes 257 | - React-jsi (= 0.71.4) 258 | - React-jsiexecutor (= 0.71.4) 259 | - React-perflogger (= 0.71.4) 260 | - Yoga 261 | - React-Core/RCTVibrationHeaders (0.71.4): 262 | - glog 263 | - hermes-engine 264 | - RCT-Folly (= 2021.07.22.00) 265 | - React-Core/Default 266 | - React-cxxreact (= 0.71.4) 267 | - React-hermes 268 | - React-jsi (= 0.71.4) 269 | - React-jsiexecutor (= 0.71.4) 270 | - React-perflogger (= 0.71.4) 271 | - Yoga 272 | - React-Core/RCTWebSocket (0.71.4): 273 | - glog 274 | - hermes-engine 275 | - RCT-Folly (= 2021.07.22.00) 276 | - React-Core/Default (= 0.71.4) 277 | - React-cxxreact (= 0.71.4) 278 | - React-hermes 279 | - React-jsi (= 0.71.4) 280 | - React-jsiexecutor (= 0.71.4) 281 | - React-perflogger (= 0.71.4) 282 | - Yoga 283 | - React-CoreModules (0.71.4): 284 | - RCT-Folly (= 2021.07.22.00) 285 | - RCTTypeSafety (= 0.71.4) 286 | - React-Codegen (= 0.71.4) 287 | - React-Core/CoreModulesHeaders (= 0.71.4) 288 | - React-jsi (= 0.71.4) 289 | - React-RCTBlob 290 | - React-RCTImage (= 0.71.4) 291 | - ReactCommon/turbomodule/core (= 0.71.4) 292 | - React-cxxreact (0.71.4): 293 | - boost (= 1.76.0) 294 | - DoubleConversion 295 | - glog 296 | - hermes-engine 297 | - RCT-Folly (= 2021.07.22.00) 298 | - React-callinvoker (= 0.71.4) 299 | - React-jsi (= 0.71.4) 300 | - React-jsinspector (= 0.71.4) 301 | - React-logger (= 0.71.4) 302 | - React-perflogger (= 0.71.4) 303 | - React-runtimeexecutor (= 0.71.4) 304 | - React-hermes (0.71.4): 305 | - DoubleConversion 306 | - glog 307 | - hermes-engine 308 | - RCT-Folly (= 2021.07.22.00) 309 | - RCT-Folly/Futures (= 2021.07.22.00) 310 | - React-cxxreact (= 0.71.4) 311 | - React-jsi 312 | - React-jsiexecutor (= 0.71.4) 313 | - React-jsinspector (= 0.71.4) 314 | - React-perflogger (= 0.71.4) 315 | - React-jsi (0.71.4): 316 | - boost (= 1.76.0) 317 | - DoubleConversion 318 | - glog 319 | - hermes-engine 320 | - RCT-Folly (= 2021.07.22.00) 321 | - React-jsiexecutor (0.71.4): 322 | - DoubleConversion 323 | - glog 324 | - hermes-engine 325 | - RCT-Folly (= 2021.07.22.00) 326 | - React-cxxreact (= 0.71.4) 327 | - React-jsi (= 0.71.4) 328 | - React-perflogger (= 0.71.4) 329 | - React-jsinspector (0.71.4) 330 | - React-logger (0.71.4): 331 | - glog 332 | - react-native-get-random-values (1.8.0): 333 | - React-Core 334 | - react-native-safe-area-context (4.5.0): 335 | - RCT-Folly 336 | - RCTRequired 337 | - RCTTypeSafety 338 | - React-Core 339 | - ReactCommon/turbomodule/core 340 | - React-perflogger (0.71.4) 341 | - React-RCTActionSheet (0.71.4): 342 | - React-Core/RCTActionSheetHeaders (= 0.71.4) 343 | - React-RCTAnimation (0.71.4): 344 | - RCT-Folly (= 2021.07.22.00) 345 | - RCTTypeSafety (= 0.71.4) 346 | - React-Codegen (= 0.71.4) 347 | - React-Core/RCTAnimationHeaders (= 0.71.4) 348 | - React-jsi (= 0.71.4) 349 | - ReactCommon/turbomodule/core (= 0.71.4) 350 | - React-RCTAppDelegate (0.71.4): 351 | - RCT-Folly 352 | - RCTRequired 353 | - RCTTypeSafety 354 | - React-Core 355 | - ReactCommon/turbomodule/core 356 | - React-RCTBlob (0.71.4): 357 | - hermes-engine 358 | - RCT-Folly (= 2021.07.22.00) 359 | - React-Codegen (= 0.71.4) 360 | - React-Core/RCTBlobHeaders (= 0.71.4) 361 | - React-Core/RCTWebSocket (= 0.71.4) 362 | - React-jsi (= 0.71.4) 363 | - React-RCTNetwork (= 0.71.4) 364 | - ReactCommon/turbomodule/core (= 0.71.4) 365 | - React-RCTImage (0.71.4): 366 | - RCT-Folly (= 2021.07.22.00) 367 | - RCTTypeSafety (= 0.71.4) 368 | - React-Codegen (= 0.71.4) 369 | - React-Core/RCTImageHeaders (= 0.71.4) 370 | - React-jsi (= 0.71.4) 371 | - React-RCTNetwork (= 0.71.4) 372 | - ReactCommon/turbomodule/core (= 0.71.4) 373 | - React-RCTLinking (0.71.4): 374 | - React-Codegen (= 0.71.4) 375 | - React-Core/RCTLinkingHeaders (= 0.71.4) 376 | - React-jsi (= 0.71.4) 377 | - ReactCommon/turbomodule/core (= 0.71.4) 378 | - React-RCTNetwork (0.71.4): 379 | - RCT-Folly (= 2021.07.22.00) 380 | - RCTTypeSafety (= 0.71.4) 381 | - React-Codegen (= 0.71.4) 382 | - React-Core/RCTNetworkHeaders (= 0.71.4) 383 | - React-jsi (= 0.71.4) 384 | - ReactCommon/turbomodule/core (= 0.71.4) 385 | - React-RCTSettings (0.71.4): 386 | - RCT-Folly (= 2021.07.22.00) 387 | - RCTTypeSafety (= 0.71.4) 388 | - React-Codegen (= 0.71.4) 389 | - React-Core/RCTSettingsHeaders (= 0.71.4) 390 | - React-jsi (= 0.71.4) 391 | - ReactCommon/turbomodule/core (= 0.71.4) 392 | - React-RCTText (0.71.4): 393 | - React-Core/RCTTextHeaders (= 0.71.4) 394 | - React-RCTVibration (0.71.4): 395 | - RCT-Folly (= 2021.07.22.00) 396 | - React-Codegen (= 0.71.4) 397 | - React-Core/RCTVibrationHeaders (= 0.71.4) 398 | - React-jsi (= 0.71.4) 399 | - ReactCommon/turbomodule/core (= 0.71.4) 400 | - React-runtimeexecutor (0.71.4): 401 | - React-jsi (= 0.71.4) 402 | - ReactCommon/turbomodule/bridging (0.71.4): 403 | - DoubleConversion 404 | - glog 405 | - hermes-engine 406 | - RCT-Folly (= 2021.07.22.00) 407 | - React-callinvoker (= 0.71.4) 408 | - React-Core (= 0.71.4) 409 | - React-cxxreact (= 0.71.4) 410 | - React-jsi (= 0.71.4) 411 | - React-logger (= 0.71.4) 412 | - React-perflogger (= 0.71.4) 413 | - ReactCommon/turbomodule/core (0.71.4): 414 | - DoubleConversion 415 | - glog 416 | - hermes-engine 417 | - RCT-Folly (= 2021.07.22.00) 418 | - React-callinvoker (= 0.71.4) 419 | - React-Core (= 0.71.4) 420 | - React-cxxreact (= 0.71.4) 421 | - React-jsi (= 0.71.4) 422 | - React-logger (= 0.71.4) 423 | - React-perflogger (= 0.71.4) 424 | - RNCAsyncStorage (1.17.12): 425 | - React-Core 426 | - RNGestureHandler (2.9.0): 427 | - React-Core 428 | - RNReanimated (3.0.2): 429 | - DoubleConversion 430 | - FBLazyVector 431 | - FBReactNativeSpec 432 | - glog 433 | - RCT-Folly 434 | - RCTRequired 435 | - RCTTypeSafety 436 | - React-callinvoker 437 | - React-Core 438 | - React-Core/DevSupport 439 | - React-Core/RCTWebSocket 440 | - React-CoreModules 441 | - React-cxxreact 442 | - React-jsi 443 | - React-jsiexecutor 444 | - React-jsinspector 445 | - React-RCTActionSheet 446 | - React-RCTAnimation 447 | - React-RCTBlob 448 | - React-RCTImage 449 | - React-RCTLinking 450 | - React-RCTNetwork 451 | - React-RCTSettings 452 | - React-RCTText 453 | - ReactCommon/turbomodule/core 454 | - Yoga 455 | - RNScreens (3.20.0): 456 | - React-Core 457 | - React-RCTImage 458 | - RNSVG (13.8.0): 459 | - React-Core 460 | - RNVectorIcons (9.2.0): 461 | - React-Core 462 | - SocketRocket (0.6.0) 463 | - Yoga (1.14.0) 464 | - YogaKit (1.18.1): 465 | - Yoga (~> 1.14) 466 | 467 | DEPENDENCIES: 468 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) 469 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 470 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 471 | - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) 472 | - Flipper (= 0.125.0) 473 | - Flipper-Boost-iOSX (= 1.76.0.1.11) 474 | - Flipper-DoubleConversion (= 3.2.0.1) 475 | - Flipper-Fmt (= 7.1.7) 476 | - Flipper-Folly (= 2.6.10) 477 | - Flipper-Glog (= 0.5.0.5) 478 | - Flipper-PeerTalk (= 0.0.4) 479 | - Flipper-RSocket (= 1.4.3) 480 | - FlipperKit (= 0.125.0) 481 | - FlipperKit/Core (= 0.125.0) 482 | - FlipperKit/CppBridge (= 0.125.0) 483 | - FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0) 484 | - FlipperKit/FBDefines (= 0.125.0) 485 | - FlipperKit/FKPortForwarding (= 0.125.0) 486 | - FlipperKit/FlipperKitHighlightOverlay (= 0.125.0) 487 | - FlipperKit/FlipperKitLayoutPlugin (= 0.125.0) 488 | - FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0) 489 | - FlipperKit/FlipperKitNetworkPlugin (= 0.125.0) 490 | - FlipperKit/FlipperKitReactPlugin (= 0.125.0) 491 | - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0) 492 | - FlipperKit/SKIOSNetworkPlugin (= 0.125.0) 493 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 494 | - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) 495 | - libevent (~> 2.1.12) 496 | - OpenSSL-Universal (= 1.1.1100) 497 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) 498 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 499 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 500 | - React (from `../node_modules/react-native/`) 501 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 502 | - React-Codegen (from `build/generated/ios`) 503 | - React-Core (from `../node_modules/react-native/`) 504 | - React-Core/DevSupport (from `../node_modules/react-native/`) 505 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 506 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 507 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 508 | - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`) 509 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 510 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 511 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 512 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`) 513 | - react-native-get-random-values (from `../node_modules/react-native-get-random-values`) 514 | - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) 515 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) 516 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 517 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 518 | - React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`) 519 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 520 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 521 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 522 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 523 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 524 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 525 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 526 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) 527 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 528 | - "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)" 529 | - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) 530 | - RNReanimated (from `../node_modules/react-native-reanimated`) 531 | - RNScreens (from `../node_modules/react-native-screens`) 532 | - RNSVG (from `../node_modules/react-native-svg`) 533 | - RNVectorIcons (from `../node_modules/react-native-vector-icons`) 534 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 535 | 536 | SPEC REPOS: 537 | trunk: 538 | - CocoaAsyncSocket 539 | - Flipper 540 | - Flipper-Boost-iOSX 541 | - Flipper-DoubleConversion 542 | - Flipper-Fmt 543 | - Flipper-Folly 544 | - Flipper-Glog 545 | - Flipper-PeerTalk 546 | - Flipper-RSocket 547 | - FlipperKit 548 | - fmt 549 | - libevent 550 | - OpenSSL-Universal 551 | - SocketRocket 552 | - YogaKit 553 | 554 | EXTERNAL SOURCES: 555 | boost: 556 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" 557 | DoubleConversion: 558 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 559 | FBLazyVector: 560 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 561 | FBReactNativeSpec: 562 | :path: "../node_modules/react-native/React/FBReactNativeSpec" 563 | glog: 564 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 565 | hermes-engine: 566 | :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" 567 | RCT-Folly: 568 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" 569 | RCTRequired: 570 | :path: "../node_modules/react-native/Libraries/RCTRequired" 571 | RCTTypeSafety: 572 | :path: "../node_modules/react-native/Libraries/TypeSafety" 573 | React: 574 | :path: "../node_modules/react-native/" 575 | React-callinvoker: 576 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 577 | React-Codegen: 578 | :path: build/generated/ios 579 | React-Core: 580 | :path: "../node_modules/react-native/" 581 | React-CoreModules: 582 | :path: "../node_modules/react-native/React/CoreModules" 583 | React-cxxreact: 584 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 585 | React-hermes: 586 | :path: "../node_modules/react-native/ReactCommon/hermes" 587 | React-jsi: 588 | :path: "../node_modules/react-native/ReactCommon/jsi" 589 | React-jsiexecutor: 590 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 591 | React-jsinspector: 592 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 593 | React-logger: 594 | :path: "../node_modules/react-native/ReactCommon/logger" 595 | react-native-get-random-values: 596 | :path: "../node_modules/react-native-get-random-values" 597 | react-native-safe-area-context: 598 | :path: "../node_modules/react-native-safe-area-context" 599 | React-perflogger: 600 | :path: "../node_modules/react-native/ReactCommon/reactperflogger" 601 | React-RCTActionSheet: 602 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 603 | React-RCTAnimation: 604 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 605 | React-RCTAppDelegate: 606 | :path: "../node_modules/react-native/Libraries/AppDelegate" 607 | React-RCTBlob: 608 | :path: "../node_modules/react-native/Libraries/Blob" 609 | React-RCTImage: 610 | :path: "../node_modules/react-native/Libraries/Image" 611 | React-RCTLinking: 612 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 613 | React-RCTNetwork: 614 | :path: "../node_modules/react-native/Libraries/Network" 615 | React-RCTSettings: 616 | :path: "../node_modules/react-native/Libraries/Settings" 617 | React-RCTText: 618 | :path: "../node_modules/react-native/Libraries/Text" 619 | React-RCTVibration: 620 | :path: "../node_modules/react-native/Libraries/Vibration" 621 | React-runtimeexecutor: 622 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" 623 | ReactCommon: 624 | :path: "../node_modules/react-native/ReactCommon" 625 | RNCAsyncStorage: 626 | :path: "../node_modules/@react-native-async-storage/async-storage" 627 | RNGestureHandler: 628 | :path: "../node_modules/react-native-gesture-handler" 629 | RNReanimated: 630 | :path: "../node_modules/react-native-reanimated" 631 | RNScreens: 632 | :path: "../node_modules/react-native-screens" 633 | RNSVG: 634 | :path: "../node_modules/react-native-svg" 635 | RNVectorIcons: 636 | :path: "../node_modules/react-native-vector-icons" 637 | Yoga: 638 | :path: "../node_modules/react-native/ReactCommon/yoga" 639 | 640 | SPEC CHECKSUMS: 641 | boost: 57d2868c099736d80fcd648bf211b4431e51a558 642 | CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 643 | DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 644 | FBLazyVector: 446e84642979fff0ba57f3c804c2228a473aeac2 645 | FBReactNativeSpec: 241709e132e3bf1526c1c4f00bc5384dd39dfba9 646 | Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0 647 | Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c 648 | Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 649 | Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b 650 | Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3 651 | Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446 652 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 653 | Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 654 | FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 655 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 656 | glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b 657 | hermes-engine: a1f157c49ea579c28b0296bda8530e980c45bdb3 658 | libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 659 | OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c 660 | RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 661 | RCTRequired: 5a024fdf458fa8c0d82fc262e76f982d4dcdecdd 662 | RCTTypeSafety: b6c253064466411c6810b45f66bc1e43ce0c54ba 663 | React: 715292db5bd46989419445a5547954b25d2090f0 664 | React-callinvoker: 105392d1179058585b564d35b4592fe1c46d6fba 665 | React-Codegen: b75333b93d835afce84b73472927cccaef2c9f8c 666 | React-Core: 88838ed1724c64905fc6c0811d752828a92e395b 667 | React-CoreModules: cd238b4bb8dc8529ccc8b34ceae7267b04ce1882 668 | React-cxxreact: 291bfab79d8098dc5ebab98f62e6bdfe81b3955a 669 | React-hermes: b1e67e9a81c71745704950516f40ee804349641c 670 | React-jsi: c9d5b563a6af6bb57034a82c2b0d39d0a7483bdc 671 | React-jsiexecutor: d6b7fa9260aa3cb40afee0507e3bc1d17ecaa6f2 672 | React-jsinspector: 1f51e775819199d3fe9410e69ee8d4c4161c7b06 673 | React-logger: 0d58569ec51d30d1792c5e86a8e3b78d24b582c6 674 | react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a 675 | react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc 676 | React-perflogger: 0bb0522a12e058f6eb69d888bc16f40c16c4b907 677 | React-RCTActionSheet: bfd675a10f06a18728ea15d82082d48f228a213a 678 | React-RCTAnimation: 2fa220b2052ec75b733112aca39143d34546a941 679 | React-RCTAppDelegate: 8564f93c1d9274e95e3b0c746d08a87ff5a621b2 680 | React-RCTBlob: d0336111f46301ae8aba2e161817e451aad72dd6 681 | React-RCTImage: fec592c46edb7c12a9cde08780bdb4a688416c62 682 | React-RCTLinking: 14eccac5d2a3b34b89dbfa29e8ef6219a153fe2d 683 | React-RCTNetwork: 1fbce92e772e39ca3687a2ebb854501ff6226dd7 684 | React-RCTSettings: 1abea36c9bb16d9979df6c4b42e2ea281b4bbcc5 685 | React-RCTText: 15355c41561a9f43dfd23616d0a0dd40ba05ed61 686 | React-RCTVibration: ad17efcfb2fa8f6bfd8ac0cf48d96668b8b28e0b 687 | React-runtimeexecutor: 8fa50b38df6b992c76537993a2b0553d3b088004 688 | ReactCommon: b49a4b00ca6d181ff74b17c12b2d59ac4add0bde 689 | RNCAsyncStorage: 09fc8595e6d6f6d5abf16b23a56b257d9c6b7c5b 690 | RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39 691 | RNReanimated: f0dd6b881808e635ef0673f89642937d6c141314 692 | RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f 693 | RNSVG: c1e76b81c76cdcd34b4e1188852892dc280eb902 694 | RNVectorIcons: fcc2f6cb32f5735b586e66d14103a74ce6ad61f8 695 | SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 696 | Yoga: 79dd7410de6f8ad73a77c868d3d368843f0c93e0 697 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a 698 | 699 | PODFILE CHECKSUM: 0391dee75199f3bf1d00145ae5ac069cd8ac9e08 700 | 701 | COCOAPODS: 1.12.0 702 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet.xcodeproj/xcshareddata/xcschemes/ReactNativeWallet.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | @implementation AppDelegate 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 8 | { 9 | self.moduleName = @"ReactNativeWallet"; 10 | // You can add your custom initial props in the dictionary below. 11 | // They will be passed down to the ViewController used by React Native. 12 | self.initialProps = @{}; 13 | 14 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 15 | } 16 | 17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 18 | { 19 | #if DEBUG 20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 21 | #else 22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 23 | #endif 24 | } 25 | 26 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. 27 | /// 28 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html 29 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). 30 | /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`. 31 | - (BOOL)concurrentRootEnabled 32 | { 33 | return true; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ReactNativeWallet 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSFaceIDUsageDescription 39 | You need to use your face id to sign a message 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/ReactNativeWallet.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | keychain-access-groups 6 | 7 | $(AppIdentifierPrefix)com.itu.blockchain.ReactNative 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWallet/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWalletTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/ios/ReactNativeWalletTests/ReactNativeWalletTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface ReactNativeWalletTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation ReactNativeWalletTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/lib/enclave.ts: -------------------------------------------------------------------------------- 1 | import {NativeModules} from 'react-native'; 2 | import {Buffer} from 'buffer'; 3 | import elliptic from 'elliptic'; 4 | 5 | const LINKING_ERROR = 'Enclave Module is not linked'; 6 | 7 | const EnclaveModule = NativeModules.EnclaveModule 8 | ? NativeModules.EnclaveModule 9 | : new Proxy( 10 | {}, 11 | { 12 | get() { 13 | throw new Error(LINKING_ERROR); 14 | }, 15 | }, 16 | ); 17 | 18 | const ALIAS: string = 'com.itu.blockchain.enclave'; 19 | const CURVE = new elliptic.ec('p256'); 20 | 21 | const formatPublicKey = (publicKeyBase64: string): string => { 22 | const publicKeyBuffer = Buffer.from(publicKeyBase64, 'base64'); 23 | const publicKeyWithoutHeader = Uint8Array.prototype.slice.call( 24 | publicKeyBuffer, 25 | 26, 26 | ); 27 | return CURVE.keyFromPublic(publicKeyWithoutHeader).getPublic(true, 'hex'); 28 | }; 29 | 30 | export async function getPublicKey(): Promise { 31 | const publicKeyBase64 = await EnclaveModule.getPublicKey(ALIAS); 32 | return formatPublicKey(publicKeyBase64); 33 | } 34 | 35 | export async function generateKeyPair(): Promise { 36 | const publicKeyBase64 = await EnclaveModule.generateKeyPair(ALIAS); 37 | return formatPublicKey(publicKeyBase64); 38 | } 39 | 40 | export async function deleteKeyPair(): Promise { 41 | return await EnclaveModule.deleteKeyPair(ALIAS); 42 | } 43 | 44 | export async function signMessage(data: string): Promise { 45 | const signatureBase64 = await EnclaveModule.signMessage(ALIAS, data); 46 | return Buffer.from(signatureBase64, 'base64').toString('hex'); 47 | } -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/lib/index.ts: -------------------------------------------------------------------------------- 1 | import * as Enclave from "./enclave"; 2 | import * as UserOperation from "./userOperation"; 3 | 4 | export { Enclave, UserOperation } -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/lib/provider.ts: -------------------------------------------------------------------------------- 1 | import "@ethersproject/shims"; 2 | import { providers } from 'ethers'; 3 | 4 | const RPC_URL = "https://optimism-goerli.public.blastapi.io"; 5 | 6 | export const provider = new providers.JsonRpcProvider(RPC_URL); 7 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/lib/userOperation.ts: -------------------------------------------------------------------------------- 1 | import {BigNumber, Contract, utils} from 'ethers'; 2 | import {provider} from './provider'; 3 | 4 | export type TxData = { 5 | dest: string; 6 | value?: number; 7 | data?: string; 8 | }; 9 | 10 | export type Params = { 11 | sender: string; 12 | nonce: number; 13 | initCode: string; 14 | callData: string; 15 | callGasLimit: number; 16 | verificationGasLimit: number; 17 | preVerificationGas: number; 18 | maxFeePerGas: number; 19 | maxPriorityFeePerGas: number; 20 | paymaster: string; 21 | chainId: number; 22 | entryPoint: string; 23 | }; 24 | 25 | const USER_OPERATION_DEFAULTS: Params = { 26 | sender: '0x2e234DAe75C793f67A35089C9d99245E1C58470b', 27 | nonce: 0, 28 | initCode: '0x', 29 | callGasLimit: 100000, 30 | verificationGasLimit: 100000, 31 | preVerificationGas: 100000, 32 | maxFeePerGas: 5, 33 | maxPriorityFeePerGas: 5, 34 | entryPoint: '0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f', 35 | chainId: 420, 36 | callData: '0x', 37 | paymaster: '0x', 38 | }; 39 | 40 | export type Operation = Omit & { 41 | signature: string; 42 | paymasterAndData: string; 43 | }; 44 | 45 | const ACCOUNT_INTERFACE = new utils.Interface([ 46 | 'function nonce() public view returns(uint256)', 47 | 'function execute(address target, uint256 value, bytes calldata data)', 48 | 'function executeBatch(address[] calldata dest, bytes[] calldata func) external', 49 | ]); 50 | 51 | function encodeCalldata(params: TxData): string { 52 | const value = utils.parseEther(String(params.value ?? 0)); 53 | const data = params.data ?? '0x'; 54 | 55 | return ACCOUNT_INTERFACE.encodeFunctionData('execute', [ 56 | params.dest, 57 | value, 58 | data, 59 | ]); 60 | } 61 | 62 | function encodeCalldataBatch(params: TxData[]): string { 63 | const dest = params.map(p => p.dest); 64 | const data = params.map(p => p.data ?? '0x'); 65 | 66 | return ACCOUNT_INTERFACE.encodeFunctionData('executeBatch', [dest, data]); 67 | } 68 | 69 | export async function getNonce(sender: string): Promise { 70 | const accountContract = new Contract(sender, ACCOUNT_INTERFACE, provider); 71 | return await accountContract.nonce().then((n: BigNumber) => Number(n)); 72 | } 73 | 74 | export async function fillParams( 75 | data: TxData, 76 | params?: Partial, 77 | ): Promise { 78 | const sender = params?.sender ?? USER_OPERATION_DEFAULTS.sender; 79 | 80 | let nonce: number; 81 | 82 | if (params?.nonce != null) { 83 | nonce = params.nonce; 84 | } else { 85 | nonce = await getNonce(sender); 86 | } 87 | 88 | return { 89 | ...USER_OPERATION_DEFAULTS, 90 | ...params, 91 | callData: encodeCalldata(data), 92 | nonce, 93 | }; 94 | } 95 | 96 | export async function fillParamsBatch( 97 | data: TxData[], 98 | params?: Partial, 99 | ): Promise { 100 | const sender = params?.sender ?? USER_OPERATION_DEFAULTS.sender; 101 | 102 | let nonce: number; 103 | 104 | if (params?.nonce != null) { 105 | nonce = params.nonce; 106 | } else { 107 | nonce = await getNonce(sender); 108 | } 109 | 110 | return { 111 | ...USER_OPERATION_DEFAULTS, 112 | ...params, 113 | callData: encodeCalldataBatch(data), 114 | nonce, 115 | }; 116 | } 117 | 118 | export async function encode(params: Params): Promise { 119 | const { 120 | sender, 121 | nonce, 122 | initCode, 123 | callGasLimit, 124 | verificationGasLimit, 125 | preVerificationGas, 126 | maxFeePerGas, 127 | maxPriorityFeePerGas, 128 | paymaster, 129 | chainId, 130 | entryPoint, 131 | callData: calldata, 132 | } = params; 133 | 134 | return utils.keccak256( 135 | utils.defaultAbiCoder.encode( 136 | [ 137 | 'address', 138 | 'uint256', 139 | 'bytes', 140 | 'bytes', 141 | 'uint256', 142 | 'uint256', 143 | 'uint256', 144 | 'uint256', 145 | 'uint256', 146 | 'bytes', 147 | 'address', 148 | 'uint256', 149 | ], 150 | [ 151 | sender, 152 | nonce, 153 | initCode, 154 | calldata, 155 | callGasLimit, 156 | verificationGasLimit, 157 | preVerificationGas, 158 | maxFeePerGas, 159 | maxPriorityFeePerGas, 160 | paymaster, 161 | entryPoint, 162 | chainId, 163 | ], 164 | ), 165 | ); 166 | } 167 | 168 | export async function create( 169 | params: Params, 170 | signature: string, 171 | ): Promise { 172 | const {paymaster, ...rest} = params; 173 | const paymasterAndData = paymaster; 174 | 175 | if (!rest.initCode.startsWith('0x')) rest.initCode = '0x' + rest.initCode; 176 | if (!rest.callData.startsWith('0x')) rest.callData = '0x' + rest.callData; 177 | if (!signature.startsWith('0x')) signature = '0x' + signature; 178 | 179 | return {...rest, paymasterAndData, signature}; 180 | } 181 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: true, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/navigation/NavMain.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React from 'react'; 3 | import {SafeAreaView, View} from 'react-native'; 4 | import Landing from '../screens/Landing'; 5 | import {createNativeStackNavigator} from '@react-navigation/native-stack'; 6 | import {NavigationContainer} from '@react-navigation/native'; 7 | 8 | import Applications from '../screens/Application'; 9 | import Wallet from '../screens/Wallet'; 10 | import Send from '../screens/Send'; 11 | 12 | import AppsButton from '../components/AppsButton'; 13 | 14 | const Stack = createNativeStackNavigator(); 15 | 16 | const NavMain = () => { 17 | return ( 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | }} 31 | /> 32 | }} 35 | component={Applications} 36 | /> 37 | 38 | 39 | 40 | 41 | ); 42 | }; 43 | 44 | export default NavMain; 45 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/navigation/NavTab.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; 3 | import Wallet from '../screens/Wallet'; 4 | 5 | import AppsButton from '../components/AppsButton'; 6 | import SendButton from '../components/SendButton'; 7 | import GuardButton from '../components/GuardButton'; 8 | import BrowserButton from '../components/BrowserButton'; 9 | 10 | import Applications from '../screens/Application'; 11 | import NotAvailable from '../screens/NotAvailable'; 12 | 13 | const Tab = createBottomTabNavigator(); 14 | 15 | const NavTab = () => { 16 | return ( 17 | 18 | , 25 | tabBarActiveBackgroundColor: 'pink', 26 | tabBarShowLabel: false, 27 | }} 28 | /> 29 | , 36 | tabBarActiveBackgroundColor: 'pink', 37 | tabBarShowLabel: false, 38 | }} 39 | /> 40 | , 47 | tabBarActiveBackgroundColor: 'pink', 48 | tabBarShowLabel: false, 49 | }} 50 | /> 51 | , 58 | tabBarActiveBackgroundColor: 'pink', 59 | tabBarShowLabel: false, 60 | }} 61 | /> 62 | 63 | ); 64 | }; 65 | 66 | export default NavTab; 67 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeWallet", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "lint": "eslint .", 9 | "start": "react-native start", 10 | "test": "jest" 11 | }, 12 | "dependencies": { 13 | "@babel/plugin-proposal-class-properties": "^7.18.6", 14 | "@ethersproject/shims": "^5.7.0", 15 | "@react-native-async-storage/async-storage": "^1.17.12", 16 | "@react-navigation/bottom-tabs": "^6.5.7", 17 | "@react-navigation/material-bottom-tabs": "^6.2.15", 18 | "@react-navigation/native": "^6.1.6", 19 | "@react-navigation/native-stack": "^6.9.12", 20 | "axios": "^1.3.4", 21 | "elliptic": "^6.5.4", 22 | "ethers": "^5.7.2", 23 | "react": "18.2.0", 24 | "react-native": "0.71.4", 25 | "react-native-dropdown-select-list": "^2.0.4", 26 | "react-native-gesture-handler": "^2.9.0", 27 | "react-native-get-random-values": "^1.8.0", 28 | "react-native-paper": "^5.4.1", 29 | "react-native-reanimated": "^3.0.2", 30 | "react-native-safe-area-context": "^4.5.0", 31 | "react-native-screens": "^3.20.0", 32 | "react-native-svg": "^13.8.0", 33 | "react-native-vector-icons": "^9.2.0" 34 | }, 35 | "devDependencies": { 36 | "@babel/core": "^7.20.0", 37 | "@babel/preset-env": "^7.20.0", 38 | "@babel/runtime": "^7.20.0", 39 | "@react-native-community/eslint-config": "^3.2.0", 40 | "@tsconfig/react-native": "^2.0.2", 41 | "@types/elliptic": "^6.4.14", 42 | "@types/jest": "^29.2.1", 43 | "@types/react": "^18.0.24", 44 | "@types/react-test-renderer": "^18.0.0", 45 | "babel-jest": "^29.2.1", 46 | "eslint": "^8.19.0", 47 | "jest": "^29.2.1", 48 | "metro-react-native-babel-preset": "0.73.8", 49 | "prettier": "^2.4.1", 50 | "react-test-renderer": "18.2.0", 51 | "typescript": "4.8.4" 52 | }, 53 | "jest": { 54 | "preset": "react-native" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/screens/Application.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React, {useContext} from 'react'; 3 | import {View, Text, Image, TextInput, TouchableOpacity} from 'react-native'; 4 | import {SelectList} from 'react-native-dropdown-select-list'; 5 | 6 | import {AppContext} from '../context/AppContext'; 7 | 8 | import UniLogo from '../assets/uni-logo.png'; 9 | import AaveLogo from '../assets/aave-logo.png'; 10 | import {Colors, Fonts} from './style'; 11 | 12 | const Application = () => { 13 | const [selected, setSelected] = React.useState(''); 14 | const [amount, setAmount] = React.useState('0'); 15 | const {displayData} = useContext(AppContext); 16 | 17 | return ( 18 | 25 | 35 | {displayData.username} 36 | 37 | 46 | 52 | 56 | 63 | Uniswap 64 | 65 | 66 | 67 | 75 | {/* setSelected(val)} 77 | data={appData.tokens.map((i: any, index: number) => ({ 78 | key: index, 79 | value: i.name, 80 | }))} 81 | save="value" 82 | defaultOption={ 83 | appData.tokens.map((i: any, index: number) => ({ 84 | key: index, 85 | value: i.name, 86 | }))[0] 87 | } 88 | /> */} 89 | { 101 | if (e.endsWith('.') || e.endsWith('0')) { 102 | console.log(e); 103 | return setAmount(e); 104 | } 105 | if (isNaN(parseFloat(e)) || e.length === 0) { 106 | console.log(e); 107 | return setAmount('0'); 108 | } else { 109 | setAmount(parseFloat(e).toString()); 110 | } 111 | }} 112 | value={String(amount)} 113 | placeholder="Amount" 114 | keyboardType="numeric" 115 | /> 116 | 117 | 126 | {/* setSelected(val)} 128 | data={appData.tokens.map((i: any, index: number) => ({ 129 | key: index, 130 | value: i.name, 131 | }))} 132 | save="value" 133 | defaultOption={ 134 | appData.tokens.map((i: any, index: number) => ({ 135 | key: index, 136 | value: i.name, 137 | }))[1] 138 | } 139 | /> */} 140 | 151 | {String((Number(amount) * 1.745).toFixed(2))} 152 | 153 | 154 | 160 | 161 | 171 | Swap 172 | 173 | 174 | 175 | 176 | 177 | 178 | 182 | {/* 189 | AAVE coming soon! 190 | */} 191 | 192 | 193 | ); 194 | }; 195 | 196 | export default Application; 197 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/screens/Landing.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | Alert, 4 | Image, 5 | StyleSheet, 6 | Text, 7 | View, 8 | ActivityIndicator, 9 | } from 'react-native'; 10 | import {TouchableOpacity} from 'react-native-gesture-handler'; 11 | 12 | import Logo from '../assets/logo.png'; 13 | import FaceIdLogo from '../assets/faceid-logo.png'; 14 | 15 | import {Colors, Fonts} from './style'; 16 | import {getAccount, setAccount} from '../chain/accountStore'; 17 | import {Enclave, UserOperation} from '../lib'; 18 | import axios from 'axios'; 19 | 20 | const LandingState = { 21 | Welcome: 0, 22 | Deployment: 1, 23 | } as const; 24 | 25 | type Navigation = { 26 | navigate: (arg0: string) => void; 27 | }; 28 | 29 | type WelcomeProps = { 30 | navigation: Navigation; 31 | setLandingState: React.Dispatch>; 32 | }; 33 | 34 | type LandingProps = { 35 | navigation: Navigation; 36 | }; 37 | 38 | async function onLandingPress( 39 | navigation: Navigation, 40 | setTransferState: React.Dispatch>, 41 | ) { 42 | const account = await getAccount(); 43 | 44 | if (account != null) { 45 | navigation.navigate('Menu'); 46 | return; 47 | } 48 | 49 | setTransferState(LandingState.Deployment); 50 | 51 | try { 52 | // const deployOp = {} as UserOperation.Operation; 53 | // const bundlerResponse: {jobId: string} = await axios 54 | // .post('http://localhost:3000/broadcast-txs', { 55 | // txs: [deployOp], 56 | // }) 57 | // .then(resp => resp.data); 58 | 59 | // console.log(bundlerResponse); 60 | // await setAccount(deployOp.sender); 61 | 62 | // Trigger the enclave 63 | await Enclave.getPublicKey(); 64 | 65 | // Sleep 5 second 66 | await new Promise(resolve => setTimeout(resolve, 5000)); 67 | 68 | navigation.navigate('Menu'); 69 | } catch (e) { 70 | console.error(e); 71 | Alert.alert('Error', 'Failed to deploy wallet'); 72 | } 73 | } 74 | 75 | const Deployment = () => { 76 | return ( 77 | <> 78 | 85 | 86 | Deploying your account 87 | 88 | 89 | 90 | 91 | 92 | ); 93 | }; 94 | 95 | const Welcome = (props: WelcomeProps) => { 96 | return ( 97 | <> 98 | 99 | Let's set up your wallet 100 | 102 | onLandingPress(props.navigation, props.setLandingState) 103 | }> 104 | 116 | 124 | 131 | Continue 132 | 133 | 134 | 135 | 136 | 137 | 138 | Alert.alert('Not available yet!')}> 139 | Already have a wallet? 140 | 141 | Recover wallet using Guardians 142 | 143 | 144 | 145 | 146 | ); 147 | }; 148 | 149 | const Landing = (props: LandingProps) => { 150 | const [landingState, setLandingState] = React.useState(0); 151 | 152 | return ( 153 | 154 | 155 | 156 | 160 | 167 | OPCLAVE 168 | 169 | 170 | 171 | 172 | {landingState === 0 && ( 173 | 177 | )} 178 | {landingState === 1 && } 179 | 180 | ); 181 | }; 182 | 183 | const styles = StyleSheet.create({ 184 | container: {height: '100%', backgroundColor: Colors.dark.background}, 185 | upperSection: { 186 | flex: 3, 187 | alignItems: 'center', 188 | justifyContent: 'center', 189 | }, 190 | middleSection: { 191 | flex: 2, 192 | alignItems: 'center', 193 | }, 194 | lowerSection: { 195 | flex: 1, 196 | alignItems: 'center', 197 | justifyContent: 'center', 198 | }, 199 | button: { 200 | paddingHorizontal: 20, 201 | paddingVertical: 10, 202 | marginTop: 15, 203 | backgroundColor: Colors.dark.accent, 204 | color: Colors.dark.text, 205 | overflow: 'hidden', 206 | borderRadius: 3, 207 | shadowColor: 'white', 208 | }, 209 | bigBold: { 210 | color: Colors.dark.text, 211 | fontSize: 24, 212 | fontFamily: Fonts.bold, 213 | }, 214 | bigRegular: { 215 | color: Colors.dark.text, 216 | fontSize: 32, 217 | fontFamily: Fonts.regular, 218 | }, 219 | bigThin: { 220 | color: Colors.dark.text, 221 | fontSize: 24, 222 | fontFamily: Fonts.thin, 223 | }, 224 | smallThin: { 225 | textAlign: 'center', 226 | color: Colors.dark.text, 227 | fontSize: 16, 228 | fontFamily: Fonts.thin, 229 | }, 230 | smallRegular: { 231 | textAlign: 'center', 232 | color: Colors.dark.text, 233 | fontFamily: Fonts.regular, 234 | fontSize: 16, 235 | }, 236 | }); 237 | 238 | export default Landing; 239 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/screens/NotAvailable.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {StyleSheet, Text, View} from 'react-native'; 3 | import {Colors} from './style'; 4 | 5 | const NotAvailable = () => { 6 | return ( 7 | 8 | 9 | This page is not available yet! 10 | 11 | 12 | ); 13 | }; 14 | 15 | const styles = StyleSheet.create({ 16 | container: { 17 | backgroundColor: Colors.dark.background, 18 | height: '100%', 19 | display: 'flex', 20 | flexDirection: 'row', 21 | alignItems: 'center', 22 | justifyContent: 'center', 23 | }, 24 | }); 25 | 26 | export default NotAvailable; 27 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/screens/Send.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React, {useContext, useState} from 'react'; 3 | import axios from 'axios'; 4 | import { 5 | TextInput, 6 | View, 7 | Text, 8 | TouchableOpacity, 9 | Image, 10 | StyleSheet, 11 | ActivityIndicator, 12 | Linking, 13 | Keyboard, 14 | } from 'react-native'; 15 | import {SelectList} from 'react-native-dropdown-select-list'; 16 | 17 | import '@ethersproject/shims'; 18 | import {utils} from 'ethers'; 19 | import {Enclave, UserOperation} from '../lib'; 20 | 21 | import FaceIdLogo from '../assets/faceid-logo.png'; 22 | import SentIcon from '../assets/sent.png'; 23 | import FailedIcon from '../assets/failed.png'; 24 | import FollowLinkIcon from '../assets/follow-link-white.png'; 25 | 26 | import {Colors, Fonts} from './style'; 27 | import {deployments, tokens} from '../chain'; 28 | import {AppContext} from '../context/AppContext'; 29 | 30 | const ESTIMATE_FEE = 0.0000194; 31 | 32 | const Container = (props: {children: any}) => { 33 | return ( 34 | 39 | {props.children} 40 | 41 | ); 42 | }; 43 | 44 | const FlexRow = (props: {children: any}) => { 45 | return ( 46 | 52 | {props.children} 53 | 54 | ); 55 | }; 56 | 57 | const VerticalSpacer = (props: {height: number}) => { 58 | return ; 59 | }; 60 | 61 | const Picker = (props: { 62 | defaultItem: {key: number; value: string}; 63 | items: {key: number; value: string}[]; 64 | setSelected: React.Dispatch>; 65 | }) => { 66 | return ( 67 | props.setSelected(val)} 71 | save="key" 72 | fontFamily={Fonts.bold} 73 | dropdownTextStyles={{color: 'white'}} 74 | dropdownStyles={{ 75 | width: 75, 76 | backgroundColor: Colors.dark.accent, 77 | position: 'absolute', 78 | transform: [{translateY: 35}], 79 | borderRadius: 5, 80 | zIndex: 1, 81 | borderColor: 'transparent', 82 | }} 83 | search={false} 84 | arrowicon={} 85 | inputStyles={{color: 'white', marginLeft: 5}} 86 | boxStyles={{ 87 | borderRadius: 5, 88 | borderColor: 'transparent', 89 | backgroundColor: Colors.dark.accent, 90 | width: 75, 91 | }} 92 | /> 93 | ); 94 | }; 95 | 96 | const TransferSuccess = (props: {onPress: () => void}) => { 97 | return ( 98 | 105 | 109 | 110 | { 112 | const URL = 113 | 'https://goerli-optimism.etherscan.io/address/0xc6a2FBCFad2F45960cbfe876c26D3Eb342A98D18'; 114 | 115 | const supported = await Linking.canOpenURL(URL); 116 | 117 | if (supported) { 118 | await Linking.openURL(URL); 119 | } 120 | }}> 121 | 122 | 123 | Transfer successful 124 | 125 | 129 | 130 | 131 | 132 | 133 | 140 | Go back 141 | 142 | 143 | ); 144 | }; 145 | 146 | const TransferError = (props: {onPress: () => void}) => { 147 | return ( 148 | 155 | 159 | 160 | 161 | Transfer failed 162 | 163 | 164 | 171 | Go back 172 | 173 | 174 | ); 175 | }; 176 | 177 | const PrepareTransfer = (props: { 178 | onSuccess: (successData: {txHash: string}) => void; 179 | onError: () => void; 180 | }) => { 181 | // These are for the convenience in the demo, otherwise we'd have to wait for balanceOf calls 182 | const {dummyData, setDummyData} = useContext(AppContext); 183 | 184 | const [amount, setAmount] = useState('1'); 185 | const [address, setAddress] = useState( 186 | '0x81841c4648E17Db0F4Dc7e47195D19B19BA47a66', 187 | ); 188 | const [clicked, setClicked] = useState(false); 189 | 190 | const [selectedGasToken, setSelectedGasToken] = useState(0); 191 | const [selectedTransferToken, setSelectedTransferToken] = useState(0); 192 | 193 | async function onSend() { 194 | if (utils.isAddress(address) === false) { 195 | console.log('Invalid address'); 196 | return; 197 | } 198 | 199 | const ERC20_IFACE = new utils.Interface([ 200 | 'function approve(address spender, uint256 amount) public returns (bool)', 201 | 'function transfer(address to, uint256 amount) public returns (bool)', 202 | ]); 203 | 204 | let nonce = await UserOperation.getNonce(deployments.account); 205 | 206 | const parsedAmount = utils.parseUnits( 207 | amount, 208 | tokens[selectedTransferToken].decimals, 209 | ); 210 | 211 | // We are approving more than we want in reality 212 | const approveData = ERC20_IFACE.encodeFunctionData('approve', [ 213 | deployments.paymaster, 214 | utils.parseEther(amount), 215 | ]); 216 | 217 | const transferData = ERC20_IFACE.encodeFunctionData('transfer', [ 218 | address, 219 | parsedAmount, 220 | ]); 221 | 222 | const createOperation = async ( 223 | data: UserOperation.TxData[], 224 | params?: Partial, 225 | ): Promise => { 226 | const opParams = await UserOperation.fillParamsBatch(data, params); 227 | nonce += 1; 228 | const encodedOp = await UserOperation.encode(opParams); 229 | const signature = await Enclave.signMessage(encodedOp); 230 | 231 | // Sleep 5 seconds to simulate the time it takes to send the transaction 232 | await new Promise((resolve) => setTimeout(resolve, 5000)); 233 | 234 | return await UserOperation.create(opParams, signature); 235 | }; 236 | 237 | const transferOp = await createOperation( 238 | [{dest: deployments.opToken, data: transferData}], 239 | { 240 | sender: deployments.account, 241 | entryPoint: deployments.entryPoint, 242 | paymaster: deployments.paymaster, 243 | chainId: 420, 244 | nonce, 245 | callGasLimit: Math.floor(Math.random() * 90000 + 10000), 246 | verificationGasLimit: Math.floor(Math.random() * 90000 + 10000), 247 | preVerificationGas: Math.floor(Math.random() * 90000 + 10000), 248 | maxFeePerGas: 10, 249 | maxPriorityFeePerGas: 10, 250 | }, 251 | ); 252 | 253 | // DEBUG 254 | if (selectedGasToken === 0) { 255 | setDummyData({ 256 | ...dummyData, 257 | ethBalance: dummyData.ethBalance - ESTIMATE_FEE, 258 | }); 259 | } else { 260 | setDummyData({ 261 | ...dummyData, 262 | opBalance: 263 | dummyData.opBalance - 264 | ESTIMATE_FEE * tokens[selectedGasToken].priceEth, 265 | }); 266 | } 267 | 268 | // DEBUG 269 | if (selectedTransferToken === 0) { 270 | setDummyData({ 271 | ...dummyData, 272 | ethBalance: dummyData.ethBalance - parseFloat(amount), 273 | }); 274 | } else { 275 | setDummyData({ 276 | ...dummyData, 277 | opBalance: dummyData.opBalance - parseFloat(amount), 278 | }); 279 | } 280 | 281 | try { 282 | const bundlerResponse: {jobId: string} = await axios 283 | .post('http://localhost:3000/broadcast-txs', { 284 | txs: [transferOp], 285 | }) 286 | .then(resp => resp.data); 287 | console.log(bundlerResponse); 288 | 289 | // Handle Success 290 | props.onSuccess({txHash: bundlerResponse.jobId}); 291 | } catch (e) { 292 | console.error(e); 293 | 294 | // Handle Error 295 | props.onError(); 296 | } 297 | } 298 | 299 | return ( 300 | 309 | 317 | Send Funds 318 | 319 | 320 | 321 | Recipient: 322 | 323 | 330 | 338 | 339 | 340 | 341 | 342 | Amount: 343 | 344 | 351 | { 355 | setAmount(parseFloat(e).toString()); 356 | }} 357 | value={amount} 358 | placeholder="Amount" 359 | keyboardType="numeric" 360 | placeholderTextColor={'white'} 361 | /> 362 | 363 | ({ 367 | key: index, 368 | value: symbol, 369 | }))} 370 | /> 371 | 372 | 373 | 381 | Fee: 382 | 383 | 389 | 396 | {ESTIMATE_FEE * tokens[selectedGasToken].priceEth} 397 | 398 | 399 | ({ 403 | key: index, 404 | value: symbol, 405 | }))} 406 | /> 407 | 408 | 409 | 410 | 411 | 412 | 413 | {clicked ? ( 414 | 415 | ) : ( 416 | { 418 | setClicked(true); 419 | await onSend(); 420 | }}> 421 | 432 | 440 | 447 | Send 448 | 449 | 450 | 451 | )} 452 | 453 | ); 454 | }; 455 | 456 | const styles = StyleSheet.create({ 457 | labelText: { 458 | color: Colors.dark.text, 459 | fontSize: 24, 460 | fontFamily: Fonts.regular, 461 | marginBottom: 5, 462 | }, 463 | input: { 464 | borderRadius: 5, 465 | borderWidth: 1, 466 | paddingVertical: 13, 467 | paddingHorizontal: 10, 468 | marginRight: 20, 469 | textAlign: 'right', 470 | borderColor: 'white', 471 | color: 'white', 472 | flex: 1, 473 | }, 474 | }); 475 | 476 | const Send = ({navigation}: {navigation: any}) => { 477 | const [transferState, setTransferState] = useState(0); 478 | 479 | switch (transferState) { 480 | case 0: 481 | return ( 482 | { 484 | setTransferState(1); 485 | }} 486 | onError={() => { 487 | setTransferState(1); 488 | }} 489 | /> 490 | ); 491 | case 1: 492 | return ( 493 | { 495 | navigation.navigate('Menu'); 496 | }} 497 | /> 498 | ); 499 | case 2: 500 | return ( 501 | { 503 | navigation.navigate('Menu'); 504 | }} 505 | /> 506 | ); 507 | } 508 | 509 | return ; 510 | }; 511 | 512 | export default Send; 513 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/screens/Wallet.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React, {useContext} from 'react'; 3 | import {Alert, Image, ScrollView, StyleSheet, Text, View} from 'react-native'; 4 | import {TouchableOpacity} from 'react-native-gesture-handler'; 5 | import {tokens} from '../chain'; 6 | import {AppContext} from '../context/AppContext'; 7 | import {Colors, Fonts} from './style'; 8 | 9 | import profile from '../assets/profile.png'; 10 | 11 | const Wallet = ({navigation}: {navigation: any}) => { 12 | const {displayData, dummyData} = useContext(AppContext); 13 | 14 | // DEBUG 15 | const balances = [dummyData.ethBalance, dummyData.opBalance]; 16 | 17 | return ( 18 | 19 | 29 | 42 | {displayData.username} 43 | 44 | 51 | {dummyData.ethBalance.toFixed(3)} ETH 52 | 53 | 60 | navigation.navigate('Send')} 64 | /> 65 | navigation.navigate('Swap')} 69 | /> 70 | 71 | 72 | 79 | Alert.alert('Not available yet!')} 84 | /> 85 | Alert.alert('Not available yet!')} 90 | /> 91 | 92 | 93 | 97 | 98 | ); 99 | }; 100 | 101 | const WalletButton = (props: { 102 | text: string; 103 | logo: any; 104 | onPress: () => void; 105 | style?: any; 106 | disabled?: boolean; 107 | }) => { 108 | return ( 109 | 121 | 125 | 130 | {props.text} 131 | 132 | 133 | ); 134 | }; 135 | 136 | const Balances = (props: {balances: number[]; style?: any}) => { 137 | return ( 138 | 139 | 147 | Your Balances 148 | 149 | 150 | 158 | {tokens.map(({name, logo}, i: number) => { 159 | const balance = props.balances[i]; 160 | 161 | return ( 162 | 172 | 179 | 190 | 196 | {name} 197 | 198 | 199 | 205 | {balance.toFixed(3)} 206 | 207 | 208 | ); 209 | })} 210 | 211 | 212 | ); 213 | }; 214 | 215 | const styles = StyleSheet.create({ 216 | container: { 217 | height: '100%', 218 | alignItems: 'center', 219 | justifyContent: 'center', 220 | backgroundColor: Colors.dark.background, 221 | }, 222 | amountInput: { 223 | marginTop: 20, 224 | paddingHorizontal: 15, 225 | paddingVertical: 5, 226 | textAlign: 'left', 227 | overflow: 'hidden', 228 | borderRadius: 10, 229 | color: 'white', 230 | borderBottomColor: 'white', 231 | borderBottomWidth: 1, 232 | fontSize: 25, 233 | }, 234 | button: { 235 | paddingHorizontal: 5, 236 | paddingVertical: 10, 237 | marginTop: 15, 238 | backgroundColor: Colors.dark.accent, 239 | overflow: 'hidden', 240 | borderRadius: 5, 241 | marginHorizontal: 5, 242 | width: 120, 243 | }, 244 | buttonText: { 245 | color: 'white', 246 | fontSize: 16, 247 | fontFamily: Fonts.bold, 248 | textAlign: 'center', 249 | }, 250 | bigText: { 251 | color: 'white', 252 | fontSize: 16, 253 | fontFamily: Fonts.bold, 254 | textAlign: 'center', 255 | }, 256 | }); 257 | 258 | export default Wallet; 259 | -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/screens/style.ts: -------------------------------------------------------------------------------- 1 | export const Colors = { 2 | dark: { 3 | background: "#130c33", 4 | accent: "#8A6299", 5 | text: "#FFFFFF", 6 | emphasis: "#FF0303" 7 | }, 8 | light: { /* */ } 9 | }; 10 | 11 | export const FontSizes = { 12 | small: "12px", 13 | medium: "14px", 14 | large: "16px", 15 | xlarge: "18px", 16 | } 17 | 18 | export const Fonts = { 19 | thin: "AppleSDGothicNeo-Thin", 20 | regular: "AppleSDGothicNeo-Regular", 21 | bold:'AppleSDGothicNeo-Bold', 22 | } -------------------------------------------------------------------------------- /frontend/ReactNativeWallet/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/react-native/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /go.work: -------------------------------------------------------------------------------- 1 | go 1.20 2 | 3 | use ./precompiles 4 | use ./opclave-scaling2023_op-geth 5 | -------------------------------------------------------------------------------- /go.work.sum: -------------------------------------------------------------------------------- 1 | github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= 2 | github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= 3 | github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= 4 | github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= 5 | -------------------------------------------------------------------------------- /precompiles/crypto/secp256r1/secp256.go: -------------------------------------------------------------------------------- 1 | package secp256r1 2 | 3 | import ( 4 | "crypto/ecdsa" 5 | "crypto/elliptic" 6 | ) 7 | 8 | func VerifySignature(pubKeyByte, dataHashByte, signatureByte []byte) bool { 9 | pubKey := newPubKey(pubKeyByte) 10 | if pubKey.X == nil || pubKey.Y == nil { 11 | return false 12 | } 13 | 14 | return ecdsa.VerifyASN1(pubKey, dataHashByte, signatureByte) 15 | } 16 | 17 | func newPubKey(pk []byte) *ecdsa.PublicKey { 18 | pubKey := new(ecdsa.PublicKey) 19 | pubKey.Curve = elliptic.P256() 20 | pubKey.X, pubKey.Y = elliptic.UnmarshalCompressed(pubKey.Curve, pk) 21 | 22 | return pubKey 23 | } 24 | -------------------------------------------------------------------------------- /precompiles/crypto/signature_r1.go: -------------------------------------------------------------------------------- 1 | package crypto 2 | 3 | import "github.com/itublockchain/opclave-scaling2023/crypto/secp256r1" 4 | 5 | func VerifySignatureR1(pubKey, dataHash, signature []byte) []byte { 6 | if secp256r1.VerifySignature(pubKey, dataHash, signature) { 7 | return []byte{1} 8 | } 9 | return []byte{0} 10 | } 11 | -------------------------------------------------------------------------------- /precompiles/crypto/signature_r1_test.go: -------------------------------------------------------------------------------- 1 | package crypto 2 | 3 | import ( 4 | "encoding/hex" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | const ( 11 | pubKey string = "03b434054a968479e6d1adb7b6185d1373c5b8f9cdd0813028327e6a342d702df6" 12 | dataHash string = "989a647219cb0c3de61ec045ea197b8c48e8e40bc3fda8b93033b96b109a222a" 13 | signature string = "3045022074bcdc20e53b9342b8dad74aa65dfc8c0b80c3963f596440452316c762fa4b81022100f693c4b11ca20c3cffe96a4d0f404fcfeaf4b954d3d4dd162fe156381de654a6" 14 | ) 15 | 16 | func TestVerifySignatureR1(t *testing.T) { 17 | pkh, _ := hex.DecodeString(pubKey) 18 | dhh, _ := hex.DecodeString(dataHash) 19 | sh, _ := hex.DecodeString(signature) 20 | 21 | ok := VerifySignatureR1(pkh, dhh, sh) 22 | assert.Equal(t, []byte{1}, ok) 23 | 24 | ok = VerifySignatureR1(pkh, sh, dhh) 25 | assert.Equal(t, []byte{0}, ok) 26 | } 27 | -------------------------------------------------------------------------------- /precompiles/ecverify.go: -------------------------------------------------------------------------------- 1 | package ecverify 2 | 3 | import ( 4 | "github.com/itublockchain/opclave-scaling2023/crypto" 5 | 6 | "github.com/ethereum/go-ethereum/common" 7 | ) 8 | 9 | // secp256r1 signature verification implemented as a native contract. 10 | type ecverify struct{} 11 | 12 | const ecVerifyGas uint64 = 3000 // ecVerifyGas gas price 13 | 14 | func (c *ecverify) RequiredGas(input []byte) uint64 { 15 | return ecVerifyGas 16 | } 17 | 18 | func (c *ecverify) Run(input []byte) ([]byte, error) { 19 | const ecVerifyInputLength = 256 20 | input = common.RightPadBytes(input, ecVerifyInputLength) 21 | 22 | pubKey := make([]byte, 33) 23 | dataHash := make([]byte, 32) 24 | signature := make([]byte, 72) 25 | 26 | copy(pubKey, input[0:33]) 27 | copy(dataHash, input[33:65]) 28 | copy(signature, input[65:137]) 29 | 30 | // signature size can vary from 70 to 72 bytes, so we are left-trimming 31 | signature = common.TrimLeftZeroes(signature) 32 | 33 | // custom signature verification for secp256r1 34 | return common.LeftPadBytes(crypto.VerifySignatureR1(pubKey, dataHash, signature), 32), nil 35 | } 36 | -------------------------------------------------------------------------------- /precompiles/ecverify_test.go: -------------------------------------------------------------------------------- 1 | package ecverify 2 | 3 | import ( 4 | "encoding/hex" 5 | "testing" 6 | 7 | "github.com/ethereum/go-ethereum/common" 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | const ( 12 | pubKey string = "03acdd696a4c5b603f7115db9baa5fc58b14fb2fa133b9c1f472465e4718bfb98d" 13 | dataHash string = "62fe8625fd33bd7f48ca4561fed3c80d5d82e6c41ef0f0122d594b35924bf04e" 14 | signature string = "304502200f62a197ceb328bfcacc42d4118e19823a1f281e3ff2eda1c87f2464437cc3b3022100bbcda922818ba7ee43369a71db1b9c53a5981bff39300aded68ba51b99ced6dc" 15 | 16 | data string = "03acdd696a4c5b603f7115db9baa5fc58b14fb2fa133b9c1f472465e4718bfb98d62fe8625fd33bd7f48ca4561fed3c80d5d82e6c41ef0f0122d594b35924bf04e00304502200f62a197ceb328bfcacc42d4118e19823a1f281e3ff2eda1c87f2464437cc3b3022100bbcda922818ba7ee43369a71db1b9c53a5981bff39300aded68ba51b99ced6dc" 17 | ) 18 | 19 | var input []byte 20 | var inputx []byte 21 | 22 | func init() { 23 | in := make([]byte, 256) 24 | inx := make([]byte, 256) 25 | 26 | pkh, _ := hex.DecodeString(pubKey) 27 | dhh, _ := hex.DecodeString(dataHash) 28 | sh, _ := hex.DecodeString(signature) 29 | sh = common.LeftPadBytes(sh, 72) 30 | 31 | copy(in[0:33], pkh) 32 | copy(in[33:65], dhh) 33 | copy(in[65:137], sh) 34 | 35 | dh, _ := hex.DecodeString(data) 36 | copy(inx, dh) 37 | 38 | input = in 39 | inputx = inx 40 | } 41 | 42 | func TestRunEcverify(t *testing.T) { 43 | one := common.LeftPadBytes([]byte{1}, 32) 44 | ecv := &ecverify{} 45 | ok, _ := ecv.Run(input) 46 | assert.Equal(t, one, ok) 47 | 48 | ok, _ = ecv.Run(inputx) 49 | assert.Equal(t, one, ok) 50 | } 51 | -------------------------------------------------------------------------------- /precompiles/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/itublockchain/opclave-scaling2023 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/ethereum/go-ethereum v1.11.4 7 | github.com/stretchr/testify v1.8.2 8 | ) 9 | 10 | require ( 11 | github.com/davecgh/go-spew v1.1.1 // indirect 12 | github.com/pmezard/go-difflib v1.0.0 // indirect 13 | golang.org/x/crypto v0.1.0 // indirect 14 | golang.org/x/sys v0.5.0 // indirect 15 | gopkg.in/yaml.v3 v3.0.1 // indirect 16 | ) 17 | -------------------------------------------------------------------------------- /precompiles/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 4 | github.com/ethereum/go-ethereum v1.11.4 h1:KG81SnUHXWk8LJB3mBcHg/E2yLvXoiPmRMCIRxgx3cE= 5 | github.com/ethereum/go-ethereum v1.11.4/go.mod h1:it7x0DWnTDMfVFdXcU6Ti4KEFQynLHVRarcSlPr0HBo= 6 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 7 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 8 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 9 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 10 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 11 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 12 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 13 | github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= 14 | github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 15 | golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= 16 | golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= 17 | golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= 18 | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 19 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 20 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 21 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 22 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 23 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 24 | --------------------------------------------------------------------------------