@shapeshiftoss/contracts 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/dist/abis/arbOutbox.d.ts +413 -0
- package/dist/abis/arbOutbox.js +226 -0
- package/dist/abis/arbProxy.d.ts +102 -0
- package/dist/abis/arbProxy.js +66 -0
- package/dist/abis/arbRetryableTx.d.ts +230 -0
- package/dist/abis/arbRetryableTx.js +113 -0
- package/dist/abis/arbSys.d.ts +278 -0
- package/dist/abis/arbSys.js +139 -0
- package/dist/abis/evergreenFarming.d.ts +517 -0
- package/dist/abis/evergreenFarming.js +652 -0
- package/dist/abis/farming.d.ts +361 -0
- package/dist/abis/farming.js +456 -0
- package/dist/abis/foxy.d.ts +519 -0
- package/dist/abis/foxy.js +675 -0
- package/dist/abis/foxyStaking.d.ts +556 -0
- package/dist/abis/foxyStaking.js +717 -0
- package/dist/abis/iBep20.d.ts +201 -0
- package/dist/abis/iBep20.js +125 -0
- package/dist/abis/iUniswapV2Pair.d.ts +560 -0
- package/dist/abis/iUniswapV2Pair.js +707 -0
- package/dist/abis/iUniswapV3Pool.d.ts +770 -0
- package/dist/abis/iUniswapV3Pool.js +983 -0
- package/dist/abis/index.d.ts +24 -0
- package/dist/abis/index.js +24 -0
- package/dist/abis/l1ArbitrumGateway.d.ts +494 -0
- package/dist/abis/l1ArbitrumGateway.js +256 -0
- package/dist/abis/l1OrbitCustomGateway.d.ts +769 -0
- package/dist/abis/l1OrbitCustomGateway.js +375 -0
- package/dist/abis/l2ArbitrumGateway.d.ts +308 -0
- package/dist/abis/l2ArbitrumGateway.js +169 -0
- package/dist/abis/liquidityReserve.d.ts +421 -0
- package/dist/abis/liquidityReserve.js +547 -0
- package/dist/abis/rfox.d.ts +680 -0
- package/dist/abis/rfox.js +555 -0
- package/dist/abis/thorchainRouter.d.ts +349 -0
- package/dist/abis/thorchainRouter.js +442 -0
- package/dist/abis/tokeManager.d.ts +774 -0
- package/dist/abis/tokeManager.js +508 -0
- package/dist/abis/tokePool.d.ts +502 -0
- package/dist/abis/tokePool.js +308 -0
- package/dist/abis/tokeRewardHash.d.ts +112 -0
- package/dist/abis/tokeRewardHash.js +71 -0
- package/dist/abis/uniV2StakingRewards.d.ts +316 -0
- package/dist/abis/uniV2StakingRewards.js +411 -0
- package/dist/abis/uniswapV2Router02.d.ts +737 -0
- package/dist/abis/uniswapV2Router02.js +953 -0
- package/dist/abis/uniswapV3Quoter.d.ts +147 -0
- package/dist/abis/uniswapV3Quoter.js +193 -0
- package/dist/abis/weth.d.ts +213 -0
- package/dist/abis/weth.js +279 -0
- package/dist/constants.d.ts +6640 -0
- package/dist/constants.js +105 -0
- package/dist/contractManager.d.ts +11 -0
- package/dist/contractManager.js +69 -0
- package/dist/ethersProviderSingleton.d.ts +6 -0
- package/dist/ethersProviderSingleton.js +69 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.js +6 -0
- package/dist/viemClient.d.ts +28338 -0
- package/dist/viemClient.js +107 -0
- package/package.json +25 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { KnownChainIds } from '@shapeshiftoss/types';
|
|
2
|
+
import assert from 'assert';
|
|
3
|
+
import { createPublicClient, fallback, http } from 'viem';
|
|
4
|
+
import { arbitrum, arbitrumNova, avalanche, base, bsc, gnosis, mainnet, optimism, polygon, } from 'viem/chains';
|
|
5
|
+
const env = import.meta.env ?? process.env;
|
|
6
|
+
export const viemEthMainnetClient = createPublicClient({
|
|
7
|
+
chain: mainnet,
|
|
8
|
+
transport: fallback([env.VITE_ETHEREUM_NODE_URL, 'https://eth.llamarpc.com'].filter(Boolean).map(url => http(url))),
|
|
9
|
+
});
|
|
10
|
+
export const viemBscClient = createPublicClient({
|
|
11
|
+
chain: bsc,
|
|
12
|
+
transport: fallback(
|
|
13
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/llamaNodesRpcs.js#L30
|
|
14
|
+
[env.VITE_BNBSMARTCHAIN_NODE_URL, 'https://binance.llamarpc.com']
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.map(url => http(url))),
|
|
17
|
+
});
|
|
18
|
+
export const viemAvalancheClient = createPublicClient({
|
|
19
|
+
chain: avalanche,
|
|
20
|
+
transport: fallback(
|
|
21
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/extraRpcs.js#L937
|
|
22
|
+
[env.VITE_AVALANCHE_NODE_URL, 'https://api.avax.network/ext/bc/C/rpc']
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
.map(url => http(url))),
|
|
25
|
+
});
|
|
26
|
+
export const viemArbitrumClient = createPublicClient({
|
|
27
|
+
chain: arbitrum,
|
|
28
|
+
transport: fallback(
|
|
29
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/llamaNodesRpcs.js#L63
|
|
30
|
+
[env.VITE_ARBITRUM_NODE_URL, 'https://arbitrum.llamarpc.com']
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.map(url => http(url))),
|
|
33
|
+
});
|
|
34
|
+
export const viemArbitrumNovaClient = createPublicClient({
|
|
35
|
+
chain: arbitrumNova,
|
|
36
|
+
transport: fallback(
|
|
37
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/extraRpcs.js#L1393
|
|
38
|
+
[env.VITE_ARBITRUM_NOVA_NODE_URL, 'https://nova.arbitrum.io/rpc']
|
|
39
|
+
.filter(Boolean)
|
|
40
|
+
.map(url => http(url))),
|
|
41
|
+
});
|
|
42
|
+
export const viemOptimismClient = createPublicClient({
|
|
43
|
+
chain: optimism,
|
|
44
|
+
transport: fallback(
|
|
45
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/llamaNodesRpcs.js#L41
|
|
46
|
+
[env.VITE_OPTIMISM_NODE_URL, 'https://optimism.llamarpc.com']
|
|
47
|
+
.filter(Boolean)
|
|
48
|
+
.map(url => http(url))),
|
|
49
|
+
});
|
|
50
|
+
export const viemGnosisClient = createPublicClient({
|
|
51
|
+
chain: gnosis,
|
|
52
|
+
transport: fallback(
|
|
53
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/extraRpcs.js#L1978
|
|
54
|
+
[env.VITE_GNOSIS_NODE_URL, 'https://rpc.gnosischain.com'].filter(Boolean).map(url => http(url))),
|
|
55
|
+
});
|
|
56
|
+
export const viemPolygonClient = createPublicClient({
|
|
57
|
+
chain: polygon,
|
|
58
|
+
transport: fallback(
|
|
59
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/llamaNodesRpcs.js#L52
|
|
60
|
+
[env.VITE_POLYGON_NODE_URL, 'https://polygon.llamarpc.com']
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.map(url => http(url))),
|
|
63
|
+
});
|
|
64
|
+
export const viemBaseClient = createPublicClient({
|
|
65
|
+
chain: base,
|
|
66
|
+
transport: fallback(
|
|
67
|
+
// https://github.com/DefiLlama/chainlist/blob/83b8cc32ee79c10e0281e1799ebe4cd1696082b7/constants/llamaNodesRpcs.js#L19
|
|
68
|
+
[env.VITE_BASE_NODE_URL, 'https://base.llamarpc.com'].filter(Boolean).map(url => http(url))),
|
|
69
|
+
});
|
|
70
|
+
export const viemClientByChainId = {
|
|
71
|
+
[KnownChainIds.EthereumMainnet]: viemEthMainnetClient,
|
|
72
|
+
[KnownChainIds.BnbSmartChainMainnet]: viemBscClient,
|
|
73
|
+
[KnownChainIds.AvalancheMainnet]: viemAvalancheClient,
|
|
74
|
+
[KnownChainIds.ArbitrumMainnet]: viemArbitrumClient,
|
|
75
|
+
[KnownChainIds.ArbitrumNovaMainnet]: viemArbitrumNovaClient,
|
|
76
|
+
[KnownChainIds.GnosisMainnet]: viemGnosisClient,
|
|
77
|
+
[KnownChainIds.PolygonMainnet]: viemPolygonClient,
|
|
78
|
+
[KnownChainIds.OptimismMainnet]: viemOptimismClient,
|
|
79
|
+
[KnownChainIds.BaseMainnet]: viemBaseClient,
|
|
80
|
+
};
|
|
81
|
+
export const viemNetworkIdByChainId = {
|
|
82
|
+
[KnownChainIds.EthereumMainnet]: mainnet.id,
|
|
83
|
+
[KnownChainIds.BnbSmartChainMainnet]: bsc.id,
|
|
84
|
+
[KnownChainIds.AvalancheMainnet]: avalanche.id,
|
|
85
|
+
[KnownChainIds.ArbitrumMainnet]: arbitrum.id,
|
|
86
|
+
[KnownChainIds.ArbitrumNovaMainnet]: arbitrumNova.id,
|
|
87
|
+
[KnownChainIds.GnosisMainnet]: gnosis.id,
|
|
88
|
+
[KnownChainIds.PolygonMainnet]: polygon.id,
|
|
89
|
+
[KnownChainIds.OptimismMainnet]: optimism.id,
|
|
90
|
+
[KnownChainIds.BaseMainnet]: base.id,
|
|
91
|
+
};
|
|
92
|
+
export const viemClientByNetworkId = {
|
|
93
|
+
[mainnet.id]: viemEthMainnetClient,
|
|
94
|
+
[bsc.id]: viemBscClient,
|
|
95
|
+
[avalanche.id]: viemAvalancheClient,
|
|
96
|
+
[arbitrum.id]: viemArbitrumClient,
|
|
97
|
+
[arbitrumNova.id]: viemArbitrumNovaClient,
|
|
98
|
+
[gnosis.id]: viemGnosisClient,
|
|
99
|
+
[polygon.id]: viemPolygonClient,
|
|
100
|
+
[optimism.id]: viemOptimismClient,
|
|
101
|
+
[base.id]: viemBaseClient,
|
|
102
|
+
};
|
|
103
|
+
export const assertGetViemClient = (chainId) => {
|
|
104
|
+
const publicClient = viemClientByChainId[chainId];
|
|
105
|
+
assert(publicClient !== undefined, `no public client found for chainId '${chainId}'`);
|
|
106
|
+
return publicClient;
|
|
107
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shapeshiftoss/contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"packageManager": "yarn@3.5.0",
|
|
5
|
+
"repository": "https://github.com/shapeshift/web",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "yarn clean && yarn run -T tsc --build",
|
|
17
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
18
|
+
"dev": "yarn run -T tsc --build --watch"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@shapeshiftoss/caip": "^8.16.1",
|
|
22
|
+
"@shapeshiftoss/types": "^8.6.1",
|
|
23
|
+
"@shapeshiftoss/utils": "^1.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|