@btc-vision/walletconnect 1.5.3 → 1.5.5
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/browser/consts.d.ts +1 -1
- package/browser/context/WalletConnectContext.d.ts +3 -3
- package/browser/index.js +1 -1
- package/browser/types.d.ts +2 -1
- package/browser/wallets/controller.d.ts +4 -4
- package/browser/wallets/opwallet/controller.d.ts +2 -2
- package/browser/wallets/opwallet/interface.d.ts +1 -1
- package/browser/wallets/types.d.ts +3 -3
- package/browser/wallets/unisat/controller.d.ts +2 -2
- package/browser/wallets/unisat/interface.d.ts +1 -1
- package/build/consts.d.ts +1 -1
- package/build/consts.js +2 -0
- package/build/context/WalletConnectContext.d.ts +3 -3
- package/build/context/WalletConnectContext.js +3 -0
- package/build/provider/WalletConnectProvider.js +4 -3
- package/build/types.d.ts +2 -1
- package/build/types.js +2 -1
- package/build/wallets/controller.d.ts +4 -4
- package/build/wallets/controller.js +9 -6
- package/build/wallets/opwallet/controller.d.ts +2 -2
- package/build/wallets/opwallet/controller.js +4 -2
- package/build/wallets/opwallet/interface.d.ts +1 -1
- package/build/wallets/opwallet/interface.js +1 -0
- package/build/wallets/types.d.ts +3 -3
- package/build/wallets/types.js +4 -1
- package/build/wallets/unisat/controller.d.ts +2 -2
- package/build/wallets/unisat/controller.js +3 -1
- package/build/wallets/unisat/interface.d.ts +1 -1
- package/build/wallets/unisat/interface.js +1 -0
- package/package.json +3 -3
- package/src/consts.ts +2 -1
- package/src/context/WalletConnectContext.ts +3 -3
- package/src/provider/WalletConnectProvider.tsx +6 -6
- package/src/types.ts +2 -1
- package/src/wallets/controller.ts +11 -11
- package/src/wallets/opwallet/controller.ts +4 -4
- package/src/wallets/opwallet/interface.ts +1 -1
- package/src/wallets/types.ts +4 -4
- package/src/wallets/unisat/controller.ts +3 -3
- package/src/wallets/unisat/interface.ts +1 -1
- package/tsconfig.base.json +1 -0
package/browser/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Network } from '@btc-vision/bitcoin';
|
|
1
|
+
import { type Network } from '@btc-vision/bitcoin';
|
|
2
2
|
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
3
|
export interface WalletConnectNetwork extends Network {
|
|
4
4
|
chainType: UnisatChainType;
|
|
5
|
+
network: string;
|
|
5
6
|
}
|
|
6
7
|
export interface WalletInformation {
|
|
7
8
|
name: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import { WalletConnectNetwork } from '../types';
|
|
3
|
-
import { SupportedWallets } from './index';
|
|
4
|
-
import type { ControllerConnectAccounts, ControllerErrorResponse, ControllerResponse, WalletConnectWallet } from './types.ts';
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
5
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
3
|
+
import { type WalletConnectNetwork } from '../types';
|
|
4
|
+
import { type SupportedWallets } from './index';
|
|
5
|
+
import type { ControllerConnectAccounts, ControllerErrorResponse, ControllerResponse, WalletConnectWallet } from './types.ts';
|
|
6
6
|
declare class WalletController {
|
|
7
7
|
private static wallets;
|
|
8
8
|
private static currentWallet;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType } from '@btc-vision/transaction';
|
|
2
|
-
import type { WalletBase } from '../types.ts';
|
|
1
|
+
import { type Unisat, UnisatChainType } from '@btc-vision/transaction';
|
|
3
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
3
|
+
import { type WalletBase } from '../types';
|
|
4
4
|
declare class OPWallet implements WalletBase {
|
|
5
5
|
private walletBase;
|
|
6
6
|
private accountsChangedHookWrapper?;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import { SupportedWallets } from './index';
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
3
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
4
|
-
|
|
3
|
+
import { type SupportedWallets } from './index';
|
|
4
|
+
export { type AbstractRpcProvider } from 'opnet';
|
|
5
5
|
export interface WalletBase {
|
|
6
6
|
isInstalled(): boolean;
|
|
7
7
|
isConnected(): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import type
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
+
import { type WalletBase } from '../types';
|
|
3
3
|
import { AbstractRpcProvider } from 'opnet';
|
|
4
4
|
declare class UnisatWallet implements WalletBase {
|
|
5
5
|
private walletBase;
|
package/build/consts.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WalletConnectNetwork } from './types';
|
|
1
|
+
import { type WalletConnectNetwork } from './types';
|
|
2
2
|
export declare const DefaultWalletConnectNetwork: WalletConnectNetwork;
|
package/build/consts.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { networks } from '@btc-vision/bitcoin';
|
|
2
2
|
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
|
+
import {} from './types';
|
|
3
4
|
export const DefaultWalletConnectNetwork = {
|
|
4
5
|
...networks.regtest,
|
|
5
6
|
chainType: UnisatChainType.BITCOIN_REGTEST,
|
|
7
|
+
network: 'regtest',
|
|
6
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address, Unisat, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import type { WalletConnectNetwork, WalletInformation } from '../types.ts';
|
|
3
|
-
import { SupportedWallets } from '../wallets';
|
|
1
|
+
import { Address, type Unisat, UnisatSigner } from '@btc-vision/transaction';
|
|
4
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
3
|
+
import type { WalletConnectNetwork, WalletInformation } from '../types.ts';
|
|
4
|
+
import { type SupportedWallets } from '../wallets';
|
|
5
5
|
export type WalletConnectContextType = {
|
|
6
6
|
allWallets: WalletInformation[];
|
|
7
7
|
walletType: string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Address } from '@btc-vision/transaction';
|
|
3
|
-
import {
|
|
2
|
+
import { Address, UnisatSigner } from '@btc-vision/transaction';
|
|
3
|
+
import { AbstractRpcProvider } from 'opnet';
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { DefaultWalletConnectNetwork } from '../consts';
|
|
5
6
|
import { WalletConnectContext } from '../context/WalletConnectContext';
|
|
6
7
|
import '../utils/style.css';
|
|
@@ -147,7 +148,7 @@ const WalletConnectProvider = ({ theme, children }) => {
|
|
|
147
148
|
}, [walletAddress]);
|
|
148
149
|
useEffect(() => {
|
|
149
150
|
const updateWalletInfo = async () => {
|
|
150
|
-
const provider = walletAddress ?
|
|
151
|
+
const provider = walletAddress ? await WalletController.getProvider() : null;
|
|
151
152
|
setProvider(provider);
|
|
152
153
|
};
|
|
153
154
|
void updateWalletInfo();
|
package/build/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Network } from '@btc-vision/bitcoin';
|
|
1
|
+
import { type Network } from '@btc-vision/bitcoin';
|
|
2
2
|
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
3
|
export interface WalletConnectNetwork extends Network {
|
|
4
4
|
chainType: UnisatChainType;
|
|
5
|
+
network: string;
|
|
5
6
|
}
|
|
6
7
|
export interface WalletInformation {
|
|
7
8
|
name: string;
|
package/build/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import {} from '@btc-vision/bitcoin';
|
|
2
|
+
import { UnisatChainType } from '@btc-vision/transaction';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import { WalletConnectNetwork } from '../types';
|
|
3
|
-
import { SupportedWallets } from './index';
|
|
4
|
-
import type { ControllerConnectAccounts, ControllerErrorResponse, ControllerResponse, WalletConnectWallet } from './types.ts';
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
5
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
3
|
+
import { type WalletConnectNetwork } from '../types';
|
|
4
|
+
import { type SupportedWallets } from './index';
|
|
5
|
+
import type { ControllerConnectAccounts, ControllerErrorResponse, ControllerResponse, WalletConnectWallet } from './types.ts';
|
|
6
6
|
declare class WalletController {
|
|
7
7
|
private static wallets;
|
|
8
8
|
private static currentWallet;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { networks } from '@btc-vision/bitcoin';
|
|
3
|
-
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
|
+
import { UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
4
|
+
import { AbstractRpcProvider } from 'opnet';
|
|
4
5
|
import { DefaultWalletConnectNetwork } from '../consts';
|
|
6
|
+
import {} from '../types';
|
|
5
7
|
import { _e } from '../utils/accessibility/errorDecoder';
|
|
8
|
+
import {} from './index';
|
|
6
9
|
class WalletController {
|
|
7
10
|
static isWalletInstalled(wallet) {
|
|
8
11
|
return this.wallets.get(wallet)?.controller?.isInstalled() || false;
|
|
@@ -34,16 +37,16 @@ class WalletController {
|
|
|
34
37
|
return await wallet.controller.getSigner();
|
|
35
38
|
}
|
|
36
39
|
static convertChainTypeToNetwork(chainType) {
|
|
37
|
-
const walletNetwork = (network) => {
|
|
38
|
-
return { ...network, chainType: chainType };
|
|
40
|
+
const walletNetwork = (network, name) => {
|
|
41
|
+
return { ...network, chainType: chainType, network: name };
|
|
39
42
|
};
|
|
40
43
|
switch (chainType) {
|
|
41
44
|
case UnisatChainType.BITCOIN_REGTEST:
|
|
42
|
-
return walletNetwork(networks.regtest);
|
|
45
|
+
return walletNetwork(networks.regtest, 'regtest');
|
|
43
46
|
case UnisatChainType.BITCOIN_TESTNET:
|
|
44
|
-
return walletNetwork(networks.testnet);
|
|
47
|
+
return walletNetwork(networks.testnet, 'testnet');
|
|
45
48
|
case UnisatChainType.BITCOIN_MAINNET:
|
|
46
|
-
return walletNetwork(networks.bitcoin);
|
|
49
|
+
return walletNetwork(networks.bitcoin, 'mainnet');
|
|
47
50
|
case UnisatChainType.BITCOIN_TESTNET4:
|
|
48
51
|
case UnisatChainType.BITCOIN_SIGNET:
|
|
49
52
|
case UnisatChainType.FRACTAL_BITCOIN_TESTNET:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType } from '@btc-vision/transaction';
|
|
2
|
-
import type { WalletBase } from '../types.ts';
|
|
1
|
+
import { type Unisat, UnisatChainType } from '@btc-vision/transaction';
|
|
3
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
3
|
+
import { type WalletBase } from '../types';
|
|
4
4
|
declare class OPWallet implements WalletBase {
|
|
5
5
|
private walletBase;
|
|
6
6
|
private accountsChangedHookWrapper?;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { UnisatChainType } from '@btc-vision/transaction';
|
|
2
|
-
import { JSONRpcProvider } from 'opnet';
|
|
3
1
|
import { networks } from '@btc-vision/bitcoin';
|
|
2
|
+
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
|
+
import { AbstractRpcProvider, JSONRpcProvider } from 'opnet';
|
|
4
|
+
import {} from '../types';
|
|
5
|
+
import {} from './interface';
|
|
4
6
|
const notInstalledError = 'OP_WALLET is not installed';
|
|
5
7
|
class OPWallet {
|
|
6
8
|
constructor() {
|
package/build/wallets/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import { SupportedWallets } from './index';
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
3
2
|
import { AbstractRpcProvider } from 'opnet';
|
|
4
|
-
|
|
3
|
+
import { type SupportedWallets } from './index';
|
|
4
|
+
export { type AbstractRpcProvider } from 'opnet';
|
|
5
5
|
export interface WalletBase {
|
|
6
6
|
isInstalled(): boolean;
|
|
7
7
|
isConnected(): boolean;
|
package/build/wallets/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import type
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
+
import { type WalletBase } from '../types';
|
|
3
3
|
import { AbstractRpcProvider } from 'opnet';
|
|
4
4
|
declare class UnisatWallet implements WalletBase {
|
|
5
5
|
private walletBase;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import {
|
|
2
|
+
import {} from '../types';
|
|
3
|
+
import {} from './interface';
|
|
4
|
+
import { AbstractRpcProvider, JSONRpcProvider } from 'opnet';
|
|
3
5
|
import { networks } from '@btc-vision/bitcoin';
|
|
4
6
|
const notInstalledError = 'UNISAT is not installed';
|
|
5
7
|
class UnisatWallet {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btc-vision/walletconnect",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.5",
|
|
5
5
|
"author": "impredmet",
|
|
6
6
|
"description": "The OP_NET Wallet Connect library helps your dApp connect to any compatible wallet.",
|
|
7
7
|
"engines": {
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@btc-vision/bitcoin": "^6.4.8",
|
|
90
|
-
"@btc-vision/transaction": "^1.6.
|
|
90
|
+
"@btc-vision/transaction": "^1.6.15",
|
|
91
91
|
"@eslint/js": "^9.34.0",
|
|
92
92
|
"css-loader": "^7.1.2",
|
|
93
93
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
94
94
|
"gulp-clean": "^0.4.0",
|
|
95
95
|
"gulp-eslint-new": "^2.4.0",
|
|
96
96
|
"gulp-logger-new": "^1.0.1",
|
|
97
|
-
"opnet": "^1.6.
|
|
97
|
+
"opnet": "^1.6.27",
|
|
98
98
|
"style-loader": "^4.0.0",
|
|
99
99
|
"webpack": "^5.101.3"
|
|
100
100
|
}
|
package/src/consts.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { networks } from '@btc-vision/bitcoin';
|
|
2
2
|
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
|
-
import { WalletConnectNetwork } from './types';
|
|
3
|
+
import { type WalletConnectNetwork } from './types';
|
|
4
4
|
|
|
5
5
|
export const DefaultWalletConnectNetwork: WalletConnectNetwork = {
|
|
6
6
|
...networks.regtest,
|
|
7
7
|
chainType: UnisatChainType.BITCOIN_REGTEST,
|
|
8
|
+
network: 'regtest',
|
|
8
9
|
} as const;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Address, Unisat, UnisatSigner } from '@btc-vision/transaction';
|
|
1
|
+
import { Address, type Unisat, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
+
import { AbstractRpcProvider } from 'opnet';
|
|
2
3
|
import { createContext } from 'react';
|
|
3
4
|
import type { WalletConnectNetwork, WalletInformation } from '../types.ts';
|
|
4
|
-
import { SupportedWallets } from '../wallets';
|
|
5
|
-
import { AbstractRpcProvider } from 'opnet';
|
|
5
|
+
import { type SupportedWallets } from '../wallets';
|
|
6
6
|
|
|
7
7
|
export type WalletConnectContextType = {
|
|
8
8
|
allWallets: WalletInformation[];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Address, Unisat, UnisatSigner } from '@btc-vision/transaction';
|
|
1
|
+
import { Address, type Unisat, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
+
import { AbstractRpcProvider } from 'opnet';
|
|
2
3
|
import React, { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
4
|
import { DefaultWalletConnectNetwork } from '../consts';
|
|
4
5
|
import { WalletConnectContext } from '../context/WalletConnectContext';
|
|
5
6
|
import type { WalletConnectNetwork, WalletInformation } from '../types.ts';
|
|
6
7
|
import '../utils/style.css';
|
|
7
8
|
import '../utils/theme.css';
|
|
8
|
-
import { SupportedWallets, WalletController } from '../wallets';
|
|
9
|
+
import { type SupportedWallets, WalletController } from '../wallets';
|
|
9
10
|
import type {
|
|
10
11
|
ControllerConnectAccounts,
|
|
11
12
|
ControllerErrorResponse,
|
|
12
13
|
ControllerResponse,
|
|
13
14
|
WalletConnectWallet,
|
|
14
15
|
} from '../wallets/types.ts';
|
|
15
|
-
import { AbstractRpcProvider } from 'opnet';
|
|
16
16
|
|
|
17
17
|
const AUTO_RECONNECT_RETRIES = 5;
|
|
18
18
|
|
|
@@ -201,11 +201,11 @@ const WalletConnectProvider: React.FC<WalletConnectProviderProps> = ({ theme, ch
|
|
|
201
201
|
|
|
202
202
|
useEffect(() => {
|
|
203
203
|
const updateWalletInfo = async () => {
|
|
204
|
-
const provider = walletAddress ?
|
|
204
|
+
const provider = walletAddress ? await WalletController.getProvider() : null;
|
|
205
205
|
setProvider(provider);
|
|
206
|
-
}
|
|
206
|
+
};
|
|
207
207
|
void updateWalletInfo();
|
|
208
|
-
}, [walletAddress,network]);
|
|
208
|
+
}, [walletAddress, network]);
|
|
209
209
|
|
|
210
210
|
useEffect(() => {
|
|
211
211
|
const updateSigner = async () => {
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Network } from '@btc-vision/bitcoin';
|
|
1
|
+
import { type Network } from '@btc-vision/bitcoin';
|
|
2
2
|
import { UnisatChainType } from '@btc-vision/transaction';
|
|
3
3
|
|
|
4
4
|
export interface WalletConnectNetwork extends Network {
|
|
5
5
|
chainType: UnisatChainType;
|
|
6
|
+
network: string;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export interface WalletInformation {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Network, networks } from '@btc-vision/bitcoin';
|
|
2
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
1
|
+
import { type Network, networks } from '@btc-vision/bitcoin';
|
|
2
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
3
|
+
import { AbstractRpcProvider } from 'opnet';
|
|
3
4
|
import { DefaultWalletConnectNetwork } from '../consts';
|
|
4
|
-
import { WalletConnectNetwork } from '../types';
|
|
5
|
+
import { type WalletConnectNetwork } from '../types';
|
|
5
6
|
import { _e } from '../utils/accessibility/errorDecoder';
|
|
6
|
-
import { SupportedWallets } from './index';
|
|
7
|
+
import { type SupportedWallets } from './index';
|
|
7
8
|
import type {
|
|
8
9
|
ControllerConnectAccounts,
|
|
9
10
|
ControllerErrorResponse,
|
|
10
11
|
ControllerResponse,
|
|
11
12
|
WalletConnectWallet,
|
|
12
13
|
} from './types.ts';
|
|
13
|
-
import { AbstractRpcProvider } from 'opnet';
|
|
14
14
|
|
|
15
15
|
class WalletController {
|
|
16
16
|
private static wallets: Map<string, WalletConnectWallet> = new Map();
|
|
@@ -42,7 +42,7 @@ class WalletController {
|
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
// Needs to return a Proxy to be sure useEffects are triggered
|
|
45
|
-
const provider = await wallet.controller.getProvider()
|
|
45
|
+
const provider = await wallet.controller.getProvider();
|
|
46
46
|
return provider ? new Proxy(provider, {}) : null;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -57,16 +57,16 @@ class WalletController {
|
|
|
57
57
|
//TODO: check if we really want to return a default network here
|
|
58
58
|
// instead of null. Default is there: DefaultWalletConnectChain.network
|
|
59
59
|
static convertChainTypeToNetwork(chainType: UnisatChainType): WalletConnectNetwork {
|
|
60
|
-
const walletNetwork = (network: Network): WalletConnectNetwork => {
|
|
61
|
-
return { ...network, chainType: chainType };
|
|
60
|
+
const walletNetwork = (network: Network, name: string): WalletConnectNetwork => {
|
|
61
|
+
return { ...network, chainType: chainType, network: name };
|
|
62
62
|
};
|
|
63
63
|
switch (chainType) {
|
|
64
64
|
case UnisatChainType.BITCOIN_REGTEST:
|
|
65
|
-
return walletNetwork(networks.regtest);
|
|
65
|
+
return walletNetwork(networks.regtest, 'regtest');
|
|
66
66
|
case UnisatChainType.BITCOIN_TESTNET:
|
|
67
|
-
return walletNetwork(networks.testnet);
|
|
67
|
+
return walletNetwork(networks.testnet, 'testnet');
|
|
68
68
|
case UnisatChainType.BITCOIN_MAINNET:
|
|
69
|
-
return walletNetwork(networks.bitcoin);
|
|
69
|
+
return walletNetwork(networks.bitcoin, 'mainnet');
|
|
70
70
|
|
|
71
71
|
case UnisatChainType.BITCOIN_TESTNET4:
|
|
72
72
|
case UnisatChainType.BITCOIN_SIGNET:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Unisat, UnisatChainInfo, UnisatChainType } from '@btc-vision/transaction';
|
|
2
|
-
import type { WalletBase } from '../types.ts';
|
|
3
|
-
import type { OPWalletInterface } from './interface';
|
|
4
|
-
import { AbstractRpcProvider, JSONRpcProvider } from 'opnet';
|
|
5
1
|
import { networks } from '@btc-vision/bitcoin';
|
|
2
|
+
import { type Unisat, type UnisatChainInfo, UnisatChainType } from '@btc-vision/transaction';
|
|
3
|
+
import { AbstractRpcProvider, JSONRpcProvider } from 'opnet';
|
|
4
|
+
import { type WalletBase } from '../types';
|
|
5
|
+
import { type OPWalletInterface } from './interface';
|
|
6
6
|
|
|
7
7
|
interface OPWalletWindow extends Window {
|
|
8
8
|
opnet?: OPWalletInterface;
|
package/src/wallets/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export type
|
|
1
|
+
import { type Unisat, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
+
import { AbstractRpcProvider } from 'opnet';
|
|
3
|
+
import { type SupportedWallets } from './index';
|
|
4
|
+
export { type AbstractRpcProvider } from 'opnet';
|
|
5
5
|
|
|
6
6
|
export interface WalletBase {
|
|
7
7
|
isInstalled(): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Unisat, UnisatChainInfo, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
1
|
+
import { type Unisat, type UnisatChainInfo, UnisatChainType, UnisatSigner } from '@btc-vision/transaction';
|
|
2
|
+
import { type WalletBase } from '../types';
|
|
3
|
+
import { type UnisatWalletInterface } from './interface';
|
|
4
4
|
import { AbstractRpcProvider, JSONRpcProvider } from 'opnet';
|
|
5
5
|
import { networks } from '@btc-vision/bitcoin';
|
|
6
6
|
|
package/tsconfig.base.json
CHANGED