Skip to content

Commit cdcae3c

Browse files
refactor: remove unused MultiSignature related code (#1295)
* Remove MultiSignature support * Remove error * Remove form test-transaction-builder * Remove from tests * Remove from errors * Remove from tests * style: resolve style guide violations [ci-lint-fix]
1 parent 2425d1f commit cdcae3c

20 files changed

Lines changed: 6 additions & 393 deletions

File tree

packages/contracts/source/contracts/crypto/identities.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { ByteBuffer } from "@mainsail/utils";
22

3-
import type { MultiSignatureAsset } from "./legacy.js";
4-
53
export interface KeyPair {
64
publicKey: string;
75
privateKey: string;
@@ -12,7 +10,6 @@ export interface AddressFactory {
1210
fromMnemonic(mnemonic: string): Promise<string>;
1311
fromPublicKey(publicKey: string): Promise<string>;
1412
fromWIF(wif: string): Promise<string>;
15-
fromMultiSignatureAsset(asset: MultiSignatureAsset): Promise<string>;
1613
fromBuffer(buffer: Buffer): Promise<string>;
1714
toBuffer(address: string): Promise<Buffer>;
1815
validate(address: string): Promise<boolean>;
@@ -21,7 +18,6 @@ export interface AddressFactory {
2118
export interface PublicKeyFactory {
2219
fromMnemonic(mnemonic: string): Promise<string>;
2320
fromWIF(wif: string): Promise<string>;
24-
fromMultiSignatureAsset(asset: MultiSignatureAsset): Promise<string>;
2521
verify(publicKey: string): Promise<boolean>;
2622
aggregate(publicKeys: Buffer[]): Promise<string>;
2723
}

packages/contracts/source/contracts/crypto/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export * from "./config.js";
55
export * from "./crypto.js";
66
export * from "./hash.js";
77
export * from "./identities.js";
8-
export * from "./legacy.js";
98
export * from "./messages.js";
109
export * from "./networks.js";
1110
export * from "./proposal.js";

packages/contracts/source/contracts/crypto/legacy.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/crypto-address-base58/source/address.factory.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,6 @@ describe<{ app: Application; factory: AddressFactory }>("AddressFactory", ({ ass
2929
assert.is(await factory.fromMnemonic(mnemonic), "DLsMhiUzAVEXBXDTY1NGNZteWz8SDvphfa");
3030
});
3131

32-
it("#fromMultiSignatureAsset - should derive an address from multi signature address", async ({ factory }) => {
33-
assert.is(
34-
await factory.fromMultiSignatureAsset({
35-
min: 3,
36-
publicKeys: [
37-
"0235d486fea0193cbe77e955ab175b8f6eb9eaf784de689beffbd649989f5d6be3",
38-
"03a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a",
39-
"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357",
40-
],
41-
}),
42-
"D8UtPGvjKzjn1fN5GfESoTrTrkQv6XjALS",
43-
);
44-
});
45-
4632
it("#fromPublicKey - should derive an address from a public key", async ({ factory }) => {
4733
assert.is(
4834
await factory.fromPublicKey("034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192"),

packages/crypto-address-base58/source/address.factory.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ export class AddressFactory implements Contracts.Crypto.AddressFactory {
3939
return this.fromPublicKey(await this.publicKeyFactory.fromWIF(wif));
4040
}
4141

42-
public async fromMultiSignatureAsset(asset: Contracts.Crypto.MultiSignatureAsset): Promise<string> {
43-
return this.fromPublicKey(await this.publicKeyFactory.fromMultiSignatureAsset(asset));
44-
}
45-
4642
public async fromBuffer(buffer: Buffer): Promise<string> {
4743
return this.#encodeCheck(buffer);
4844
}

packages/crypto-address-keccak256/source/address.factory.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,6 @@ describe<{ app: Application; factory: AddressFactory }>("AddressFactory", ({ ass
5555
wallets,
5656
);
5757

58-
it("#fromMultiSignatureAsset - should derive an address from multi signature address", async ({ factory }) => {
59-
assert.is(
60-
await factory.fromMultiSignatureAsset({
61-
min: 3,
62-
publicKeys: [
63-
"0235d486fea0193cbe77e955ab175b8f6eb9eaf784de689beffbd649989f5d6be3",
64-
"03a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a",
65-
"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357",
66-
],
67-
}),
68-
"0x970996B998f3C854D9a4D2C327Cc049ae6241C40",
69-
);
70-
});
71-
7258
each(
7359
"#validate - should be valid",
7460
async ({ context: { factory }, dataset: address }) => {

packages/crypto-address-keccak256/source/address.factory.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ export class AddressFactory implements Contracts.Crypto.AddressFactory {
2727
return this.fromPublicKey(await this.publicKeyFactory.fromWIF(wif));
2828
}
2929

30-
public async fromMultiSignatureAsset(asset: Contracts.Crypto.MultiSignatureAsset): Promise<string> {
31-
return this.fromPublicKey(await this.publicKeyFactory.fromMultiSignatureAsset(asset));
32-
}
33-
3430
public async fromBuffer(buffer: Buffer): Promise<string> {
3531
return getAddress(toHex(buffer));
3632
}

packages/crypto-key-pair-bls12-381/source/public.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ describe<{ app: Application; factory: PublicKeyFactory }>("PublicKeyFactory", ({
3737
await assert.rejects(() => factory.fromWIF(""), NotImplemented);
3838
});
3939

40-
it("#fromMultiSignatureAsset - should throw NotImplemented", async ({ factory }) => {
41-
await assert.rejects(async () => factory.fromMultiSignatureAsset({} as any), NotImplemented);
42-
});
43-
4440
each(
4541
"#verify - should pass with valid public keys",
4642
async ({ context, dataset }) => {

packages/crypto-key-pair-bls12-381/source/public.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ export class PublicKeyFactory implements Contracts.Crypto.PublicKeyFactory {
2020
throw new NotImplemented(this.constructor.name, "fromWIF");
2121
}
2222

23-
public async fromMultiSignatureAsset(asset: Contracts.Crypto.MultiSignatureAsset): Promise<string> {
24-
throw new NotImplemented(this.constructor.name, "fromMultiSignatureAsset");
25-
}
26-
2723
public async verify(publicKey: string): Promise<boolean> {
2824
const bls = await getBls();
2925

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

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -42,65 +42,6 @@ describe<{ app: Application; factory: PublicKeyFactory }>("PrivateKeyFactory", (
4242
wallets,
4343
);
4444

45-
it("should derive from a musig", async ({ factory }) => {
46-
assert.is(
47-
await factory.fromMultiSignatureAsset({
48-
min: 3,
49-
publicKeys: [
50-
"0235d486fea0193cbe77e955ab175b8f6eb9eaf784de689beffbd649989f5d6be3",
51-
"03a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a",
52-
"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357",
53-
],
54-
}),
55-
"0321d8b4df000280dd7f3ac8dae0558e214bd6fe736d97cf68ea8a083c024c249c",
56-
);
57-
});
58-
59-
it("should throw if min < 1", async ({ factory }) => {
60-
await assert.rejects(
61-
() =>
62-
factory.fromMultiSignatureAsset({
63-
min: 0,
64-
publicKeys: [
65-
"0235d486fea0193cbe77e955ab175b8f6eb9eaf784de689beffbd649989f5d6be3",
66-
"03a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a",
67-
"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357",
68-
],
69-
}),
70-
"The multi signature asset is invalid.",
71-
);
72-
});
73-
74-
it("should throw if min > publicKeys.length", async ({ factory }) => {
75-
await assert.rejects(
76-
() =>
77-
factory.fromMultiSignatureAsset({
78-
min: 4,
79-
publicKeys: [
80-
"0235d486fea0193cbe77e955ab175b8f6eb9eaf784de689beffbd649989f5d6be3",
81-
"03a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a",
82-
"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357",
83-
],
84-
}),
85-
"The multi signature asset is invalid.",
86-
);
87-
});
88-
89-
it("should throw if publicKey is invalid", async ({ factory }) => {
90-
await assert.rejects(
91-
() =>
92-
factory.fromMultiSignatureAsset({
93-
min: 1,
94-
publicKeys: [
95-
"0",
96-
"03a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a",
97-
"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357",
98-
],
99-
}),
100-
"Expected 0 to be a valid public key",
101-
);
102-
});
103-
10445
each(
10546
"should pass with valid public keys",
10647
async ({ context, dataset }) => {

0 commit comments

Comments
 (0)