Skip to content

Commit 6bcdd9b

Browse files
style: resolve style guide violations [ci-lint-fix]
1 parent c64c1c6 commit 6bcdd9b

6 files changed

Lines changed: 96 additions & 62 deletions

File tree

packages/crypto-key-pair-ecdsa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"devDependencies": {
3333
"@mainsail/contracts": "workspace:*",
3434
"@mainsail/crypto-config": "workspace:*",
35+
"@mainsail/crypto-wif": "workspace:*",
3536
"@mainsail/test-runner": "workspace:*",
3637
"@mainsail/validation": "workspace:*",
37-
"@mainsail/crypto-wif": "workspace:*",
3838
"bip39": "3.1.0",
3939
"uvu": "0.5.6"
4040
},

packages/crypto-key-pair-ecdsa/source/pair.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { KeyPairFactory } from "./pair";
1111
import { wallet1, wallets } from "../../crypto-wif/test/index.js";
1212
import cryptoJson from "../../core/bin/config/devnet/core/crypto.json";
1313

14-
1514
describe<{
1615
app: Application;
1716
factory: KeyPairFactory;
@@ -31,8 +30,7 @@ describe<{
3130
// context.factory = context.app.resolve(KeyPairFactory);
3231
});
3332

34-
35-
it("#fromMnemonic - should derive a key pair", async ( { factory }) => {
33+
it("#fromMnemonic - should derive a key pair", async ({ factory }) => {
3634
// assert.equal(await factory.fromMnemonic(wallet.mnemonic), {
3735
// compressed: true,
3836
// privateKey: wallet.privateKey,
@@ -69,7 +67,6 @@ describe<{
6967
// });
7068
// }, wallets);
7169

72-
7370
// each("#fromWIF - should derive a key pair from a WIF 170", async ({ context: { factory }, dataset: wallet }) => {
7471
// assert.equal(await factory.fromWIF(wallet.wif), {
7572
// compressed: true,

packages/crypto-wif/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"@mainsail/contracts": "workspace:*",
3131
"@mainsail/crypto-config": "workspace:*",
3232
"@mainsail/crypto-key-pair-ecdsa": "workspace:*",
33+
"@mainsail/exceptions": "workspace:*",
3334
"@mainsail/test-runner": "workspace:*",
3435
"@mainsail/validation": "workspace:*",
35-
"@mainsail/exceptions": "workspace:*",
3636
"uvu": "0.5.6"
3737
},
3838
"engines": {

packages/crypto-wif/source/wif.factory.test.ts

Lines changed: 69 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,79 @@ describe<{
2828
context.factory = context.app.resolve(WIFFactory);
2929
});
3030

31-
each("#fromMnemonic - should be OK", async ({ context: { factory }, dataset: wallet }) => {
32-
assert.equal(await factory.fromMnemonic(wallet.mnemonic), wallet.wif);
33-
}, wallets);
31+
each(
32+
"#fromMnemonic - should be OK",
33+
async ({ context: { factory }, dataset: wallet }) => {
34+
assert.equal(await factory.fromMnemonic(wallet.mnemonic), wallet.wif);
35+
},
36+
wallets,
37+
);
3438

35-
each("#fromMnemonic - should be OK for WIF 170", async ({ context: { factory, configuration }, dataset: wallet }) => {
36-
configuration.set("network.wif", 170);
37-
assert.equal(await factory.fromMnemonic(wallet.mnemonic), wallet.wif170);
38-
}, wallets);
39+
each(
40+
"#fromMnemonic - should be OK for WIF 170",
41+
async ({ context: { factory, configuration }, dataset: wallet }) => {
42+
configuration.set("network.wif", 170);
43+
assert.equal(await factory.fromMnemonic(wallet.mnemonic), wallet.wif170);
44+
},
45+
wallets,
46+
);
3947

40-
each("#fromKeys - should be OK", async ({ context: { factory, app }, dataset: wallet }) => {
41-
assert.equal(
42-
await factory.fromKeys(
43-
await app.get<KeyPairFactory>(Identifiers.Cryptography.Identity.KeyPair.Factory).fromMnemonic(wallet.mnemonic),
44-
),
45-
wallet.wif,
46-
);
47-
}, wallets);
48+
each(
49+
"#fromKeys - should be OK",
50+
async ({ context: { factory, app }, dataset: wallet }) => {
51+
assert.equal(
52+
await factory.fromKeys(
53+
await app
54+
.get<KeyPairFactory>(Identifiers.Cryptography.Identity.KeyPair.Factory)
55+
.fromMnemonic(wallet.mnemonic),
56+
),
57+
wallet.wif,
58+
);
59+
},
60+
wallets,
61+
);
4862

49-
each("#fromKeys - should be OK for WIF 170", async ({ context: { factory, app, configuration }, dataset: wallet }) => {
50-
configuration.set("network.wif", 170);
51-
assert.equal(
52-
await factory.fromKeys(
53-
await app.get<KeyPairFactory>(Identifiers.Cryptography.Identity.KeyPair.Factory).fromMnemonic(wallet.mnemonic),
54-
),
55-
wallet.wif170,
56-
);
57-
}, wallets);
63+
each(
64+
"#fromKeys - should be OK for WIF 170",
65+
async ({ context: { factory, app, configuration }, dataset: wallet }) => {
66+
configuration.set("network.wif", 170);
67+
assert.equal(
68+
await factory.fromKeys(
69+
await app
70+
.get<KeyPairFactory>(Identifiers.Cryptography.Identity.KeyPair.Factory)
71+
.fromMnemonic(wallet.mnemonic),
72+
),
73+
wallet.wif170,
74+
);
75+
},
76+
wallets,
77+
);
5878

59-
each("#toPrivateKey - should be OK", async ({ context: { factory }, dataset: wallet }) => {
60-
assert.equal(await factory.toPrivateKey(wallet.wif), { compressed: true, privateKey: wallet.privateKey });
61-
}, wallets);
79+
each(
80+
"#toPrivateKey - should be OK",
81+
async ({ context: { factory }, dataset: wallet }) => {
82+
assert.equal(await factory.toPrivateKey(wallet.wif), { compressed: true, privateKey: wallet.privateKey });
83+
},
84+
wallets,
85+
);
6286

63-
each("#toPrivateKey - should be OK for WIF 170", async ({ context: { factory, configuration }, dataset: wallet }) => {
64-
configuration.set("network.wif", 170);
65-
assert.equal(await factory.toPrivateKey(wallet.wif170), { compressed: true, privateKey: wallet.privateKey });
66-
}, wallets);
87+
each(
88+
"#toPrivateKey - should be OK for WIF 170",
89+
async ({ context: { factory, configuration }, dataset: wallet }) => {
90+
configuration.set("network.wif", 170);
91+
assert.equal(await factory.toPrivateKey(wallet.wif170), {
92+
compressed: true,
93+
privateKey: wallet.privateKey,
94+
});
95+
},
96+
wallets,
97+
);
6798

68-
69-
each("#toPrivateKey - should throw on invalid WIF network version", async ({ context: { factory }, dataset: wallet }) => {
70-
await assert.rejects(() => factory.toPrivateKey(wallet.wif170), WifNetworkError);
71-
}, wallets);
99+
each(
100+
"#toPrivateKey - should throw on invalid WIF network version",
101+
async ({ context: { factory }, dataset: wallet }) => {
102+
await assert.rejects(() => factory.toPrivateKey(wallet.wif170), WifNetworkError);
103+
},
104+
wallets,
105+
);
72106
});

packages/crypto-wif/source/wif.factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class WIFFactory implements Contracts.Crypto.WIFFactory {
3636
compressed: boolean;
3737
privateKey: string;
3838
}> {
39-
const networkVersion = this.configuration.get<number>("network.wif")
39+
const networkVersion = this.configuration.get<number>("network.wif");
4040
const decoded = decode(wif);
4141

4242
if (decoded.version !== networkVersion) {
@@ -46,6 +46,6 @@ export class WIFFactory implements Contracts.Crypto.WIFFactory {
4646
return {
4747
compressed: decoded.compressed,
4848
privateKey: Buffer.from(decoded.privateKey).toString("hex"),
49-
}
49+
};
5050
}
5151
}
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
export const wallet1 = {
2-
address: '0x4DDA5269bC0D28c15006A75C6eaFb282138c71A6',
3-
mnemonic: 'goddess laugh coin share picture napkin sausage surprise busy soft sting nothing drastic stove drive magic border amount symbol child swing peace book brass',
4-
privateKey: 'ae9eac49907186760d8a1e2efa2a537adfa8333bfeddb0aaaa92fde6c86e4043',
5-
publicKey: '02ffa9181f8ea9ea1ed85bed0ce53213367b5e8258b18cc745fa397ed40fa867fe',
6-
validatorPrivateKey: '09dadae56492c1abd8453f393169fc2019c079b91369fe9f76d568e5964a69cf',
7-
validatorPublicKey: '84b19d74a9bcb9d9e6c59b6114499820fba555884403120149a0041b892136141cbe08d929c5a4dfa18b881467da5d68',
8-
wif: 'UchikoX1AAPyjNeLZRh975EAxuMPuC7Xz9gm9Zho1jSzuc6tN5JD',
9-
wif170: 'SFRdcDkcMhjn96S3iDNrNHiNyx8xYVmuP5igCJAHA5PcQJwREvrR',
10-
}
11-
2+
address: "0x4DDA5269bC0D28c15006A75C6eaFb282138c71A6",
3+
mnemonic:
4+
"goddess laugh coin share picture napkin sausage surprise busy soft sting nothing drastic stove drive magic border amount symbol child swing peace book brass",
5+
privateKey: "ae9eac49907186760d8a1e2efa2a537adfa8333bfeddb0aaaa92fde6c86e4043",
6+
publicKey: "02ffa9181f8ea9ea1ed85bed0ce53213367b5e8258b18cc745fa397ed40fa867fe",
7+
validatorPrivateKey: "09dadae56492c1abd8453f393169fc2019c079b91369fe9f76d568e5964a69cf",
8+
validatorPublicKey:
9+
"84b19d74a9bcb9d9e6c59b6114499820fba555884403120149a0041b892136141cbe08d929c5a4dfa18b881467da5d68",
10+
wif: "UchikoX1AAPyjNeLZRh975EAxuMPuC7Xz9gm9Zho1jSzuc6tN5JD",
11+
wif170: "SFRdcDkcMhjn96S3iDNrNHiNyx8xYVmuP5igCJAHA5PcQJwREvrR",
12+
};
1213

1314
export const wallet2 = {
14-
address: '0x3A6DfD8C942eE15fA9b2e17c10A4a38C6BC7d8d4',
15-
mnemonic: 'desert belt subject reject digital flight topic frost decide juice run visa dilemma zoo jelly skirt play turtle soon globe solution vacant first mixture',
16-
privateKey: 'd294208627305427225cf52485ce97c59c73ba178fdc0a0f8c96ad4152bd4a97',
17-
publicKey: '02f032d4e5ee2c75029798ce50217eb403e55965daa3edcc1e9f4abdcccc025f54',
18-
validatorPrivateKey: '59ef9225e0eba62a7c985061cef0bb48a82661c39901f7d3b142246912229100',
19-
validatorPublicKey: 'b4ef04ddab942fbeee07ba6f657bfe2e6a01bdfbc2afb9b04ff2eb44cdf830f162cf6024bd417a97d62d476c9f93da6d',
20-
wif: 'Uducumhc47DYcpxZYjJE8nNNkL3FbNA2vyxYMPW967FxBrAbS8Z4',
21-
wif170: 'SGdXmBwDFeZM2YkGhWywPzramNppEfpQKuzTQ7xdETCZgYyu9ZyU',
22-
}
15+
address: "0x3A6DfD8C942eE15fA9b2e17c10A4a38C6BC7d8d4",
16+
mnemonic:
17+
"desert belt subject reject digital flight topic frost decide juice run visa dilemma zoo jelly skirt play turtle soon globe solution vacant first mixture",
18+
privateKey: "d294208627305427225cf52485ce97c59c73ba178fdc0a0f8c96ad4152bd4a97",
19+
publicKey: "02f032d4e5ee2c75029798ce50217eb403e55965daa3edcc1e9f4abdcccc025f54",
20+
validatorPrivateKey: "59ef9225e0eba62a7c985061cef0bb48a82661c39901f7d3b142246912229100",
21+
validatorPublicKey:
22+
"b4ef04ddab942fbeee07ba6f657bfe2e6a01bdfbc2afb9b04ff2eb44cdf830f162cf6024bd417a97d62d476c9f93da6d",
23+
wif: "Uducumhc47DYcpxZYjJE8nNNkL3FbNA2vyxYMPW967FxBrAbS8Z4",
24+
wif170: "SGdXmBwDFeZM2YkGhWywPzramNppEfpQKuzTQ7xdETCZgYyu9ZyU",
25+
};
2326

2427
export const wallets = [wallet1, wallet2];

0 commit comments

Comments
 (0)