Skip to content

Commit 6733ba9

Browse files
committed
revert extra type safety
1 parent 45f9d53 commit 6733ba9

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

packages/amino/src/addresses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ export function pubkeyToRawAddress(pubkey: Pubkey): Uint8Array {
3737
}
3838
}
3939

40-
export function pubkeyToAddress(pubkey: Pubkey, prefix: string): `${string}1${string}` {
40+
export function pubkeyToAddress(pubkey: Pubkey, prefix: string): string {
4141
return toBech32(prefix, pubkeyToRawAddress(pubkey));
4242
}

packages/amino/src/secp256k1wallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class Secp256k1Wallet implements OfflineAminoSigner {
3333
this.prefix = prefix;
3434
}
3535

36-
private get address(): `${string}1${string}` {
36+
private get address(): string {
3737
return toBech32(this.prefix, rawSecp256k1PubkeyToRawAddress(this.pubkey));
3838
}
3939

packages/cosmwasm-stargate/src/instantiate2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function _instantiate2AddressIntermediate(
2929
salt: Uint8Array,
3030
msg: string | null,
3131
prefix: string,
32-
): { key: Uint8Array; addressData: Uint8Array; address: `${string}1${string}` } {
32+
): { key: Uint8Array; addressData: Uint8Array; address: string } {
3333
assert(checksum.length === 32);
3434
const creatorData = fromBech32(creator).data;
3535

@@ -68,7 +68,7 @@ export function instantiate2Address(
6868
creator: string,
6969
salt: Uint8Array,
7070
bech32Prefix: string,
71-
): `${string}1${string}` {
71+
): string {
7272
// Non-empty msg values are discouraged.
7373
// See https://medium.com/cosmwasm/dev-note-3-limitations-of-instantiate2-and-how-to-deal-with-them-a3f946874230.
7474
const msg = null;

packages/cosmwasm-stargate/src/testutils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function getHackatom(): ContractUploadInstructions {
6565
};
6666
}
6767

68-
export function makeRandomAddress(): `${string}1${string}` {
68+
export function makeRandomAddress(): string {
6969
return toBech32("wasm", Random.getBytes(20));
7070
}
7171

packages/encoding/src/bech32.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { bech32 } from "@scure/base";
22

3-
export function toBech32(prefix: string, data: Uint8Array, limit?: number): `${string}1${string}` {
4-
const address = bech32.encode(prefix, data, limit);
3+
export function toBech32(prefix: string, data: Uint8Array, limit?: number): string {
4+
const address: `${typeof prefix}1${string}` = bech32.encode(prefix, data, limit);
55
return address;
66
}
77

@@ -22,7 +22,7 @@ export function fromBech32(
2222
* The input is validated along the way, which makes this significantly safer than
2323
* using `address.toLowerCase()`.
2424
*/
25-
export function normalizeBech32(address: string): `${string}1${string}` {
25+
export function normalizeBech32(address: string): string {
2626
const { prefix, data } = fromBech32(address.toLowerCase() as `${string}1${string}`);
2727
return toBech32(prefix, data);
2828
}

packages/ledger-amino/src/ledgerconnector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class LedgerConnector {
9595
);
9696
}
9797

98-
public async getCosmosAddress(pubkey?: Uint8Array): Promise<`${string}1${string}`> {
98+
public async getCosmosAddress(pubkey?: Uint8Array): Promise<string> {
9999
const pubkeyToUse = pubkey || (await this.getPubkey());
100100
return pubkeyToAddress(encodeSecp256k1Pubkey(pubkeyToUse), this.prefix);
101101
}

packages/proto-signing/src/directsecp256k1wallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class DirectSecp256k1Wallet implements OfflineDirectSigner {
3333
this.prefix = prefix;
3434
}
3535

36-
private get address(): `${string}1${string}` {
36+
private get address(): string {
3737
return toBech32(this.prefix, rawSecp256k1PubkeyToRawAddress(this.pubkey));
3838
}
3939

packages/stargate/src/modules/staking/messages.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from "../../testutils.spec";
1717
import { MsgCreateValidatorEncodeObject, MsgEditValidatorEncodeObject } from "./messages";
1818

19-
function changePrefix(address: string, newPrefix: string): `${string}1${string}` {
19+
function changePrefix(address: string, newPrefix: string): string {
2020
return toBech32(newPrefix, fromBech32(address).data);
2121
}
2222

0 commit comments

Comments
 (0)