Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Latest commit

 

History

History
89 lines (51 loc) · 5.02 KB

freighter.mdx

File metadata and controls

89 lines (51 loc) · 5.02 KB
sidebar_position title description sidebar_custom_props
70
Freighter Wallet
Freighter is a browser extension that can sign Soroban transactions.

:::danger These are not the droids you're looking for

This page has been migrated to the Stellar Developers documentation. Please click here for the most up-to-date information

:::

Freighter is a browser extension wallet provided by the Stellar Development Foundation. It provides users a way to interact with Soroban tokens directly from the web browser.

Setup

  1. Install the Freighter browser extension.

  2. Create a keypair or import an existing account using a mnemonic phrase to complete setup.

  3. Next, switch to Testnet or Futurenet. Testnet is available from the network dropdown. To add Futurenet, go to Settings > Network Settings > Add a custom network. Here you can add the following Futurenet settings:

  1. If your account does not exist on the selected network, Freighter will prompt you to fund it the account using Friendbot. Alternatively, you can do so in the Stellar Laboratory.

Enable Soroban Tokens

With a funded Testnet or Futurenet account, you can now add Soroban tokens to your Freighter wallet.

  1. On the Freighter account screen, click this Manage Assets button at the bottom of the screen.

  2. You will now see a button to Add Soroban token at the bottom of the screen. Click this Add Soroban token button.

  3. On the next screen, enter the Token ID of the token you want to add to Freighter and click Add New Token.

  4. You will now see your token's balance on Freighter's account page. Clicking on the balance will show a history of payments sent using this token.

Send Token Payments

Once you have added a Soroban token to your Freighter wallet, you can now send a payment of that token directly from Freighter.

  1. On the Freighter account screen, click the Send Payment icon in the upper right of the screen.

  2. Enter a recipient public key. Click Continue.

  3. Select your token from the asset dropdown at the bottom of the screen and enter a token amount. Click Continue.

  4. Enter a memo (optional). Click Review Send.

  5. Review the details of your payment. Click Send.

Sign Soroban XDRs

With a funded Testnet or Futurenet account, you can now sign Soroban XDRs using dApps that are integrated with Freighter. An example of an integrated dApp is Stellar's Laboratory.

  1. On the Lab's transaction signer, enter a Soroban XDR into the form field.

  2. Click Sign with Freighter.

  3. Freighter will open with the details of the XDR. Click Approve to sign or Reject to dismiss without a signature.

  4. If approved, Freighter will transmit a signed XDR back to the Lab.

As a Dapp Provider, Prompt Freighter to Sign Transactions (Advanced)

If you're building a JS dapp, easily sign Soroban transactions using the Freighter browser extension and its corresponding client library @stellar/freighter-api:

  1. Follow the setup instructions above.

  2. Now, you can use the signTransaction method from @stellar/freighter-api in your dapp to sign Soroban XDRs using the account in Freighter.

  3. Upon calling signTransaction, Freighter will open and prompt the user to sign the transaction. Approving the transaction will return the signed XDR to the requesting dapp.

Sign Authorization Entries

In order to take advantage of contract authorization, you can use Freighter's API to sign an authorization entry. A good example of how signing an authorization entry works can be found in the authorizeEntry helper of stellar-sdk.

Like in the helper, you can construct a HashIdPreimageSorobanAuthorization and use the xdr representation of that structure to call await freighterApi.signAuthEntry(preimageXdr). This call will return a Buffer of the signed hash of the HashIdPreimageSorobanAuthorization passed in, which can then be used to submit to the network during a contract authorization workflow.

For a full example of how to use contract authorization, the scaffold-soroban demo for an atomic swap makes use of both contract auth and Freighter's signAuthEntry API.