Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
8416811b
Unverified
Commit
8416811b
authored
Nov 15, 2021
by
kf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: convert generate-deployed-artifacts to ts
parent
b882d8c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
package.json
packages/contracts/package.json
+1
-1
generate-deployed-artifacts.ts
packages/contracts/scripts/generate-deployed-artifacts.ts
+13
-14
No files found.
packages/contracts/package.json
View file @
8416811b
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
"build:contracts"
:
"hardhat compile --show-stack-traces"
,
"build:contracts"
:
"hardhat compile --show-stack-traces"
,
"build:dump"
:
"ts-node bin/take-dump.ts"
,
"build:dump"
:
"ts-node bin/take-dump.ts"
,
"autogen:markdown"
:
"node scripts/generate-markdown.js"
,
"autogen:markdown"
:
"node scripts/generate-markdown.js"
,
"autogen:artifacts"
:
"node scripts/generate-artifacts.js &&
node scripts/generate-deployed-artifacts.j
s"
,
"autogen:artifacts"
:
"node scripts/generate-artifacts.js &&
ts-node scripts/generate-deployed-artifacts.t
s"
,
"test"
:
"yarn test:contracts"
,
"test"
:
"yarn test:contracts"
,
"test:contracts"
:
"hardhat test --show-stack-traces"
,
"test:contracts"
:
"hardhat test --show-stack-traces"
,
"test:coverage"
:
"NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage && istanbul check-coverage --statements 88 --branches 76 --functions 84 --lines 88"
,
"test:coverage"
:
"NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage && istanbul check-coverage --statements 88 --branches 76 --functions 84 --lines 88"
,
...
...
packages/contracts/scripts/generate-deployed-artifacts.
j
s
→
packages/contracts/scripts/generate-deployed-artifacts.
t
s
View file @
8416811b
#!/usr/bin/env node
import
path
from
'
path
'
const
path
=
require
(
'
path
'
)
import
glob
from
'
glob
'
const
glob
=
require
(
'
glob
'
)
import
fs
from
'
fs
'
const
fs
=
require
(
'
fs
'
)
/**
;(
async
()
=>
{
* Script for automatically generating a TypeScript file for retrieving deploy artifact JSON files.
console
.
log
(
`writing deployed contract artifacts typescript file`
)
* We do this to make sure that this package remains browser compatible.
*/
const
main
=
async
()
=>
{
let
content
=
`
let
content
=
`
/* eslint-disable */
/* eslint-disable */
/*
/*
...
@@ -51,14 +52,12 @@ const fs = require('fs')
...
@@ -51,14 +52,12 @@ const fs = require('fs')
content
+=
`
content
+=
`
export const getDeployedContractArtifact = (name: string, network: string): any => {
export const getDeployedContractArtifact = (name: string, network: string): any => {
return {
return {
${
artifactNames
${
artifactNames
.
join
(
'
,
\n
'
)}
.
map
((
artifactName
)
=>
{
return
`
${
artifactName
}
:
${
artifactName
}
`
})
.
join
(
'
,
\n
'
)}
}[(network + '__' + name).replace(/-/g, '_')]
}[(network + '__' + name).replace(/-/g, '_')]
}
}
`
`
fs
.
writeFileSync
(
`./src/contract-deployed-artifacts.ts`
,
content
)
fs
.
writeFileSync
(
`./src/contract-deployed-artifacts.ts`
,
content
)
})().
catch
(
console
.
error
)
}
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment