@wagmi/core 0.4.5 → 0.4.6
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/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/utils/deepEqual.d.ts +2 -0
- package/dist/declarations/src/utils/index.d.ts +1 -0
- package/dist/wagmi-core.cjs.dev.js +42 -3
- package/dist/wagmi-core.cjs.prod.js +42 -3
- package/dist/wagmi-core.esm.js +42 -4
- package/package.json +1 -1
|
@@ -9,5 +9,5 @@ export { AddChainError, ChainDoesNotSupportMulticallError, ChainMismatchError, C
|
|
|
9
9
|
export { createStorage, noopStorage } from './storage';
|
|
10
10
|
export type { ClientStorage as Storage } from './storage';
|
|
11
11
|
export type { Chain, ChainProviderFn, FallbackProviderConfig, ProviderWithFallbackConfig, Provider, Unit, WebSocketProvider, } from './types';
|
|
12
|
-
export { configureChains, normalizeChainId } from './utils';
|
|
12
|
+
export { configureChains, deepEqual, normalizeChainId } from './utils';
|
|
13
13
|
export type { ConfigureChainsConfig } from './utils';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { configureChains } from './configureChains';
|
|
2
2
|
export type { ConfigureChainsConfig } from './configureChains';
|
|
3
|
+
export { deepEqual } from './deepEqual';
|
|
3
4
|
export { getInjectedName } from './getInjectedName';
|
|
4
5
|
export { normalizeChainId } from './normalizeChainId';
|
|
5
6
|
export { warn } from './warn';
|
|
@@ -132,6 +132,44 @@ function fallbackProvider(targetQuorum, minQuorum, providers_, _ref4) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/** Forked from https://github.com/epoberezkin/fast-deep-equal */
|
|
136
|
+
function deepEqual(a, b) {
|
|
137
|
+
if (a === b) return true;
|
|
138
|
+
|
|
139
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
140
|
+
if (a.constructor !== b.constructor) return false;
|
|
141
|
+
let length;
|
|
142
|
+
let i;
|
|
143
|
+
|
|
144
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
145
|
+
length = a.length;
|
|
146
|
+
if (length != b.length) return false;
|
|
147
|
+
|
|
148
|
+
for (i = length; i-- !== 0;) if (!deepEqual(a[i], b[i])) return false;
|
|
149
|
+
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
154
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
155
|
+
const keys = Object.keys(a);
|
|
156
|
+
length = keys.length;
|
|
157
|
+
if (length !== Object.keys(b).length) return false;
|
|
158
|
+
|
|
159
|
+
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
160
|
+
|
|
161
|
+
for (i = length; i-- !== 0;) {
|
|
162
|
+
const key = keys[i];
|
|
163
|
+
if (key && !deepEqual(a[key], b[key])) return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return true;
|
|
167
|
+
} // true if both NaN, false otherwise
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
return a !== a && b !== b;
|
|
171
|
+
}
|
|
172
|
+
|
|
135
173
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
136
174
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
137
175
|
|
|
@@ -358,7 +396,7 @@ async function multicall(_ref) {
|
|
|
358
396
|
returnData,
|
|
359
397
|
success
|
|
360
398
|
} = _ref3;
|
|
361
|
-
if (!success) return
|
|
399
|
+
if (!success) return null;
|
|
362
400
|
const {
|
|
363
401
|
addressOrName,
|
|
364
402
|
contractInterface,
|
|
@@ -375,7 +413,7 @@ async function multicall(_ref) {
|
|
|
375
413
|
});
|
|
376
414
|
if (!allowFailure) throw err;
|
|
377
415
|
console.warn(err.message);
|
|
378
|
-
return
|
|
416
|
+
return null;
|
|
379
417
|
}
|
|
380
418
|
|
|
381
419
|
const contract = getContract({
|
|
@@ -388,7 +426,7 @@ async function multicall(_ref) {
|
|
|
388
426
|
return Array.isArray(result) && result.length === 1 ? result[0] : result;
|
|
389
427
|
} catch (err) {
|
|
390
428
|
if (!allowFailure) throw err;
|
|
391
|
-
return
|
|
429
|
+
return null;
|
|
392
430
|
}
|
|
393
431
|
});
|
|
394
432
|
}
|
|
@@ -1126,6 +1164,7 @@ exports.defaultL2Chains = chains.defaultL2Chains;
|
|
|
1126
1164
|
exports.etherscanBlockExplorers = chains.etherscanBlockExplorers;
|
|
1127
1165
|
exports.configureChains = configureChains;
|
|
1128
1166
|
exports.connect = connect;
|
|
1167
|
+
exports.deepEqual = deepEqual;
|
|
1129
1168
|
exports.disconnect = disconnect;
|
|
1130
1169
|
exports.erc20ABI = erc20ABI;
|
|
1131
1170
|
exports.erc721ABI = erc721ABI;
|
|
@@ -132,6 +132,44 @@ function fallbackProvider(targetQuorum, minQuorum, providers_, _ref4) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/** Forked from https://github.com/epoberezkin/fast-deep-equal */
|
|
136
|
+
function deepEqual(a, b) {
|
|
137
|
+
if (a === b) return true;
|
|
138
|
+
|
|
139
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
140
|
+
if (a.constructor !== b.constructor) return false;
|
|
141
|
+
let length;
|
|
142
|
+
let i;
|
|
143
|
+
|
|
144
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
145
|
+
length = a.length;
|
|
146
|
+
if (length != b.length) return false;
|
|
147
|
+
|
|
148
|
+
for (i = length; i-- !== 0;) if (!deepEqual(a[i], b[i])) return false;
|
|
149
|
+
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
154
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
155
|
+
const keys = Object.keys(a);
|
|
156
|
+
length = keys.length;
|
|
157
|
+
if (length !== Object.keys(b).length) return false;
|
|
158
|
+
|
|
159
|
+
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
160
|
+
|
|
161
|
+
for (i = length; i-- !== 0;) {
|
|
162
|
+
const key = keys[i];
|
|
163
|
+
if (key && !deepEqual(a[key], b[key])) return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return true;
|
|
167
|
+
} // true if both NaN, false otherwise
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
return a !== a && b !== b;
|
|
171
|
+
}
|
|
172
|
+
|
|
135
173
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
136
174
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
137
175
|
|
|
@@ -358,7 +396,7 @@ async function multicall(_ref) {
|
|
|
358
396
|
returnData,
|
|
359
397
|
success
|
|
360
398
|
} = _ref3;
|
|
361
|
-
if (!success) return
|
|
399
|
+
if (!success) return null;
|
|
362
400
|
const {
|
|
363
401
|
addressOrName,
|
|
364
402
|
contractInterface,
|
|
@@ -375,7 +413,7 @@ async function multicall(_ref) {
|
|
|
375
413
|
});
|
|
376
414
|
if (!allowFailure) throw err;
|
|
377
415
|
console.warn(err.message);
|
|
378
|
-
return
|
|
416
|
+
return null;
|
|
379
417
|
}
|
|
380
418
|
|
|
381
419
|
const contract = getContract({
|
|
@@ -388,7 +426,7 @@ async function multicall(_ref) {
|
|
|
388
426
|
return Array.isArray(result) && result.length === 1 ? result[0] : result;
|
|
389
427
|
} catch (err) {
|
|
390
428
|
if (!allowFailure) throw err;
|
|
391
|
-
return
|
|
429
|
+
return null;
|
|
392
430
|
}
|
|
393
431
|
});
|
|
394
432
|
}
|
|
@@ -1126,6 +1164,7 @@ exports.defaultL2Chains = chains.defaultL2Chains;
|
|
|
1126
1164
|
exports.etherscanBlockExplorers = chains.etherscanBlockExplorers;
|
|
1127
1165
|
exports.configureChains = configureChains;
|
|
1128
1166
|
exports.connect = connect;
|
|
1167
|
+
exports.deepEqual = deepEqual;
|
|
1129
1168
|
exports.disconnect = disconnect;
|
|
1130
1169
|
exports.erc20ABI = erc20ABI;
|
|
1131
1170
|
exports.erc721ABI = erc721ABI;
|
package/dist/wagmi-core.esm.js
CHANGED
|
@@ -126,6 +126,44 @@ function fallbackProvider(targetQuorum, minQuorum, providers_, _ref4) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/** Forked from https://github.com/epoberezkin/fast-deep-equal */
|
|
130
|
+
function deepEqual(a, b) {
|
|
131
|
+
if (a === b) return true;
|
|
132
|
+
|
|
133
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
134
|
+
if (a.constructor !== b.constructor) return false;
|
|
135
|
+
let length;
|
|
136
|
+
let i;
|
|
137
|
+
|
|
138
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
139
|
+
length = a.length;
|
|
140
|
+
if (length != b.length) return false;
|
|
141
|
+
|
|
142
|
+
for (i = length; i-- !== 0;) if (!deepEqual(a[i], b[i])) return false;
|
|
143
|
+
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
148
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
149
|
+
const keys = Object.keys(a);
|
|
150
|
+
length = keys.length;
|
|
151
|
+
if (length !== Object.keys(b).length) return false;
|
|
152
|
+
|
|
153
|
+
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
154
|
+
|
|
155
|
+
for (i = length; i-- !== 0;) {
|
|
156
|
+
const key = keys[i];
|
|
157
|
+
if (key && !deepEqual(a[key], b[key])) return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return true;
|
|
161
|
+
} // true if both NaN, false otherwise
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
return a !== a && b !== b;
|
|
165
|
+
}
|
|
166
|
+
|
|
129
167
|
// https://ethereum.org/en/developers/docs/standards/tokens/erc-20
|
|
130
168
|
const erc20ABI = ['event Approval(address indexed _owner, address indexed _spender, uint256 _value)', 'event Transfer(address indexed _from, address indexed _to, uint256 _value)', 'function allowance(address _owner, address _spender) public view returns (uint256 remaining)', 'function approve(address _spender, uint256 _value) public returns (bool success)', 'function balanceOf(address _owner) public view returns (uint256 balance)', 'function decimals() public view returns (uint8)', 'function name() public view returns (string)', 'function symbol() public view returns (string)', 'function totalSupply() public view returns (uint256)', 'function transfer(address _to, uint256 _value) public returns (bool success)', 'function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)']; // https://ethereum.org/en/developers/docs/standards/tokens/erc-721
|
|
131
169
|
|
|
@@ -352,7 +390,7 @@ async function multicall(_ref) {
|
|
|
352
390
|
returnData,
|
|
353
391
|
success
|
|
354
392
|
} = _ref3;
|
|
355
|
-
if (!success) return
|
|
393
|
+
if (!success) return null;
|
|
356
394
|
const {
|
|
357
395
|
addressOrName,
|
|
358
396
|
contractInterface,
|
|
@@ -369,7 +407,7 @@ async function multicall(_ref) {
|
|
|
369
407
|
});
|
|
370
408
|
if (!allowFailure) throw err;
|
|
371
409
|
console.warn(err.message);
|
|
372
|
-
return
|
|
410
|
+
return null;
|
|
373
411
|
}
|
|
374
412
|
|
|
375
413
|
const contract = getContract({
|
|
@@ -382,7 +420,7 @@ async function multicall(_ref) {
|
|
|
382
420
|
return Array.isArray(result) && result.length === 1 ? result[0] : result;
|
|
383
421
|
} catch (err) {
|
|
384
422
|
if (!allowFailure) throw err;
|
|
385
|
-
return
|
|
423
|
+
return null;
|
|
386
424
|
}
|
|
387
425
|
});
|
|
388
426
|
}
|
|
@@ -1088,4 +1126,4 @@ async function waitForTransaction(_ref) {
|
|
|
1088
1126
|
return await promise;
|
|
1089
1127
|
}
|
|
1090
1128
|
|
|
1091
|
-
export { configureChains, connect, disconnect, erc20ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, units, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract };
|
|
1129
|
+
export { configureChains, connect, deepEqual, disconnect, erc20ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, readContract, readContracts, sendTransaction, signMessage, signTypedData, switchNetwork, units, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract };
|