Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/starknet-io/get-starknet
StarkNet wallet <-> dApp bridge
https://github.com/starknet-io/get-starknet
Last synced: 4 days ago
JSON representation
StarkNet wallet <-> dApp bridge
- Host: GitHub
- URL: https://github.com/starknet-io/get-starknet
- Owner: starknet-io
- License: mit
- Created: 2022-03-31T15:16:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T12:06:28.000Z (about 1 month ago)
- Last Synced: 2024-10-29T14:35:12.200Z (about 1 month ago)
- Language: TypeScript
- Size: 1.37 MB
- Stars: 157
- Watchers: 8
- Forks: 112
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starknet - get-starknet - Starknet's official wallet SDK for developers. (Additional developer resources)
README
# get-starknet
[![npm](https://img.shields.io/npm/v/get-starknet.svg)](https://www.npmjs.com/package/get-starknet)
## Goals
- âĪïļâðĐđ Allow Starknet dApps and wallets to seamlessly connect
- ðŠķ Lightweight and easy to use
- ð Fast integration, building and testing
- âïļ Customizable and extensible
- ð Open source and controlled by the community## Installation
```
# using npm
npm install get-starknet starknet@next# using yarn
yarn add get-starknet starknet@next# using pnpm
pnpm add get-starknet starknet@next
```## Usage for dApp developers
You can use the built-in UI to connect to any Starknet wallet as fast as
possible like this:```tsx
import { connect, disconnect } from "get-starknet"return connect()}>Connect wallet
```### Advanced usage
You can also choose to customize the UI by overwriting the CSS classes, or by
implementing your very own UI. This is possible due to a split into a `core` and
`ui` package. As a library author or dapp developer who wants to implement a
custom UI, you can use the `core` package.```tsx
import {
disconnect,
enable,
getAvailableWallets,
getDiscoveryWallets,
getLastConnectedWallet,
getPreAuthorizedWallets,
} from "get-starknet-core"interface GetStarknetResult {
// Returns all wallets available in the window object
getAvailableWallets: (
options?: GetWalletOptions,
) => Promise
// Returns only preauthorized wallets available in the window object
getPreAuthorizedWallets: (
options?: GetWalletOptions,
) => Promise
// Returns all wallets in existence (from discovery file)
getDiscoveryWallets: (options?: GetWalletOptions) => Promise
// Returns the last wallet connected when it's still connected
getLastConnectedWallet: () => Promise
// Connects to a wallet
enable: (
wallet: StarknetWindowObject,
options?: {
starknetVersion?: "v4" | "v5"
},
) => Promise
// Disconnects from a wallet
disconnect: (options?: { clearLastWallet?: boolean }) => Promise
}
```## Development
You need Node and pnpm installed. Make sure to clone this repo and run:
```bash
pnpm install
pnpm build
```To start watching for changes, run:
```bash
pnpm dev
```and open `http://localhost:5173/`
### Running tests
For running tests:
```bash
pnpm test
```