@reality.eth/contracts 3.0.19 → 3.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reality.eth/contracts",
3
- "version": "3.0.19",
3
+ "version": "3.0.21",
4
4
  "description": "Collection of smart contracts for the Realitio fact verification platform",
5
5
  "scripts": {
6
6
  "generate-chains": "node scripts/generate_chains_json.js",
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/RealityETH/monorepo/issues"
31
31
  },
32
32
  "homepage": "https://reality.eth.link",
33
- "gitHead": "f1fa5a1a1ea69e30311ecb14809fe2c1854b404b",
33
+ "gitHead": "a1a1c9160d34921ac395d23614820eaa8a13b305",
34
34
  "dependencies": {
35
35
  "ethers": "^5.6.8"
36
36
  }
@@ -16,29 +16,39 @@ if (!rpc) {
16
16
  throw new Error("Usage: node migrate_wallet.js <from> <to> <rpc>");
17
17
  }
18
18
 
19
+ const is_out = (process.argv.length > 4 && process.argv[5] == 'out')
20
+
19
21
  // For infura we just pass the network name eg kovan
20
22
  const provider = (rpc.startsWith('http')) ? new ethers.providers.JsonRpcProvider(rpc) : new ethers.providers.InfuraProvider(rpc);
21
23
 
22
24
  const fpriv = fs.readFileSync(from, 'utf8').replace(/\n/, '')
23
- const tpriv = fs.readFileSync(to, 'utf8').replace(/\n/, '')
24
-
25
25
  const f = new ethers.Wallet(fpriv, provider);
26
- const t = new ethers.Wallet(tpriv, provider);
26
+
27
+ // to can be an address if we specify out, otherwise expect a key
28
+ let to_addr;
29
+ if (is_out) {
30
+ to_addr = to;
31
+ } else {
32
+ const tpriv = fs.readFileSync(to, 'utf8').replace(/\n/, '')
33
+ const t = new ethers.Wallet(tpriv, provider);
34
+ to_addr = t.address;
35
+ }
36
+ console.log(to_addr);
27
37
 
28
38
  //console.log(provider);
29
- migrateFunds(provider, f, t);
39
+ migrateFunds(provider, f, to_addr);
30
40
 
31
- async function migrateFunds(provider, f, t) {
41
+ async function migrateFunds(provider, f, to_addr) {
32
42
 
33
- const bal = await provider.getBalance(f.signingKey.address)
43
+ const bal = await provider.getBalance(f.address)
34
44
  const gas_price = await provider.getGasPrice()
35
- const nonce = await provider.getTransactionCount(f.signingKey.address, 'latest')
45
+ const nonce = await provider.getTransactionCount(f.address, 'latest')
36
46
  const gas_limit = 21000;
37
47
 
38
48
  // console.log(f)
39
49
 
40
50
  const txdata = {
41
- to: t.signingKey.address,
51
+ to: to_addr,
42
52
  value: bal.sub((gas_price.mul(gas_limit))),
43
53
  nonce: nonce,
44
54
  gasLimit: ethers.utils.hexlify(gas_limit),