Skip to content

Commit

Permalink
env, deploy setup
Browse files Browse the repository at this point in the history
  • Loading branch information
aykutulis committed Mar 26, 2022
1 parent 5ac23c3 commit 784e9e9
Show file tree
Hide file tree
Showing 5 changed files with 1,080 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
dist
dist
.env
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"typescript": "^4.6.3"
},
"dependencies": {
"@truffle/hdwallet-provider": "^2.0.4",
"dotenv": "^16.0.0",
"ganache-cli": "^6.12.2",
"mocha": "^9.2.2",
"solc": "^0.8.13",
Expand Down
6 changes: 6 additions & 0 deletions src/@types/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare namespace NodeJS {
export interface ProcessEnv {
MNEMONIC_PHRASE?: string;
RINKEBY_URI?: string;
}
}
13 changes: 13 additions & 0 deletions src/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'dotenv/config';
import HDWalletProvider from '@truffle/hdwallet-provider';
import Web3 from 'web3';
import { abi, evm } from './compile';

const { MNEMONIC_PHRASE, RINKEBY_URI } = process.env;

if (!MNEMONIC_PHRASE || !RINKEBY_URI) {
throw new Error('Please set the MNEMONIC_PHRASE and RINKEBY_URI environment variables');
}

const provider = new HDWalletProvider(MNEMONIC_PHRASE, RINKEBY_URI);
const web3 = new Web3(provider);
Loading

0 comments on commit 784e9e9

Please sign in to comment.