Skip to content

ArgentX browser extension for StarkNet - made with ❤️ by Argent

License

Notifications You must be signed in to change notification settings

aniann/argent-x

 
 

Repository files navigation


⬇️ Get ArgentX for StarkNet today:


🌈 Table of contents

🧒 Example dapp

You can try the extension using our example dapp hosted at:

https://argentlabs.github.io/argent-x/

The example dapp is also contained in this repository.

🌐 Usage with your dapp

If you want to use this StarkNet Wallet extension with your dapp, the easiest way is to checkout the @argent/get-starknet package developed in this repo by running:

# starknet.js is a peer dependency
yarn add @argent/get-starknet starknet

The package is a light wrapper around starknet.js to interact with the wallet extension. You can then use it like the following:

import { getStarknet } from "@argent/get-starknet"

// check if wallet extension is installed and initialized. Shows a modal prompting the user to download ArgentX otherwise.
const starknet = getStarknet({ showModal: true })
const [userWalletContractAddress] = await starknet.enable() // may throws when no extension is detected

// check if connection was successful
if(starknet.isConnected) {
    // If the extension was installed and successfully connected, you have access to a starknet.js Signer object to do all kind of requests through the users wallet contract.
    starknet.signer.invokeFunction({ ... })
} else {
    // In case the extension wasn't successfully connected you still have access to a starknet.js Provider to read starknet states and sent anonymous transactions
    starknet.provider.callContract( ... )
}

Checkout starknet.js to learn more about how to use Provider and Signer.

🚀 Install from sources

First clone this repository on your machine then run:

yarn      # setup dependencies
yarn build  # run build process for all packages

Now you need to load the locally build chrome extension into your browser, by loading an unpacked extension from path packages/extension/dist:

  1. Open the Extension Management page by navigating to chrome://extensions.
  2. Enable Developer Mode by clicking the toggle switch next to Developer mode.
  3. Click the Load unpacked button and select the extension directory.

Chrome screenshot of setup

Source

👩🏾‍💻 Development

To contribute to this repository please read the contributing guidelines first.

To setup the repo on your machine just run:

yarn      # setup dependencies
yarn dev  # run build process for all packages in watch mode

This project contains 3 packages:

package description
extension ArgentX extension
get-starknet npm module to get started with starknet.js and ArgentX quickly
playground example dapp for testing purposes and example for DApps how to use get-starknet

To test changes made to the extension package you need to load the local unpacked extension into Chrome as described above. Changes are shown after reopening the extension. Changes to background.js are just shown after a complete restart of the Chrome process.

✏️ Contributing

Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.

❤️ Family and friends

Since this project were not possible without starknet.js a big thank you to all starknet.js contributors and @seanjameshan for starting it.

One more thank you to the StarkWare Team and Discord.

👨🏼‍🎨 Authors and license

Argent and contributors.

GNU General Public License V3, see the included License.md file.

About

ArgentX browser extension for StarkNet - made with ❤️ by Argent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 90.8%
  • CSS 5.5%
  • JavaScript 1.8%
  • Svelte 1.7%
  • HTML 0.2%