Skip to content

Commit 21e06f4

Browse files
MSNTCSsgkim126
authored andcommitted
Apply yarn fmt and yarn lint
Due to previous settings, these files were not include in yarn lint and yarn fmt
1 parent cf87f8a commit 21e06f4

File tree

10 files changed

+66
-71
lines changed

10 files changed

+66
-71
lines changed

test/src/sdk/src/core/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,8 @@ export class Core {
419419
}
420420
| {
421421
recipientFrom: AssetAddressValue;
422-
}) &
422+
}
423+
) &
423424
(
424425
| {
425426
lockScriptHashFee: H160Value;
@@ -428,7 +429,8 @@ export class Core {
428429
| {
429430
recipientFee: AssetAddressValue;
430431
}
431-
| {})
432+
| {}
433+
)
432434
): Order {
433435
const {
434436
assetTypeFrom,
@@ -886,7 +888,8 @@ export class Core {
886888
| {
887889
lockScriptHash: H256Value;
888890
parameters: Buffer[];
889-
})
891+
}
892+
)
890893
): AssetTransferOutput {
891894
const { assetType, shardId } = params;
892895
const quantity = U64.ensure(params.quantity);

test/src/sdk/src/core/transaction/AssetMintOutput.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ export class AssetMintOutput {
6767
break;
6868
default:
6969
throw Error(
70-
`Unexpected type of AssetAddress: ${type}, ${
71-
data.recipient
72-
}`
70+
`Unexpected type of AssetAddress: ${type}, ${data.recipient}`
7371
);
7472
}
7573
} else {

test/src/sdk/src/core/transaction/AssetTransferOutput.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ export class AssetTransferOutput {
9191
break;
9292
default:
9393
throw Error(
94-
`Unexpected type of AssetAddress: ${type}, ${
95-
data.recipient
96-
}`
94+
`Unexpected type of AssetAddress: ${type}, ${data.recipient}`
9795
);
9896
}
9997
} else {

test/src/sdk/src/core/transaction/ChangeAssetScheme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class ChangeAssetScheme extends Transaction {
6161
return "changeAssetScheme";
6262
}
6363

64-
protected actionToEncodeObject(): (any)[] {
64+
protected actionToEncodeObject(): any[] {
6565
const encoded = this._transaction.toEncodeObject();
6666
encoded.push(this.approvals);
6767
return encoded;

test/src/sdk/src/core/transaction/Order.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,17 @@ export class Order {
143143
}
144144
| {
145145
recipientFrom: AssetAddress;
146-
}) &
146+
}
147+
) &
147148
(
148149
| {
149150
lockScriptHashFee: H160;
150151
parametersFee: Buffer[];
151152
}
152153
| {
153154
recipientFee: AssetAddress;
154-
})
155+
}
156+
)
155157
) {
156158
if ("recipientFrom" in data) {
157159
const { lockScriptHash, parameters } = decomposeRecipient(

test/src/sdk/src/core/transaction/WrapCCC.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ export class WrapCCC extends Transaction implements AssetTransaction {
6262
break;
6363
default:
6464
throw Error(
65-
`Unexpected type of AssetAddress: ${type}, ${
66-
data.recipient
67-
}`
65+
`Unexpected type of AssetAddress: ${type}, ${data.recipient}`
6866
);
6967
}
7068
} else {

test/src/sdk/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ class SDK {
5151
keyStoreType?: KeyStoreType;
5252
networkId?: NetworkId;
5353
}) {
54-
const {
55-
keyStoreType = "local",
56-
networkId = "tc",
57-
} = params;
54+
const { keyStoreType = "local", networkId = "tc" } = params;
5855

5956
this.core = new Core({ networkId });
6057
this.key = new Key({

test/src/stakeholder/src/actionData.ts

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import RPC from "foundry-rpc";
66
import { SDK } from "../../sdk/src";
77
import { H512, PlatformAddress, U64 } from "../../sdk/src/core/classes";
88

9-
import {toHex} from "codechain-primitives/lib";
9+
import { toHex } from "codechain-primitives/lib";
1010
import { HANDLER_ID } from "./index";
1111
import {
1212
decodeH512,
@@ -22,16 +22,18 @@ export async function getUndelegatedCCS(
2222
address: PlatformAddressValue,
2323
blockNumber?: number
2424
): Promise<U64> {
25-
const data = await rpc.engine.getCustomActionData(
26-
{ handlerId: HANDLER_ID,
27-
bytes: `0x${toHex(RLP.encode([
28-
"Account",
29-
PlatformAddress.ensure(address)
30-
.getAccountId()
31-
.toEncodeObject()
32-
]))}`,
33-
blockNumber }
34-
);
25+
const data = await rpc.engine.getCustomActionData({
26+
handlerId: HANDLER_ID,
27+
bytes: `0x${toHex(
28+
RLP.encode([
29+
"Account",
30+
PlatformAddress.ensure(address)
31+
.getAccountId()
32+
.toEncodeObject()
33+
])
34+
)}`,
35+
blockNumber
36+
});
3537
if (data == null) {
3638
return new U64(0);
3739
}
@@ -43,11 +45,11 @@ export async function getCCSHolders(
4345
sdk: SDK,
4446
blockNumber?: number
4547
): Promise<PlatformAddress[]> {
46-
const data = await rpc.engine.getCustomActionData(
47-
{ handlerId: HANDLER_ID,
48-
bytes : `0x${toHex(RLP.encode(["StakeholderAddresses"]))}`,
49-
blockNumber }
50-
);
48+
const data = await rpc.engine.getCustomActionData({
49+
handlerId: HANDLER_ID,
50+
bytes: `0x${toHex(RLP.encode(["StakeholderAddresses"]))}`,
51+
blockNumber
52+
});
5153
if (data == null) {
5254
throw Error("Expected non-null value, but got a null");
5355
}
@@ -70,11 +72,13 @@ export async function getDelegations(
7072
delegator: PlatformAddress,
7173
blockNumber?: number
7274
): Promise<Delegation[]> {
73-
const data = await rpc.engine.getCustomActionData(
74-
{handlerId: HANDLER_ID,
75-
bytes : `0x${toHex(RLP.encode(["Delegation", delegator.accountId.toEncodeObject()]))}`,
76-
blockNumber}
77-
);
75+
const data = await rpc.engine.getCustomActionData({
76+
handlerId: HANDLER_ID,
77+
bytes: `0x${toHex(
78+
RLP.encode(["Delegation", delegator.accountId.toEncodeObject()])
79+
)}`,
80+
blockNumber
81+
});
7882
if (data == null) {
7983
return [];
8084
}
@@ -106,11 +110,11 @@ export async function getCandidates(
106110
rpc: RPC,
107111
blockNumber?: number
108112
): Promise<Candidate[]> {
109-
const data = await rpc.engine.getCustomActionData(
110-
{handlerId: HANDLER_ID,
111-
bytes : `0x${toHex(RLP.encode( ["Candidates"]))}`,
112-
blockNumber}
113-
);
113+
const data = await rpc.engine.getCustomActionData({
114+
handlerId: HANDLER_ID,
115+
bytes: `0x${toHex(RLP.encode(["Candidates"]))}`,
116+
blockNumber
117+
});
114118
if (data == null) {
115119
return [];
116120
}
@@ -145,9 +149,9 @@ export async function getJailed(
145149
): Promise<Prisoner[]> {
146150
const data = await rpc.engine.getCustomActionData({
147151
handlerId: HANDLER_ID,
148-
bytes : `0x${toHex(RLP.encode( ["Jail"]))}`,
149-
blockNumber}
150-
);
152+
bytes: `0x${toHex(RLP.encode(["Jail"]))}`,
153+
blockNumber
154+
});
151155
if (data == null) {
152156
return [];
153157
}
@@ -172,11 +176,11 @@ export async function getBanned(
172176
sdk: SDK,
173177
blockNumber?: number
174178
): Promise<PlatformAddress[]> {
175-
const data = await rpc.engine.getCustomActionData(
176-
{handlerId: HANDLER_ID,
177-
bytes : `0x${toHex(RLP.encode( ["Banned"]))}`,
178-
blockNumber}
179-
);
179+
const data = await rpc.engine.getCustomActionData({
180+
handlerId: HANDLER_ID,
181+
bytes: `0x${toHex(RLP.encode(["Banned"]))}`,
182+
blockNumber
183+
});
180184
if (data == null) {
181185
return [];
182186
}
@@ -204,11 +208,11 @@ export async function getIntermediateRewards(
204208
sdk: SDK,
205209
blockNumber?: number
206210
): Promise<IntermediateRewards> {
207-
const data = await rpc.engine.getCustomActionData(
208-
{ handlerId: HANDLER_ID,
209-
bytes : `0x${toHex(RLP.encode(["IntermediateRewards"]))}`,
210-
blockNumber }
211-
);
211+
const data = await rpc.engine.getCustomActionData({
212+
handlerId: HANDLER_ID,
213+
bytes: `0x${toHex(RLP.encode(["IntermediateRewards"]))}`,
214+
blockNumber
215+
});
212216
if (data == null) {
213217
return {
214218
previous: [],
@@ -254,11 +258,11 @@ export async function getValidators(
254258
sdk: SDK,
255259
blockNumber?: number
256260
): Promise<Validator[]> {
257-
const data = await rpc.engine.getCustomActionData(
258-
{handlerId: HANDLER_ID,
259-
bytes : `0x${toHex(RLP.encode(["Validators"]))}`,
260-
blockNumber}
261-
);
261+
const data = await rpc.engine.getCustomActionData({
262+
handlerId: HANDLER_ID,
263+
bytes: `0x${toHex(RLP.encode(["Validators"]))}`,
264+
blockNumber
265+
});
262266
if (data == null) {
263267
return [];
264268
}

test/src/stakeholder/src/rpc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function getTermMetadata(
1111
rpc: RPC,
1212
blockNumber?: number
1313
): Promise<TermMetadata | null> {
14-
const result = await rpc.chain.getTermMetadata({blockNumber})
14+
const result = await rpc.chain.getTermMetadata({ blockNumber });
1515
if (result === null) {
1616
return null;
1717
}
@@ -33,7 +33,7 @@ export async function getPossibleAuthors(
3333
rpc: RPC,
3434
blockNumber?: number
3535
): Promise<PlatformAddress[] | null> {
36-
const result = await rpc.chain.getPossibleAuthors({blockNumber});
36+
const result = await rpc.chain.getPossibleAuthors({ blockNumber });
3737
if (result === null) {
3838
return null;
3939
}

test/src/stakeholder/src/util.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { SDK } from "../../sdk/src";
2-
import {
3-
H256,
4-
H512,
5-
PlatformAddress,
6-
U64
7-
} from "../../sdk/src/core/classes";
2+
import { H256, H512, PlatformAddress, U64 } from "../../sdk/src/core/classes";
83

94
export function isArrayOf<T>(
105
list: any,

0 commit comments

Comments
 (0)