Skip to content

Commit dca1593

Browse files
committed
walletpack helpers
1 parent cff9687 commit dca1593

File tree

11 files changed

+3203
-3897
lines changed

11 files changed

+3203
-3897
lines changed

package-lock.json

Lines changed: 33 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"cors": "^2.8.4",
3333
"couchbase": "^2.6.5",
3434
"create-hash": "^1.2.0",
35-
"eosjs": "^16.0.9",
35+
"eosjs": "^20.0.0",
3636
"eosjs-ecc": "^4.0.4",
3737
"es6-promise": "^4.2.5",
3838
"express": "^4.16.4",

src/routes.js

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import { Router } from 'express';
22
import Blockchains, {flattenBlockchainObject} from './util/blockchains';
33

4-
import TransactionService, {PAYMENT_ACCOUNTS} from "./services/TransactionService";
5-
64
import PriceService, {PRICE_NETS, CURRENCIES} from './services/PriceService';
75
import AppService from "./services/AppService";
86
import VersionService from "./services/VersionService";
97
import ExplorerService from "./services/ExplorerService";
108
import FiatService from "./services/FiatService";
119
import ProxyService from "./services/ProxyService";
12-
import AccountService from "./services/AccountService";
1310
import NetworkService from "./services/NetworkService";
1411
import LanguageService from "./services/LanguageService";
1512
import StatusService from "./services/StatusService";
@@ -23,6 +20,7 @@ import ReflinkService from "./services/ReflinkService";
2320
import config from "./util/config";
2421
import * as ecc from "eosjs-ecc";
2522
import BitcoinService from "./services/BitcoinService";
23+
import WalletPackHelpers from "./services/WalletPackHelpers";
2624

2725
const bucket = couchbase('scatter');
2826

@@ -36,7 +34,6 @@ VersionService.setBucket(bucket);
3634
ExplorerService.setBucket(bucket);
3735
FiatService.setBucket(bucket);
3836
ProxyService.setBucket(bucket);
39-
AccountService.setBucket(bucket);
4037
NetworkService.setBucket(bucket);
4138
LanguageService.setBucket(bucket);
4239
FeeService.setBucket(bucket);
@@ -228,54 +225,27 @@ routes.get('/app/:applink', async (req, res) => {
228225
});
229226

230227

231-
232-
233-
234-
235228
/************************************************/
236229
/* */
237-
/* EOS ACCOUNTS */
230+
/* MOBILE HELPERS */
238231
/* */
239232
/************************************************/
240233

241234

242-
routes.post('/create_eos', async (req, res) => {
243-
returnResult({error:"makeaccounts is no longer valid."}, req, res);
235+
routes.post('/walletpack/abis', async (req, res) => {
236+
const {network, accounts} = req.body;
237+
returnResult(await WalletPackHelpers.getContract(network, accounts), req, res);
244238
});
245239

246-
routes.post('/create_bridge', async (req, res) => {
247-
const defaultError = {error:'There was an error creating the account. Please try again later.'};
248-
const {signature, key, name, machineId, free} = req.body;
249-
const ip = senderIp(req);
250-
251-
if(!key || !key.length) return returnResult({error:'Invalid Key'}, req, res);
252240

253-
if(free){
254-
if(machineId.length !== 64) return returnResult({error:'Bad Machine ID.'}, req, res);
255-
if(await AccountService.checkMachineId(machineId)) return returnResult({error:'One free account per user.'}, req, res);
256-
if(await AccountService.checkIp(ip)) return returnResult({error:'One free account per user.'}, req, res);
257-
if(!await AccountService.proveSignature(signature, key, AccountService.sha256(key+machineId+name))) return returnResult({error:'Signature does not match key.'}, req, res);
258241

259-
const created = await AccountService.createBridgeAccount(name, key, true);
260-
if(created && !created.hasOwnProperty('error')) await AccountService.logCreation(ip, machineId);
261-
returnResult(created, req, res);
262-
} else {
263-
const canCreate = await AccountService.canCreateBridge(key, signature);
264-
if(canCreate !== true) return returnResult(canCreate, req, res);
265242

266-
const created = await AccountService.createBridgeAccount(name, key);
267-
return returnResult(created, req, res);
268-
}
269-
});
243+
/************************************************/
244+
/* */
245+
/* EOS ACCOUNTS */
246+
/* */
247+
/************************************************/
270248

271-
routes.get('/machine/:id', async (req, res) => {
272-
return returnResult(false, req, res);
273-
// const {id} = req.params;
274-
// const ip = senderIp(req);
275-
// if(await AccountService.checkMachineId(id)) return returnResult(false, req, res);
276-
// if(await AccountService.checkIp(ip)) return returnResult(false, req, res);
277-
// returnResult(true, req, res);
278-
});
279249

280250

281251

0 commit comments

Comments
 (0)