@ant-design/web3-wagmi 0.0.0-alpha-20260209094036
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/CHANGELOG.md +517 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/esm/chains.d.ts +16 -0
- package/dist/esm/chains.js +83 -0
- package/dist/esm/global.d.ts +3 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/interface.d.ts +26 -0
- package/dist/esm/interface.js +1 -0
- package/dist/esm/utils.d.ts +3 -0
- package/dist/esm/utils.js +8 -0
- package/dist/esm/wagmi-provider/__mocks__/wagmiBaseMock.d.ts +76 -0
- package/dist/esm/wagmi-provider/__mocks__/wagmiBaseMock.js +36 -0
- package/dist/esm/wagmi-provider/config-provider.d.ts +23 -0
- package/dist/esm/wagmi-provider/config-provider.js +243 -0
- package/dist/esm/wagmi-provider/index.d.ts +32 -0
- package/dist/esm/wagmi-provider/index.js +102 -0
- package/dist/esm/wagmi-provider/methods/getNFTMetadata.d.ts +3 -0
- package/dist/esm/wagmi-provider/methods/getNFTMetadata.js +25 -0
- package/dist/esm/wagmi-provider/methods/index.d.ts +1 -0
- package/dist/esm/wagmi-provider/methods/index.js +1 -0
- package/dist/esm/wallets/coinbase-wallet.d.ts +4 -0
- package/dist/esm/wallets/coinbase-wallet.js +19 -0
- package/dist/esm/wallets/eip6963.d.ts +3 -0
- package/dist/esm/wallets/eip6963.js +27 -0
- package/dist/esm/wallets/im-token.d.ts +2 -0
- package/dist/esm/wallets/im-token.js +11 -0
- package/dist/esm/wallets/index.d.ts +10 -0
- package/dist/esm/wallets/index.js +10 -0
- package/dist/esm/wallets/meta-mask.d.ts +2 -0
- package/dist/esm/wallets/meta-mask.js +11 -0
- package/dist/esm/wallets/mobile-wallet.d.ts +2 -0
- package/dist/esm/wallets/mobile-wallet.js +8 -0
- package/dist/esm/wallets/okx-wallet.d.ts +2 -0
- package/dist/esm/wallets/okx-wallet.js +11 -0
- package/dist/esm/wallets/rainbow-wallet.d.ts +2 -0
- package/dist/esm/wallets/rainbow-wallet.js +11 -0
- package/dist/esm/wallets/safeheron.d.ts +2 -0
- package/dist/esm/wallets/safeheron.js +19 -0
- package/dist/esm/wallets/token-pocket.d.ts +2 -0
- package/dist/esm/wallets/token-pocket.js +13 -0
- package/dist/esm/wallets/universal-wallet.d.ts +11 -0
- package/dist/esm/wallets/universal-wallet.js +66 -0
- package/dist/esm/wallets/wallet-connect.d.ts +6 -0
- package/dist/esm/wallets/wallet-connect.js +42 -0
- package/dist/lib/chains.d.ts +16 -0
- package/dist/lib/chains.js +89 -0
- package/dist/lib/global.d.ts +3 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.js +71 -0
- package/dist/lib/interface.d.ts +26 -0
- package/dist/lib/interface.js +5 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +14 -0
- package/dist/lib/wagmi-provider/__mocks__/wagmiBaseMock.d.ts +76 -0
- package/dist/lib/wagmi-provider/__mocks__/wagmiBaseMock.js +42 -0
- package/dist/lib/wagmi-provider/config-provider.d.ts +23 -0
- package/dist/lib/wagmi-provider/config-provider.js +251 -0
- package/dist/lib/wagmi-provider/index.d.ts +32 -0
- package/dist/lib/wagmi-provider/index.js +110 -0
- package/dist/lib/wagmi-provider/methods/getNFTMetadata.d.ts +3 -0
- package/dist/lib/wagmi-provider/methods/getNFTMetadata.js +31 -0
- package/dist/lib/wagmi-provider/methods/index.d.ts +1 -0
- package/dist/lib/wagmi-provider/methods/index.js +16 -0
- package/dist/lib/wallets/coinbase-wallet.d.ts +4 -0
- package/dist/lib/wallets/coinbase-wallet.js +26 -0
- package/dist/lib/wallets/eip6963.d.ts +3 -0
- package/dist/lib/wallets/eip6963.js +34 -0
- package/dist/lib/wallets/im-token.d.ts +2 -0
- package/dist/lib/wallets/im-token.js +18 -0
- package/dist/lib/wallets/index.d.ts +10 -0
- package/dist/lib/wallets/index.js +115 -0
- package/dist/lib/wallets/meta-mask.d.ts +2 -0
- package/dist/lib/wallets/meta-mask.js +18 -0
- package/dist/lib/wallets/mobile-wallet.d.ts +2 -0
- package/dist/lib/wallets/mobile-wallet.js +15 -0
- package/dist/lib/wallets/okx-wallet.d.ts +2 -0
- package/dist/lib/wallets/okx-wallet.js +18 -0
- package/dist/lib/wallets/rainbow-wallet.d.ts +2 -0
- package/dist/lib/wallets/rainbow-wallet.js +18 -0
- package/dist/lib/wallets/safeheron.d.ts +2 -0
- package/dist/lib/wallets/safeheron.js +27 -0
- package/dist/lib/wallets/token-pocket.d.ts +2 -0
- package/dist/lib/wallets/token-pocket.js +20 -0
- package/dist/lib/wallets/universal-wallet.d.ts +11 -0
- package/dist/lib/wallets/universal-wallet.js +73 -0
- package/dist/lib/wallets/wallet-connect.d.ts +6 -0
- package/dist/lib/wallets/wallet-connect.js +49 -0
- package/package.json +73 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { metadata_OkxWallet } from '@ant-design/web3-assets';
|
|
2
|
+
import { injected } from 'wagmi/connectors';
|
|
3
|
+
import { UniversalWallet } from "./universal-wallet";
|
|
4
|
+
export const OkxWallet = metadata => {
|
|
5
|
+
return new UniversalWallet({
|
|
6
|
+
...metadata_OkxWallet,
|
|
7
|
+
...metadata
|
|
8
|
+
}, () => injected({
|
|
9
|
+
target: 'okxWallet'
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { metadata_RainbowWallet } from '@ant-design/web3-assets';
|
|
2
|
+
import { injected } from 'wagmi/connectors';
|
|
3
|
+
import { UniversalWallet } from "./universal-wallet";
|
|
4
|
+
export const RainbowWallet = metadata => {
|
|
5
|
+
return new UniversalWallet({
|
|
6
|
+
...metadata_RainbowWallet,
|
|
7
|
+
...metadata
|
|
8
|
+
}, () => injected({
|
|
9
|
+
target: 'rainbow'
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* v8 ignore start */
|
|
2
|
+
import { metadata_Safeheron } from '@ant-design/web3-assets';
|
|
3
|
+
export const SafeheronWallet = metadata => {
|
|
4
|
+
return {
|
|
5
|
+
connectors: ['Safeheron'],
|
|
6
|
+
create: connectors => {
|
|
7
|
+
return {
|
|
8
|
+
...metadata_Safeheron,
|
|
9
|
+
hasWalletReady: async () => {
|
|
10
|
+
return !!(await connectors?.[0]?.getProvider());
|
|
11
|
+
},
|
|
12
|
+
hasExtensionInstalled: async () => {
|
|
13
|
+
return !!(await connectors?.[0]?.getProvider());
|
|
14
|
+
},
|
|
15
|
+
...metadata
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { metadata_TokenPocket } from '@ant-design/web3-assets';
|
|
2
|
+
import { injected } from 'wagmi/connectors';
|
|
3
|
+
import { UniversalWallet } from "./universal-wallet";
|
|
4
|
+
export const TokenPocket = metadata => {
|
|
5
|
+
return new UniversalWallet({
|
|
6
|
+
...metadata_TokenPocket,
|
|
7
|
+
...metadata
|
|
8
|
+
}, () => {
|
|
9
|
+
return injected({
|
|
10
|
+
target: 'tokenPocket'
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WalletMetadata } from '@ant-design/web3-common';
|
|
2
|
+
import type { Connector, CreateConnectorFn } from 'wagmi';
|
|
3
|
+
import type { CreateWalletOptions, WalletFactory, WalletUseInWagmiAdapter } from '../interface';
|
|
4
|
+
export declare class UniversalWallet implements WalletFactory {
|
|
5
|
+
private wallet;
|
|
6
|
+
name?: string;
|
|
7
|
+
createWagmiConnector?: () => CreateConnectorFn;
|
|
8
|
+
connectors: string[];
|
|
9
|
+
constructor(wallet: WalletMetadata, createWagmiConnector?: () => CreateConnectorFn);
|
|
10
|
+
create: (connectors?: readonly Connector[], options?: CreateWalletOptions) => WalletUseInWagmiAdapter;
|
|
11
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export class UniversalWallet {
|
|
2
|
+
name;
|
|
3
|
+
createWagmiConnector;
|
|
4
|
+
connectors = [];
|
|
5
|
+
constructor(wallet, createWagmiConnector) {
|
|
6
|
+
this.wallet = wallet;
|
|
7
|
+
this.name = wallet.name;
|
|
8
|
+
this.createWagmiConnector = createWagmiConnector;
|
|
9
|
+
if (wallet.extensions) {
|
|
10
|
+
// support injected connector
|
|
11
|
+
// https://wagmi.sh/react/connectors/injected
|
|
12
|
+
this.connectors.push(wallet.name);
|
|
13
|
+
}
|
|
14
|
+
if (wallet.app) {
|
|
15
|
+
// support WalletConnect https://wagmi.sh/react/connectors/walletConnect
|
|
16
|
+
this.connectors.push('WalletConnect');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
create = (connectors, options) => {
|
|
20
|
+
const walletConnector = connectors?.find(item => item.name === 'WalletConnect');
|
|
21
|
+
const injectedConnector = connectors?.find(item => item.name === this.wallet.name);
|
|
22
|
+
let qrCodeUri = undefined;
|
|
23
|
+
const getQrCode = async () => {
|
|
24
|
+
const provider = await walletConnector?.getProvider();
|
|
25
|
+
return new Promise(resolve => {
|
|
26
|
+
if (qrCodeUri) {
|
|
27
|
+
resolve({
|
|
28
|
+
uri: qrCodeUri
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
provider?.on('display_uri', uri => {
|
|
33
|
+
qrCodeUri = uri;
|
|
34
|
+
resolve({
|
|
35
|
+
uri
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const hasExtensionInstalled = async () => {
|
|
41
|
+
const provider = await injectedConnector?.getProvider?.();
|
|
42
|
+
return !!provider;
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
...this.wallet,
|
|
46
|
+
getWagmiConnector: async connectOptions => {
|
|
47
|
+
if (connectOptions?.connectType === 'qrCode') {
|
|
48
|
+
return walletConnector;
|
|
49
|
+
}
|
|
50
|
+
if (await hasExtensionInstalled()) {
|
|
51
|
+
return injectedConnector;
|
|
52
|
+
}
|
|
53
|
+
return walletConnector;
|
|
54
|
+
},
|
|
55
|
+
hasExtensionInstalled: async () => {
|
|
56
|
+
return hasExtensionInstalled();
|
|
57
|
+
},
|
|
58
|
+
hasWalletReady: async () => {
|
|
59
|
+
const installed = await hasExtensionInstalled();
|
|
60
|
+
return !!(installed || walletConnector);
|
|
61
|
+
},
|
|
62
|
+
customQrCodePanel: options?.useWalletConnectOfficialModal,
|
|
63
|
+
getQrCode: walletConnector ? getQrCode : undefined
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WalletMetadata } from '@ant-design/web3-common';
|
|
2
|
+
import type { WalletFactory } from '../interface';
|
|
3
|
+
export type EthereumWalletConnect = (metadata?: Partial<WalletMetadata> & {
|
|
4
|
+
useWalletConnectOfficialModal?: boolean;
|
|
5
|
+
}) => WalletFactory;
|
|
6
|
+
export declare const WalletConnect: EthereumWalletConnect;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { metadata_WalletConnect } from '@ant-design/web3-assets';
|
|
2
|
+
export const WalletConnect = metadata => {
|
|
3
|
+
const {
|
|
4
|
+
useWalletConnectOfficialModal = false,
|
|
5
|
+
...rest
|
|
6
|
+
} = metadata || {};
|
|
7
|
+
return {
|
|
8
|
+
connectors: ['WalletConnect'],
|
|
9
|
+
create: (connectors, options = {}) => {
|
|
10
|
+
let qrCodeUri = undefined;
|
|
11
|
+
const getQrCode = async () => {
|
|
12
|
+
const provider = await connectors?.[0]?.getProvider();
|
|
13
|
+
return new Promise(resolve => {
|
|
14
|
+
if (qrCodeUri) {
|
|
15
|
+
resolve({
|
|
16
|
+
uri: qrCodeUri
|
|
17
|
+
});
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
provider?.on('display_uri', uri => {
|
|
21
|
+
qrCodeUri = uri;
|
|
22
|
+
resolve({
|
|
23
|
+
uri
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
...metadata_WalletConnect,
|
|
30
|
+
getWagmiConnector: async () => {
|
|
31
|
+
return connectors?.[0];
|
|
32
|
+
},
|
|
33
|
+
hasWalletReady: async () => {
|
|
34
|
+
return true;
|
|
35
|
+
},
|
|
36
|
+
getQrCode: getQrCode,
|
|
37
|
+
customQrCodePanel: useWalletConnectOfficialModal || options.useWalletConnectOfficialModal,
|
|
38
|
+
...rest
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChainAssetWithWagmiChain } from './interface';
|
|
2
|
+
export declare const Mainnet: ChainAssetWithWagmiChain;
|
|
3
|
+
export declare const Goerli: ChainAssetWithWagmiChain;
|
|
4
|
+
export declare const Sepolia: ChainAssetWithWagmiChain;
|
|
5
|
+
export declare const Holesky: ChainAssetWithWagmiChain;
|
|
6
|
+
export declare const Polygon: ChainAssetWithWagmiChain;
|
|
7
|
+
export declare const BSC: ChainAssetWithWagmiChain;
|
|
8
|
+
export declare const Arbitrum: ChainAssetWithWagmiChain;
|
|
9
|
+
export declare const Optimism: ChainAssetWithWagmiChain;
|
|
10
|
+
export declare const Avalanche: ChainAssetWithWagmiChain;
|
|
11
|
+
export declare const Base: ChainAssetWithWagmiChain;
|
|
12
|
+
export declare const X1Testnet: ChainAssetWithWagmiChain;
|
|
13
|
+
export declare const Scroll: ChainAssetWithWagmiChain;
|
|
14
|
+
export declare const ScrollSepolia: ChainAssetWithWagmiChain;
|
|
15
|
+
export declare const Hardhat: ChainAssetWithWagmiChain;
|
|
16
|
+
export declare const Localhost: ChainAssetWithWagmiChain;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.X1Testnet = exports.Sepolia = exports.ScrollSepolia = exports.Scroll = exports.Polygon = exports.Optimism = exports.Mainnet = exports.Localhost = exports.Holesky = exports.Hardhat = exports.Goerli = exports.Base = exports.BSC = exports.Avalanche = exports.Arbitrum = void 0;
|
|
7
|
+
var _web3Assets = require("@ant-design/web3-assets");
|
|
8
|
+
var _chains = require("wagmi/chains");
|
|
9
|
+
const Mainnet = exports.Mainnet = {
|
|
10
|
+
..._web3Assets.Mainnet,
|
|
11
|
+
wagmiChain: _chains.mainnet
|
|
12
|
+
};
|
|
13
|
+
const Goerli = exports.Goerli = {
|
|
14
|
+
..._web3Assets.Goerli,
|
|
15
|
+
wagmiChain: _chains.goerli
|
|
16
|
+
};
|
|
17
|
+
const Sepolia = exports.Sepolia = {
|
|
18
|
+
..._web3Assets.Sepolia,
|
|
19
|
+
wagmiChain: _chains.sepolia
|
|
20
|
+
};
|
|
21
|
+
const Holesky = exports.Holesky = {
|
|
22
|
+
..._web3Assets.Holesky,
|
|
23
|
+
wagmiChain: _chains.holesky
|
|
24
|
+
};
|
|
25
|
+
const Polygon = exports.Polygon = {
|
|
26
|
+
..._web3Assets.Polygon,
|
|
27
|
+
wagmiChain: _chains.polygon
|
|
28
|
+
};
|
|
29
|
+
const BSC = exports.BSC = {
|
|
30
|
+
..._web3Assets.BSC,
|
|
31
|
+
wagmiChain: _chains.bsc
|
|
32
|
+
};
|
|
33
|
+
const Arbitrum = exports.Arbitrum = {
|
|
34
|
+
..._web3Assets.Arbitrum,
|
|
35
|
+
wagmiChain: _chains.arbitrum
|
|
36
|
+
};
|
|
37
|
+
const Optimism = exports.Optimism = {
|
|
38
|
+
..._web3Assets.Optimism,
|
|
39
|
+
wagmiChain: _chains.optimism
|
|
40
|
+
};
|
|
41
|
+
const Avalanche = exports.Avalanche = {
|
|
42
|
+
..._web3Assets.Avalanche,
|
|
43
|
+
wagmiChain: _chains.avalanche
|
|
44
|
+
};
|
|
45
|
+
const Base = exports.Base = {
|
|
46
|
+
..._web3Assets.Base,
|
|
47
|
+
wagmiChain: _chains.base
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// OKX X1: https://www.okx.com/cn/x1/docs/developer/build-on-x1/quickstart
|
|
51
|
+
const X1Testnet = exports.X1Testnet = {
|
|
52
|
+
..._web3Assets.X1Testnet,
|
|
53
|
+
wagmiChain: {
|
|
54
|
+
id: _web3Assets.X1Testnet.id,
|
|
55
|
+
name: _web3Assets.X1Testnet.name,
|
|
56
|
+
nativeCurrency: {
|
|
57
|
+
name: 'OKB',
|
|
58
|
+
symbol: 'OKB',
|
|
59
|
+
decimals: 18
|
|
60
|
+
},
|
|
61
|
+
rpcUrls: {
|
|
62
|
+
default: {
|
|
63
|
+
http: ['https://testrpc.x1.tech']
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
blockExplorers: {
|
|
67
|
+
default: {
|
|
68
|
+
name: 'X1TestnetScan',
|
|
69
|
+
url: 'https://www.okx.com/explorer/x1-test'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const Scroll = exports.Scroll = {
|
|
75
|
+
..._web3Assets.Scroll,
|
|
76
|
+
wagmiChain: _chains.scroll
|
|
77
|
+
};
|
|
78
|
+
const ScrollSepolia = exports.ScrollSepolia = {
|
|
79
|
+
..._web3Assets.ScrollSepolia,
|
|
80
|
+
wagmiChain: _chains.scrollSepolia
|
|
81
|
+
};
|
|
82
|
+
const Hardhat = exports.Hardhat = {
|
|
83
|
+
..._web3Assets.Hardhat,
|
|
84
|
+
wagmiChain: _chains.hardhat
|
|
85
|
+
};
|
|
86
|
+
const Localhost = exports.Localhost = {
|
|
87
|
+
..._web3Assets.Localhost,
|
|
88
|
+
wagmiChain: _chains.localhost
|
|
89
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _wagmiProvider = require("./wagmi-provider");
|
|
7
|
+
Object.keys(_wagmiProvider).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _wagmiProvider[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _wagmiProvider[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _wallets = require("./wallets");
|
|
18
|
+
Object.keys(_wallets).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _wallets[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _wallets[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _interface = require("./interface");
|
|
29
|
+
Object.keys(_interface).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _interface[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _chains = require("./chains");
|
|
40
|
+
Object.keys(_chains).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _chains[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _chains[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _tokens = require("@ant-design/web3-assets/tokens");
|
|
51
|
+
Object.keys(_tokens).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _tokens[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _tokens[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _wallets2 = require("@ant-design/web3-assets/wallets");
|
|
62
|
+
Object.keys(_wallets2).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _wallets2[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _wallets2[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Chain, ConnectOptions, UniversalEIP6963Config, Wallet, WalletMetadata } from '@ant-design/web3-common';
|
|
2
|
+
import type { Chain as WagmiChain } from 'viem';
|
|
3
|
+
import type { CreateSiweMessageParameters } from 'viem/siwe';
|
|
4
|
+
import type { Connector, CreateConnectorFn } from 'wagmi';
|
|
5
|
+
export interface WalletUseInWagmiAdapter extends Wallet {
|
|
6
|
+
getWagmiConnector?: (options?: ConnectOptions) => Promise<Connector | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export type EthereumWallet = (metadata?: Partial<WalletMetadata>) => WalletFactory;
|
|
9
|
+
export interface CreateWalletOptions {
|
|
10
|
+
useWalletConnectOfficialModal?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface WalletFactory {
|
|
13
|
+
name?: string;
|
|
14
|
+
connectors: Connector['name'][];
|
|
15
|
+
create: (connector?: readonly Connector[], options?: CreateWalletOptions) => WalletUseInWagmiAdapter;
|
|
16
|
+
createWagmiConnector?: () => CreateConnectorFn;
|
|
17
|
+
}
|
|
18
|
+
export type EIP6963Config = boolean | UniversalEIP6963Config;
|
|
19
|
+
export type ChainAssetWithWagmiChain = Chain & {
|
|
20
|
+
wagmiChain?: WagmiChain;
|
|
21
|
+
};
|
|
22
|
+
export interface SIWEConfig {
|
|
23
|
+
getNonce: (address: string, chainId?: number) => Promise<string>;
|
|
24
|
+
createMessage: (args: CreateSiweMessageParameters) => string;
|
|
25
|
+
verifyMessage: (message: string, signature: string) => Promise<boolean>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isEIP6963Connector = void 0;
|
|
7
|
+
var _connectors = require("wagmi/connectors");
|
|
8
|
+
const isEIP6963Connector = connector => {
|
|
9
|
+
if (connector.type === _connectors.injected.type && connector.icon && connector.id && connector.name) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
exports.isEIP6963Connector = isEIP6963Connector;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const wagmiBaseMock: {
|
|
2
|
+
useAccount: () => {
|
|
3
|
+
chain: {
|
|
4
|
+
blockExplorers: {
|
|
5
|
+
readonly default: {
|
|
6
|
+
readonly name: "Etherscan";
|
|
7
|
+
readonly url: "https://etherscan.io";
|
|
8
|
+
readonly apiUrl: "https://api.etherscan.io/api";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
blockTime?: number | undefined;
|
|
12
|
+
contracts: {
|
|
13
|
+
readonly ensRegistry: {
|
|
14
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
15
|
+
};
|
|
16
|
+
readonly ensUniversalResolver: {
|
|
17
|
+
readonly address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67";
|
|
18
|
+
readonly blockCreated: 19258213;
|
|
19
|
+
};
|
|
20
|
+
readonly multicall3: {
|
|
21
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
22
|
+
readonly blockCreated: 14353601;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
ensTlds?: readonly string[] | undefined;
|
|
26
|
+
id: 1;
|
|
27
|
+
name: "Ethereum";
|
|
28
|
+
nativeCurrency: {
|
|
29
|
+
readonly name: "Ether";
|
|
30
|
+
readonly symbol: "ETH";
|
|
31
|
+
readonly decimals: 18;
|
|
32
|
+
};
|
|
33
|
+
experimental_preconfirmationTime?: number | undefined;
|
|
34
|
+
rpcUrls: {
|
|
35
|
+
readonly default: {
|
|
36
|
+
readonly http: readonly ["https://eth.merkle.io"];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
sourceId?: number | undefined;
|
|
40
|
+
testnet?: boolean | undefined;
|
|
41
|
+
custom?: Record<string, unknown> | undefined;
|
|
42
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
43
|
+
formatters?: undefined;
|
|
44
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable<bigint, number>> | undefined;
|
|
45
|
+
};
|
|
46
|
+
address: string;
|
|
47
|
+
connector: {
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
useConfig: () => {};
|
|
52
|
+
useBalance: () => {
|
|
53
|
+
data: {};
|
|
54
|
+
};
|
|
55
|
+
useSwitchChain: () => {
|
|
56
|
+
switchChain: () => void;
|
|
57
|
+
};
|
|
58
|
+
useConnect: () => {
|
|
59
|
+
connectors: {
|
|
60
|
+
name: string;
|
|
61
|
+
}[];
|
|
62
|
+
connectAsync: () => Promise<{}>;
|
|
63
|
+
};
|
|
64
|
+
useDisconnect: () => {
|
|
65
|
+
disconnectAsync: () => void;
|
|
66
|
+
};
|
|
67
|
+
useEnsName: () => {
|
|
68
|
+
data: null;
|
|
69
|
+
};
|
|
70
|
+
useEnsAvatar: () => {
|
|
71
|
+
data: null;
|
|
72
|
+
};
|
|
73
|
+
useSignMessage: () => {
|
|
74
|
+
signMessageAsync: () => Promise<string>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.wagmiBaseMock = void 0;
|
|
7
|
+
var _chains = require("wagmi/chains");
|
|
8
|
+
const mockConnector = {
|
|
9
|
+
name: 'MetaMask'
|
|
10
|
+
};
|
|
11
|
+
const wagmiBaseMock = exports.wagmiBaseMock = {
|
|
12
|
+
useAccount: () => {
|
|
13
|
+
return {
|
|
14
|
+
chain: _chains.mainnet,
|
|
15
|
+
address: '0x21CDf0974d53a6e96eF05d7B324a9803735fFd3B',
|
|
16
|
+
connector: mockConnector
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
useConfig: () => ({}),
|
|
20
|
+
useBalance: () => ({
|
|
21
|
+
data: {}
|
|
22
|
+
}),
|
|
23
|
+
useSwitchChain: () => ({
|
|
24
|
+
switchChain: () => {}
|
|
25
|
+
}),
|
|
26
|
+
useConnect: () => ({
|
|
27
|
+
connectors: [mockConnector],
|
|
28
|
+
connectAsync: async () => ({})
|
|
29
|
+
}),
|
|
30
|
+
useDisconnect: () => ({
|
|
31
|
+
disconnectAsync: () => {}
|
|
32
|
+
}),
|
|
33
|
+
useEnsName: () => ({
|
|
34
|
+
data: null
|
|
35
|
+
}),
|
|
36
|
+
useEnsAvatar: () => ({
|
|
37
|
+
data: null
|
|
38
|
+
}),
|
|
39
|
+
useSignMessage: () => ({
|
|
40
|
+
signMessageAsync: async () => 'signMessage'
|
|
41
|
+
})
|
|
42
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Chain, type Locale } from '@ant-design/web3-common';
|
|
3
|
+
import type { Config as WagmiConfig } from 'wagmi';
|
|
4
|
+
import type { EIP6963Config, SIWEConfig, WalletFactory } from '../interface';
|
|
5
|
+
export interface AntDesignWeb3ConfigProviderProps {
|
|
6
|
+
chainAssets: Chain[];
|
|
7
|
+
walletFactories: WalletFactory[];
|
|
8
|
+
locale?: Locale;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
ens?: boolean;
|
|
11
|
+
balance?: boolean;
|
|
12
|
+
eip6963?: EIP6963Config;
|
|
13
|
+
wagimConfig: WagmiConfig;
|
|
14
|
+
useWalletConnectOfficialModal?: boolean;
|
|
15
|
+
siwe?: SIWEConfig;
|
|
16
|
+
/**
|
|
17
|
+
* If true, this provider's configuration will be ignored when merging with parent context.
|
|
18
|
+
* This is useful when you have multiple chain providers and want to switch between them
|
|
19
|
+
* without causing page flickering. Only the active provider should not have this flag set.
|
|
20
|
+
*/
|
|
21
|
+
ignoreConfig?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const AntDesignWeb3ConfigProvider: React.FC<AntDesignWeb3ConfigProviderProps>;
|