File tree Expand file tree Collapse file tree 5 files changed +54
-4
lines changed
Expand file tree Collapse file tree 5 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 1+ name : Packages examples
2+ on :
3+ push :
4+ branches : [master, develop]
5+ pull_request :
6+ types : [opened, reopened, synchronize]
7+
8+ jobs :
9+ test-examples :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v2
13+ with :
14+ submodules : recursive
15+
16+ - uses : actions/setup-node@v2
17+ with :
18+ node-version : 16
19+ cache : ' npm'
20+
21+ - run : npm i
22+ - run : npm run examples
Original file line number Diff line number Diff line change 2929 "preinstall" : " npm run checkNpmVersion" ,
3030 "postinstall" : " npm run build --workspaces" ,
3131 "checkNpmVersion" : " ./scripts/check-npm-version.sh" ,
32+ "examples" : " npm run examples --workspaces --if-present" ,
3233 "clean" : " ./config/cli/clean-root.sh" ,
3334 "e2e:publish" : " ./scripts/e2e-publish.sh" ,
3435 "e2e:resolutions" : " node ./scripts/e2e-resolutions.js" ,
Original file line number Diff line number Diff line change @@ -43,18 +43,18 @@ console.log('--------------------')
4343// You can decode it with the rlp module.
4444// After that you should have something like:
4545const rawTx = [
46- '0x00 ' ,
46+ '0x ' ,
4747 '0x09184e72a000' ,
4848 '0x2710' ,
4949 '0x0000000000000000000000000000000000000000' ,
50- '0x00 ' ,
50+ '0x ' ,
5151 '0x7f7465737432000000000000000000000000000000000000000000000000000000600057' ,
5252 '0x1c' ,
5353 '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab' ,
5454 '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13' ,
5555]
5656
57- const tx2 = Transaction . fromValuesArray ( rawTx . map ( toBuffer ) ) // This is also a maninnet transaction
57+ const tx2 = Transaction . fromValuesArray ( rawTx . map ( toBuffer ) ) // This is also a mainnet transaction
5858
5959// Note rlp.decode will produce an array of buffers.
6060// So assuming that you were able to parse the transaction, we will now get the sender's address.
Original file line number Diff line number Diff line change 3030 "tape" : " tape -r ts-node/register" ,
3131 "test" : " npm run test:node && npm run test:browser" ,
3232 "test:node" : " tape -r ts-node/register ./test/index.ts" ,
33- "test:browser" : " karma start karma.conf.js"
33+ "test:browser" : " karma start karma.conf.js" ,
34+ "examples" : " ts-node ../../scripts/examples-runner.ts -- tx"
3435 },
3536 "dependencies" : {
3637 "@ethereumjs/common" : " ^2.6.0" ,
Original file line number Diff line number Diff line change 1+ import { extname , join } from 'path'
2+ import { readdir } from 'fs'
3+
4+ const pkg = process . argv [ 3 ]
5+ if ( ! pkg ) {
6+ throw new Error ( 'Package argument must be passed' )
7+ }
8+
9+ const examplesPath = `../packages/${ pkg } /examples/`
10+ const path = join ( __dirname , examplesPath )
11+
12+ readdir ( path , async ( err , files ) => {
13+ if ( err ) {
14+ throw new Error ( 'Error loading examples directory: ' + err . message )
15+ }
16+
17+ const getTsFiles = ( fileName : string ) : Promise < NodeModule > | undefined => {
18+ if ( extname ( fileName ) === '.ts' ) {
19+ return import ( examplesPath + fileName )
20+ }
21+ }
22+
23+ const importedFiles = files . map ( getTsFiles ) . filter ( ( file ) => file )
24+
25+ await Promise . all ( importedFiles )
26+ } )
You can’t perform that action at this time.
0 commit comments