Skip to content

Commit

Permalink
feat: add utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
roushou committed Jun 20, 2024
1 parent aed9a3a commit ce867c1
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 9 deletions.
3 changes: 3 additions & 0 deletions packages/onchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"clean": "rimraf ./dist",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@coinbase-platform/utils": "workspace:*"
},
"peerDependencies": {
"typescript": ">=5.0.4"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test } from "vitest";
import { RPC_URL } from "../constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { createRpcClient } from "../rpc";
import { listAddressTransactions } from "./list-address-transactions";

Expand Down
2 changes: 1 addition & 1 deletion packages/onchain/src/balance/list-balance-details.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test } from "vitest";
import { RPC_URL } from "../constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { createRpcClient } from "../rpc";
import { listBalanceDetails } from "./list-balance-details";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test } from "vitest";
import { RPC_URL } from "../constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { createRpcClient } from "../rpc";
import { listBalanceHistories } from "./list-balance-histories";

Expand Down
2 changes: 1 addition & 1 deletion packages/onchain/src/balance/list-balances.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test } from "vitest";
import { RPC_URL } from "../constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { createRpcClient } from "../rpc";
import { listBalances } from "./list-balances";

Expand Down
2 changes: 1 addition & 1 deletion packages/onchain/src/mocks/address.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { http, HttpResponse } from "msw";
import type { DefaultBodyType, PathParams } from "msw";
import { RPC_URL } from "../constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { withRpcMethod } from "./predicates";

export const handlers = [
Expand Down
2 changes: 1 addition & 1 deletion packages/onchain/src/mocks/balance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { http, HttpResponse } from "msw";
import type { DefaultBodyType, PathParams } from "msw";
import { RPC_URL } from "../constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { withRpcMethod } from "./predicates";

export const handlers = [
Expand Down
2 changes: 1 addition & 1 deletion packages/onchain/src/rpc.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "vitest";
import { RPC_URL } from "./constants";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import { createRpcClient } from "./rpc";

describe("rpc", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/onchain/src/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RPC_URL } from "./constants";
import * as http from "./http";
import { RPC_URL } from "@coinbase-platform/utils/constants";
import * as http from "@coinbase-platform/utils/http";

export type RpcClient = {
__url: string;
Expand Down
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@coinbase-platform/utils",
"version": "0.0.0",
"description": "Coinbase Platform Utils package",
"author": "roushou <roushou9@gmail.com>",
"license": "MIT",
"private": true,
"homepage": "https://github.com/roushou/coinbase-platform#readme",
"type": "module",
"files": ["src"],
"scripts": {
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
"typescript": ">=5.0.4"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"engine": {
"node": "^18.0.0 || >=20.0.0"
}
}
26 changes: 26 additions & 0 deletions packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"allowJs": false,

// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": false
}
}
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce867c1

Please sign in to comment.