File tree Expand file tree Collapse file tree 4 files changed +46
-6
lines changed Expand file tree Collapse file tree 4 files changed +46
-6
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:10.16
2
+
3
+ # Install Protocol Buffers tool
4
+ RUN apt-get -qq update && apt-get -qq install -y \
5
+ unzip
6
+
7
+ RUN git clone https://github.com/grpc/grpc-web /github/grpc-web
8
+
9
+ RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/\
10
+ protoc-3.7.1-linux-x86_64.zip -o /tmp/protoc.zip && \
11
+ cd /tmp && \
12
+ unzip -qq protoc.zip && \
13
+ cp /tmp/bin/protoc /usr/local/bin/protoc
14
+
15
+ RUN curl -sSL https://github.com/grpc/grpc-web/releases/download/1.0.4/\
16
+ protoc-gen-grpc-web-1.0.4-linux-x86_64 -o /usr/local/bin/protoc-gen-grpc-web && \
17
+ chmod +x /usr/local/bin/protoc-gen-grpc-web
18
+
19
+ # Add files
20
+ ADD tslint.json ./tslint.json
21
+ ADD tsconfig.json ./tsconfig.json
22
+ ADD globals.d.ts ./globals.d.ts
23
+ ADD package.json ./package.json
24
+
25
+ ADD src ./src
26
+ ADD test ./test
27
+
28
+ # Build package
29
+ RUN npm install && npm run build
Original file line number Diff line number Diff line change 7
7
8
8
# Entrypoint of library
9
9
` src/index.ts `
10
+
11
+ # How to build a Docker?
12
+ ```
13
+ docker build -t lightcone-v2-js -f Dockerfile .
14
+ ```
15
+
16
+ # How to run tests in Docker?
17
+ ```
18
+ docker run --rm lightcone-v2-js sh -c 'npm run test'
19
+ ```
Original file line number Diff line number Diff line change 1
1
import AbiFunction from './AbiFunction' ;
2
2
import { toHex } from '../../common/formatter' ;
3
- import { methodID } from 'ethereumjs-abi' ;
3
+ var ethereumjs_abi = require ( 'ethereumjs-abi' )
4
4
5
5
export default class Contract {
6
6
@@ -11,7 +11,7 @@ export default class Contract {
11
11
this . abiFunctions = funAbi . reduce ( ( acc , item ) => {
12
12
const inputTypes = item . inputs . map ( ( { type} ) => type ) ;
13
13
const key = `${ item . name } (${ inputTypes . toString ( ) } )` ;
14
- const methodHash = methodID ( item . name , inputTypes ) ;
14
+ const methodHash = ethereumjs_abi . methodID ( item . name , inputTypes ) ;
15
15
return ( {
16
16
...acc ,
17
17
[ item . name ] : new AbiFunction ( item ) ,
Original file line number Diff line number Diff line change 4
4
import validator from './validator' ;
5
5
import Transaction from './transaction' ;
6
6
import request from '../common/request' ;
7
- import { rawDecode } from 'ethereumjs-abi'
8
7
import { toBuffer } from "../common/formatter" ;
9
8
9
+ var ethereumjs_abi = require ( 'ethereumjs-abi' )
10
+
10
11
// HACK: What is the host in wallet/token?
11
12
const host = 'host' ;
12
13
@@ -140,19 +141,19 @@ export default class Token {
140
141
141
142
async getName ( ) {
142
143
const response = await this . getConfig ( 'name' ) ;
143
- const results = rawDecode ( [ 'string' ] , toBuffer ( response [ 'result' ] ) ) ;
144
+ const results = ethereumjs_abi . rawDecode ( [ 'string' ] , toBuffer ( response [ 'result' ] ) ) ;
144
145
return results . length > 0 ? results [ 0 ] : '' ;
145
146
}
146
147
147
148
async getSymbol ( ) {
148
149
const response = await this . getConfig ( 'symbol' ) ;
149
- const results = rawDecode ( [ 'string' ] , toBuffer ( response [ 'result' ] ) ) ;
150
+ const results = ethereumjs_abi . rawDecode ( [ 'string' ] , toBuffer ( response [ 'result' ] ) ) ;
150
151
return results . length > 0 ? results [ 0 ] : '' ;
151
152
}
152
153
153
154
async getDecimals ( ) {
154
155
const response = await this . getConfig ( 'decimals' ) ;
155
- const results = rawDecode ( [ 'uint' ] , toBuffer ( response [ 'result' ] ) ) ;
156
+ const results = ethereumjs_abi . rawDecode ( [ 'uint' ] , toBuffer ( response [ 'result' ] ) ) ;
156
157
return results . length > 0 ? results [ 0 ] . toNumber ( ) : - 1 ;
157
158
}
158
159
You can’t perform that action at this time.
0 commit comments