@wagmi/core 0.0.0-20220909032847
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/LICENSE +21 -0
- package/README.md +30 -0
- package/chains/dist/wagmi-core-chains.esm.d.ts +11 -0
- package/chains/dist/wagmi-core-chains.esm.js +2 -0
- package/chains/package.json +3 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.d.ts +11 -0
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +246 -0
- package/connectors/coinbaseWallet/package.json +3 -0
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.d.ts +11 -0
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +146 -0
- package/connectors/metaMask/package.json +3 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.d.ts +11 -0
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +257 -0
- package/connectors/mock/package.json +3 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.d.ts +11 -0
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +207 -0
- package/connectors/walletConnect/package.json +3 -0
- package/dist/chains-de91362e.esm.js +493 -0
- package/dist/getProvider-34b63ce9.esm.js +1055 -0
- package/dist/rpcs-f39d022b.esm.js +50 -0
- package/dist/wagmi-core.esm.d.ts +11 -0
- package/dist/wagmi-core.esm.js +1515 -0
- package/package.json +76 -0
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.d.ts +11 -0
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +32 -0
- package/providers/alchemy/package.json +3 -0
- package/providers/infura/dist/wagmi-core-providers-infura.esm.d.ts +11 -0
- package/providers/infura/dist/wagmi-core-providers-infura.esm.js +32 -0
- package/providers/infura/package.json +3 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.d.ts +11 -0
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.js +42 -0
- package/providers/jsonRpc/package.json +3 -0
- package/providers/public/dist/wagmi-core-providers-public.esm.d.ts +11 -0
- package/providers/public/dist/wagmi-core-providers-public.esm.js +28 -0
- package/providers/public/package.json +3 -0
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wagmi/core",
|
|
3
|
+
"description": "Vanilla JS library for Ethereum",
|
|
4
|
+
"license": "WAGMIT",
|
|
5
|
+
"version": "0.0.0-20220909032847",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/wagmi-dev/wagmi.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"author": "awkweb.eth",
|
|
12
|
+
"ethereum": "wagmi-dev.eth",
|
|
13
|
+
"funding": [
|
|
14
|
+
{
|
|
15
|
+
"type": "gitcoin",
|
|
16
|
+
"url": "https://gitcoin.co/grants/4493/wagmi-react-hooks-library-for-ethereum"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "github",
|
|
20
|
+
"url": "https://github.com/sponsors/wagmi-dev"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "dist/wagmi-core.esm.js",
|
|
25
|
+
"types": "dist/wagmi-core.esm.d.ts",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"files": [
|
|
28
|
+
"/chains",
|
|
29
|
+
"/connectors",
|
|
30
|
+
"/providers",
|
|
31
|
+
"/dist"
|
|
32
|
+
],
|
|
33
|
+
"preconstruct": {
|
|
34
|
+
"entrypoints": [
|
|
35
|
+
"index.ts",
|
|
36
|
+
"chains.ts",
|
|
37
|
+
"connectors/coinbaseWallet.ts",
|
|
38
|
+
"connectors/metaMask.ts",
|
|
39
|
+
"connectors/walletConnect.ts",
|
|
40
|
+
"connectors/mock/index.ts",
|
|
41
|
+
"providers/alchemy.ts",
|
|
42
|
+
"providers/public.ts",
|
|
43
|
+
"providers/infura.ts",
|
|
44
|
+
"providers/jsonRpc.ts"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@coinbase/wallet-sdk": ">=3.3.0",
|
|
49
|
+
"@walletconnect/ethereum-provider": ">=1.7.5",
|
|
50
|
+
"ethers": ">=5.5.1"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"@coinbase/wallet-sdk": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"@walletconnect/ethereum-provider": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"eventemitter3": "^4.0.7",
|
|
62
|
+
"zustand": "^4.0.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@coinbase/wallet-sdk": "^3.4.1",
|
|
66
|
+
"@walletconnect/ethereum-provider": "^1.7.8",
|
|
67
|
+
"ethers": "^5.7.0"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"eth",
|
|
71
|
+
"ethereum",
|
|
72
|
+
"dapps",
|
|
73
|
+
"wallet",
|
|
74
|
+
"web3"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// are you seeing an error that a default export doesn't exist but your source file has a default export?
|
|
2
|
+
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
|
|
3
|
+
|
|
4
|
+
// curious why you need to?
|
|
5
|
+
// this file exists so that you can import from the entrypoint normally
|
|
6
|
+
// except that it points to your source file and you don't need to run build constantly
|
|
7
|
+
// which means we need to re-export all of the modules from your source file
|
|
8
|
+
// and since export * doesn't include default exports, we need to read your source file
|
|
9
|
+
// to check for a default export and re-export it if it exists
|
|
10
|
+
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯
|
|
11
|
+
export * from "../../../src/providers/alchemy";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
import { b as defaultAlchemyApiKey } from '../../../dist/rpcs-f39d022b.esm.js';
|
|
3
|
+
|
|
4
|
+
function alchemyProvider() {
|
|
5
|
+
let {
|
|
6
|
+
apiKey = defaultAlchemyApiKey,
|
|
7
|
+
priority,
|
|
8
|
+
stallTimeout,
|
|
9
|
+
weight
|
|
10
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
+
return function (chain) {
|
|
12
|
+
if (!chain.rpcUrls.alchemy) return null;
|
|
13
|
+
return {
|
|
14
|
+
chain: { ...chain,
|
|
15
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
16
|
+
default: "".concat(chain.rpcUrls.alchemy, "/").concat(apiKey)
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
provider: () => {
|
|
20
|
+
const provider = new providers.AlchemyProvider(chain.id, apiKey);
|
|
21
|
+
return Object.assign(provider, {
|
|
22
|
+
priority,
|
|
23
|
+
stallTimeout,
|
|
24
|
+
weight
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
webSocketProvider: () => new providers.AlchemyWebSocketProvider(chain.id, apiKey)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { alchemyProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// are you seeing an error that a default export doesn't exist but your source file has a default export?
|
|
2
|
+
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
|
|
3
|
+
|
|
4
|
+
// curious why you need to?
|
|
5
|
+
// this file exists so that you can import from the entrypoint normally
|
|
6
|
+
// except that it points to your source file and you don't need to run build constantly
|
|
7
|
+
// which means we need to re-export all of the modules from your source file
|
|
8
|
+
// and since export * doesn't include default exports, we need to read your source file
|
|
9
|
+
// to check for a default export and re-export it if it exists
|
|
10
|
+
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯
|
|
11
|
+
export * from "../../../src/providers/infura";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
import { d as defaultInfuraApiKey } from '../../../dist/rpcs-f39d022b.esm.js';
|
|
3
|
+
|
|
4
|
+
function infuraProvider() {
|
|
5
|
+
let {
|
|
6
|
+
apiKey = defaultInfuraApiKey,
|
|
7
|
+
priority,
|
|
8
|
+
stallTimeout,
|
|
9
|
+
weight
|
|
10
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
+
return function (chain) {
|
|
12
|
+
if (!chain.rpcUrls.infura) return null;
|
|
13
|
+
return {
|
|
14
|
+
chain: { ...chain,
|
|
15
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
16
|
+
default: "".concat(chain.rpcUrls.infura, "/").concat(apiKey)
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
provider: () => {
|
|
20
|
+
const provider = new providers.InfuraProvider(chain.id, apiKey);
|
|
21
|
+
return Object.assign(provider, {
|
|
22
|
+
priority,
|
|
23
|
+
stallTimeout,
|
|
24
|
+
weight
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
webSocketProvider: () => new providers.InfuraWebSocketProvider(chain.id, apiKey)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { infuraProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// are you seeing an error that a default export doesn't exist but your source file has a default export?
|
|
2
|
+
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
|
|
3
|
+
|
|
4
|
+
// curious why you need to?
|
|
5
|
+
// this file exists so that you can import from the entrypoint normally
|
|
6
|
+
// except that it points to your source file and you don't need to run build constantly
|
|
7
|
+
// which means we need to re-export all of the modules from your source file
|
|
8
|
+
// and since export * doesn't include default exports, we need to read your source file
|
|
9
|
+
// to check for a default export and re-export it if it exists
|
|
10
|
+
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯
|
|
11
|
+
export * from "../../../src/providers/jsonRpc";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
|
|
3
|
+
function jsonRpcProvider(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
priority,
|
|
6
|
+
rpc,
|
|
7
|
+
stallTimeout,
|
|
8
|
+
static: static_ = true,
|
|
9
|
+
weight
|
|
10
|
+
} = _ref;
|
|
11
|
+
return function (chain) {
|
|
12
|
+
const rpcConfig = rpc(chain);
|
|
13
|
+
if (!rpcConfig || rpcConfig.http === '') return null;
|
|
14
|
+
return {
|
|
15
|
+
chain: { ...chain,
|
|
16
|
+
rpcUrls: { ...chain.rpcUrls,
|
|
17
|
+
default: rpcConfig.http
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
provider: () => {
|
|
21
|
+
var _chain$ens;
|
|
22
|
+
|
|
23
|
+
const RpcProvider = static_ ? providers.StaticJsonRpcProvider : providers.JsonRpcProvider;
|
|
24
|
+
const provider = new RpcProvider(rpcConfig.http, {
|
|
25
|
+
ensAddress: (_chain$ens = chain.ens) === null || _chain$ens === void 0 ? void 0 : _chain$ens.address,
|
|
26
|
+
chainId: chain.id,
|
|
27
|
+
name: chain.network
|
|
28
|
+
});
|
|
29
|
+
return Object.assign(provider, {
|
|
30
|
+
priority,
|
|
31
|
+
stallTimeout,
|
|
32
|
+
weight
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
...(rpcConfig.webSocket && {
|
|
36
|
+
webSocketProvider: () => new providers.WebSocketProvider(rpcConfig.webSocket, chain.id)
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { jsonRpcProvider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// are you seeing an error that a default export doesn't exist but your source file has a default export?
|
|
2
|
+
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
|
|
3
|
+
|
|
4
|
+
// curious why you need to?
|
|
5
|
+
// this file exists so that you can import from the entrypoint normally
|
|
6
|
+
// except that it points to your source file and you don't need to run build constantly
|
|
7
|
+
// which means we need to re-export all of the modules from your source file
|
|
8
|
+
// and since export * doesn't include default exports, we need to read your source file
|
|
9
|
+
// to check for a default export and re-export it if it exists
|
|
10
|
+
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯
|
|
11
|
+
export * from "../../../src/providers/public";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
|
|
3
|
+
function publicProvider() {
|
|
4
|
+
let {
|
|
5
|
+
priority,
|
|
6
|
+
stallTimeout,
|
|
7
|
+
weight
|
|
8
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
+
return function (chain) {
|
|
10
|
+
if (!chain.rpcUrls.default) return null;
|
|
11
|
+
return {
|
|
12
|
+
chain,
|
|
13
|
+
provider: () => {
|
|
14
|
+
const provider = new providers.StaticJsonRpcProvider(chain.rpcUrls.default, {
|
|
15
|
+
chainId: chain.id,
|
|
16
|
+
name: chain.network
|
|
17
|
+
});
|
|
18
|
+
return Object.assign(provider, {
|
|
19
|
+
priority,
|
|
20
|
+
stallTimeout,
|
|
21
|
+
weight
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { publicProvider };
|