Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit bc9fbd8

Browse files
committed
WCSPR Jsclient removed and ERC20, PAIR, FACTORY and ROUTER Jsclient code cleaned
1 parent b394c23 commit bc9fbd8

File tree

18 files changed

+29
-1666
lines changed

18 files changed

+29
-1666
lines changed

JsClients/ERC20/src/erc20.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class ERC20Client {
234234
});
235235

236236
if (deployHash !== null) {
237-
this.addPendingDeploy(ERC20Events.Approval, deployHash);
237+
238238
return deployHash;
239239
} else {
240240
throw Error("Invalid Deploy");
@@ -264,7 +264,7 @@ class ERC20Client {
264264
});
265265

266266
if (deployHash !== null) {
267-
this.addPendingDeploy(ERC20Events.Transfer, deployHash);
267+
268268
return deployHash;
269269
} else {
270270
throw Error("Invalid Deploy");
@@ -296,7 +296,7 @@ class ERC20Client {
296296
});
297297

298298
if (deployHash !== null) {
299-
this.addPendingDeploy(ERC20Events.Transfer, deployHash);
299+
300300
return deployHash;
301301
} else {
302302
throw Error("Invalid Deploy");
@@ -325,7 +325,7 @@ class ERC20Client {
325325
});
326326

327327
if (deployHash !== null) {
328-
this.addPendingDeploy(ERC20Events.Transfer, deployHash);
328+
329329
return deployHash;
330330
} else {
331331
throw Error("Invalid Deploy");
@@ -355,7 +355,7 @@ class ERC20Client {
355355
// });
356356

357357
// if (deployHash !== null) {
358-
// this.addPendingDeploy(ERC20Events.Transfer, deployHash);
358+
359359
// return deployHash;
360360
// } else {
361361
// throw Error("Invalid Deploy");
@@ -385,7 +385,7 @@ class ERC20Client {
385385
});
386386

387387
if (deployHash !== null) {
388-
this.addPendingDeploy(ERC20Events.Transfer, deployHash);
388+
389389
return deployHash;
390390
} else {
391391
throw Error("Invalid Deploy");
@@ -423,7 +423,7 @@ class ERC20Client {
423423
});
424424

425425
if (deployHash !== null) {
426-
this.addPendingDeploy(ERC20Events.Approval, deployHash);
426+
427427
return deployHash;
428428
} else {
429429
throw Error("Invalid Deploy");

JsClients/ERC20/test/installed.ts

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -69,80 +69,6 @@ const erc20 = new ERC20Client(
6969

7070
const test = async () => {
7171

72-
// const listener = erc20.onEvent(
73-
// [
74-
// ERC20Events.Approval,
75-
// ERC20Events.Transfer
76-
// ],
77-
// async (eventName, deploy, result) => {
78-
// if (deploy.success) {
79-
// console.log(`Successfull deploy of: ${eventName}, deployHash: ${deploy.deployHash}`);
80-
// const [timestamp,gasPrice,block_hash]= await getDeploy(NODE_ADDRESS!, deploy.deployHash);
81-
// console.log("... Deployhash: ", deploy.deployHash);
82-
// console.log("... Timestamp: ", timestamp);
83-
// //console.log("... GasPrice: ", gasPrice);
84-
// console.log("... Block hash: ", block_hash);
85-
86-
// let newData = JSON.parse(JSON.stringify(result.value()));
87-
88-
// if(eventName=="approve")
89-
// {
90-
// console.log(eventName+ " Event result: ");
91-
// console.log(newData[0][0].data + " = " + newData[0][1].data);
92-
// console.log(newData[1][0].data + " = " + newData[1][1].data);
93-
// console.log(newData[2][0].data + " = " + newData[2][1].data);
94-
// console.log(newData[3][0].data + " = " + newData[3][1].data);
95-
// console.log(newData[4][0].data + " = " + newData[4][1].data);
96-
// }
97-
// else if(eventName=="erc20_transfer")
98-
// {
99-
// console.log(eventName+ " Event result: ");
100-
// console.log(newData[0][0].data + " = " + newData[0][1].data);
101-
// console.log(newData[1][0].data + " = " + newData[1][1].data);
102-
103-
// console.log(newData[2][0].data + " = " + newData[2][1].data);
104-
// console.log(newData[3][0].data + " = " + newData[3][1].data);
105-
// console.log(newData[4][0].data + " = " + newData[4][1].data);
106-
107-
// var flag=0;
108-
// var temp=(newData[3][1].data).split('(');
109-
// console.log("temp[0]: ",temp[0]);
110-
// if(temp[0] == "Key::Account(")
111-
// {
112-
// flag=1;
113-
// }
114-
// var from=splitdata(newData[2][1].data);
115-
// var to=splitdata(newData[3][1].data);
116-
// var value=parseInt(newData[4][1].data);
117-
118-
// console.log("from: ", from);
119-
// console.log("to: ", to);
120-
// console.log("value: ",value);
121-
122-
// if(flag==0)
123-
// {
124-
// request(GRAPHQL!,
125-
// `mutation handleTransfer( $from: String!, $to: String!, $value: Int!, $pairAddress: String!, $deployHash: String!, $timeStamp: String!, $blockHash: String!){
126-
// handleTransfer( from: $from, to: $to, value: $value, pairAddress: $pairAddress, deployHash: $deployHash, timeStamp: $timeStamp, blockHash: $blockHash) {
127-
// result
128-
// }
129-
130-
// }`,
131-
// {from:from, to: to, value: value, pairAddress: to, deployHash:deploy.deployHash,timeStamp:timestamp.toString(), blockHash:block_hash})
132-
// .then(data => console.log(data))
133-
// .catch(error => console.error(error));
134-
// }
135-
136-
// }
137-
138-
// } else {
139-
// console.log(`Failed deploy of ${eventName}, deployHash: ${deploy.deployHash}`);
140-
// console.log(`Error: ${deploy.error}`);
141-
// }
142-
// }
143-
// );
144-
// console.log("listener: ",listener);
145-
14672
await erc20.setContractHash(TOKEN1_CONTRACT!);
14773

14874
// // //name

JsClients/FACTORY/src/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class FACTORYClient {
244244
});
245245

246246
if (deployHash !== null) {
247-
this.addPendingDeploy(FACTORYEvents.PairCreated, deployHash);
247+
248248
return deployHash;
249249
} else {
250250
throw Error("Invalid Deploy");

JsClients/FACTORY/test/installed.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -51,55 +51,6 @@ function splitdata(data:string)
5151

5252
const test = async () => {
5353

54-
// const listener = factory.onEvent(
55-
// [
56-
// FACTORYEvents.PairCreated
57-
// ],
58-
// async (eventName, deploy, result) => {
59-
// if (deploy.success) {
60-
// console.log(`Successfull deploy of: ${eventName}, deployHash: ${deploy.deployHash}`);
61-
// const [timestamp,block_hash]= await getDeploy(NODE_ADDRESS!, deploy.deployHash);
62-
// console.log("... Timestamp: ", timestamp);
63-
// console.log("... Block hash: ", block_hash);
64-
// console.log("result.value(): ", result.value());
65-
// let newData = JSON.parse(JSON.stringify(result.value()));
66-
67-
// console.log(eventName+ " Event result: ");
68-
// console.log(newData[0][0].data + " = " + newData[0][1].data);
69-
// console.log(newData[1][0].data + " = " + newData[1][1].data);
70-
// console.log(newData[2][0].data + " = " + newData[2][1].data);
71-
// console.log(newData[3][0].data + " = " + newData[3][1].data);
72-
// console.log(newData[4][0].data + " = " + newData[4][1].data);
73-
// console.log(newData[5][0].data + " = " + newData[5][1].data);
74-
75-
// var allpairslength=parseInt(newData[0][1].data);
76-
// var pair=splitdata(newData[3][1].data);
77-
// var token0=splitdata(newData[4][1].data);
78-
// var token1=splitdata(newData[5][1].data);
79-
80-
// console.log("allpairslength: ", allpairslength);
81-
// console.log("pair splited: ", pair);
82-
// console.log("token0 splited: ", token0);
83-
// console.log("token1 splited: ", token1);
84-
85-
// request(GRAPHQL!,
86-
// `mutation handleNewPair( $token0: String!, $token1: String!, $pair: String!, $all_pairs_length: Int!, $timeStamp: String!, $blockHash: String!){
87-
// handleNewPair( token0: $token0, token1: $token1, pair: $pair, all_pairs_length: $all_pairs_length, timeStamp: $timeStamp, blockHash: $blockHash) {
88-
// result
89-
// }
90-
91-
// }`,
92-
// {token0:token0, token1:token1, pair: pair, all_pairs_length: allpairslength, timeStamp:timestamp.toString(), blockHash:block_hash})
93-
// .then(data => console.log(data))
94-
// .catch(error => console.error(error));
95-
96-
// } else {
97-
// console.log(`Failed deploy of ${eventName}, deployHash: ${deploy.deployHash}`);
98-
// console.log(`Error: ${deploy.error}`);
99-
// }
100-
// }
101-
// );
102-
10354
await sleep(5 * 1000);
10455

10556
let accountInfo = await utils.getAccountInfo(NODE_ADDRESS!, KEYS.publicKey);

JsClients/PAIR/src/pair.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class PAIRClient {
266266
});
267267

268268
if (deployHash !== null) {
269-
this.addPendingDeploy(PAIREvents.Approval, deployHash);
269+
270270
return deployHash;
271271
} else {
272272
throw Error("Invalid Deploy");
@@ -297,7 +297,7 @@ class PAIRClient {
297297
});
298298

299299
if (deployHash !== null) {
300-
this.addPendingDeploy(PAIREvents.Transfer, deployHash);
300+
301301
return deployHash;
302302
} else {
303303
throw Error("Invalid Deploy");
@@ -329,7 +329,7 @@ class PAIRClient {
329329
});
330330

331331
if (deployHash !== null) {
332-
this.addPendingDeploy(PAIREvents.Transfer, deployHash);
332+
333333
return deployHash;
334334
} else {
335335
throw Error("Invalid Deploy");
@@ -357,8 +357,7 @@ class PAIRClient {
357357
});
358358

359359
if (deployHash !== null) {
360-
this.addPendingDeploy(PAIREvents.Sync, deployHash);
361-
this.addPendingDeploy(PAIREvents.Mint, deployHash);
360+
362361
return deployHash;
363362
} else {
364363
throw Error("Invalid Deploy");
@@ -385,8 +384,7 @@ class PAIRClient {
385384
});
386385

387386
if (deployHash !== null) {
388-
this.addPendingDeploy(PAIREvents.Sync, deployHash);
389-
this.addPendingDeploy(PAIREvents.Burn, deployHash);
387+
390388
return deployHash;
391389
} else {
392390
throw Error("Invalid Deploy");
@@ -424,7 +422,7 @@ class PAIRClient {
424422
});
425423

426424
if (deployHash !== null) {
427-
this.addPendingDeploy(PAIREvents.Approval, deployHash);
425+
428426
return deployHash;
429427
} else {
430428
throw Error("Invalid Deploy");
@@ -481,7 +479,7 @@ class PAIRClient {
481479
});
482480

483481
if (deployHash !== null) {
484-
this.addPendingDeploy(PAIREvents.Transfer, deployHash);
482+
485483
return deployHash;
486484
} else {
487485
throw Error("Invalid Deploy");
@@ -512,7 +510,7 @@ class PAIRClient {
512510
});
513511

514512
if (deployHash !== null) {
515-
this.addPendingDeploy(PAIREvents.Transfer, deployHash);
513+
516514
return deployHash;
517515
} else {
518516
throw Error("Invalid Deploy");
@@ -540,7 +538,7 @@ class PAIRClient {
540538
});
541539

542540
if (deployHash !== null) {
543-
this.addPendingDeploy(PAIREvents.Sync, deployHash);
541+
544542
return deployHash;
545543
} else {
546544
throw Error("Invalid Deploy");
@@ -574,8 +572,7 @@ class PAIRClient {
574572
});
575573

576574
if (deployHash !== null) {
577-
this.addPendingDeploy(PAIREvents.Sync, deployHash);
578-
this.addPendingDeploy(PAIREvents.Swap, deployHash);
575+
579576
return deployHash;
580577
} else {
581578
throw Error("Invalid Deploy");
@@ -641,7 +638,7 @@ class PAIRClient {
641638
});
642639

643640
if (deployHash !== null) {
644-
this.addPendingDeploy(PAIREvents.Transfer, deployHash);
641+
645642
return deployHash;
646643
} else {
647644
throw Error("Invalid Deploy");

0 commit comments

Comments
 (0)