Skip to content

Commit

Permalink
feat: mainnet (#1087)
Browse files Browse the repository at this point in the history
* feat: mainnet

* feat: set env variables

* feat: set env variables
  • Loading branch information
chrispanag authored Jul 21, 2022
1 parent 3908e96 commit a54e165
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/configs/production.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONTRACT_NAME="capsule-beta.testnet"
CONTRACT_NAME=blogchain.near
DOMAIN="https://blogchain.app"
CAPSULE_SERVER="https://blogchain.app/server"
ORBIT_URL="https://node1.blogchain.app"
Expand All @@ -8,4 +8,5 @@ TORUS_DISCORD_VERIFIER="blogchain-app-discord-production"
TORUS_DISCORD_CLIENTID="947888768269033512"
TORUS_NETWORK=mainnet
STRIPE_PUBLISHABLE_KEY=pk_live_51I81pBCPCJ3FaYLGK7rT7mqLsvvFCAOOxdN2RDLt868Oc2Tvrp6MYuyOoPyT6GkZNXvbGY02T5q6IsB8Z6HpE1PN00aopEjYBi
HCAPTCHA_SITE_KEY="4c2a59d5-cedc-4e81-a646-b769bf50e52c"
HCAPTCHA_SITE_KEY="4c2a59d5-cedc-4e81-a646-b769bf50e52c"
NEAR_NETWORK=mainnet
2 changes: 1 addition & 1 deletion src/backend/utilities/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (parsedTorusNetwork && parsedTorusNetwork !== `mainnet` && parsedTorusNetwork
}
export const torusNetwork: TORUS_NETWORK_TYPE = (parsedTorusNetwork as `mainnet` | `testnet` | undefined) || `testnet`

const nearNetwork = process.env.NEAR_NETWORK || `testnet`
export const nearNetwork = process.env.NEAR_NETWORK || `testnet`

export function nodeUrl() {
const preferredNodeUrl = window.localStorage.getItem(`preferredNodeUrl`)
Expand Down
3 changes: 2 additions & 1 deletion src/components/register/SignUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { getUsernameNEAR, removeNearPrivateKey, walletLogout } from '@/backend/n
import { MutationType, createSessionFromProfile, namespace as sessionStoreNamespace } from '~/store/session'
import { setNearUserFromPrivateKey, login, register, IAuthResult, IWalletStatus } from '@/backend/auth'
import { ValidationError } from '@/errors'
import { nearNetwork } from '@/backend/utilities/config'
interface IData {
funds: string
Expand Down Expand Up @@ -71,7 +72,7 @@ export default Vue.extend({
}
if (this.userInfo.type === `near`) {
// If the key exists we can login him
const pk = window.localStorage.getItem(`near-api-js:${this.userInfo.accountId}:testnet`)
const pk = window.localStorage.getItem(`near-api-js:${this.userInfo.accountId}:${nearNetwork}`)
if (pk) {
this.username = username
await this.verify(this.username)
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ import { initContract, initNear, initWalletConnection } from '@/backend/near'

const backend: Plugin = async (context) => {
try {
// If the user has refreshed or backtracked etc
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i)
if (key && key.startsWith(`near-api-js:keystore`)) {
if (key.endsWith(`testnet`)) {
const privateKey = localStorage.getItem(key)
if (privateKey) {
localStorage.setItem(key.replace(`testnet`, `mainnet`), privateKey)
}
}
}
}
await initNear()
const libsodium = initLibSodium()
libsodium.initResult.catch((err: unknown) => {
Expand Down

0 comments on commit a54e165

Please sign in to comment.