Skip to content

Commit 3876332

Browse files
author
Gil Amran
committed
run prettier on all the code
1 parent aa8842e commit 3876332

37 files changed

+271
-268
lines changed

e2e/Gamma.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const util = require("util");
22
const execFile = util.promisify(require("child_process").execFile);
33

4-
const GAMMA_PORT = 8080;
5-
const GAMMA_ENDPOINT = "localhost";
4+
const GAMMA_PORT = 8080;
5+
const GAMMA_ENDPOINT = "localhost";
66
const VIRTUAL_CHAIN_ID = 42; // gamma-cli config default
7-
const EXPERIMENTAL = true;
7+
const EXPERIMENTAL = true;
88

99
async function gammaCliRun(args) {
1010
try {
@@ -43,5 +43,5 @@ module.exports = {
4343
VIRTUAL_CHAIN_ID,
4444
start,
4545
shutdown,
46-
getEndpoint
47-
};
46+
getEndpoint,
47+
};

e2e/nodejs/e2e.test.js

+3-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const Orbs = require("../../dist/index.js");
22
const Gamma = require("./../Gamma");
33

44
describe("E2E nodejs", () => {
5-
65
beforeEach(async () => {
76
jest.setTimeout(60000);
87
await Gamma.start();
@@ -13,7 +12,6 @@ describe("E2E nodejs", () => {
1312
});
1413

1514
test("SimpleTransfer", async () => {
16-
1715
// create sender account
1816
const sender = Orbs.createAccount();
1917

@@ -25,13 +23,7 @@ describe("E2E nodejs", () => {
2523
const client = new Orbs.Client(endpoint, Gamma.VIRTUAL_CHAIN_ID, "TEST_NET");
2624

2725
// create transfer transaction
28-
const [tx, txId] = client.createTransaction(
29-
sender.publicKey,
30-
sender.privateKey,
31-
"BenchmarkToken",
32-
"transfer",
33-
[new Orbs.ArgUint64(10), new Orbs.ArgAddress(receiver.address)]
34-
);
26+
const [tx, txId] = client.createTransaction(sender.publicKey, sender.privateKey, "BenchmarkToken", "transfer", [new Orbs.ArgUint64(10), new Orbs.ArgAddress(receiver.address)]);
3527

3628
// send the transaction
3729
const transferResponse = await client.sendTransaction(tx);
@@ -57,24 +49,17 @@ describe("E2E nodejs", () => {
5749
expect(txProofResponse.packedReceipt.byteLength).toBeGreaterThan(10);
5850

5951
// create balance query
60-
const query = client.createQuery(
61-
receiver.publicKey,
62-
"BenchmarkToken",
63-
"getBalance",
64-
[new Orbs.ArgAddress(receiver.address)]
65-
);
52+
const query = client.createQuery(receiver.publicKey, "BenchmarkToken", "getBalance", [new Orbs.ArgAddress(receiver.address)]);
6653

6754
// send the query
6855
const balanceResponse = await client.sendQuery(query);
6956
console.log(balanceResponse);
7057
expect(balanceResponse.requestStatus).toEqual("COMPLETED");
7158
expect(balanceResponse.executionResult).toEqual("SUCCESS");
7259
expect(balanceResponse.outputArguments[0]).toEqual(new Orbs.ArgUint64(10));
73-
7460
});
7561

7662
test("TextualError", async () => {
77-
7863
// create client
7964
const endpoint = Gamma.getEndpoint();
8065
const client = new Orbs.Client(endpoint, Gamma.VIRTUAL_CHAIN_ID, "TEST_NET");
@@ -87,7 +72,5 @@ describe("E2E nodejs", () => {
8772
error = e;
8873
}
8974
expect(error.toString()).toMatch("http request is not a valid membuffer");
90-
9175
});
92-
93-
});
76+
});

src/codec/Arguments.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ function argumentsBuilders(args: Argument[]): Protocol.ArgumentBuilder[] {
3636
const arg = args[i];
3737
switch (arg.type) {
3838
case "uint32":
39-
res.push(new Protocol.ArgumentBuilder({type: 0, value: arg.value}));
39+
res.push(new Protocol.ArgumentBuilder({ type: 0, value: arg.value }));
4040
break;
4141
case "uint64":
42-
res.push(new Protocol.ArgumentBuilder({type: 1, value: arg.value}));
42+
res.push(new Protocol.ArgumentBuilder({ type: 1, value: arg.value }));
4343
break;
4444
case "string":
45-
res.push(new Protocol.ArgumentBuilder({type: 2, value: arg.value}));
45+
res.push(new Protocol.ArgumentBuilder({ type: 2, value: arg.value }));
4646
break;
4747
case "bytes":
48-
res.push(new Protocol.ArgumentBuilder({type: 3, value: arg.value}));
48+
res.push(new Protocol.ArgumentBuilder({ type: 3, value: arg.value }));
4949
break;
5050
default:
5151
throw new Error(`Argument unknown type: ${arg}`);
@@ -56,7 +56,7 @@ function argumentsBuilders(args: Argument[]): Protocol.ArgumentBuilder[] {
5656

5757
function argumentsArray(args: Argument[]): InternalMessage {
5858
const builders = argumentsBuilders(args);
59-
const buf = new Protocol.ArgumentArrayBuilder({arguments: builders}).build();
59+
const buf = new Protocol.ArgumentArrayBuilder({ arguments: builders }).build();
6060
return new InternalMessage(buf, buf.byteLength, Protocol.ArgumentArray_Scheme, []);
6161
}
6262

@@ -97,4 +97,4 @@ export function packedArgumentsDecode(buf: Uint8Array): Argument[] {
9797
index++;
9898
}
9999
return res;
100-
}
100+
}

src/codec/Events.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export function packedEventsDecode(buf: Uint8Array): Event[] {
1919
res.push({
2020
contractName: eventMsg.getString(0),
2121
eventName: eventMsg.getString(1),
22-
arguments: packedArgumentsDecode(eventMsg.rawBufferWithHeaderForField(2, 0))
22+
arguments: packedArgumentsDecode(eventMsg.rawBufferWithHeaderForField(2, 0)),
2323
});
2424
index++;
2525
}
2626
return res;
27-
}
27+
}

src/codec/ExecutionResult.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ export function executionResultDecode(executionResult: number): ExecutionResult
2323
default:
2424
throw new Error(`unsupported ExecutionResult received: ${executionResult}`);
2525
}
26-
}
26+
}

src/codec/NetworkType.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export enum NetworkType {
22
NETWORK_TYPE_MAIN_NET = "MAIN_NET",
3-
NETWORK_TYPE_TEST_NET = "TEST_NET"
3+
NETWORK_TYPE_TEST_NET = "TEST_NET",
44
}
55

66
export function networkTypeEncode(networkType: NetworkType): number {
@@ -12,4 +12,4 @@ export function networkTypeEncode(networkType: NetworkType): number {
1212
default:
1313
throw new Error(`unsupported network type given ${networkType}`);
1414
}
15-
}
15+
}

src/codec/OpGetTransactionReceiptProof.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function encodeGetTransactionReceiptProofRequest(req: GetTransactionRecei
4646
virtualChainId: req.virtualChainId,
4747
transactionTimestamp: txTimestamp,
4848
txHash: txHash,
49-
})
49+
}),
5050
});
5151

5252
// return
@@ -90,6 +90,6 @@ export function decodeGetTransactionReceiptProofResponse(buf: Uint8Array): GetTr
9090
blockHeight: requestResultMsg.getUint64(1),
9191
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2)),
9292
packedProof: getTransactionReceiptProofResponseMsg.getBytes(3),
93-
packedReceipt: transactionReceiptBuf
93+
packedReceipt: transactionReceiptBuf,
9494
};
95-
}
95+
}

src/codec/OpGetTransactionStatus.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function encodeGetTransactionStatusRequest(req: GetTransactionStatusReque
4444
virtualChainId: req.virtualChainId,
4545
transactionTimestamp: txTimestamp,
4646
txHash: txHash,
47-
})
47+
}),
4848
});
4949

5050
// return
@@ -86,6 +86,6 @@ export function decodeGetTransactionStatusResponse(buf: Uint8Array): GetTransact
8686
outputEvents: outputEventArray,
8787
transactionStatus: transactionStatus,
8888
blockHeight: requestResultMsg.getUint64(1),
89-
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2))
89+
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2)),
9090
};
91-
}
91+
}

src/codec/OpRunQuery.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ export function encodeRunQueryRequest(req: RunQueryRequest): Uint8Array {
5555
scheme: 0,
5656
eddsa: new Protocol.EdDSA01SignerBuilder({
5757
networkType: networkType,
58-
signerPublicKey: req.publicKey
59-
})
58+
signerPublicKey: req.publicKey,
59+
}),
6060
}),
6161
contractName: req.contractName,
6262
methodName: req.methodName,
63-
inputArgumentArray: inputArgumentArray
63+
inputArgumentArray: inputArgumentArray,
6464
}),
65-
signature: null
66-
})
65+
signature: null,
66+
}),
6767
});
6868

6969
// return
@@ -100,6 +100,6 @@ export function decodeRunQueryResponse(buf: Uint8Array): RunQueryResponse {
100100
outputArguments: outputArgumentArray,
101101
outputEvents: outputEventArray,
102102
blockHeight: requestResultMsg.getUint64(1),
103-
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2))
103+
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2)),
104104
};
105-
}
105+
}

src/codec/OpSendTransaction.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ export function encodeSendTransactionRequest(req: SendTransactionRequest, privat
6565
scheme: 0,
6666
eddsa: new Protocol.EdDSA01SignerBuilder({
6767
networkType: networkType,
68-
signerPublicKey: req.publicKey
69-
})
68+
signerPublicKey: req.publicKey,
69+
}),
7070
}),
7171
contractName: req.contractName,
7272
methodName: req.methodName,
73-
inputArgumentArray: inputArgumentArray
73+
inputArgumentArray: inputArgumentArray,
7474
}),
75-
signature: new Uint8Array(Signature.ED25519_SIGNATURE_SIZE_BYTES)
76-
})
75+
signature: new Uint8Array(Signature.ED25519_SIGNATURE_SIZE_BYTES),
76+
}),
7777
});
7878

7979
// read encoded bytes
@@ -127,6 +127,6 @@ export function decodeSendTransactionResponse(buf: Uint8Array): SendTransactionR
127127
outputEvents: outputEventArray,
128128
transactionStatus: transactionStatus,
129129
blockHeight: requestResultMsg.getUint64(1),
130-
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2))
130+
blockTimestamp: Protocol.unixNanoToDate(requestResultMsg.getUint64(2)),
131131
};
132-
}
132+
}

src/codec/RequestStatus.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export enum RequestStatus {
44
REQUEST_STATUS_BAD_REQUEST = "BAD_REQUEST",
55
REQUEST_STATUS_CONGESTION = "CONGESTION",
66
REQUEST_STATUS_SYSTEM_ERROR = "SYSTEM_ERROR",
7-
REQUEST_STATUS_OUT_OF_SYNC = "OUT_OF_SYNC"
7+
REQUEST_STATUS_OUT_OF_SYNC = "OUT_OF_SYNC",
88
}
99

1010
export function requestStatusDecode(requestStatus: number): RequestStatus {
@@ -26,4 +26,4 @@ export function requestStatusDecode(requestStatus: number): RequestStatus {
2626
default:
2727
throw new Error(`unsupported RequestStatus received: ${requestStatus}`);
2828
}
29-
}
29+
}

src/codec/TransactionStatus.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export enum TransactionStatus {
1414
TRANSACTION_STATUS_REJECTED_SMART_CONTRACT_PRE_ORDER = "REJECTED_SMART_CONTRACT_PRE_ORDER",
1515
TRANSACTION_STATUS_REJECTED_TIMESTAMP_AHEAD_OF_NODE_TIME = "REJECTED_TIMESTAMP_AHEAD_OF_NODE_TIME",
1616
TRANSACTION_STATUS_REJECTED_CONGESTION = "REJECTED_CONGESTION",
17-
TRANSACTION_STATUS_REJECTED_NODE_OUT_OF_SYNC = "REJECTED_NODE_OUT_OF_SYNC"
17+
TRANSACTION_STATUS_REJECTED_NODE_OUT_OF_SYNC = "REJECTED_NODE_OUT_OF_SYNC",
1818
}
1919

2020
export function transactionStatusDecode(transactionStatus: number): TransactionStatus {
@@ -56,4 +56,4 @@ export function transactionStatusDecode(transactionStatus: number): TransactionS
5656
default:
5757
throw new Error(`unsupported TransactionStatus received: ${transactionStatus}`);
5858
}
59-
}
59+
}

0 commit comments

Comments
 (0)