Skip to content

Commit

Permalink
Inject config at build time with .env files AxLabs#2
Browse files Browse the repository at this point in the history
  • Loading branch information
vczb committed Oct 23, 2021
1 parent 8dd429e commit 6c50a0b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_MEME_CONTRACT_HASH=0x3298f0592ad719084518850eb7147cebb1564dd2
NEXT_PUBLIC_MEME_GOVERNANCE_CONTRACT_HASH=0x7ab855b7a0d798e9a14221b5eca55a358c1f0573
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ cd my-project-name
npm install
```

Duplicate .env.template and rename it to .env.local

```
cp .env.template .env.local
```

Add proper store values to .env.local

```
NEXT_PUBLIC_MEME_CONTRACT_HASH=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_MEME_GOVERNANCE_CONTRACT_HASH=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Then, you can run **locally** in **development mode with live reload**:

```
Expand Down
3 changes: 1 addition & 2 deletions src/contracts/MemeContract.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { NeoLineN3Interface } from '../utils/neoline/neoline';
import { TypedValue } from '../utils/neoline/neoline-model';

const MEME_CONTRACT_HASH = `0x${'3298f0592ad719084518850eb7147cebb1564dd2'}`;
// const NO_OWNER_ZEROS_BASE64 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAA=';
const MEME_CONTRACT_HASH = process.env.NEXT_PUBLIC_MEME_CONTRACT_HASH || '';

export type MemeContractState = {
memes: Meme[];
Expand Down
3 changes: 1 addition & 2 deletions src/contracts/MemeGovernanceContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { NeoLineN3Interface } from '../utils/neoline/neoline';
import { TypedValue } from '../utils/neoline/neoline-model';
import { fromStackItemToMeme, Meme } from './MemeContract';

const MEME_GOVERNANCE_CONTRACT_HASH = `0x${'7ab855b7a0d798e9a14221b5eca55a358c1f0573'}`;
// const NO_OWNER_ZEROS_BASE64 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAA=';
const MEME_GOVERNANCE_CONTRACT_HASH = process.env.NEXT_PUBLIC_MEME_GOVERNANCE_CONTRACT_HASH || '';

export function fromStackToMemeGovernanceProposal(stack: TypedValue[]): MemeGovernanceProposal[] {
const proposals: MemeGovernanceProposal[] = [];
Expand Down

0 comments on commit 6c50a0b

Please sign in to comment.