Ethereum browser extension wallet for Safari on macOS & iOS.

Overview

Safari Wallet

This is an experiment to see whether we can build a viable browser extension Ethereum wallet for Safari on macOS and especially iOS.

Overview

A diagram might be useful, but basically the current plan/rundown is:

  • The window.ethereum object (EIP-1193 JavaScript API) will be injected into each page. This way, the wallet will automatically work with all apps/dApps that support MetaMask.

  • For the interface, the native Safari extension popover is used, in tandem with the WebExtensions API.

The bulk of the development is currently going on in the Shared (Extension) folder.

It is important to read these files:

  • Shared Extension (Popover) > Resources > README.md

  • test-dapp > README.md

Popover

Setting up the popover

  1. Open this repo as a project in Xcode

  2. In the leftmost top bar breadcrumb, which should be on "macOS" by default, switch it to "iOS"

  3. Set the following breadcrumb to a mobile device, perhaps "iPhone 13 Pro"?

  4. Click the play button to start the emulator

  5. Once the emulator has loaded (it might take a few minutes), open the Settings app

  6. Settings > Safari > Extensions > Wallet Extension

  7. Switch to on

Then, to test the popover, navigate to https://safari-wallet-test-dapp.vercel.app in Safari (or http://localhost:3000/, if you're running the local dev server)

You can also set up the local dev server here (WIP): https://github.com/natclark/safari-wallet-test-dapp

Comments
  • Implement Basic Json Rpc Client

    Implement Basic Json Rpc Client

    Here is a basic client without using a dependency. If this is the direction we want to go, I can clean up the code and write some proper tests mocking out the URL Session

    opened by tvongerlach 7
  • Add Web3.swift package and fetch an address's balance

    Add Web3.swift package and fetch an address's balance

    This PR

    • adds the Web3.swift package as a dependency (https://github.com/argentlabs/web3.swift)
    • fetches an addresses balance on the transaction screen

    In order for this to work you need to set your own values for clientUrl and ethAccountAddress in TransactionsView

    Then you should see this:

    simulator_screenshot_84F66DBE-57F8-4B9F-9A4C-7AD7096DCF35

    opened by tvongerlach 2
  • Update constants, make build uploadable for TestFlight, and fix tests

    Update constants, make build uploadable for TestFlight, and fix tests

    Forgot that the group ID, extension bundle ID, and app group are mentioned in a Swift file too. Tests weren't working. And App Store Connect was automatically rejecting the binary because the PRODUCT_NAME was Wallet.app, changing it to Safari Wallet.app did the trick.

    opened by DimitarNestorov 1
  • Fix - RPC call for method with no parameters failed

    Fix - RPC call for method with no parameters failed

    This fixes the error jsonRpcError(Wallet.JsonRpcError(code: -32602, message: "Invalid method parameter(s)."))

    To fix it, I created an overload method that doesn't have a parameters parameter that sets a default that satisfies RPC methods not expecting parameter values.

    opened by tvongerlach 1
  • Bug fix - task modifer on nested SwiftUI EmptyView doesn't get invoked

    Bug fix - task modifer on nested SwiftUI EmptyView doesn't get invoked

    It seems like using a task modifier on a nested view doesn't work. Not sure what exactly the reason is but moving the logic to a task modifier on the VStack solves the problem

    opened by tvongerlach 1
  • Improvement/injection housekeeping

    Improvement/injection housekeeping

    This splits the two injected classes (SafariWallet and Ethereum) into two separate JS files. Hopefully, this is a little more clear, and sets up an easy pattern for injecting any future JS files hosted by the extension.

    The added injected function provides one place to maintain the method of injection.

    The two "injections" are composed of the same code that removed from content.js, except there they each include an additional info line to validate the presence of the instantiated objects on the window object.

    The info line makes it easy to open a dev console and see them located on a page, e.g.:

    [Info] window.ethereum is injected. (localhost, line 64)
    [Info] window.safariWallet is injected. (localhost, line 24)
    
    opened by metalocal 1
  • Add check state for MacOS version

    Add check state for MacOS version

    Quick and dirty check on MacOS if the extension is enabled by the user.

    The used classes are not available on iOS, we'll need a different approach for iOS

    opened by ronaldmannak 1
  • Implement Alchemy GetAssetTransfers

    Implement Alchemy GetAssetTransfers

    Spec: https://docs.alchemy.com/alchemy/documentation/enhanced-apis/transfers-api#alchemy_getassettransfers

    Implemented the endpoint and created relevant models. To test I added a button in the developer tab called Call alchemy_getAssetTransfers. I also still need to add a test.

    opened by tvongerlach 1
  • Switch wallet network (EIP-2015, EIP-3085, EIP-3326)

    Switch wallet network (EIP-2015, EIP-3085, EIP-3326)

    https://eips.ethereum.org/EIPS/eip-2015 https://eips.ethereum.org/EIPS/eip-3085 https://eips.ethereum.org/EIPS/eip-3326

    Allow dapps to switch the network of the user wallet. For example in Zapper you can click on Polygon and MetaMask will open a popup asking if the user wants to switch to the network. image

    Do not ask again

    There should be a checkbox allowing users to prevent them for constantly opening and confirming this popup. Something along the lines of "Do not ask again when zapper.fi wants to switch to Polygon".

    low priority 
    opened by DimitarNestorov 0
  • Add token to wallet (EIP-747)

    Add token to wallet (EIP-747)

    https://eips.ethereum.org/EIPS/eip-747

    When swapping to any token in Uniswap there's an "Add token to MetaMask" button. After clicking the "Add Token" button the token will show in the Assets tab in MetaMask.

    Warning if token was already added

    If token was already added there should be a warning.

    low priority 
    opened by DimitarNestorov 0
  • Activity/History

    Activity/History

    Activity/History

    A place where the wallet keeps track of everything that the user signed which includes:

    • [ ] Transactions
    • [ ] Messages

    Every item in the activity should have:

    • [ ] Timestamp (a date and time of when the message/transaction has been signed)
    • [ ] Dapp domain

    If the activity item is a transaction it should have:

    • [ ] From address (prefer displaying ENS)
    • [ ] To address (prefer displaying ENS)
    • [ ] Nonce
    • [ ] Amount (the ETH amount that was sent)
    • [ ] Gas Limit (Units)
    • [ ] Gas Used (Units) (when the transaction has been mined)
    • [ ] Base fee (GWEI)
    • [ ] Priority fee (GWEI)
    • [ ] Total Gas Fee (base + priority) * (if transaction is mined use gas used otherwise use gas limit)
    • [ ] Total (total gas fee + amount)
    • [ ] Burnt fees (only when mined) (only when enabled in settings)
    • [ ] Transaction hash (only when enabled in settings)
    • [ ] Mined timestamp
    • [ ] Status (queued, submitted, dropped/replaced, confirmed, failed)
    • [ ] Chain ID

    If the activity item is a message it should have:

    • [ ] The message that was signed

    Filter activity

    There should be an option to filter activity:

    • [ ] filter by type (transaction/message)
    • [ ] filter by transaction status (pending/failed/succeeded)
    • [ ] filter by contract (Uniswap Router/SushiSwap router) (depends on rich activity, see below)
    • [ ] filter by dapp domain (zapper.fi/app.uniswap.org)

    Fetch onchain activity

    • [ ] When setting up the wallet it should fetch previous transactions that are on the blockchain and display them to the user.
    • [ ] Users may have made transactions using other wallets/devices. When the wallet is started again it should check for new transactions and fetch them.

    Activity from other addresses

    On Ethereum other people can send you assets. The activity should show when someone else has sent you assets, not just transactions/messages made by your address.

    Rich activity

    When I make a swap on Uniswap in MetaMask it displays Exact Input Single (which is the name of the method) and the domain of the dapp. Instead we should display the actual swap that happened like on Etherscan.

    MetaMask Etherscan

    • [ ] ERC-20 approvals should display the allowance amount
    • [ ] ERC-20 transfers should display the amount that was transferred
    • [ ] Swaps on Uniswap and other decentralized exchanges should display the actual tokens swapped
    • [ ] When NFTs are transferred the NFT should be displayed
    • [ ] When there's an interaction with ENS the ENS domain should be displayed
    • [ ] Bridged assets between different chains need to be marked as such

    Cloud sync

    • [ ] Signed messages should be synced since they're not on the blockchain. That way the user can see them on all of their devices.
    opened by DimitarNestorov 1
Owner
nathan.eth
Solo webmaster, cryptographer, blockchain developer
nathan.eth
Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux

Embassy Super lightweight async HTTP server in pure Swift. Please read: Embedded web server for iOS UI testing. See also: Our lightweight web framewor

Envoy 540 Dec 15, 2022
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.

Why Zewo? • Support • Community • Contributing Zewo Zewo is a lightweight library for web applications in Swift. What sets Zewo apart? Zewo is not a w

Zewo 1.9k Dec 22, 2022
PillowTalk - An iOS & SwiftUI server monitor tool for linux based machines using remote proc file system with script execution.

An iOS & SwiftUI server monitor tool for linux based machines using remote proc file system with script execution.

Lakr Aream 416 Dec 16, 2022
A small, lightweight, embeddable HTTP server for Mac OS X or iOS applications

CocoaHTTPServer CocoaHTTPServer is a small, lightweight, embeddable HTTP server for Mac OS X or iOS applications. Sometimes developers need an embedde

Robbie Hanson 5.5k Jan 7, 2023
RxMarbles iOS app

RxMarbles for iOS Interactive diagrams of Rx Observables. ReactiveX is a library for composing asynchronous and event-based programs by using observab

RxSwift Community 477 Oct 10, 2022
iOS Tweak to redirect Discord API calls to a Fosscord server.

FosscordTweak iOS Tweak to redirect Discord API calls to a Fosscord server. Installation Manual Download .deb file from release and install on jailbro

null 8 May 16, 2022
Build a viable browser extension Ethereum wallet for Safari on macOS and especially iOS

Safari Wallet This is an experiment to see whether we can build a viable browser extension Ethereum wallet for Safari on macOS and especially iOS. Ove

null 40 Dec 14, 2022
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Sung Woo Chang 136 Dec 25, 2022
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Sung Woo Chang 136 Dec 25, 2022
Ethereum-wallet: 100% native ethereum wallet, created with iOS version of Geth client

Ethereum-wallet: 100% native ethereum wallet, created with iOS version of Geth client

DE MINING 4 Dec 11, 2022
Wei Wallet - Ethereum wallet app for iOS

Wei Wallet - Ethereum wallet app for iOS Getting Started Download the latest Xcode Clone this repository Install Carthage, Cocoapods Run make bootstra

Popshoot, Inc. 277 Nov 17, 2022
Trust - Ethereum Wallet and Web3 DApp Browser for iOS

Trust - Ethereum Wallet and Web3 DApp Browser for iOS Welcome to Trust's open source iOS app! Getting Started Download the Xcode 9 release. Clone this

Trust Wallet 1.4k Dec 31, 2022
AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS

AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS

AlphaWallet 475 Jan 5, 2023
This is an iOS Safari Extension Sample that adds a "Develop menu" to Safari on iOS to allow you to analyze websites.

Develop Menu for Mobile Safari This is an iOS Safari Extension that adds a "Develop menu" to Safari on iOS to allow you to analyze websites. This is a

Watanabe Toshinori 1 Dec 7, 2022
BTTV-for-Safari - Unofficial BTTV/ FFZ Safari Extension for Twitch

BTTV for Safari This unofficial Safari exention adds support for BTTV and FFZ emotes on Twitch. The extension simply injects the BTTV script from the

Philipp Bolte 14 Dec 26, 2022
Browser-ext - Safari Extension Container App

browser-ext See article on dev.to. Please refer to Safari Web Extensions on how

Bing Qiao 4 Jul 18, 2022
A browser extension for Safari that makes sure that cut, copy, and paste are enabled.

Paste for Safari A browser extension for Safari that makes sure that cut, copy, and paste are enabled. Notes This is pretty rough and does work. The v

Mark Ferlatte 1 Dec 20, 2022
Multi-wallet for Bitcoin, Ethereum, Binance Smart Chain and other emerging blockchains

Multi-wallet for Bitcoin, Ethereum, Binance Smart Chain and other emerging blockchains. Non-custodial storage, decentralized exchange, and extensive analytics for thousands of tokens and NFTs. Implemented on Swift.

Horizontal Systems 446 Jan 3, 2023
Rainbow - 🌈the Ethereum wallet that lives in your pocket

??️ the Ethereum wallet that lives in your pocket! ??️ Available on the iOS App Store. ?? Android Beta available on Google Play Store ??️ Foll

Rainbow 3.2k Jan 3, 2023
An open-source Ethereum wallet built with SwiftUI

lil wallet welcome to lil wallet. it's an open-source Ethereum wallet built with SwiftUI there are two main views - coins and objects. coins are your

Jordan Singer 140 Jan 3, 2023