Skip to content

Commit 96bebe4

Browse files
author
jagdeep sidhu
committed
add polling timeout to account for longer block times
1 parent 12bf777 commit 96bebe4

File tree

7 files changed

+14672
-13968
lines changed

7 files changed

+14672
-13968
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Syscoin itself enforces the SPV proof by running Geth in light mode to sync up t
1414

1515
In the project directory, you can run:
1616

17+
### `npm install`
18+
Installs the dependencies. You should use node version 16.
19+
1720
### `npm start`
1821

1922
Runs the app in the development mode.<br>
@@ -22,6 +25,7 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
2225
The page will reload if you make edits.<br>
2326
You will also see any lint errors in the console.
2427

28+
set REACT_APP_USE_TESTNET=true in your env for testnet.
2529
### `npm test`
2630

2731
Launches the test runner in the interactive watch mode.<br>

package-lock.json

Lines changed: 326 additions & 359 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"react-textarea-autosize": "^7.1.2",
2323
"react-validation-mixin": "^5.4.0",
2424
"satoshi-bitcoin": "^1.0.5",
25-
"syscoinjs-lib": "^1.0.224",
26-
"web3": "^1.5.2"
25+
"syscoinjs-lib": "^1.0.228",
26+
"web3": "^1.7.5"
2727
},
2828
"scripts": {
2929
"start": "react-scripts start",

src/config.js

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,40 @@
1-
const sjs = require('syscoinjs-lib')
1+
const sjs = require('syscoinjs-lib');
2+
23
class CONFIGURATION {
3-
constructor() {
4-
this.Web3URL = "https://rpc.syscoin.org";
5-
this.RelayContract = "0xd714E7915362FF89388025F584726E6dF26D20f9";
6-
this.ERC20Manager = "0x7904299b3D3dC1b03d1DdEb45E9fDF3576aCBd5f";
7-
this.TokenFreezeFunction = "0x0b8914e27c9a6c88836bc5547f82ccf331142c761f84e9f1d36934a6a31eefad";
8-
this.NEVMExplorerURL = "https://explorer.syscoin.org/";
4+
constructor(useTestnet = false) {
5+
if (useTestnet) {
6+
// 🧪 TESTNET SETTINGS
7+
this.Web3URL = "wss://rpc.tanenbaum.io/wss";
8+
this.NEVMExplorerURL = "https://explorer.tanenbaum.io/";
9+
this.FaucetURL = "https://faucet.syscoin.org/";
10+
this.BlockbookAPIURL = "https://sys-test.org/";
11+
this.ChainId = "0x1644"; // 5700
12+
this.NativeCurrencySymbol = "tSYS";
13+
this.SysNetwork = sjs.utils.syscoinNetworks.testnet;
14+
} else {
15+
// ✅ MAINNET SETTINGS
16+
this.Web3URL = "wss://rpc.syscoin.org/wss";
17+
this.NEVMExplorerURL = "https://explorer.syscoin.org/";
18+
this.FaucetURL = ""; // No faucet on mainnet
19+
this.BlockbookAPIURL = "https://blockbook.syscoin.org/";
20+
this.ChainId = "0x39"; // 57
21+
this.NativeCurrencySymbol = "SYS";
22+
this.SysNetwork = sjs.utils.syscoinNetworks.mainnet;
23+
}
24+
925
this.NEVMAddressExplorerURL = this.NEVMExplorerURL + "address/";
10-
this.SyscoinTxExplorerURL = "https://blockbook.syscoin.org/tx/";
1126
this.NEVMTxExplorerURL = this.NEVMExplorerURL + "tx/";
12-
this.FaucetURL = "https://faucet.syscoin.org/";
13-
this.BlockbookAPIURL = "https://blockbook.syscoin.org/";
14-
this.ChainId = "0x39"; // 5700 testnet, 57 mainnet
27+
this.SyscoinTxExplorerURL = this.BlockbookAPIURL + "tx/";
28+
29+
// Shared
30+
this.RelayContract = "0xd714E7915362FF89388025F584726E6dF26D20f9";
31+
this.ERC20Manager = "0x7904299b3D3dC1b03d1DdEb45E9fDF3576aCBd5f";
32+
this.TokenFreezeFunction = "0x0b8914e27c9a6c88836bc5547f82ccf331142c761f84e9f1d36934a6a31eefad";
33+
this.SYSXAsset = "123456";
34+
this.TokenUnfreezeFn = "0xb27598a6740f5e57c905fdf107266796e030a0739a6e06cee3b5b74c69d0545e";
1535
this.ChainName = "Syscoin NEVM";
1636
this.NativeCurrencyName = "Syscoin";
17-
this.NativeCurrencySymbol = "SYS";
18-
this.SYSXAsset = "123456";
19-
this.TokenUnfreezeFn = '0x4f3215d035d7407ce0b19bc31b8e8e9269d0af49093fbf8ec1a11a2c58a73061';
20-
this.SysNetwork = sjs.utils.syscoinNetworks.mainnet;
2137
}
2238
}
23-
export default new CONFIGURATION();
39+
40+
export default new CONFIGURATION(process.env.REACT_APP_USE_TESTNET === 'true');

src/wizard/Step1EthToSys.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,16 @@ class Step1ES extends Component {
265265
fromAccount
266266
) {
267267
let thisObj = this
268+
268269
thisObj.state.receiptObj = null;
270+
269271
syscoinERC20Manager.methods
270272
.freezeBurn(amount, sysxContract, tokenId, syscoinWitnessAddress)
271273
.send({
272274
from: fromAccount,
273275
gas: 400000,
274276
value: tokenId === 0 ? amount : undefined,
277+
transactionPollingTimeout: 1800,
275278
})
276279
.once("transactionHash", function (hash) {
277280
validateNewInput.buttonVal = true;
@@ -545,7 +548,7 @@ class Step1ES extends Component {
545548

546549
if (allowance.lt(amount)) {
547550
await contractBase.methods.approve(CONFIGURATION.ERC20Manager, amount.toString())
548-
.send({ from: fromAccount, gas: 400000 })
551+
.send({ from: fromAccount, gas: 400000, transactionPollingTimeout: 1800 })
549552
.once("transactionHash", (hash) => {
550553
validateNewInput.buttonVal = true;
551554
validateNewInput.receiptTxHash = hash;
@@ -576,7 +579,7 @@ class Step1ES extends Component {
576579
let approved = await contractBase.methods.isApprovedForAll(fromAccount, CONFIGURATION.ERC20Manager).call();
577580
if (!approved) {
578581
await contractBase.methods.setApprovalForAll(CONFIGURATION.ERC20Manager, true)
579-
.send({ from: fromAccount, gas: 400000 })
582+
.send({ from: fromAccount, gas: 400000, transactionPollingTimeout: 1800 })
580583
.once("transactionHash", (hash) => {
581584
validateNewInput.buttonValMsg = this.props.t("step3AuthAllowanceMetamask");
582585
this.setState(Object.assign(userInput, validateNewInput, this._validationErrors(validateNewInput)));
@@ -606,6 +609,7 @@ class Step1ES extends Component {
606609
syscoinERC20Manager,
607610
validateNewInput,
608611
amount.toString(),
612+
userInput.sysxContract,
609613
tokenId,
610614
syscoinWitnessAddress,
611615
userInput,

src/wizard/Step3SysToEth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class Step3 extends Component {
251251
merkleProof.sibling,
252252
_syscoinBlockHeader
253253
)
254-
.send({ from: accounts[0], gas: 400000 })
254+
.send({ from: accounts[0], gas: 400000, transactionPollingTimeout: 1800})
255255
.once("transactionHash", function (hash) {
256256
thisObj.setState({
257257
receiptTxHash: hash,

0 commit comments

Comments
 (0)