@exodus/web3-ethereum-utils 3.25.0 → 3.26.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.
|
@@ -62,8 +62,10 @@ const handleExpectedBalanceChange = (expectedBalanceChange, simulationResult, {
|
|
|
62
62
|
// ERC1155 is a multi-token standard (https://eips.ethereum.org/EIPS/eip-1155) and can be used for NFTs as well.
|
|
63
63
|
const isNftTransfer = kind === 'ERC721_TRANSFER' ||
|
|
64
64
|
(kind === 'ERC1155_TRANSFER' && !asset.decimals);
|
|
65
|
+
const isNftTransferApproval = kind === 'ERC721_APPROVAL' ||
|
|
66
|
+
(kind === 'ERC1155_APPROVAL_FOR_ALL' && !asset.decimals);
|
|
65
67
|
const symbol = asset.symbol;
|
|
66
|
-
const decimals = isNftTransfer ? 1 : asset.decimals;
|
|
68
|
+
const decimals = isNftTransfer || isNftTransferApproval ? 1 : asset.decimals;
|
|
67
69
|
const asset_ = pick(asset, [
|
|
68
70
|
'address',
|
|
69
71
|
'imageUrl',
|
|
@@ -71,20 +73,21 @@ const handleExpectedBalanceChange = (expectedBalanceChange, simulationResult, {
|
|
|
71
73
|
'symbol',
|
|
72
74
|
'verified',
|
|
73
75
|
]);
|
|
74
|
-
if (isNftTransfer) {
|
|
76
|
+
if (isNftTransfer || isNftTransferApproval) {
|
|
75
77
|
asset_.imageUrl = data?.metadata?.rawImageUrl;
|
|
76
78
|
}
|
|
77
79
|
if (kind === 'ERC20_APPROVAL' ||
|
|
78
80
|
kind === 'ERC721_APPROVAL_FOR_ALL' ||
|
|
79
81
|
kind === 'ERC1155_APPROVAL_FOR_ALL' ||
|
|
80
82
|
kind === 'ERC721_APPROVAL') {
|
|
83
|
+
const unitsToUse = symbol || asset.name || 'Units.';
|
|
81
84
|
willApprove.push({
|
|
82
85
|
asset: asset_,
|
|
83
86
|
spender: data.spender.address,
|
|
84
|
-
unitName:
|
|
87
|
+
unitName: unitsToUse,
|
|
85
88
|
balance: createCurrency({
|
|
86
89
|
amount: data.amount.after,
|
|
87
|
-
symbol:
|
|
90
|
+
symbol: unitsToUse,
|
|
88
91
|
denominator: decimals,
|
|
89
92
|
}),
|
|
90
93
|
});
|
|
@@ -99,7 +102,7 @@ const handleExpectedBalanceChange = (expectedBalanceChange, simulationResult, {
|
|
|
99
102
|
asset: asset_,
|
|
100
103
|
balance,
|
|
101
104
|
};
|
|
102
|
-
if (isNftTransfer) {
|
|
105
|
+
if (isNftTransfer || isNftTransferApproval) {
|
|
103
106
|
const tokenId = data.tokenId;
|
|
104
107
|
const compositeId = `${asset.address}/${tokenId}`;
|
|
105
108
|
balanceChange.nft = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/web3-ethereum-utils",
|
|
3
3
|
"description": "Web3 Ethereum utils.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.26.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@exodus/basic-utils": "^2.5.1",
|
|
33
33
|
"@exodus/ethereumjs-common": "^2.4.0-exodus.6",
|
|
34
34
|
"@exodus/ethereumjs-tx": "^3.3.0-exodus.6",
|
|
35
|
-
"@exodus/web3-utils": "^1.43.
|
|
35
|
+
"@exodus/web3-utils": "^1.43.1",
|
|
36
36
|
"@metamask/eth-sig-util": "^4.0.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "46dd9ea6b783c3c2421afaee9aa280f01474a353"
|
|
39
39
|
}
|