Skip to content

Commit

Permalink
Apply new array-type linter rule
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Jul 7, 2020
1 parent 9646849 commit f10faf0
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions packages/cosmwasm/src/cosmwasmclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface GetNonceResult {
export interface Account {
/** Bech32 account address */
readonly address: string;
readonly balance: ReadonlyArray<Coin>;
readonly balance: readonly Coin[];
readonly pubkey: PubKey | undefined;
readonly accountNumber: number;
readonly sequence: number;
Expand Down Expand Up @@ -68,7 +68,7 @@ export interface SearchBySentFromOrToQuery {
* more powerful and slightly lower level than the other search options.
*/
export interface SearchByTagsQuery {
readonly tags: readonly { readonly key: string; readonly value: string }[];
readonly tags: ReadonlyArray<{ readonly key: string; readonly value: string }>;
}

export type SearchTxQuery =
Expand Down Expand Up @@ -144,7 +144,7 @@ export interface Block {
readonly id: string;
readonly header: BlockHeader;
/** Array of raw transactions */
readonly txs: ReadonlyArray<Uint8Array>;
readonly txs: readonly Uint8Array[];
}

/** Use for testing only */
Expand Down
4 changes: 2 additions & 2 deletions packages/cosmwasm/src/msgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface MsgInstantiateContract extends Msg {
readonly label: string;
/** Init message as JavaScript object */
readonly init_msg: any;
readonly init_funds: ReadonlyArray<Coin>;
readonly init_funds: readonly Coin[];
/** Bech32-encoded admin address */
readonly admin?: string;
};
Expand Down Expand Up @@ -106,7 +106,7 @@ export interface MsgExecuteContract extends Msg {
readonly contract: string;
/** Handle message as JavaScript object */
readonly msg: any;
readonly sent_funds: ReadonlyArray<Coin>;
readonly sent_funds: readonly Coin[];
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/cosmwasm/src/restclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ interface SmartQueryResponse {
}

/** Unfortunately, Cosmos SDK encodes empty arrays as null */
type CosmosSdkArray<T> = ReadonlyArray<T> | null;
type CosmosSdkArray<T> = readonly T[] | null;

function normalizeArray<T>(backend: CosmosSdkArray<T>): ReadonlyArray<T> {
function normalizeArray<T>(backend: CosmosSdkArray<T>): readonly T[] {
return backend || [];
}

Expand Down
8 changes: 4 additions & 4 deletions packages/cosmwasm/types/cosmwasmclient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface GetNonceResult {
export interface Account {
/** Bech32 account address */
readonly address: string;
readonly balance: ReadonlyArray<Coin>;
readonly balance: readonly Coin[];
readonly pubkey: PubKey | undefined;
readonly accountNumber: number;
readonly sequence: number;
Expand Down Expand Up @@ -44,10 +44,10 @@ export interface SearchBySentFromOrToQuery {
* more powerful and slightly lower level than the other search options.
*/
export interface SearchByTagsQuery {
readonly tags: readonly {
readonly tags: ReadonlyArray<{
readonly key: string;
readonly value: string;
}[];
}>;
}
export declare type SearchTxQuery =
| SearchByIdQuery
Expand Down Expand Up @@ -99,7 +99,7 @@ export interface Block {
readonly id: string;
readonly header: BlockHeader;
/** Array of raw transactions */
readonly txs: ReadonlyArray<Uint8Array>;
readonly txs: readonly Uint8Array[];
}
/** Use for testing only */
export interface PrivateCosmWasmClient {
Expand Down
4 changes: 2 additions & 2 deletions packages/cosmwasm/types/msgs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface MsgInstantiateContract extends Msg {
readonly label: string;
/** Init message as JavaScript object */
readonly init_msg: any;
readonly init_funds: ReadonlyArray<Coin>;
readonly init_funds: readonly Coin[];
/** Bech32-encoded admin address */
readonly admin?: string;
};
Expand Down Expand Up @@ -89,7 +89,7 @@ export interface MsgExecuteContract extends Msg {
readonly contract: string;
/** Handle message as JavaScript object */
readonly msg: any;
readonly sent_funds: ReadonlyArray<Coin>;
readonly sent_funds: readonly Coin[];
};
}
export declare function isMsgExecuteContract(msg: Msg): msg is MsgExecuteContract;
Expand Down
8 changes: 4 additions & 4 deletions packages/crypto/src/secp256k1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ describe("Secp256k1", () => {

it("verifies unnormalized pyca/cryptography signatures", async () => {
// signatures are mixed lowS and non-lowS, prehash type is sha256
const data: readonly {
const data: ReadonlyArray<{
readonly message: Uint8Array;
readonly privkey: Uint8Array;
readonly signature: Uint8Array;
}[] = [
}> = [
{
message: fromHex(
"5c868fedb8026979ebd26f1ba07c27eedf4ff6d10443505a96ecaf21ba8c4f0937b3cd23ffdc3dd429d4cd1905fb8dbcceeff1350020e18b58d2ba70887baa3a9b783ad30d3fbf210331cdd7df8d77defa398cdacdfc2e359c7ba4cae46bb74401deb417f8b912a1aa966aeeba9c39c7dd22479ae2b30719dca2f2206c5eb4b7",
Expand Down Expand Up @@ -395,11 +395,11 @@ describe("Secp256k1", () => {

it("matches normalized pyca/cryptography signatures", async () => {
// signatures are normalized to lowS, prehash type is sha256
const data: readonly {
const data: ReadonlyArray<{
readonly message: Uint8Array;
readonly privkey: Uint8Array;
readonly signature: Uint8Array;
}[] = [
}> = [
{
message: fromHex(
"5c868fedb8026979ebd26f1ba07c27eedf4ff6d10443505a96ecaf21ba8c4f0937b3cd23ffdc3dd429d4cd1905fb8dbcceeff1350020e18b58d2ba70887baa3a9b783ad30d3fbf210331cdd7df8d77defa398cdacdfc2e359c7ba4cae46bb74401deb417f8b912a1aa966aeeba9c39c7dd22479ae2b30719dca2f2206c5eb4b7",
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/src/actions/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Bip39, Random } from "@cosmjs/crypto";
import * as constants from "../constants";
import { createPens } from "../profile";

export async function generate(args: ReadonlyArray<string>): Promise<void> {
export async function generate(args: readonly string[]): Promise<void> {
if (args.length < 1) {
throw Error(
`Not enough arguments for action 'generate'. See '${constants.binaryName} help' or README for arguments.`,
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/src/actions/start/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as constants from "../../constants";
import { logAccountsState } from "../../debugging";
import { Faucet } from "../../faucet";

export async function start(args: ReadonlyArray<string>): Promise<void> {
export async function start(args: readonly string[]): Promise<void> {
if (args.length < 1) {
throw Error(
`Not enough arguments for action 'start'. See '${constants.binaryName} help' or README for arguments.`,
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { generate, help, start, version } from "./actions";

export function main(args: ReadonlyArray<string>): void {
export function main(args: readonly string[]): void {
if (args.length < 1) {
help();
process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/src/debugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function debugAccount(account: MinimalAccount, tokens: TokenConfiguration
return `${account.address}: ${debugBalance(account.balance, tokens)}`;
}

export function logAccountsState(accounts: ReadonlyArray<MinimalAccount>, tokens: TokenConfiguration): void {
export function logAccountsState(accounts: readonly MinimalAccount[], tokens: TokenConfiguration): void {
if (accounts.length < 2) {
throw new Error("List of accounts must contain at least one token holder and one distributor");
}
Expand Down
6 changes: 3 additions & 3 deletions packages/faucet/src/faucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Faucet {
apiUrl: string,
addressPrefix: string,
config: TokenConfiguration,
pens: readonly [string, Pen][],
pens: ReadonlyArray<[string, Pen]>,
logging = false,
) {
this.addressPrefix = addressPrefix;
Expand All @@ -64,7 +64,7 @@ export class Faucet {
/**
* Returns a list of ticker symbols of tokens owned by the the holder and configured in the faucet
*/
public async availableTokens(): Promise<ReadonlyArray<string>> {
public async availableTokens(): Promise<readonly string[]> {
const holderAccount = await this.readOnlyClient.getAccount(this.holderAddress);
const balance = holderAccount ? holderAccount.balance : [];

Expand Down Expand Up @@ -99,7 +99,7 @@ export class Faucet {
return this.tokenConfig.bankTokens.map((token) => token.tickerSymbol);
}

public async loadAccounts(): Promise<ReadonlyArray<MinimalAccount>> {
public async loadAccounts(): Promise<readonly MinimalAccount[]> {
const addresses = [this.holderAddress, ...this.distributorAddresses];

return Promise.all(
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/src/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function createPens(
addressPrefix: string,
numberOfDistributors: number,
logging = false,
): Promise<readonly [string, Pen][]> {
): Promise<ReadonlyArray<[string, Pen]>> {
const pens = new Array<[string, Pen]>();

// first account is the token holder
Expand Down
2 changes: 1 addition & 1 deletion packages/faucet/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface BankTokenMeta {

export interface TokenConfiguration {
/** Supported tokens of the Cosmos SDK bank module */
readonly bankTokens: ReadonlyArray<BankTokenMeta>;
readonly bankTokens: readonly BankTokenMeta[];
}

export type MinimalAccount = Pick<Account, "address" | "balance">;
6 changes: 3 additions & 3 deletions packages/sdk38/src/cosmosclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface GetNonceResult {
export interface Account {
/** Bech32 account address */
readonly address: string;
readonly balance: ReadonlyArray<Coin>;
readonly balance: readonly Coin[];
readonly pubkey: PubKey | undefined;
readonly accountNumber: number;
readonly sequence: number;
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface SearchBySentFromOrToQuery {
* more powerful and slightly lower level than the other search options.
*/
export interface SearchByTagsQuery {
readonly tags: readonly { readonly key: string; readonly value: string }[];
readonly tags: ReadonlyArray<{ readonly key: string; readonly value: string }>;
}

export type SearchTxQuery =
Expand Down Expand Up @@ -125,7 +125,7 @@ export interface Block {
readonly id: string;
readonly header: BlockHeader;
/** Array of raw transactions */
readonly txs: ReadonlyArray<Uint8Array>;
readonly txs: readonly Uint8Array[];
}

/** Use for testing only */
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk38/src/msgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface MsgSend extends Msg {
readonly from_address: string;
/** Bech32 account address */
readonly to_address: string;
readonly amount: ReadonlyArray<Coin>;
readonly amount: readonly Coin[];
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/sdk38/src/restclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CosmosSdkTx, StdTx } from "./types";
export interface CosmosSdkAccount {
/** Bech32 account address */
readonly address: string;
readonly coins: ReadonlyArray<Coin>;
readonly coins: readonly Coin[];
/** Bech32 encoded pubkey */
readonly public_key: string;
readonly account_number: number;
Expand Down Expand Up @@ -84,7 +84,7 @@ interface Block {
readonly header: BlockHeader;
readonly data: {
/** Array of base64 encoded transactions */
readonly txs: ReadonlyArray<string> | null;
readonly txs: readonly string[] | null;
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk38/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface CosmosSdkTx {
}

export interface StdFee {
readonly amount: ReadonlyArray<Coin>;
readonly amount: readonly Coin[];
readonly gas: string;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/sdk38/types/cosmosclient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface GetNonceResult {
export interface Account {
/** Bech32 account address */
readonly address: string;
readonly balance: ReadonlyArray<Coin>;
readonly balance: readonly Coin[];
readonly pubkey: PubKey | undefined;
readonly accountNumber: number;
readonly sequence: number;
Expand Down Expand Up @@ -44,10 +44,10 @@ export interface SearchBySentFromOrToQuery {
* more powerful and slightly lower level than the other search options.
*/
export interface SearchByTagsQuery {
readonly tags: readonly {
readonly tags: ReadonlyArray<{
readonly key: string;
readonly value: string;
}[];
}>;
}
export declare type SearchTxQuery =
| SearchByIdQuery
Expand Down Expand Up @@ -90,7 +90,7 @@ export interface Block {
readonly id: string;
readonly header: BlockHeader;
/** Array of raw transactions */
readonly txs: ReadonlyArray<Uint8Array>;
readonly txs: readonly Uint8Array[];
}
/** Use for testing only */
export interface PrivateCosmWasmClient {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk38/types/msgs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface MsgSend extends Msg {
readonly from_address: string;
/** Bech32 account address */
readonly to_address: string;
readonly amount: ReadonlyArray<Coin>;
readonly amount: readonly Coin[];
};
}
export declare function isMsgSend(msg: Msg): msg is MsgSend;
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk38/types/restclient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CosmosSdkTx, StdTx } from "./types";
export interface CosmosSdkAccount {
/** Bech32 account address */
readonly address: string;
readonly coins: ReadonlyArray<Coin>;
readonly coins: readonly Coin[];
/** Bech32 encoded pubkey */
readonly public_key: string;
readonly account_number: number;
Expand Down Expand Up @@ -69,7 +69,7 @@ interface Block {
readonly header: BlockHeader;
readonly data: {
/** Array of base64 encoded transactions */
readonly txs: ReadonlyArray<string> | null;
readonly txs: readonly string[] | null;
};
}
export interface BlockResponse {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk38/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface CosmosSdkTx {
readonly value: StdTx;
}
export interface StdFee {
readonly amount: ReadonlyArray<Coin>;
readonly amount: readonly Coin[];
readonly gas: string;
}
export interface StdSignature {
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/src/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Producer, Stream, Subscription } from "xstream";
* differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170.
*
*/
export function concat<T>(...streams: Stream<T>[]): Stream<T> {
export function concat<T>(...streams: Array<Stream<T>>): Stream<T> {
const subscriptions = new Array<Subscription>();
const queues = new Array<T[]>(); // one queue per stream
const completedStreams = new Set<number>();
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/types/concat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ import { Stream } from "xstream";
* differently than xstream's concat as discussed in https://github.com/staltz/xstream/issues/170.
*
*/
export declare function concat<T>(...streams: Stream<T>[]): Stream<T>;
export declare function concat<T>(...streams: Array<Stream<T>>): Stream<T>;

0 comments on commit f10faf0

Please sign in to comment.