Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 573c28d

Browse files
authored
refactor: update default API server (#3106)
1 parent 8d71c5c commit 573c28d

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

__tests__/unit/services/client.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const sessionNetwork = Object.freeze({
1616
},
1717
vendorField: {
1818
maxLength: 64
19-
}
19+
},
20+
version: 23
2021
})
2122

2223
jest.mock('@/store', () => ({

__tests__/unit/services/crypto/transaction-signer.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const sessionNetwork = Object.freeze({
1616
},
1717
vendorField: {
1818
maxLength: 64
19-
}
19+
},
20+
version: 23
2021
})
2122

2223
jest.mock('@/store', () => ({

config/networks/devnet.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "ark.devnet",
33
"name": "ARK Devnet",
44
"title": "ARK Devnet",
5-
"server": "https://dexplorer.ark.io:8443",
5+
"server": "https://dwallets.ark.io",
66
"description": "The ARK Devnet is only used for R&D by engineers.",
77
"imagePath": "networks/ark.devnet.svg",
88
"apiVersion": 2,

config/networks/mainnet.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "ark.mainnet",
33
"name": "ARK Mainnet",
44
"title": "ARK Mainnet",
5-
"server": "https://explorer.ark.io:8443",
5+
"server": "http://wallets.ark.io",
66
"description": "The ARK Mainnet should be chosen in most cases.",
77
"imagePath": "networks/ark.png",
88
"apiVersion": 2,

src/renderer/services/crypto/transaction-signer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class TransactionSigner {
2727
network = store.getters['session/network']
2828
}
2929

30-
transaction = transaction.network(network.version)
30+
transaction = transaction.network(+network.version)
3131

3232
// TODO replace with dayjs
3333
const epochTime = dayjs(network.constants.epoch)

src/renderer/store/modules/network.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,28 @@ export default new BaseModule(NetworkModel, {
5353
load ({ commit, getters, rootGetters }) {
5454
const all = cloneDeep(getters.all)
5555
if (!isEmpty(all)) {
56+
// Update API server on existing networks
57+
const servers = {
58+
'ark.devnet': 'https://dwallets.ark.io',
59+
'ark.mainnet': 'http://wallets.ark.io'
60+
}
61+
const sanitizedAll = all.map(network => {
62+
const server = servers[network.id] || network.server
63+
return {
64+
...network,
65+
server
66+
}
67+
})
68+
5669
// TODO: remove in future major version
5770
// This is a "hack" to make sure all custom networks are in state.all
58-
let missingCustom = false
5971
for (const custom of Object.values(getters.customNetworks)) {
60-
if (!all.find(network => network.name === custom.name)) {
61-
all.push(custom)
62-
missingCustom = true
72+
if (!sanitizedAll.find(network => network.name === custom.name)) {
73+
sanitizedAll.push(custom)
6374
}
6475
}
65-
if (missingCustom) {
66-
commit('SET_ALL', all)
67-
}
76+
77+
commit('SET_ALL', sanitizedAll)
6878
} else {
6979
commit('SET_ALL', NETWORKS)
7080
}

0 commit comments

Comments
 (0)