@btc-vision/walletconnect 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.babelrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "sourceType": "module",
3
+ "presets": ["@babel/preset-react", "@babel/preset-env", "@babel/preset-typescript"]
4
+ }
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,12 @@
1
+ {
2
+ "printWidth": 100,
3
+ "trailingComma": "all",
4
+ "tabWidth": 4,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "quoteProps": "as-needed",
8
+ "bracketSpacing": true,
9
+ "bracketSameLine": true,
10
+ "arrowParens": "always",
11
+ "singleAttributePerLine": true
12
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "eslint.validate": ["javascript", "typescript"],
3
+ "prettier.useEditorConfig": false,
4
+ "prettier.useTabs": false,
5
+ "prettier.configPath": ".prettierrc.json",
6
+ "prettier.requireConfig": true,
7
+ "prettier.tabWidth": 4,
8
+ "prettier.singleQuote": true,
9
+ "editor.formatOnSave": true,
10
+ }
@@ -0,0 +1,71 @@
1
+ # Contributing Guidelines
2
+
3
+ Thank you for considering contributing to our project! Please take a moment to
4
+ review the following guidelines before submitting your contribution.
5
+
6
+ ## Pull Requests
7
+
8
+ When submitting a pull request, please make sure to follow these guidelines:
9
+
10
+ ### Before You Begin
11
+
12
+ 1. **Fork the repository**: If you haven't already, fork the repository to your
13
+ GitHub account.
14
+
15
+ 2. **Create a new branch**: Create a new branch for your feature or bug fix.
16
+ This helps keep the main branch clean and makes it easier to review your
17
+ changes.
18
+
19
+ 3. **Ensure your code is up-to-date**: Before starting work, make sure your
20
+ forked repository is up-to-date with the latest changes from the main
21
+ repository.
22
+
23
+ ### Making Changes
24
+
25
+ 1. **Follow coding conventions**: Make sure your code follows the existing
26
+ coding style and conventions used in the project.
27
+
28
+ 2. **Write descriptive commit messages**: Write clear and descriptive commit
29
+ messages that explain the purpose of your changes.
30
+
31
+ 3. **Test your changes**: Before submitting your pull request, make sure to test
32
+ your changes thoroughly to ensure they work as expected.
33
+
34
+ ### Submitting the Pull Request
35
+
36
+ 1. **Create a descriptive title**: Use a clear and descriptive title for your
37
+ pull request that summarizes the purpose of your changes.
38
+
39
+ 2. **Provide a detailed description**: Include a detailed description of the
40
+ changes you've made and any relevant context that reviewers should know.
41
+
42
+ 3. **Link related issues**: If your pull request addresses a specific issue,
43
+ make sure to reference it in the description using GitHub's issue linking
44
+ syntax (`#issue_number`).
45
+
46
+ 4. **Review and address feedback**: Be responsive to any feedback or comments
47
+ you receive on your pull request and make any necessary changes.
48
+
49
+ ## Issues
50
+
51
+ When submitting an issue, please provide as much information as possible to help
52
+ us understand and address the problem. Follow these guidelines when creating an
53
+ issue:
54
+
55
+ 1. **Use a descriptive title**: Use a clear and descriptive title that
56
+ summarizes the issue you're experiencing.
57
+
58
+ 2. **Provide detailed steps to reproduce**: Include detailed steps to reproduce
59
+ the issue, including any relevant code or configuration.
60
+
61
+ 3. **Include relevant information**: Provide any relevant information such as
62
+ error messages, screenshots, or logs that can help diagnose the problem.
63
+
64
+ 4. **Specify your environment**: If the issue is related to a specific
65
+ environment (e.g., operating system, browser), please specify it in your
66
+ issue description.
67
+
68
+ 5. **Check for existing issues**: Before submitting a new issue, please check if
69
+ a similar issue has already been reported to avoid duplicates.
70
+
71
+ Thank you for your contributions!
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 [ORANGE PILLS INC, 2140 S DUPONT HWY CAMDEN, DE 19934]
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.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # OP_NET - WalletConnect
2
+
3
+ ![Bitcoin](https://img.shields.io/badge/Bitcoin-000?style=for-the-badge&logo=bitcoin&logoColor=white)
4
+ ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
5
+ ![NodeJS](https://img.shields.io/badge/Node%20js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)
6
+ ![NPM](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)
7
+ ![Gulp](https://img.shields.io/badge/GULP-%23CF4647.svg?style=for-the-badge&logo=gulp&logoColor=white)
8
+ ![ESLint](https://img.shields.io/badge/ESLint-4B3263?style=for-the-badge&logo=eslint&logoColor=white)
9
+
10
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
11
+
12
+ ## Introduction
13
+
14
+ The OP_NET WalletConnect library is a TypeScript library that provides a simple interface for interacting with the
15
+ WalletConnect protocol. It allows you to create a WalletConnect session, send transactions, and receive notifications
16
+ from the connected wallet.
17
+
18
+ ## Getting Started
19
+
20
+ ### Prerequisites
21
+
22
+ - Node.js version 16.x or higher
23
+ - npm (Node Package Manager)
24
+
25
+ ### Installation
26
+
27
+ ```shell
28
+ npm i @btc-vision/walletconnect
29
+ ```
30
+
31
+ ### Documentation
32
+
33
+ Documentation is available at [docs.opnet.org](https://docs.opnet.org)
34
+
35
+ #### Development
36
+
37
+ 1. Clone the repository:
38
+ ```bash
39
+ git clone https://github.com/btc-vision/walletconnect.git
40
+ ```
41
+ 2. Navigate to the repository directory:
42
+ ```bash
43
+ cd walletconnect
44
+ ```
45
+ 3. Install the required dependencies:
46
+ ```bash
47
+ npm i
48
+ ```
49
+
50
+ ## Contribution
51
+
52
+ Contributions are welcome! Please read through the `CONTRIBUTING.md` file for guidelines on how to submit issues,
53
+ feature requests, and pull requests. We appreciate your input and encourage you to help us improve OP_NET.
54
+
55
+ ## License
56
+
57
+ This project is open source and available under the [MIT License](LICENSE). If you have any suggestions or
58
+ contributions, please feel free to submit a pull request.
@@ -0,0 +1,17 @@
1
+ import { Network } from '@btc-vision/bitcoin';
2
+ import { Address, Unisat, UnisatSigner } from '@btc-vision/transaction';
3
+ import { JSONRpcProvider } from 'opnet';
4
+ export declare enum SupportedWallets {
5
+ OP_WALLET = "op_wallet"
6
+ }
7
+ export type Signers = UnisatSigner;
8
+ export type Wallets = Unisat;
9
+ export declare class WalletConnection {
10
+ signer: Signers | null;
11
+ connect(walletType: SupportedWallets): Promise<void>;
12
+ disconnect(): void;
13
+ getAddress(): Promise<Address>;
14
+ getNetwork(): Promise<Network>;
15
+ getProvider(): Promise<JSONRpcProvider>;
16
+ }
17
+ export default WalletConnection;
@@ -0,0 +1,19 @@
1
+ import { Network } from '@btc-vision/bitcoin';
2
+ import { Address } from '@btc-vision/transaction';
3
+ import { JSONRpcProvider } from 'opnet';
4
+ import React from 'react';
5
+ import { Signers, SupportedWallets } from './WalletConnection';
6
+ interface WalletContextType {
7
+ connect: (walletType: SupportedWallets) => Promise<void>;
8
+ disconnect: () => void;
9
+ address: Address | null;
10
+ signer: Signers | null;
11
+ network: Network | null;
12
+ provider: JSONRpcProvider | null;
13
+ isConnected: boolean;
14
+ }
15
+ export declare const WalletProvider: React.FC<{
16
+ children: React.ReactNode;
17
+ }>;
18
+ export declare const useWallet: () => WalletContextType;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './WalletConnection';
2
+ export * from './WalletProvider';