Giter Site home page Giter Site logo

freighter's Introduction

Freighter

Freighter is a non-custodial wallet extension that enables you to sign Stellar transactions via your browser. Learn more at freighter.app.

Yarn Workspaces

This repo is constructed using yarn workspaces and consists of the 4 sections:

  • the browser extension (/extension)
  • the client-facing SDK (/@stellar/freighter-api)
  • the docs (/docs)
  • some shared files that the above use (/@shared/*)

Prerequisites

You will need

Build the extension

To simply build a production version of the extension, install the prerequisites then navigate to this root folder in your command line and run these 2 steps:

yarn setup

followed by

yarn build:extension:production

This will generate the files that make up the extension in extension/build

Starting a dev environment

yarn setup
yarn start

This will start up multiple watching builds in parallel:

  • The @stellar/freighter-api npm module
  • The docs, serving on localhost:3000
  • A dev server with the webapp running in the extension, serving on localhost:9000
  • The actual built extension, able to be installed in Chrome, in build/

Each of these will build in response to editing their source.

These can be started individually with yarn start:\<workspace name\> where \<workspace name\> is one of:

  • freighter-api
  • docs
  • extension
yarn build

This will produce final output for the docs, the @stellar/freighter npm module, and the extension.

yarn build:\<workspace name\>, like the equivalent start commands, will build an individual workspace.

Useful URLs:

The popup webapp

The getPublicKey playground The signTransaction playground

It's important to note that these two won't interact with the dev server popup UI on localhost:9000 — you'll need to re-install the unpacked extension each time you make a change.

Importing a workspace

In some cases, you will want to import a workspace into another. For example, in extension we need to import @shared/constants. To do this, simply add @shared/constants to the dependencies list in package.json in extension. Yarn symlinks all the workspaces, so doing so will allow you to import files from the @shared/constants workspace as if it were a published npm package.

Dependencies

Many dev dependencies (such as Typescript, linters, Webpack, etc.) have been moved to the root package.json to allow devs to upgrade these libraries all in one place.

Pushing to repo

This repo will run a pre-push hook before pushing. This hook will run the cmd yarn build:extension:translations to check if any strings in the extension need to be added to the translations JSON. If there is no need to update the translations JSON, the push will go through. If there is a need to update, the changes will be automatically committed to your branch and the push will be aborted. You will need to run git push again.

NOTE: If you're using nvm and run into an error where the git hook is using an incompatible version of node, create a file ~/.huskryc on your system and added the following:

# This loads nvm.sh, sets the correct PATH before running hook, and ensures the project version of Node
export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# If you have an .nvmrc file, we use the relevant node version
if [[ -f ".nvmrc" ]]; then
  nvm use
fi

This will instruct the git hook to use the .nvmrc found in this repo.

freighter's People

Contributors

acharb avatar actions-user avatar aristidesstaffieri avatar cassiomg avatar chadoh avatar dependabot[bot] avatar github-actions[bot] avatar jeesunikim avatar kostimarko avatar marcociaramella avatar paulbellamy avatar piyalbasu avatar quietbits avatar tomerweller avatar vcarl avatar vinamogit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freighter's Issues

Feature Request: Integrate WalletConnect

What problem does your feature solve?

Users will be able to use Freighter to connect to more dapps on Stellar.

Some of the dapps that currently support WalletConnect:

  • StellarX
  • StellarTerm
  • Litemint
  • Nicetrade

Freighter supporting WalletConnect would help make more wallets and dapps interoperable.
The main benefit for dapps is that they could allow many interoperable wallets through a single integration with Wallet Connect.

What would you like to see?

Freighter to implement JSON-RPC for signing transactions coming through WalletConnect interface, according to the standard here:
https://docs.walletconnect.com/json-rpc/stellar

What alternatives are there?

Otherwise, every dapp needs to add a custom integration code to support Freighter specifically, as described in the docs:
https://docs.freighter.app/docs/guide/usingFreighterBrowser

Feature Request: Safari Port

  1. From Freighter’s directory, you can run run-p --print-label build:freighter-api build:extension , then xcrun safari-web-extension-converter --macos-only --swift --bundle-identifier org.stellar.freighter --app-name Freighter extension/build . This will open XCode. Hit “Run”.
  2. Hit “Run”. This will generate the app and make the extension available to Safari.
  3. Go to Safari. Under “Develop” menu, choose “Allow Unsigned Extensions”.
  4. Go to Safari’s preferences and activate the extension under “Extension”.

There will be a few bugs to review

Freighter won't process a transaction on testnet

What version are you using?

1.1.3, verified via extension settings.

What did you do?

I'm using Freighter to log in on the Account Viewer using testnet https://accountviewer.stellar.org/dashboard?testnet=true
I can log in successfully with Freighter, verify my account information and verify I'm on testnet. Freighter setting is on testnet as well.
I created a payment to another test account I've been using. It's created and active, funded with XLM.
When verifying the transaction via Freighter I receive the message:
"Freighter is currently on Test network
The transaction you’re trying to sign is on Public network.
Signing this transaction is not possible at the moment."

What did you expect to see?

I expected the transaction to be valid and accepted as I'm on the Test network and have no other browsers open.

What did you see instead?

I saw the message that I couldn't sign the transaction.

Decouple local `@stellar/freighter-api` from `@stellar/wallet-sdk`

Problem: if @stellar/wallet-sdk depends on a version of @stellar/freighter-api that matches what is currently in this workspace's package.json, on installation, it will use the symlinked version of freighter-api rather than the published version.

This could lead to issues if we make changes to freighter-api locally that are not published and we attempt to build the extension as wallet-sdk will be using an unpublished/untested version of freighter-api.

Goal: Building the extension always uses published versions of freighter-api as a dependency by default rather than using the local workspace

Freighter Support for Protocol 18

As part of the upcoming Protocol 18 changes, we'll want to address the following in Freighter

  • Support signing the Liquidity pool transactions to withdraw and deposit.
  • Display historical transactions for any pool activity
  • Display current pool balances

Will want support by Testnet release, current target Sept 28

scrollbar galore

Screenshot_2021-08-03_13-53-04

Expected behavior: there should be a single scrollbar when the content is actually scrollable, zero if the content is not scrollable.

Env: Chrome 92, Linux

Feature Request: Import existing accounts

What problem does your feature solve?

Import account using private key

What would you like to see?

When importing an account, allow to use a private key instead of mnemonic words

What alternatives are there?

I guess at the moment you could create a new account an add your other account as signer.

Feature Request: support for custom asset

Is it on the roadmap to be able to add other type of asset to the wallet ?

What problem does your feature solve?

User Freighter to manage other stellar asset them XLM

What would you like to see?

Ability to import asset by asset code and issuer

What alternatives are there?

I do not see any at the moment.

Feature Request: Support multi-sig accounts

What problem does your feature solve?

The same problem and idea that @tomerweller proposed here stellar/go#432.

For multi-sig accounts that have a signer that isn't the master key of the account, and where the user doesn't have the master key anymore, there's no way to add an account and its signing key. I can add the signing key, but then web apps assume its G address is the account address, which is not the case.

What would you like to see?

  1. The API expanded to distinguish getting the account public key, and the signer public key, which will be the same value for single key accounts, but will be different for accounts using a non-master key signer.

  2. The UI expanded to support importing an account using only its signing key, where the extension looks up accounts on the network that have that signer (e.g. via https://horizon-testnet.stellar.org/accounts?signer=GAZUXDPWVSYD7HE33GZPCJW76QMAZTBEKLFUQCHO5SP2OOL52ANVYZCE) and offers to setup with one of them and the signer as the signing key.

Upgrade Manifest to Version 3

Not urgent but Google Chrome store advises to start migrating Version 2 manifests (which Freighter uses) to Version 3. Freighter will remain in the store and still be able to be updated without doing this for the foreseeable future, but it is best to do this before it becomes critical.

From Google:

Dear Developer,

Last year, we announced the availability of Manifest V3 - a more secure, performant, and privacy-preserving iteration of the extension platform. Since then, we have added new functionality to and improved the robustness of Manifest V3 with feedback from our developer community.

We recently published a timeline of our plans to move forward with the deprecation of Manifest V2 and shifting focus fully to the new iteration of the platform. This is a notice that beginning January 17, 2022, the Chrome Web Store will stop accepting any new Manifest V2 extensions with visibility set to “Public” or “Unlisted”. Existing Manifest V2 extensions that have previously been published publicly will not be affected by this change and updates to those already-published extensions will continue to be accepted.

Additionally, beginning in June of 2022, this restriction on new extensions will expand to include items set to “Private” visibility as well. For more details and dates relating to the phase-out of Manifest V2, please refer to the Manifest V2 Support Timeline page, which will be kept up to date as more exact dates and milestone details are available.

If you have not yet begun to do so, we recommend that you begin migrating your extensions to Manifest V3. If you have feedback around migration, please please post to the chromium-extensions Google Group.

Thank you for your cooperation and for your participation in the Chrome extension ecosystem!

- The Google Chrome Web Store team

Feature Request: Import with S secret key without creating an account

What problem does your feature solve?

It is not possible to import a Stellar account using an S secret key. For users of many legacy products, like account viewer, or the Stellar launch wallet, the secret key the user has is in the form of an S secret key. Freighter only supports import using a SEP-5 mnemonic secret key, and so Freighter is only usable by folks who have created accounts using more modern wallets.

Also for developers building on testnet, who likely have S secret keys generated by the laboratory.stellar.org, there is no straightforward way to use Freighter, albeit this is also prevented by #171.

What would you like to see?

Import with S secret key.

What alternatives are there?

None I believe.

Feature Request: Android app

What problem does your feature solve?

Limited accessibility to Freighter and limited amount of good mobile Stellar wallets.

What would you like to see?

A Freighter Android app.

What alternatives are there?

Solar, Lobstr, Lumenshine, Stellarport

Errors signing transactions containing some operations

What version are you using?

1.0.8-beta.0

What did you do?

Attempt to sign a transaction containing a Begin Sponsoring Future Reserves operation, which is operation number 16.

What did you expect to see?

Transaction get signed.

What did you see instead?

Error: XDR Read Error: Unknown OperationType member for value 16
    at wrappedSendMessageCallback

Add a LICENSE.md to the repo

Right now it isn't clear which license this project has. Adding a LICENSE.md makes it easy to see the license.

Freighter assigning random images to assets not verified by TOML

What version are you using?

1.1.3

What did you do?

  • Setup an account to hold several assets with balance, each asset is verified by TOML with an image assigned in CURRENCIES field.
  • Import the account (first account) to Freighter via Secret Key import.
  • Setup an account to hold one asset with balance, the asset has a home_domain set on the issuer account but is not verified via the TOML at home_domain.
  • Import the account (second account) to Freighter via Secret Key import.

What did you expect to see?

For the asset that is not verified by TOML on the second account, Freighter should not assign an image as TOML information is not available (should be a blue dot in current UI).

What did you see instead?

Freighter assigns a (possibly) random image from an asset of the first account imported.

Feature Request: Add USD value next to the assets.

What problem does your feature solve?

Users will be able to see the total value of their assets without using a calculator :)

What would you like to see?

It would be great to add USD value of the assets on the "Account Assets" page. Right next to the assets we should be able to see the total value in USD. MetaMask has this feature and it is very helpful.

What alternatives are there?

Feature Request: Make it easier to merge Freighter into another wallet

What problem does your feature solve?

If someone wishes to close their Freighter wallet, and shift to another wallet, there is no way to do so since the secret key of the source account (the Freighter wallet) is not available to users.

What would you like to see?

Be able to merge the Freighter wallet with another wallet.

What alternatives are there?

Provide a way to gain access to the seed / secret key (with sufficient hurdles to prevent most users from doing so), as that will allow for merge operation to be conducted through the Stellar Laboratory's tools.

Catch error not working for getPublicKey()

Below code catches error when user closes the freighter window:

try {
signedTransaction = await window.freighterApi.signTransaction(xdr, network);
} catch (e) {
error = e;
}

This one does not!

try {
publicKey = await window.freighterApi.getPublicKey();
} catch (e) {
error = e;
}

Feature Request: Make getPublicKey() return a Signed Message

What problem does your feature solve?

Improve authentication to a third party (web application, ecc) ensuring that a user owns the corresponding secret key

What would you like to see?

In my opinion could be useful if the getPublicKey() will implements:

Accept:

  • an input parameter String (this will be an arbitrary token generated by the requesting application)

Return:

  • Public Key (this is already returned)
  • Message Signed
  • Signature

Almost like albedo (albedo.link) does:

This feature will permit also to the requesting application (web application, ecc) to check the authentication data

What alternatives are there?

Public key is different with Albedo

What version are you using?

What did you do?

  • Create an account with albedo.link
  • Save seed phase
  • Open Freighter and import account
  • Paste the seed phase

What did you expect to see?

Same public address for both services

What did you see instead?

Different public addresses

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.