Skip to content

Commit 1b3d158

Browse files
committed
init
0 parents  commit 1b3d158

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+6721
-0
lines changed

.eslintrc.cjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-env node */
2+
require('@rushstack/eslint-patch/modern-module-resolution')
3+
4+
module.exports = {
5+
root: true,
6+
'extends': [
7+
'plugin:vue/vue3-essential',
8+
'eslint:recommended',
9+
'@vue/eslint-config-typescript'
10+
],
11+
parserOptions: {
12+
ecmaVersion: 'latest'
13+
}
14+
}

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
#dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 kolirt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dev-docs:
2+
yarn dev-docs
3+
build-docs:
4+
yarn build-docs
5+
preview-docs:
6+
yarn preview-docs
7+
build-lib:
8+
yarn build-lib

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<h1 align="center">Web3 authentication for Vue3 apps based on WalletConnect v2</h1>
2+
3+
<p align="center">
4+
<img src="https://img.shields.io/static/v1?label=Made%20with&message=VueJS&color=limegreen&style=for-the-badge&logo=vue.js" />
5+
<img src="https://img.shields.io/badge/Made%20for-Dapps-orange?style=for-the-badge&logo=ethereum" />
6+
</p>
7+
8+
Simple WalletConnect v2 integration package for Vue3 apps.
9+
10+
**Table of Contents**
11+
- [Getting started](#getting-started)
12+
- [Installation](#installation)
13+
- [Setup](#setup)
14+
- [Usage](#usage)
15+
- [Connect wallet button](#connect-wallet-button)
16+
- [Demo](#demo)
17+
- [Example](#example)
18+
- [Faq](#faq)
19+
- [License](#license)
20+
21+
[//]: # (# Web3 authentication for Vue3 apps)
22+
# Getting started
23+
24+
## Installation
25+
26+
Use yarn or npm to install the package `@kolirt/vue-web3-auth`.
27+
28+
```bash
29+
npm install --save @kolirt/vue-web3-auth
30+
31+
yarn add @kolirt/vue-web3-auth
32+
```
33+
34+
## Setup
35+
36+
Add dependencies to your `main.js`:
37+
38+
```javascript
39+
import {createApp} from 'vue'
40+
import {Chains, createWeb3Auth} from '@kolirt/vue-web3-auth'
41+
42+
const app = createApp({...})
43+
44+
app.use(createWeb3Auth({
45+
projectId: '', // generate here https://cloud.walletconnect.com/ and turn on 'Supports Sign v2'
46+
chains: [
47+
Chains.bsc,
48+
Chains.mainnet,
49+
Chains.polygon
50+
]
51+
}))
52+
53+
app.mount('#app')
54+
```
55+
56+
# Usage
57+
## Connect wallet button
58+
```vue
59+
<script setup lang="ts">
60+
import {account, disconnect, connect} from '@kolirt/vue-web3-auth'
61+
</script>
62+
63+
<template>
64+
<button v-if="account.connected" @click="disconnect()">
65+
{{ account.address }}
66+
</button>
67+
<button v-else @click="connect()">
68+
Connect wallet
69+
</button>
70+
</template>
71+
```
72+
73+
# Demo
74+
[Demo here](https://kolirt.github.io/vue-web3-auth/).
75+
76+
# Example
77+
[Example here](https://github.com/kolirt/vue-web3-auth/blob/master/src).
78+
79+
# FAQ
80+
Check closed [issues](https://github.com/kolirt/vue-web3-auth/issues) to get answers for most asked questions.
81+
82+
# License
83+
[MIT](https://github.com/kolirt/vue-web3-auth/blob/master/LICENSE).

dist/vue-web3-auth.d.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import type { Chain } from '@wagmi/core';
2+
import * as Chains from '@wagmi/core/chains';
3+
import type { ComputedRef } from 'vue';
4+
import type { Plugin as Plugin_2 } from 'vue';
5+
import type { ThemeCtrlState } from '@web3modal/core';
6+
7+
export declare function $off(event: Event_2, callback: (...args: any) => void): void;
8+
9+
export declare function $on(event: Event_2, callback: (...args: any) => void): void;
10+
11+
export declare const account: {
12+
connected: boolean;
13+
address?: string | undefined;
14+
shortAddress?: string | undefined;
15+
};
16+
17+
export declare function accountDetails(): Promise<void>;
18+
19+
export { Chain }
20+
21+
export declare const chain: ComputedRef<Chain>;
22+
23+
export { Chains }
24+
25+
export declare function connect(chain?: Chain): Promise<void>;
26+
27+
export declare function createWeb3Auth(options: Options): Plugin_2;
28+
29+
export declare function disconnect(): Promise<void>;
30+
31+
declare enum Event_2 {
32+
Connected = "connected",
33+
Disconnected = "disconnect",
34+
ChainSwitched = "chain_switched",
35+
UnknownChain = "unknown_chain",
36+
ModalStateChanged = "modal_state_changed"
37+
}
38+
export { Event_2 as Event }
39+
40+
export declare function getAvailableChains(): Chain[];
41+
42+
export declare type Options = {
43+
autoInit?: boolean;
44+
projectId: string;
45+
chains: Chain[];
46+
autoConnect?: boolean;
47+
disconnectUnknownChain?: boolean;
48+
reconnectToChain?: boolean;
49+
logEnabled?: boolean;
50+
web3modalOptions?: ThemeCtrlState;
51+
};
52+
53+
export declare function selectChain(): Promise<void>;
54+
55+
export declare function shortAddressFilter(value?: string): string;
56+
57+
export declare function switchChain(newChain: Chain): Promise<void>;
58+
59+
export { }

0 commit comments

Comments
 (0)