Skip to content

Commit

Permalink
remove unused #100
Browse files Browse the repository at this point in the history
  • Loading branch information
ukorvl committed Jul 29, 2024
1 parent d919754 commit f751fce
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ runs:
- name: Npm audit
shell: bash
run: npm audit --audit-level=moderate
# - name: Test
# shell: bash
# run: npm run test:ci
- name: Test
shell: bash
run: npm run test:ci
- name: Build
shell: bash
run: |
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"sideEffects": false,
"description": "Typescript library to interact with the Nil blockchain. Can be used in the browser or in Node.js.",
"scripts": {
"test": "vitest -c ./test/vitest.config.ts",
"test:unit": "vitest -c ./test/vitest.config.ts",
"test:ci": "CI=true vitest -c ./test/vitest.config.ts",
"integration-test": "CI=true vitest -c ./test/vitest.integration.config.ts --isolate false",
"test:integration": "CI=true vitest -c ./test/vitest.integration.config.ts --isolate false",
"test:coverage": "npm run test:ci -- --coverage",
"build": "rimraf dist && rollup -c ./rollup/rollup.config.js --bundleConfigAsCjs",
"prepare": "npx simple-git-hooks",
Expand Down
5 changes: 4 additions & 1 deletion src/clients/PublicClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ test("getMessageByHash", async ({ expect }) => {

test("getMessageReceiptByHash", async ({ expect }) => {
const fn = vi.fn();
fn.mockReturnValue({});
fn.mockReturnValue({
gasPrice: "0x100",
gasUsed: "0x100",
});
const client = new PublicClient({
transport: new MockTransport(fn),
shardId: 1,
Expand Down
1 change: 1 addition & 0 deletions src/clients/PublicClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class PublicClient extends BaseClient {
shardId = this.shardId,
): Promise<ProcessedReceipt | null> {
assertIsValidShardId(shardId);

const mapReceipt = (receipt: IReceipt): ProcessedReceipt => {
return {
...receipt,
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Faucet/Faucet.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PublicClient } from "../../clients/index.js";
import { bytesToHex } from "../../index.js";
import { bytesToHex } from "../../encoding/fromBytes.js";
import {
LocalECDSAKeySigner,
generateRandomPrivateKey,
Expand Down
3 changes: 2 additions & 1 deletion src/contracts/WalletV1/WalletV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { bytesToHex, encodeFunctionData } from "viem";
import type { PublicClient } from "../../clients/PublicClient.js";
import { prepareDeployPart } from "../../encoding/deployPart.js";
import { externalMessageEncode } from "../../encoding/externalMessage.js";
import { hexToBytes, toHex } from "../../index.js";
import { hexToBytes } from "../../encoding/fromHex.js";
import { toHex } from "../../encoding/toHex.js";
import type { ISigner } from "../../signers/index.js";
import type { IDeployData } from "../../types/IDeployData.js";
import { getShardIdFromAddress, refineAddress } from "../../utils/address.js";
Expand Down
3 changes: 2 additions & 1 deletion src/encoding/fromBytes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type Hex, toHex } from "../index.js";
import type { Hex } from "../index.js";
import { toHex } from "./toHex.js";

const decoder = new TextDecoder("utf8");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { bytesToHex, encodeFunctionData } from "viem";
import { testEnv } from "../../test/testEnv.js";
import {
Faucet,
HttpTransport,
Expand All @@ -9,7 +8,8 @@ import {
convertEthToWei,
generateRandomPrivateKey,
waitTillCompleted,
} from "../index.js";
} from "../../src/index.js";
import { testEnv } from "../testEnv.js";
const client = new PublicClient({
transport: new HttpTransport({
endpoint: testEnv.endpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { testEnv } from "../../test/testEnv.js";
import {
Faucet,
HttpTransport,
Expand All @@ -9,7 +8,8 @@ import {
convertEthToWei,
generateRandomPrivateKey,
waitTillCompleted,
} from "../index.js";
} from "../../src/index.js";
import { testEnv } from "../testEnv.js";
const client = new PublicClient({
transport: new HttpTransport({
endpoint: testEnv.endpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Abi } from "abitype";
import { testEnv } from "../../test/testEnv.js";
import {
Faucet,
HttpTransport,
Expand All @@ -11,7 +10,8 @@ import {
externalDeploymentMessage,
generateRandomPrivateKey,
waitTillCompleted,
} from "../index.js";
} from "../../src/index.js";
import { testEnv } from "../testEnv.js";
const client = new PublicClient({
transport: new HttpTransport({
endpoint: testEnv.endpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { testEnv } from "../../test/testEnv.js";
import { Faucet, WalletV1 } from "../contracts/index.js";
import {
Faucet,
HttpTransport,
LocalECDSAKeySigner,
PublicClient,
WalletV1,
convertEthToWei,
generateRandomPrivateKey,
waitTillCompleted,
} from "../index.js";
import { LocalECDSAKeySigner } from "../signers/LocalECDSAKeySigner.js";
import { generateRandomPrivateKey } from "../signers/privateKey.js";
} from "../../src/index.js";
import { testEnv } from "../../test/testEnv.js";

const client = new PublicClient({
transport: new HttpTransport({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { encodeFunctionData } from "viem";
import { testEnv } from "../../test/testEnv.js";
import {
Faucet,
HttpTransport,
Expand All @@ -14,7 +13,8 @@ import {
hexToBigInt,
toHex,
waitTillCompleted,
} from "../index.js";
} from "../../src/index.js";
import { testEnv } from "../testEnv.js";
const client = new PublicClient({
transport: new HttpTransport({
endpoint: testEnv.endpoint,
Expand Down
3 changes: 0 additions & 3 deletions test/testEnv.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const defaultRpcEndpoint = "http://127.0.0.1:8529";
const defaultPrivateKey =
"41285f03e8692676bf80a98e4052a008026427a7302ca97cb06edcd60689850b";

const testEnv = {
localPrivKey: process.env.LOCAL_PRIV_KEY ?? defaultPrivateKey,
endpoint: process.env.RPC_ENDPOINT ?? defaultRpcEndpoint,
} as const;

Expand Down
2 changes: 1 addition & 1 deletion test/vitest.integration.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
include: ["src/integrations/*.test.ts"],
include: ["test/integration/*.test.ts"],
hookTimeout: 20_000,
testTimeout: 40_000,
globals: true,
Expand Down

0 comments on commit f751fce

Please sign in to comment.