Skip to content

Commit 4df1cb1

Browse files
iwbrhwfyxiaowheat
authored andcommitted
[Lightcone2.js]update account ready && statement termination (#288)
* update account ready * [Lightcone_V2.js] Remove tslint.json in packages/lightcone_v2.js/Dockerfile
1 parent f378b62 commit 4df1cb1

File tree

10 files changed

+30
-79
lines changed

10 files changed

+30
-79
lines changed

packages/lightcone_v2.js/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ protoc-gen-grpc-web-1.0.4-linux-x86_64 -o /usr/local/bin/protoc-gen-grpc-web &&
1717
chmod +x /usr/local/bin/protoc-gen-grpc-web
1818

1919
# Add files
20-
ADD tslint.json ./tslint.json
2120
ADD tsconfig.json ./tsconfig.json
2221
ADD globals.d.ts ./globals.d.ts
2322
ADD package.json ./package.json

packages/lightcone_v2.js/src/lib/wallet/common/schemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ let basicSchemas = {
9999
required: true,
100100
enum: [1, 2, 3, 4]
101101
}
102-
}
102+
};
103103

104104
export default basicSchemas

packages/lightcone_v2.js/src/lib/wallet/ethereum/contracts/AbiFunction.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Using import {*} from 'ethereumjs-abi'; failed to import ethereumjs-abi
2-
var abi = require('ethereumjs-abi')
2+
var abi = require('ethereumjs-abi');
33
import {addHexPrefix, clearHexPrefix, toBuffer, toHex} from '../../common/formatter';
44
import BN from 'bn.js';
55

66
export default class AbiFunction {
77

8-
name: string
9-
inputTypes: string[]
10-
inputs: any[]
11-
outputTypes: string[]
12-
outputs: any[]
13-
constant: string
14-
methodAbiHash: string
8+
name: string;
9+
inputTypes: string[];
10+
inputs: any[];
11+
outputTypes: string[];
12+
outputs: any[];
13+
constant: string;
14+
methodAbiHash: string;
1515

1616
constructor({inputs, name, outputs, constant}) {
1717
this.name = name;

packages/lightcone_v2.js/src/lib/wallet/ethereum/contracts/Contract.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import AbiFunction from './AbiFunction';
22
import {toHex} from '../../common/formatter';
3-
var ethereumjs_abi = require('ethereumjs-abi')
3+
var ethereumjs_abi = require('ethereumjs-abi');
44

55
export default class Contract {
66

7-
abiFunctions: any
7+
abiFunctions: any;
88

99
constructor(abi) {
1010
const funAbi = abi.filter(({type}) => type === 'function');

packages/lightcone_v2.js/src/lib/wallet/ethereum/eth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import code from '../common/code';
55

66
export default class Eth {
77

8-
host: string
8+
host: string;
99

1010
constructor(host) {
1111
this.host = host;

packages/lightcone_v2.js/src/lib/wallet/ethereum/token.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ import Transaction from './transaction';
66
import request from '../common/request';
77
import {toBuffer} from "../common/formatter";
88

9-
var ethereumjs_abi = require('ethereumjs-abi')
9+
var ethereumjs_abi = require('ethereumjs-abi');
1010

1111
// HACK: What is the host in wallet/token?
1212
const host = 'host';
1313

1414
export default class Token {
1515

16-
address: string
17-
symbol: string
18-
name: string
19-
digits: number
20-
unit: number
21-
website: string
22-
allowance: number
23-
precision: number
24-
minTradeValue: number
16+
address: string;
17+
symbol: string;
18+
name: string;
19+
digits: number;
20+
unit: number;
21+
website: string;
22+
allowance: number;
23+
precision: number;
24+
minTradeValue: number;
2525

2626
constructor(input) {
2727
validator.validate({value: input, type: 'BASIC_TOKEN'});

packages/lightcone_v2.js/src/lib/wallet/ethereum/transaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const host = 'host';
1010

1111
export default class Transaction {
1212

13-
raw: string
14-
signed: string
13+
raw: string;
14+
signed: string;
1515

1616
constructor(rawTx) {
1717
validator.validate({value: rawTx, type: 'BASIC_TX'});

packages/lightcone_v2.js/src/lib/wallet/ethereum/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export function addParticipant({feeRecipient, signer, to, gasPrice, gasLimit, no
226226

227227
export function isValidEthAddress(address) {
228228
try {
229-
validator.validate({value: address, type: "ADDRESS"})
229+
validator.validate({value: address, type: "ADDRESS"});
230230
return true
231231
} catch (e) {
232232
return false

packages/lightcone_v2.js/src/sign/exchange.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ export class Exchange {
110110
if (this.accounts.get(wallet) == null) {
111111
const keyPair = generateKeyPair();
112112
this.currentWalletAccount = wallet;
113-
let rawTx: Transaction = await this.createOrUpdateAccount(keyPair.publicKeyX, keyPair.publicKeyY, gasPrice)
114-
const signedTx = wallet.signEthereumTx(rawTx);
113+
let rawTx: Transaction = await this.createOrUpdateAccount(keyPair.publicKeyX, keyPair.publicKeyY, gasPrice);
114+
const signedTx = wallet.signEthereumTx(rawTx.raw);
115115

116116
// TODO: Let's avoid using Promises. Change this part to await.
117117
// At least, avoid using a Promise in another Promise.
118-
wallet.sendTransaction(new Eth('localhost:8545'), signedTx).then(() => { // TODO: config
118+
wallet.sendTransaction(new Eth('http://localhost:8545'), signedTx).then(() => { // TODO: config
119119
grpcClientService.getAccount(wallet.getAddress()).then((account: Account) => {
120120
const dexAccount = new DexAccount();
121121
dexAccount.nonce = 0;
@@ -138,12 +138,12 @@ export class Exchange {
138138
public async createOrUpdateAccount(publicX: string, publicY: string, gasPrice: number) {
139139
// FIXME: ethereum.abi.Contracts.ExchangeContract.encodeInputs returns error
140140
// Unhandled Rejection (TypeError): name.startsWith is not a function
141-
console.log('Start encode input of createOrUpdateAccount')
141+
console.log('Start encode input of createOrUpdateAccount');
142142
const data = ethereum.abi.Contracts.ExchangeContract.encodeInputs('createOrUpdateAccount', {
143143
pubKeyX: fm.toBN(publicX),
144144
pubKeyY: fm.toBN(publicY)
145145
});
146-
console.log('End encode input of createOrUpdateAccount')
146+
console.log('End encode input of createOrUpdateAccount');
147147
return new Transaction({
148148
to: this.exchangeAddr,
149149
value: '0x0',

packages/lightcone_v2.js/tslint.json

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)