Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import js from "@eslint/js";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import importt from "eslint-plugin-import";
// eslint-disable-next-line import/extensions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this with ignorePackages?

import prettier from "eslint-plugin-prettier/recommended";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import globals from "globals";
Expand Down Expand Up @@ -58,6 +59,8 @@ export default [
},
],

"import/extensions": ["warn", "ignorePackages"],

"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
},
Expand Down
6 changes: 3 additions & 3 deletions packages/amino/src/addresses.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fromBech32, fromHex, toBase64 } from "@cosmjs/encoding";

import { pubkeyToAddress, pubkeyToRawAddress } from "./addresses";
import { decodeBech32Pubkey } from "./encoding";
import { MultisigThresholdPubkey } from "./pubkeys";
import { pubkeyToAddress, pubkeyToRawAddress } from "./addresses.ts";
import { decodeBech32Pubkey } from "./encoding.ts";
import { MultisigThresholdPubkey } from "./pubkeys.ts";

describe("addresses", () => {
describe("pubkeyToRawAddress", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { ripemd160, sha256 } from "@cosmjs/crypto";
import { fromBase64, toBech32 } from "@cosmjs/encoding";

import { encodeAminoPubkey } from "./encoding";
import { isEd25519Pubkey, isMultisigThresholdPubkey, isSecp256k1Pubkey, Pubkey } from "./pubkeys";
import { encodeAminoPubkey } from "./encoding.ts";
import { isEd25519Pubkey, isMultisigThresholdPubkey, isSecp256k1Pubkey, Pubkey } from "./pubkeys.ts";

export function rawEd25519PubkeyToRawAddress(pubkeyData: Uint8Array): Uint8Array<ArrayBuffer> {
if (pubkeyData.length !== 32) {
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/coins.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addCoins, coin, coins, parseCoins } from "./coins";
import { addCoins, coin, coins, parseCoins } from "./coins.ts";

describe("coins", () => {
describe("coin", () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/amino/src/encoding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
encodeBech32Pubkey,
encodeEd25519Pubkey,
encodeSecp256k1Pubkey,
} from "./encoding";
import { Pubkey } from "./pubkeys";
} from "./encoding.ts";
import { Pubkey } from "./pubkeys.ts";
import {
testgroup1,
testgroup1PubkeyBech32,
Expand All @@ -19,7 +19,7 @@ import {
testgroup3PubkeyBech32,
testgroup4,
testgroup4PubkeyBech32,
} from "./testutils";
} from "./testutils.ts";

describe("encoding", () => {
describe("encodeSecp256k1Pubkey", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Pubkey,
pubkeyType,
Secp256k1Pubkey,
} from "./pubkeys";
} from "./pubkeys.ts";

/**
* Takes a Secp256k1 public key as raw bytes and returns the Amino JSON
Expand Down
34 changes: 17 additions & 17 deletions packages/amino/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ export {
pubkeyToRawAddress,
rawEd25519PubkeyToRawAddress,
rawSecp256k1PubkeyToRawAddress,
} from "./addresses";
export type { Coin } from "./coins";
export { addCoins, coin, coins, parseCoins } from "./coins";
} from "./addresses.ts";
export type { Coin } from "./coins.ts";
export { addCoins, coin, coins, parseCoins } from "./coins.ts";
export {
decodeAminoPubkey,
decodeBech32Pubkey,
encodeAminoPubkey,
encodeBech32Pubkey,
encodeEd25519Pubkey,
encodeSecp256k1Pubkey,
} from "./encoding";
export { createMultisigThresholdPubkey } from "./multisig";
export { omitDefault } from "./omitdefault";
export { makeCosmoshubPath } from "./paths";
} from "./encoding.ts";
export { createMultisigThresholdPubkey } from "./multisig.ts";
export { omitDefault } from "./omitdefault.ts";
export { makeCosmoshubPath } from "./paths.ts";
export type {
Ed25519Pubkey,
MultisigThresholdPubkey,
Pubkey,
Secp256k1Pubkey,
SinglePubkey,
} from "./pubkeys";
} from "./pubkeys.ts";
export {
isEd25519Pubkey,
isMultisigThresholdPubkey,
isSecp256k1Pubkey,
isSinglePubkey,
pubkeyType,
} from "./pubkeys";
} from "./pubkeys.ts";
export {
type Secp256k1HdWalletOptions,
extractKdfConfiguration,
Secp256k1HdWallet,
} from "./secp256k1hdwallet";
export { Secp256k1Wallet } from "./secp256k1wallet";
export { type StdSignature, decodeSignature, encodeSecp256k1Signature } from "./signature";
export type { AminoMsg, StdFee, StdSignDoc } from "./signdoc";
export { makeSignDoc, serializeSignDoc } from "./signdoc";
export type { AccountData, Algo, AminoSignResponse, OfflineAminoSigner } from "./signer";
export { type StdTx, isStdTx, makeStdTx } from "./stdtx";
export { type KdfConfiguration, executeKdf } from "./wallet";
} from "./secp256k1hdwallet.ts";
export { Secp256k1Wallet } from "./secp256k1wallet.ts";
export { type StdSignature, decodeSignature, encodeSecp256k1Signature } from "./signature.ts";
export type { AminoMsg, StdFee, StdSignDoc } from "./signdoc.ts";
export { makeSignDoc, serializeSignDoc } from "./signdoc.ts";
export type { AccountData, Algo, AminoSignResponse, OfflineAminoSigner } from "./signer.ts";
export { type StdTx, isStdTx, makeStdTx } from "./stdtx.ts";
export { type KdfConfiguration, executeKdf } from "./wallet.ts";
4 changes: 2 additions & 2 deletions packages/amino/src/multisig.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { compareArrays, createMultisigThresholdPubkey } from "./multisig";
import { test1, test2, test3, testgroup1, testgroup2, testgroup3, testgroup4 } from "./testutils";
import { compareArrays, createMultisigThresholdPubkey } from "./multisig.ts";
import { test1, test2, test3, testgroup1, testgroup2, testgroup3, testgroup4 } from "./testutils.ts";

describe("multisig", () => {
describe("compareArrays", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/multisig.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { toHex } from "@cosmjs/encoding";
import { Uint53 } from "@cosmjs/math";

import { pubkeyToRawAddress } from "./addresses";
import { MultisigThresholdPubkey, SinglePubkey } from "./pubkeys";
import { pubkeyToRawAddress } from "./addresses.ts";
import { MultisigThresholdPubkey, SinglePubkey } from "./pubkeys.ts";

/**
* Compare arrays lexicographically.
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/omitdefault.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { omitDefault } from "./omitdefault";
import { omitDefault } from "./omitdefault.ts";

describe("omitDefault", () => {
it("works for numbers", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/paths.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Slip10RawIndex } from "@cosmjs/crypto";

import { makeCosmoshubPath } from "./paths";
import { makeCosmoshubPath } from "./paths.ts";

describe("paths", () => {
describe("makeCosmoshubPath", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/pubkeys.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isMultisigThresholdPubkey, isSinglePubkey } from "./pubkeys";
import { isMultisigThresholdPubkey, isSinglePubkey } from "./pubkeys.ts";

describe("pubkeys", () => {
const pubkeyEd25519 = {
Expand Down
10 changes: 5 additions & 5 deletions packages/amino/src/secp256k1hdwallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Secp256k1, Secp256k1Signature, sha256 } from "@cosmjs/crypto";
import { fromBase64, fromHex } from "@cosmjs/encoding";

import { makeCosmoshubPath } from "./paths";
import { extractKdfConfiguration, Secp256k1HdWallet } from "./secp256k1hdwallet";
import { serializeSignDoc, StdSignDoc } from "./signdoc";
import { base64Matcher } from "./testutils";
import { executeKdf, KdfConfiguration } from "./wallet";
import { makeCosmoshubPath } from "./paths.ts";
import { extractKdfConfiguration, Secp256k1HdWallet } from "./secp256k1hdwallet.ts";
import { serializeSignDoc, StdSignDoc } from "./signdoc.ts";
import { base64Matcher } from "./testutils.ts";
import { executeKdf, KdfConfiguration } from "./wallet.ts";

describe("Secp256k1HdWallet", () => {
// m/44'/118'/0'/0/0
Expand Down
12 changes: 6 additions & 6 deletions packages/amino/src/secp256k1hdwallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import {
import { fromBase64, fromUtf8, toBase64, toBech32, toUtf8 } from "@cosmjs/encoding";
import { assert, isNonNullObject } from "@cosmjs/utils";

import { rawSecp256k1PubkeyToRawAddress } from "./addresses";
import { makeCosmoshubPath } from "./paths";
import { encodeSecp256k1Signature } from "./signature";
import { serializeSignDoc, StdSignDoc } from "./signdoc";
import { AccountData, AminoSignResponse, OfflineAminoSigner } from "./signer";
import { rawSecp256k1PubkeyToRawAddress } from "./addresses.ts";
import { makeCosmoshubPath } from "./paths.ts";
import { encodeSecp256k1Signature } from "./signature.ts";
import { serializeSignDoc, StdSignDoc } from "./signdoc.ts";
import { AccountData, AminoSignResponse, OfflineAminoSigner } from "./signer.ts";
import {
decrypt,
encrypt,
EncryptionConfiguration,
executeKdf,
KdfConfiguration,
supportedAlgorithms,
} from "./wallet";
} from "./wallet.ts";

interface AccountDataWithPrivkey extends AccountData {
readonly privkey: Uint8Array;
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/secp256k1wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Secp256k1, Secp256k1Signature, Sha256 } from "@cosmjs/crypto";
import { fromBase64, fromHex } from "@cosmjs/encoding";

import { Secp256k1Wallet } from "./secp256k1wallet";
import { serializeSignDoc, StdSignDoc } from "./signdoc";
import { Secp256k1Wallet } from "./secp256k1wallet.ts";
import { serializeSignDoc, StdSignDoc } from "./signdoc.ts";

describe("Secp256k1Wallet", () => {
const defaultPrivkey = fromHex("b8c462d2bb0c1a92edf44f735021f16c270f28ee2c3d1cb49943a5e70a3c763e");
Expand Down
8 changes: 4 additions & 4 deletions packages/amino/src/secp256k1wallet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Secp256k1, Sha256 } from "@cosmjs/crypto";
import { toBech32 } from "@cosmjs/encoding";

import { rawSecp256k1PubkeyToRawAddress } from "./addresses";
import { encodeSecp256k1Signature } from "./signature";
import { serializeSignDoc, StdSignDoc } from "./signdoc";
import { AccountData, AminoSignResponse, OfflineAminoSigner } from "./signer";
import { rawSecp256k1PubkeyToRawAddress } from "./addresses.ts";
import { encodeSecp256k1Signature } from "./signature.ts";
import { serializeSignDoc, StdSignDoc } from "./signdoc.ts";
import { AccountData, AminoSignResponse, OfflineAminoSigner } from "./signer.ts";

/**
* A wallet that holds a single secp256k1 keypair.
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/signature.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fromBase64 } from "@cosmjs/encoding";

import { decodeSignature, encodeSecp256k1Signature, StdSignature } from "./signature";
import { decodeSignature, encodeSecp256k1Signature, StdSignature } from "./signature.ts";

describe("signature", () => {
describe("encodeSecp256k1Signature", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/signature.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromBase64, toBase64 } from "@cosmjs/encoding";

import { encodeSecp256k1Pubkey } from "./encoding";
import { Pubkey, pubkeyType } from "./pubkeys";
import { encodeSecp256k1Pubkey } from "./encoding.ts";
import { Pubkey, pubkeyType } from "./pubkeys.ts";

export interface StdSignature {
readonly pub_key: Pubkey;
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/signdoc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Random } from "@cosmjs/crypto";
import { toBech32 } from "@cosmjs/encoding";

import { AminoMsg, escapeCharacters, makeSignDoc, sortedJsonStringify } from "./signdoc";
import { AminoMsg, escapeCharacters, makeSignDoc, sortedJsonStringify } from "./signdoc.ts";

function makeRandomAddress(): string {
return toBech32("cosmos", Random.getBytes(20));
Expand Down
2 changes: 1 addition & 1 deletion packages/amino/src/signdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { toUtf8 } from "@cosmjs/encoding";
import { Uint53 } from "@cosmjs/math";

import { Coin } from "./coins";
import { Coin } from "./coins.ts";

export interface AminoMsg {
readonly type: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StdSignature } from "./signature";
import { StdSignDoc } from "./signdoc";
import { StdSignature } from "./signature.ts";
import { StdSignDoc } from "./signdoc.ts";

export type Algo = "secp256k1" | "ed25519" | "sr25519";

Expand Down
8 changes: 4 additions & 4 deletions packages/amino/src/stdtx.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { coins } from "./coins";
import { StdSignature } from "./signature";
import { makeSignDoc, StdFee } from "./signdoc";
import { isStdTx, makeStdTx, StdTx } from "./stdtx";
import { coins } from "./coins.ts";
import { StdSignature } from "./signature.ts";
import { makeSignDoc, StdFee } from "./signdoc.ts";
import { isStdTx, makeStdTx, StdTx } from "./stdtx.ts";

describe("makeStdTx", () => {
it("can make an StdTx from a SignDoc and one signature", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/stdtx.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StdSignature } from "./signature";
import { AminoMsg, StdFee, StdSignDoc } from "./signdoc";
import { StdSignature } from "./signature.ts";
import { AminoMsg, StdFee, StdSignDoc } from "./signdoc.ts";

/**
* A Cosmos SDK StdTx
Expand Down
4 changes: 2 additions & 2 deletions packages/amino/src/testutils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { decodeBech32Pubkey } from "./encoding";
import { MultisigThresholdPubkey } from "./pubkeys";
import { decodeBech32Pubkey } from "./encoding.ts";
import { MultisigThresholdPubkey } from "./pubkeys.ts";

export const base64Matcher =
/^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/;
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmwasm/src/compression.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fromHex } from "@cosmjs/encoding";
import { Uint32 } from "@cosmjs/math";

import { gzip } from "./compression";
import { gzip } from "./compression.ts";

async function uncompress(compressed: Uint8Array): Promise<Uint8Array> {
const ds = new DecompressionStream("gzip");
Expand Down
4 changes: 2 additions & 2 deletions packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
import { assert, sleep } from "@cosmjs/utils";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";

import { CosmWasmClient } from "./cosmwasmclient";
import { alice, fromOneElementArray, makeRandomAddress, wasmd, wasmdEnabled } from "./testutils";
import { CosmWasmClient } from "./cosmwasmclient.ts";
import { alice, fromOneElementArray, makeRandomAddress, wasmd, wasmdEnabled } from "./testutils.ts";

interface TestTxSend {
readonly sender: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/cosmwasm/src/cosmwasmclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { assert, sleep } from "@cosmjs/utils";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { ReadonlyDate } from "readonly-date";

import { Code, CosmWasmClient, PrivateCosmWasmClient } from "./cosmwasmclient";
import { SigningCosmWasmClient } from "./signingcosmwasmclient";
import { Code, CosmWasmClient, PrivateCosmWasmClient } from "./cosmwasmclient.ts";
import { SigningCosmWasmClient } from "./signingcosmwasmclient.ts";
import {
alice,
defaultInstantiateFee,
Expand All @@ -28,7 +28,7 @@ import {
unused,
wasmd,
wasmdEnabled,
} from "./testutils";
} from "./testutils.ts";

interface HackatomInstance {
readonly instantiateMsg: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmwasm/src/cosmwasmclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from "cosmjs-types/cosmwasm/wasm/v1/query";
import { ContractCodeHistoryOperationType } from "cosmjs-types/cosmwasm/wasm/v1/types";

import { JsonObject, setupWasmExtension, WasmExtension } from "./modules";
import { JsonObject, setupWasmExtension, WasmExtension } from "./modules/index.ts";

export interface Code {
readonly id: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmwasm/src/encoding.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fromBinary, toBinary } from "./encoding";
import { fromBinary, toBinary } from "./encoding.ts";

describe("encoding", () => {
describe("toBinary", () => {
Expand Down
Loading
Loading