Migrate/switch to RSK testnet #203
+6
-12
@@ -1,27 +1,21 @@
|
|||||||
---
|
---
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "10"
|
- "14"
|
||||||
|
- "16"
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
dist: xenial
|
dist: precise
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email: false
|
||||||
on_success: never
|
|
||||||
on_failure: always
|
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
chrome: stable
|
chrome: stable
|
||||||
|
|
||||||
env:
|
cache:
|
||||||
global:
|
npm: false
|
||||||
# See https://git.io/vdao3 for details.
|
|
||||||
- JOBS=1
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
script:
|
|
||||||
- npm test
|
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ import * as localforage from 'localforage';
|
|||||||
import config from 'kredits-web/config/environment';
|
import config from 'kredits-web/config/environment';
|
||||||
|
|
||||||
function createStore(name) {
|
function createStore(name) {
|
||||||
const networkName = config.web3RequiredNetwork || 'custom';
|
let networkName;
|
||||||
|
if (config.web3RequiredNetworkName) {
|
||||||
|
networkName = config.web3RequiredNetworkName.toLocaleLowerCase().replace(' ', '-');
|
||||||
|
} else {
|
||||||
|
networkName = 'custom';
|
||||||
|
}
|
||||||
return localforage.createInstance({ name: `kredits:${networkName}:${name}` });
|
return localforage.createInstance({ name: `kredits:${networkName}:${name}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import ethers from 'ethers';
|
import ethers from 'ethers';
|
||||||
import Kredits from 'kredits-contracts';
|
import Kredits from '@kredits/contracts';
|
||||||
|
|
||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
import EmberObject from '@ember/object';
|
import EmberObject from '@ember/object';
|
||||||
@@ -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.web3RequiredChainId) &&
|
||||||
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,12 +111,14 @@ 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());
|
||||||
|
|
||||||
|
|||||||
+4
-10
@@ -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';
|
||||||
@@ -82,13 +82,7 @@ module.exports = function(environment) {
|
|||||||
|
|
||||||
if (process.env.WEB3_PROVIDER_URL) {
|
if (process.env.WEB3_PROVIDER_URL) {
|
||||||
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
||||||
ENV.web3RequiredNetwork = null;
|
ENV.web3RequiredChainId = null;
|
||||||
}
|
|
||||||
if (process.env.KREDITS_DAO_ADDRESS) {
|
|
||||||
ENV.kreditsKernelAddress = process.env.KREDITS_DAO_ADDRESS;
|
|
||||||
}
|
|
||||||
if (process.env.KREDITS_APM_DOMAIN) {
|
|
||||||
ENV.kreditsApmDomain = process.env.KREDITS_APM_DOMAIN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
|
|||||||
Generated
+3462
-12312
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -31,6 +31,7 @@
|
|||||||
"@ember/optional-features": "^1.3.0",
|
"@ember/optional-features": "^1.3.0",
|
||||||
"@glimmer/component": "^1.0.0",
|
"@glimmer/component": "^1.0.0",
|
||||||
"@glimmer/tracking": "^1.0.0",
|
"@glimmer/tracking": "^1.0.0",
|
||||||
|
"@kredits/contracts": "^7.0.1",
|
||||||
"babel-preset-es2015": "^6.22.0",
|
"babel-preset-es2015": "^6.22.0",
|
||||||
"broccoli-asset-rev": "^3.0.0",
|
"broccoli-asset-rev": "^3.0.0",
|
||||||
"ember-auto-import": "^1.12.1",
|
"ember-auto-import": "^1.12.1",
|
||||||
@@ -66,7 +67,6 @@
|
|||||||
"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",
|
|
||||||
"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",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ module('Unit | Service | browser-cache', function(hooks) {
|
|||||||
|
|
||||||
test('creates kredits data stores', function(assert) {
|
test('creates kredits data stores', function(assert) {
|
||||||
let cache = this.owner.lookup('service:browser-cache');
|
let cache = this.owner.lookup('service:browser-cache');
|
||||||
assert.equal(cache.contributors._config.name, "kredits:rinkeby:contributors");
|
assert.equal(cache.contributors._config.name, "kredits:rsk-testnet:contributors");
|
||||||
assert.equal(cache.contributions._config.name, "kredits:rinkeby:contributions");
|
assert.equal(cache.contributions._config.name, "kredits:rsk-testnet:contributions");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user