@exodus/ethereum-lib 2.12.0 → 2.12.1
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.md +0 -0
- package/package.json +3 -2
- package/src/abi/ierc20-extended.js +128 -0
- package/src/abi/index.js +2 -0
- package/src/fee-data/avalanchec.js +1 -1
- package/src/fee-data/bsc.js +1 -1
- package/src/fee-data/ethereum.js +1 -1
- package/src/fee-data/polygon.js +1 -1
- package/src/utils/index.js +4 -1
package/LICENSE.md
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Exodus Movement, Inc.",
|
|
@@ -23,5 +23,6 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@exodus/assets": "8.0.x"
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "c83e89a956335bdf9a323a868027e22918a7d251"
|
|
27
28
|
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// extended (with metadata: decimals, name, symbol) erc20
|
|
2
|
+
// compiled from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol with solcjs, compiler 0.8.0
|
|
3
|
+
// `solcjs --abi --base-path . extensions/IERC20Metadata.sol`
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
anonymous: false,
|
|
8
|
+
inputs: [
|
|
9
|
+
{ indexed: true, internalType: 'address', name: 'owner', type: 'address' },
|
|
10
|
+
{
|
|
11
|
+
indexed: true,
|
|
12
|
+
internalType: 'address',
|
|
13
|
+
name: 'spender',
|
|
14
|
+
type: 'address',
|
|
15
|
+
},
|
|
16
|
+
{ indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
|
|
17
|
+
],
|
|
18
|
+
name: 'Approval',
|
|
19
|
+
type: 'event',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
anonymous: false,
|
|
23
|
+
inputs: [
|
|
24
|
+
{ indexed: true, internalType: 'address', name: 'from', type: 'address' },
|
|
25
|
+
{
|
|
26
|
+
indexed: true,
|
|
27
|
+
internalType: 'address',
|
|
28
|
+
name: 'to',
|
|
29
|
+
type: 'address',
|
|
30
|
+
},
|
|
31
|
+
{ indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
|
|
32
|
+
],
|
|
33
|
+
name: 'Transfer',
|
|
34
|
+
type: 'event',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
inputs: [
|
|
38
|
+
{ internalType: 'address', name: 'owner', type: 'address' },
|
|
39
|
+
{
|
|
40
|
+
internalType: 'address',
|
|
41
|
+
name: 'spender',
|
|
42
|
+
type: 'address',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
name: 'allowance',
|
|
46
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
47
|
+
stateMutability: 'view',
|
|
48
|
+
type: 'function',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
inputs: [
|
|
52
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
53
|
+
{
|
|
54
|
+
internalType: 'uint256',
|
|
55
|
+
name: 'amount',
|
|
56
|
+
type: 'uint256',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
name: 'approve',
|
|
60
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
61
|
+
stateMutability: 'nonpayable',
|
|
62
|
+
type: 'function',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
|
|
66
|
+
name: 'balanceOf',
|
|
67
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
68
|
+
stateMutability: 'view',
|
|
69
|
+
type: 'function',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
inputs: [],
|
|
73
|
+
name: 'decimals',
|
|
74
|
+
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
|
|
75
|
+
stateMutability: 'view',
|
|
76
|
+
type: 'function',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
inputs: [],
|
|
80
|
+
name: 'name',
|
|
81
|
+
outputs: [{ internalType: 'string', name: '', type: 'string' }],
|
|
82
|
+
stateMutability: 'view',
|
|
83
|
+
type: 'function',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
inputs: [],
|
|
87
|
+
name: 'symbol',
|
|
88
|
+
outputs: [{ internalType: 'string', name: '', type: 'string' }],
|
|
89
|
+
stateMutability: 'view',
|
|
90
|
+
type: 'function',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
inputs: [],
|
|
94
|
+
name: 'totalSupply',
|
|
95
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
96
|
+
stateMutability: 'view',
|
|
97
|
+
type: 'function',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
inputs: [
|
|
101
|
+
{ internalType: 'address', name: 'to', type: 'address' },
|
|
102
|
+
{
|
|
103
|
+
internalType: 'uint256',
|
|
104
|
+
name: 'amount',
|
|
105
|
+
type: 'uint256',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
name: 'transfer',
|
|
109
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
110
|
+
stateMutability: 'nonpayable',
|
|
111
|
+
type: 'function',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
inputs: [
|
|
115
|
+
{ internalType: 'address', name: 'from', type: 'address' },
|
|
116
|
+
{
|
|
117
|
+
internalType: 'address',
|
|
118
|
+
name: 'to',
|
|
119
|
+
type: 'address',
|
|
120
|
+
},
|
|
121
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
122
|
+
],
|
|
123
|
+
name: 'transferFrom',
|
|
124
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
125
|
+
stateMutability: 'nonpayable',
|
|
126
|
+
type: 'function',
|
|
127
|
+
},
|
|
128
|
+
]
|
package/src/abi/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ant from './ant'
|
|
2
2
|
import cdai from './cdai'
|
|
3
3
|
import dai from './dai'
|
|
4
|
+
import erc20 from './ierc20-extended'
|
|
4
5
|
import gnt from './gnt'
|
|
5
6
|
import kyberv2 from './kyberv2.js'
|
|
6
7
|
import loomv2Swap from './loomv2-swap'
|
|
@@ -11,6 +12,7 @@ export default {
|
|
|
11
12
|
ant,
|
|
12
13
|
cdai,
|
|
13
14
|
dai,
|
|
15
|
+
erc20,
|
|
14
16
|
gnt,
|
|
15
17
|
kyberv2,
|
|
16
18
|
loomv2Swap,
|
package/src/fee-data/bsc.js
CHANGED
package/src/fee-data/ethereum.js
CHANGED
package/src/fee-data/polygon.js
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -16,13 +16,16 @@ export const isAvalancheToken = (asset) => asset.assetType === 'AVAX_ERC20'
|
|
|
16
16
|
|
|
17
17
|
// All ethereum-like tokens
|
|
18
18
|
export const isEthereumLikeToken = (asset) => ETHEREUM_LIKE_TOKEN_TYPES.includes(asset.assetType)
|
|
19
|
+
export const isEthereumLikeTokenByName = (assetName) => isEthereumLikeToken(assets[assetName])
|
|
19
20
|
export const isToken = isEthereumLikeToken
|
|
20
21
|
|
|
21
22
|
// All ethereum-like assets (native coins)
|
|
22
|
-
export const isEthereumLikeAsset = (asset) =>
|
|
23
|
+
export const isEthereumLikeAsset = (asset) => isEthereumLikeAssetByName(asset.name)
|
|
24
|
+
export const isEthereumLikeAssetByName = (assetName) => ETHEREUM_LIKE_ASSETS.includes(assetName)
|
|
23
25
|
|
|
24
26
|
// All ethereum-like assets and tokens
|
|
25
27
|
export const isEthereumLike = (asset) => ETHEREUM_LIKE_ASSETS.includes(asset.baseAsset.name)
|
|
28
|
+
export const isEthereumLikeByName = (assetName) => isEthereumLike(assets[assetName])
|
|
26
29
|
|
|
27
30
|
export function buffer2currency({ asset, value }) {
|
|
28
31
|
return asset.currency.baseUnit(base10.encode(value)).toDefault()
|