polkamarkets-js 3.4.5 → 3.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/abis/Multicall3.json +1 -0
- package/package.json +1 -1
- package/src/Application.js +16 -0
- package/src/interfaces/index.js +1 -0
- package/src/models/Multicall3Contract.js +14 -0
- package/src/models/index.js +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"abi":[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"aggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes[]","name":"returnData","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3[]","name":"calls","type":"tuple[]"}],"name":"aggregate3","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"allowFailure","type":"bool"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call3Value[]","name":"calls","type":"tuple[]"}],"name":"aggregate3Value","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"blockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getBasefee","outputs":[{"internalType":"uint256","name":"basefee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"chainid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockCoinbase","outputs":[{"internalType":"address","name":"coinbase","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockDifficulty","outputs":[{"internalType":"uint256","name":"difficulty","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockGasLimit","outputs":[{"internalType":"uint256","name":"gaslimit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBlockTimestamp","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getEthBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastBlockHash","outputs":[{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryAggregate","outputs":[{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"requireSuccess","type":"bool"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct Multicall3.Call[]","name":"calls","type":"tuple[]"}],"name":"tryBlockAndAggregate","outputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"internalType":"struct Multicall3.Result[]","name":"returnData","type":"tuple[]"}],"stateMutability":"payable","type":"function"}]}
|
package/package.json
CHANGED
package/src/Application.js
CHANGED
|
@@ -18,6 +18,7 @@ const WETH9Contract = require("./models/index").WETH9Contract;
|
|
|
18
18
|
const ArbitrationContract = require("./models/index").ArbitrationContract;
|
|
19
19
|
const ArbitrationProxyContract = require("./models/index").ArbitrationProxyContract;
|
|
20
20
|
const MerkleRewardsDistributorContract = require("./models/index").MerkleRewardsDistributorContract;
|
|
21
|
+
const Multicall3Contract = require("./models/index").Multicall3Contract;
|
|
21
22
|
|
|
22
23
|
const DualProvider = require("./utils/DualProvider");
|
|
23
24
|
const Account = require('./utils/Account');
|
|
@@ -428,6 +429,21 @@ class Application {
|
|
|
428
429
|
}
|
|
429
430
|
}
|
|
430
431
|
|
|
432
|
+
/**
|
|
433
|
+
* @name getMulticall3Contract
|
|
434
|
+
* @param {Address} ContractAddress (Opt) If it is deployed
|
|
435
|
+
* @description Create a Multicall3 Contract
|
|
436
|
+
*/
|
|
437
|
+
getMulticall3Contract({ contractAddress = null } = {}) {
|
|
438
|
+
try {
|
|
439
|
+
return new Multicall3Contract({
|
|
440
|
+
...this.contractDefaultParams(contractAddress)
|
|
441
|
+
});
|
|
442
|
+
} catch (err) {
|
|
443
|
+
throw err;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
431
447
|
/***********/
|
|
432
448
|
/** UTILS **/
|
|
433
449
|
/***********/
|
package/src/interfaces/index.js
CHANGED
|
@@ -16,6 +16,7 @@ let index = {
|
|
|
16
16
|
predictionV3Querier: require("../../abis/PredictionMarketV3Querier.json"),
|
|
17
17
|
realitio: require("../../abis/RealitioERC20.json"),
|
|
18
18
|
merkleRewardsDistributor: require("../../abis/MerkleRewardsDistributor.json"),
|
|
19
|
+
multicall3: require("../../abis/Multicall3.json"),
|
|
19
20
|
voting: require("../../abis/Voting.json"),
|
|
20
21
|
weth: require("../../abis/WETH9.json"),
|
|
21
22
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const IContract = require('./IContract');
|
|
2
|
+
|
|
3
|
+
const multicall3 = require('../interfaces').multicall3;
|
|
4
|
+
|
|
5
|
+
class Multicall3Contract extends IContract {
|
|
6
|
+
constructor(params) {
|
|
7
|
+
super({ abi: multicall3, ...params });
|
|
8
|
+
// used by bepro-api routing (contract name in /call?contract=...)
|
|
9
|
+
this.contractName = 'multicall3';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = Multicall3Contract;
|
|
14
|
+
|
package/src/models/index.js
CHANGED
|
@@ -15,6 +15,7 @@ const WETH9Contract = require('./WETH9Contract');
|
|
|
15
15
|
const ArbitrationContract = require('./ArbitrationContract');
|
|
16
16
|
const ArbitrationProxyContract = require('./ArbitrationProxyContract');
|
|
17
17
|
const MerkleRewardsDistributorContract = require('./MerkleRewardsDistributorContract');
|
|
18
|
+
const Multicall3Contract = require('./Multicall3Contract');
|
|
18
19
|
|
|
19
20
|
module.exports = {
|
|
20
21
|
ERC20Contract,
|
|
@@ -33,5 +34,6 @@ module.exports = {
|
|
|
33
34
|
ArbitrationProxyContract,
|
|
34
35
|
PredictionMarketV3FactoryContract,
|
|
35
36
|
PredictionMarketV3ControllerContract,
|
|
36
|
-
MerkleRewardsDistributorContract
|
|
37
|
+
MerkleRewardsDistributorContract,
|
|
38
|
+
Multicall3Contract
|
|
37
39
|
}
|