Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gergold committed Oct 6, 2023
0 parents commit ac2db3e
Show file tree
Hide file tree
Showing 52 changed files with 10,074 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"vars": "all",
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-non-null-assertion": "error",
"curly": "error"
}
}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: release
on:
push:
branches:
- develop
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- uses: actions/setup-node@v3
with:
node-version: 18

- run: pnpm install --frozen-lockfile
- run: pnpm run build
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --debug true --dry-run false
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
pnpm-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?


.eslintcache
# env
.env
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
18 changes: 18 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"useTabs": false,
"trailingComma": "all",
"singleQuote": false,
"semi": false,
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 70,
"useTabs": false,
"trailingComma": "none",
"arrowParens": "avoid",
"proseWrap": "never"
}
}
]
}
30 changes: 30 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"branches": [
"main",
{
"name": "develop",
"channel": "next"
},
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"pnpm-lock.yaml"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
],
"repositoryUrl": "[email protected]:argentlabs/starknetkit.git"
}
Empty file added CONTRIBUTING.md
Empty file.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2023 Argent Labs Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!-- logo -->
<p align="center">
<img width='300' src="https://starknetkit-website-git-blo-1541-argentlabs.vercel.app/starknetKit-logo.svg">
</p>

<!-- primary badges -->
<p align="center">
<a href="https://www.npmjs.com/package/starknetkit">
<img src='https://img.shields.io/npm/v/starknetkit' />
</a>
<a href="https://bundlephobia.com/package/starknetkit">
<img src='https://img.shields.io/bundlephobia/minzip/starknet?color=success&label=size' />
</a>
<a href="https://www.npmjs.com/package/starknetkit">
<img src='https://img.shields.io/npm/dt/starknetkit?color=blueviolet' />
</a>
<a href="https://github.com/argentlabs/starknetkit/blob/main/LICENSE/">
<img src="https://img.shields.io/badge/license-MIT-black">
</a>
</p>

## 🕹️ StarknetKit

Install starknetkit with `npm` or `yarn`

```bash
# latest official release (main branch)
$ npm install starknetkit

# or with yarn:
$ yarn add starknetkit
```

## Imports

After installation, we get access to different methods, such as `connect`, `disconnect`, etc which we should import for use in our application:

```js
import { connect, disconnect } from "starknetkit"
```

## Establishing a connection

To establish a wallet connection, we need to call the connect method which was imported earlier like this:

```js
const wallet = await connect()
```

By default, the list of connectors is:

- Argent webwallet
- Argent mobile
- Argent X
- Braavos

## Connect with specific connectors

```js
const webwallet = await connect([new WebWalletConnector()])

const argentMobileWallet = await connect([
new ArgentMobileConnector()
])

const wallet = await connect([
new InjectedConnector({ options: { id: "argentX" } }),
new InjectedConnector({ options: { id: "braavos" } })
])
```

## Reconnect to a previously connected wallet on load:

```js
const wallet = await connect({ modalMode: "neverAsk" })
```

## Disconnect a wallet

```js
await disconnect({ clearLastWallet: true })
```

## 📕 Guides

Guides can be found [here](https://www.starknetkit.com/docs/getting-started)

## ✏️ Contributing

If you consider to contribute to this project please read [CONTRIBUTING.md](./CONTRIBUTING.md) first.

## 📜 License

Copyright (c) 2023

Licensed under the [MIT license](./LICENSE.md).
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
}
110 changes: 110 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"name": "starknetkit",
"version": "1.0.0",
"repository": "github:argentlabs/starknetkit",
"private": false,
"browser": {
"crypto": false
},
"keywords": [
"starknet",
"starkware",
"l2",
"zk",
"rollup",
"wallet",
"dapp"
],
"license": "MIT",
"lint-staged": {
"*.{js,jsx,ts,tsx,css,md,yml,json}": "prettier --write",
"*.{ts,tsx}": "eslint --cache --ext .ts,.tsx"
},
"type": "module",
"exports": {
".": {
"types": "./dist/starknetkit.d.ts",
"import": "./dist/starknetkit.js",
"require": "./dist/starknetkit.cjs"
},
"./webwallet": {
"types": "./dist/webwalletConnector.d.ts",
"import": "./dist/webwalletConnector.js",
"require": "./dist/webwalletConnector.cjs"
},
"./argentMobile": {
"types": "./dist/argentMobile.d.ts",
"import": "./dist/argentMobile.js",
"require": "./dist/argentMobile.cjs"
},
"./injected": {
"types": "./dist/injectedConnector.d.ts",
"import": "./dist/injectedConnector.js",
"require": "./dist/injectedConnector.cjs"
}
},
"main": "./dist/starknetkit.cjs",
"module": "./dist/starknetkit.js",
"types": "./dist/starknetkit.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "vite build",
"check": "svelte-check --tsconfig ./tsconfig.json",
"dev": "vite build --watch"
},
"dependencies": {
"@trpc/client": "^10.38.1",
"@trpc/server": "^10.38.1",
"@walletconnect/sign-client": "^2.10.1",
"bowser": "^2.11.0",
"detect-browser": "^5.3.0",
"eventemitter3": "^5.0.1",
"events": "^3.3.0",
"get-starknet-core": "^3.1.0",
"lodash-es": "^4.17.21",
"svelte-forms": "^2.3.1",
"trpc-browser": "^1.3.2"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@semantic-release/git": "^10.0.1",
"@sveltejs/vite-plugin-svelte": "^2.2.0",
"@tsconfig/svelte": "^5.0.0",
"@types/async-retry": "^1.4.5",
"@types/lodash-es": "^4.17.8",
"@types/node": "^20.5.7",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@walletconnect/ethereum-provider": "^2.7.7",
"@walletconnect/jsonrpc-provider": "^1.0.13",
"@walletconnect/signer-connection": "^2.7.7",
"@walletconnect/types": "^2.7.7",
"@walletconnect/utils": "^2.10.0",
"autoprefixer": "^10.4.7",
"eslint": "^8.48.0",
"eslint-config-next": "^13.4.19",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"postcss": "^8.4.21",
"postcss-load-config": "^4.0.1",
"prettier": "^3.0.3",
"prettier-plugin-import-sort": "^0.0.7",
"semantic-release": "^21.1.1",
"svelte": "^4.0.0",
"svelte-check": "^3.5.1",
"svelte-preprocess": "^5.0.4",
"tailwindcss": "^3.1.6",
"tslib": "^2.4.0",
"typescript": "^5.1.6",
"vite": "^4.3.8",
"vite-plugin-dts": "^3.0.0",
"ws": "^8.8.1",
"zod": "^3.20.6"
},
"peerDependencies": {
"starknet": "5.18.0"
},
"gitHead": "b16688a8638cc138938e74e1a39d004760165d75"
}
Loading

0 comments on commit ac2db3e

Please sign in to comment.