Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QTum Wallet FAQ and Knowledge Doc #1

Merged
merged 12 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0-rc.8] - 2024-06-17
### Added
- Expose `remove network` method for snap
## [Unreleased]

## [0.1.0-rc.6] - 2024-04-26
## [0.1.0] - 2024-06-24
### Added
- Initial release of the snap.

[Unreleased]: https://github.com/qtumproject/metamasksnap/compare/0.1.0-rc.8...HEAD
[0.1.0-rc.8]: https://github.com/qtumproject/metamasksnap/compare/0.1.0-rc.6...0.1.0-rc.8
[0.1.0-rc.6]: https://github.com/qtumproject/metamasksnap/releases/tag/0.1.0-rc.6
[Unreleased]: https://github.com/qtumproject/qtum-extension-wallet/compare/0.1.0...HEAD
[0.1.0]: https://github.com/qtumproject/qtum-extension-wallet/releases/tag/0.1.0


56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
# Qtum Snap
# Qtum Wallet

Qtum Snap is a MetaMask Snap that allows you to work with Qtum network by using ethers js providers.
The Qtum Wallet acts as an RPC proxy that accepts requests from DApps to MetaMask, for example, by using ethers.js or web3.js, and forwards them to the Qtum network using the Qtum ethers adapter.

## Qtum Wallet FAQ

### What is MetaMask Snaps?

MetaMask Snaps enhance the wallet experience offered by Consensys by allowing end-users to add extra functionality for Web3 and DeFi purposes above the level provided by a normal MetaMask installation.

Because of the rapidly evolving nature of blockchain technology, many new features are being developed and requested by the community. This happens at a pace that far outstrips the ability for MetaMask developers to provide in their core wallet, so by allowing a decentralized and audited framework called “Snaps”, developers can now offer their niche functionality to a greater MetaMask install by allowing “modules” called Snaps.

In the example of the Qtum Blockchain, there was not a MetaMask/Qtum wallet module to work with Qtum Bridge infrastructure. Users who would like to interface with the Qtum-Ethereum bridge would need to either develop their own wallet, or learn to use complicated command-line interfaces. MetaMask Snaps allows users to seamlessly add this functionality to an existing MetaMask installation and interface with the Qtum bridge in minutes.

### What is the Qtum Snap Wallet, and what does it do?

The Qtum Wallet is an extension of your MetaMask wallet. It is a proxy between the Qtum blockchain and MetaMask. The Qtum Snap allows you to hold the QTUM token, manage QRC20 tokens and NFTs, and connect to Qtum’s bridge that allows Web3 and DeFi between the Ethereum and Qtum blockchains.

### Why should I use the Qtum Snap with my MetaMask Wallet?

Qtum MetaMask Snap simplifies the integration of MetaMask with the Qtum blockchain. It facilitates the storage and transfer of Ethereum ERC20 assets to and from the Qtum blockchain, using the Qtum Bridge, and other QRC20 assets like Circle Bridged USDC, allowing users to access the Qtum ecosystem seamlessly without needing additional wallets.

The Qtum MetaMask Snap is an audited and non-custodial wallet, meaning that the end user keeps full control of their private keys. The Qtum or MetaMask team have no ability to access an end-user’s wallet whatsoever.

### How does the Qtum MetaMask Snap work?

Metamask Snaps are open-source extensions that enhance MetaMask's functionality in a secure manner. Each snap is a JavaScript program that operates in an isolated environment, ensuring a customized and secure wallet experience.

These “Snaps” are developed by third parties, in this case, the Qtum Foundation. They are audited by a Consensys-approved auditing team, and submitted to Consensys for review. If approved, the “Snap” will be listed on the [MetaMask Snaps Directory](https://snaps.metamask.io/)

### Is my private key and recovery phrase exposed when using the Qtum Snap?

Qtum Snap does not have access to users’ private keys.

### Can I access all Qtum apps?

Currently, you can use the Qtum bridge to transfer supported assets, like Circle Bridged USDC from the Ethereum Mainnet. For more information on the Circle set of contracts, please see here: [Introducing Bridged USDC Standard](https://www.circle.com/blog/bridged-usdc-standard)

### Does the Qtum MetaMask Snap support Qtum NFTs?

Not currently. The purpose of the Qtum MetaMask Snap was to provide access to the Qtum-Ethereum bridge in order to facilitate DeFi applications. Qtum NFT’s are supported on other Qtum wallets, but not currently the Qtum MetaMask Snap.

### How do I get help with the Qtum MetaMask Snap?

Visit Qtum’s official [Discord](https://discord.com/invite/aqkWtb6HVa) channel or send an email to [email protected].

## Qtum Wallet Knowledge Doc

### What happens if I lose the keys for my account?

Please be extremely careful with your keys - there is no way to recover them if they are lost. Qtum Wallet does not have access to users’ keys and cannot help you recover them. However, the Qtum private key is generated from the MetaMask mnemonic entropy, so it can be recovered if you still have your MetaMask mnemonic (for the first account). Please be advised that your private keys and mnemonic entropy are the highest sought item from scammers, drainers, impostors, etc. Never click on suspicious links, never respond to random direct messages, and always assume that any application that is asking for this information is trying to steal your tokens.

### Is the Qtum MetaMask Snap Secure?

The Qtum MetaMask Snap was audited by an approved Consensys auditor called “Sayfer”. The Qtum Blockchain is an EVM-compatible chain that uses technology almost identical to the Ethereum and Bitcoin blockchains. The MetaMask Snap technology is not new, other projects have built and deployed Snaps previously without issue. The Qtum MetaMask Snap is a non-custodial wallet.

## Contributing

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "qtum-snap-monorepo",
"name": "qtum-wallet-monorepo",
"private": true,
"description": "",
"homepage": "https://github.com/qtumproject/metamasksnap#readme",
"homepage": "https://github.com/qtumproject/qtum-extension-wallet",
"bugs": {
"url": "https://github.com/qtumproject/metamasksnap/issues"
"url": "https://github.com/qtumproject/qtum-extension-wallet/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/qtumproject/metamasksnap.git"
"url": "git+https://github.com/qtumproject/qtum-extension-wallet.git"
},
"license": "(MIT-0 OR Apache-2.0)",
"author": "Distributed Lab",
"author": "Qtum project",
"workspaces": [
"packages/*"
],
"scripts": {
"apply-version": "node scripts/versions.js $0 && yarn build:connector && yarn workspace @qtumproject/wallet-snap preversion",
"apply-version": "node scripts/versions.js $0 && yarn build:connector && yarn workspace @qtumproject/qtum-wallet preversion",
"build": "yarn workspaces foreach -pv --topological-dev --verbose --all run build",
"build:connector": "yarn workspace @qtumproject/wallet-snap-connector build",
"build:connector": "yarn workspace @qtumproject/qtum-wallet-connector build",
"postinstall": "patch-package",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
Expand Down
30 changes: 16 additions & 14 deletions packages/connector/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# QtumSnap Connector
# Qtum Wallet Connector

QtumSnap connector is used to install snap and exposes methods for calling snap on dApps and other applications.
Qtum Wallet connector is used to install snap and exposes methods for calling snap on dApps and other applications.

## Usage

### Installation

```bash
npm install @qtumproject/wallet-snap-connector
npm install @qtumproject/qtum-wallet-connector
```

```bash
yarn add @qtumproject/wallet-snap-connector
yarn add @qtumproject/qtum-wallet-connector
```

### Define raw provider (object which is similar to window.ethereum)

```typescript
import { QtumWallet } from '@qtumproject/wallet-snap-connector';
import { QtumWallet } from '@qtumproject/qtum-wallet-connector';

export const qtumSnap = new QtumWallet();
export const qtumWallet = new QtumWallet();
```

### Establish connection

```typescript
import { qtumSnap } from '@/path/to/qtumSnap';
import { qtumWallet } from '@/path/to/qtumWallet';

const init = async () => {
await qtumSnap.enable();
await qtumWallet.enable();
};
```

### check if snap or metamask is installed
### Check if snap or metamask is installed

```typescript
import { isMetamaskInstalled } from '@qtumproject/wallet-snap-connector';
import { isMetamaskInstalled } from '@qtumproject/qtum-wallet-connector';

import { qtumSnap } from '@/path/to/qtumSnap';
import { qtumWallet } from '@/path/to/qtumWallet';

const checkSnapStatus = async () => {
return {
isMetamaskInstalled: await isMetamaskInstalled(),
isSnapInstalled: await qtumSnap.isInstalled(),
isSnapInstalled: await qtumWallet.isInstalled(),
};
};
```
Expand All @@ -63,12 +63,14 @@ const provider = new ethers.providers.Web3Provider(connector);
import { providers } from 'ethers';
import { useMemo } from 'react';

import { qtumSnap } from '@/path/to/qtumSnap';
import { qtumWallet } from '@/path/to/qtumWallet';

export const useProvider = () => {
const provider = useMemo(() => {
try {
return new providers.Web3Provider(qtumSnap as providers.ExternalProvider);
return new providers.Web3Provider(
qtumWallet as providers.ExternalProvider,
);
} catch (error) {
return undefined;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/connector/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@qtumproject/wallet-snap-connector",
"version": "0.1.0-rc.8",
"description": "A Provider to be used in ethers.js to interact with Qtum's Snap",
"name": "@qtumproject/qtum-wallet-connector",
"version": "0.1.0-rc.0",
"description": "A Provider to be used in ethers.js to interact with Qtum's wallet",
"repository": {
"type": "git",
"url": "https://github.com/qtumproject/metamasksnap"
"url": "https://github.com/qtumproject/qtum-extension-wallet.git"
},
"license": "(MIT-0 OR Apache-2.0)",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/connector/src/consts/snap.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const defaultSnapOrigin = 'npm:@qtumproject/wallet-snap';
export const defaultSnapOrigin = 'npm:@qtumproject/qtum-wallet';
2 changes: 1 addition & 1 deletion packages/connector/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.1.0-rc.8"
"version": "0.1.0-rc.0"
}
4 changes: 2 additions & 2 deletions packages/snap/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Qtum Snap
# QTum Wallet

Qtum snap is a snap, that allows to interact with Qtum blockchain by implementing metamsk RPC requests handlers https://docs.metamask.io/wallet/reference/json-rpc-api/.
QTum wallet is a snap, that allows to interact with QTum blockchain by implementing metamask RPC requests handlers https://docs.metamask.io/wallet/reference/json-rpc-api/.

## Methods

Expand Down
10 changes: 5 additions & 5 deletions packages/snap/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@qtumproject/wallet-snap",
"version": "0.1.0-rc.8",
"description": "Qtum Snap is a MetaMask Snap that allows you to work with Qtum network by using ethers js providers.",
"name": "@qtumproject/qtum-wallet",
"version": "0.1.0-rc.0",
"description": "Qtum Wallet is a MetaMask Snap that plays the role of the RPC proxy that accepts requests to the MetaMask and forwards them to the Qtum network with the Qtum ethers adapter.",
"repository": {
"type": "git",
"url": "https://github.com/qtumproject/metamasksnap.git"
"url": "https://github.com/qtumproject/qtum-extension-wallet.git"
},
"license": "(MIT-0 OR Apache-2.0)",
"files": [
Expand Down Expand Up @@ -42,7 +42,7 @@
"@metamask/snaps-sdk": "^3.0.1",
"@metamask/snaps-utils": "^7.0.3",
"@metamask/transaction-controller": "^27.0.1",
"@qtumproject/wallet-snap-connector": "workspace:^",
"@qtumproject/qtum-wallet-connector": "workspace:^",
"buffer": "6.0.3",
"ethers": "5.7.2",
"intl": "1.2.5",
Expand Down
16 changes: 9 additions & 7 deletions packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"version": "0.1.0-rc.8",
"description": "Securely store and manage all of your identity credentials. Use them across chains with ZK-protected privacy guarantees.",
"proposedName": "QtumSnap",
"version": "0.1.0-rc.0",
"description": "Qtum Wallet is a MetaMask Snap that plays the role of the RPC proxy that accepts requests to the MetaMask and forwards them to the Qtum network with the Qtum ethers adapter.",
"proposedName": "Qtum Wallet",
"repository": {
"type": "git",
"url": "https://github.com/qtumproject/metamasksnap.git"
"url": "https://github.com/qtumproject/qtum-extension-wallet.git"
},
"source": {
"shasum": "kYgOXV4uTSClbUxUMXFOaiVEpMELvQlb/eTugGmxGI8=",
"shasum": "BQi39VhbfNaQsnSpCM9+B8c3ZFNdDlaH60RAljEppDs=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
"iconPath": "images/icon.svg",
"packageName": "@qtumproject/wallet-snap",
"packageName": "@qtumproject/qtum-wallet",
"registry": "https://registry.npmjs.org/"
}
}
Expand All @@ -21,7 +21,9 @@
"snap_dialog": {},
"endowment:rpc": {
"dapps": true,
"snaps": true,
"snaps": true
},
"endowment:transaction-insight": {
"maxRequestTime": 180000
},
"snap_manageState": {},
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sleep } from '@qtumproject/wallet-snap-connector';
import { sleep } from '@qtumproject/qtum-wallet-connector';
import { QtumProvider, QtumWallet } from 'qtum-ethers-wrapper';

import { StorageKeys } from '@/enums';
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/src/consts/networks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Chain } from '@qtumproject/wallet-snap-connector';
import type { Chain } from '@qtumproject/qtum-wallet-connector';

export const DEFAULT_NETWORKS_RPC_URLS: Chain[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/snap/src/helpers/networks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DialogType, divider, heading, text } from '@metamask/snaps-sdk';
import type { Chain } from '@qtumproject/wallet-snap-connector';
import { sleep } from '@qtumproject/wallet-snap-connector';
import type { Chain } from '@qtumproject/qtum-wallet-connector';
import { sleep } from '@qtumproject/qtum-wallet-connector';

import { DEFAULT_NETWORKS_RPC_URLS } from '@/consts';
import { StorageKeys } from '@/enums';
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/src/helpers/parsers/erc20.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line camelcase
import { Erc20__factory } from '@qtumproject/wallet-snap-connector';
import { Erc20__factory } from '@qtumproject/qtum-wallet-connector';

import { getProvider } from '@/config';
import { erc20Interface } from '@/helpers';
Expand Down
7 changes: 3 additions & 4 deletions packages/snap/src/helpers/ui/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import type {
SnapRequestParams,
RPCMethods,
} from '@qtumproject/wallet-snap-connector';
} from '@qtumproject/qtum-wallet-connector';

import { formatUnits } from '@/helpers/format';
import {
Expand All @@ -37,13 +37,12 @@ export const buildTxUi = async (
content: panel([
heading('Sending QTUM'),
row(
formatUnits(tx.value),
formatUnits((await tx.value)!),
image(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1735" width="24" height="24"><path d="M1995 1794.48l-.68-1L1649.69 1482l163.87-506.47.48-1.49v-13.11l-167.71-521.46a11.54 11.54 0 0 0-1.5-4.08v-1.3l-4.54-4.54a11.07 11.07 0 0 0-6.12-5.52L1192.7 101.9l-2.61-1.9h-558c-3.26 0-4 .52-11 5.46-3.34 2.37-8.21 5.86-14.4 10.29-11.69 8.38-28.83 20.71-50.92 36.63-37.21 26.82-89 64.21-154 111.13-110.58 79.9-222.46 160.83-223.58 161.64l-.64.46-8.47 8.47V440L.48 959.42l-.48 1.5v13.17L169.21 1495v.11a13.06 13.06 0 0 0 3.73 9.53l4.74 4.74L618 1827.91a10.65 10.65 0 0 0 8.53 5.39 13.69 13.69 0 0 0 6.57 1.7h553.6l2-2a11.47 11.47 0 0 0 3.44-1.38h.39l428.31-310.4 339 307.71a20.41 20.41 0 0 0 7.85 4.7 30.78 30.78 0 0 0 18 0 16.87 16.87 0 0 0 9.18-7.78 22.57 22.57 0 0 0 5.14-15 29.07 29.07 0 0 0-5.01-16.37zM1615.31 944.2l22.91-370.77 118.83 370.77h-141.74zm141.74 46.6l-118.84 370.77-22.9-370.77h141.74zM433.63 1411l142.52 329.54-337-244.93zm517.26-932l224.48-307.46 153.77 355.12zm429.52 45l-142.52-329.55 337 244.93zm22.05 42.92l193.11-84.66-24.14 394.18-.18 4.3zM242.79 880.74l-.17-4.11-24.15-394.32 114.11 50.38 79 34.27zM1133 148.27L907.83 456.62 681.16 148.27H1133zm418.33 842.53l-180.46 334.88-98.87-211.56-55.63-123.32h335zm-334.83-46.6l154.43-334.77 180.4 334.77H1216.5zM951.56 527.54l382.24 47.77-157.22 340.58zm46.93 800.05l178.11-308.45 157.2 340.54-382.12 47.76zM677.08 944.2l230.71-399 113.76 199.4L1137 944.2H677.08zM1137 990.8l-229.17 399.07-115.37-199.52L677.08 990.8H1137zm-316.49-390l-181.4 315.03-157.2-340.52 380.66-47.77zm42 806.69l-380.66-47.77 118.32-257.39 38.84-83.21zM264.38 944.2l180.38-334.7 98.94 216.39 55.41 118.31H264.38zm334.83 46.6L444.8 1325.57 264.38 990.8h334.83zm972.17 63.2v1l24.16 397.66-114.12-50.38-79-34.27zM239.15 439.38l337-244.93L433.63 524zm172.43 928.7l-193.12 84.66 24.15-397.56.05-1.17zm496.26 110.29L1133 1786.73H681.16zm667.06 17.24l-337 244.93L1380.41 1411zM484.9 526.7l153.77-355.11L863.15 479zM57 944.2l118.82-370.77 22.91 370.77H57zm141.75 46.6l-22.91 370.77L57 990.8h141.73zm664.4 465.2l-224.48 307.41-153.76-355.12zm466-47.66l-153.77 355.12L950.88 1456z" fill="#2e9ad0"/></svg>',
),
),
text(`**To**:`),
address(String(tx.to)),
...(tx.to ? [text(`**To**:`), address(tx.to?.toString())] : []),

divider(),

Expand Down
4 changes: 2 additions & 2 deletions packages/snap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
text,
} from '@metamask/snaps-sdk';
import type { JsonRpcRequest } from '@metamask/utils';
import type { SnapRequestParams } from '@qtumproject/wallet-snap-connector';
import { sleep, RPCMethods } from '@qtumproject/wallet-snap-connector';
import type { SnapRequestParams } from '@qtumproject/qtum-wallet-connector';
import { sleep, RPCMethods } from '@qtumproject/qtum-wallet-connector';
import { BigNumber, ethers } from 'ethers';
import { QtumWallet } from 'qtum-ethers-wrapper';

Expand Down
2 changes: 1 addition & 1 deletion packages/snap/src/types/storage-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Chain } from '@qtumproject/wallet-snap-connector';
import type { Chain } from '@qtumproject/qtum-wallet-connector';

import type { StorageKeys } from '@/enums';

Expand Down
2 changes: 1 addition & 1 deletion scripts/release-sanity-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function validateChangelogHasVersionOnTop () {
}

function validateChangelogAnchorsLegend () {
const baseRepoUrl = 'https://github.com/qtumproject/metamasksnap'
const baseRepoUrl = 'https://github.com/qtumproject/qtum-extension-wallet'
const anyReleaseTagRe =
/## \[\d+\.\d+\.\d+((-rc|-x)\.\d+)?\] - \d{4}-\d{2}-\d{2}/gi

Expand Down
Loading
Loading