WIP Migrate to RSK testnet

This commit is contained in:
Râu Cao
2022-10-24 16:30:38 +02:00
parent 52f7e86fc9
commit 0c5aebf7b4
4 changed files with 983 additions and 2920 deletions
+6 -5
View File
@@ -73,13 +73,12 @@ export default Service.extend({
} }
async function instantiateWithAccount (web3Provider, context) { async function instantiateWithAccount (web3Provider, context) {
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask'); console.debug('[kredits] Using user-provided Web3 instance, e.g. from Metamask');
ethProvider = new ethers.providers.Web3Provider(web3Provider); ethProvider = new ethers.providers.Web3Provider(web3Provider);
const network = await ethProvider.getNetwork(); const network = await ethProvider.getNetwork();
if (isPresent(config.web3RequiredNetwork) && if (isPresent(config.web3RequiredNetwork) &&
network.name !== config.web3RequiredNetwork) { network.chainId !== config.web3RequiredChainId) {
window.alert(`Please switch your Ethereum wallet to the "${config.web3RequiredNetwork}" network before connecting your account.`);
return instantiateWithoutAccount(); return instantiateWithoutAccount();
} }
@@ -112,11 +111,13 @@ export default Service.extend({
}, },
async setup () { async setup () {
const kredits = await this.getEthProvider().then((providerAndSigner) => { const kredits = await this.getEthProvider().then(providerAndSigner => {
return new Kredits(providerAndSigner.ethProvider, providerAndSigner.ethSigner, { return new Kredits(providerAndSigner.ethProvider, providerAndSigner.ethSigner, {
ipfsConfig: config.ipfs ipfsConfig: config.ipfs
}).init();
}); });
});
await kredits.init();
this.set('kredits', kredits); this.set('kredits', kredits);
this.set('currentBlock', await kredits.provider.getBlockNumber()); this.set('currentBlock', await kredits.provider.getBlockNumber());
+3 -3
View File
@@ -25,8 +25,9 @@ module.exports = function(environment) {
// when it is created // when it is created
}, },
web3ProviderUrl: 'https://rinkeby.infura.io/v3/d4f788b7a6584f7db2fc3c268d4d09e9', web3ProviderUrl: 'https://rsk-testnet.kosmos.org',
web3RequiredNetwork: 'rinkeby', web3RequiredChainId: 31,
web3RequiredNetworkName: 'RSK Testnet',
githubConnectUrl: 'https://hal8000.chat.kosmos.org/kredits/signup/connect/github', githubConnectUrl: 'https://hal8000.chat.kosmos.org/kredits/signup/connect/github',
githubSignupUrl: 'https://hal8000.chat.kosmos.org/kredits/signup/github', githubSignupUrl: 'https://hal8000.chat.kosmos.org/kredits/signup/github',
@@ -55,7 +56,6 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true; // ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.web3ProviderUrl = 'https://rinkeby.infura.io/v3/d4f788b7a6584f7db2fc3c268d4d09e9';
ENV.githubConnectUrl = 'http://localhost:8888/kredits/signup/connect/github'; ENV.githubConnectUrl = 'http://localhost:8888/kredits/signup/connect/github';
ENV.githubSignupUrl = 'http://localhost:8888/kredits/signup/github'; ENV.githubSignupUrl = 'http://localhost:8888/kredits/signup/github';
+967 -2905
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -66,7 +66,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"ethers": "^5.4.7", "ethers": "^5.4.7",
"fetch-mock": "^9.10.7", "fetch-mock": "^9.10.7",
"kredits-contracts": "github:67P/kredits-contracts#hardhat", "kredits-contracts": "git+https://gitea.kosmos.org/kredits/contracts#addresses/rsk-testnet-raucao-1",
"loader.js": "^4.7.0", "loader.js": "^4.7.0",
"localforage": "^1.7.3", "localforage": "^1.7.3",
"ndjson": "github:hugomrdias/ndjson#feat/readable-stream3", "ndjson": "github:hugomrdias/ndjson#feat/readable-stream3",