From a27ccb66fb7f2c60425ed7c5af3e3567291fd0dd Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 10:31:57 +0000 Subject: [PATCH 1/9] remove css import --- src/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5c0f258..9916d85 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,2 @@ -import "./style.css"; - export * from "./components"; export * from "./types"; From 6f037b28b4cdd86bc00ae59533d49d09dc6e5eee Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 11:21:25 +0000 Subject: [PATCH 2/9] adjust import --- src/hooks/useTxnFees.ts | 2 +- src/hooks/useTxnPrice.ts | 2 +- src/lib/utils.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useTxnFees.ts b/src/hooks/useTxnFees.ts index 0a24b78..ba09b0d 100644 --- a/src/hooks/useTxnFees.ts +++ b/src/hooks/useTxnFees.ts @@ -1,6 +1,6 @@ import { Transaction } from "@near-wallet-selector/core"; import BN from "bn.js"; -import { formatNearAmount } from "near-api-js/lib/utils/format"; +import { formatNearAmount } from "near-api-js/lib/utils/format.js"; import { formatUnits } from "viem"; import { removeTrailingZeros } from "../lib/utils"; import { Cost } from "../types"; diff --git a/src/hooks/useTxnPrice.ts b/src/hooks/useTxnPrice.ts index f95a252..57553b6 100644 --- a/src/hooks/useTxnPrice.ts +++ b/src/hooks/useTxnPrice.ts @@ -5,7 +5,7 @@ import { Transaction, } from "@near-wallet-selector/core"; import BN from "bn.js/"; -import { formatNearAmount } from "near-api-js/lib/utils/format"; +import { formatNearAmount } from "near-api-js/lib/utils/format.js"; import { useEffect, useMemo, useRef, useState } from "react"; import { RPC_URL } from "../lib/constants"; import { Cost } from "../types"; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 18b903e..c492402 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,6 +1,6 @@ import BN from "bn.js"; import { clsx, type ClassValue } from "clsx"; -import { formatNearAmount } from "near-api-js/lib/utils/format"; +import { formatNearAmount } from "near-api-js/lib/utils/format.js"; import { twMerge } from "tailwind-merge"; import { Cost } from "../types/types"; From 793d367dea50ed7e6bea94028f831366cc78a8c7 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 11:40:18 +0000 Subject: [PATCH 3/9] .js --- src/components/chat/BitteSpinner.tsx | 2 +- src/hooks/useTxnPrice.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/chat/BitteSpinner.tsx b/src/components/chat/BitteSpinner.tsx index b24aef8..9a74784 100644 --- a/src/components/chat/BitteSpinner.tsx +++ b/src/components/chat/BitteSpinner.tsx @@ -1,4 +1,4 @@ -import Lottie from "react-lottie-player/dist/LottiePlayerLight"; +import Lottie from "react-lottie-player/dist/LottiePlayerLight.js"; import { Color } from "../../lib/animation-colors/colors"; import { hexToRgb } from "../../lib/animation-colors/hex-to-rgb"; diff --git a/src/hooks/useTxnPrice.ts b/src/hooks/useTxnPrice.ts index 57553b6..c03f9b3 100644 --- a/src/hooks/useTxnPrice.ts +++ b/src/hooks/useTxnPrice.ts @@ -1,4 +1,4 @@ -import { getLatestGasPrice } from "@mintbase-js/rpc/lib/methods/getLatestGasPrice"; +import { getLatestGasPrice } from "@mintbase-js/rpc/lib/methods/getLatestGasPrice.js"; import { Action, FunctionCallAction, From 39eb56b60524195a0cc5982969b099a9aa02be4c Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 13:35:29 +0000 Subject: [PATCH 4/9] tsup config --- tsup.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsup.config.ts b/tsup.config.ts index e9f3107..e53bb01 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ format: ['cjs', 'esm'], dts: true, clean: true, - external: ['react', 'react-dom'], + external: ['react', 'react-dom', 'bn.js/lib/bn.js'], minify: true, outDir: 'dist', sourcemap: true, From ba07f45efa4d5a7695fc32b875770de3fb49d1a2 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 13:44:01 +0000 Subject: [PATCH 5/9] no external bn --- src/components/chat/transactions/ReviewTransaction.tsx | 2 +- tsup.config.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/chat/transactions/ReviewTransaction.tsx b/src/components/chat/transactions/ReviewTransaction.tsx index df8fe6a..7f46243 100644 --- a/src/components/chat/transactions/ReviewTransaction.tsx +++ b/src/components/chat/transactions/ReviewTransaction.tsx @@ -1,5 +1,5 @@ import { Transaction } from "@near-wallet-selector/core"; -import BN from "bn.js"; +import BN from "bn.js/lib/bn.js"; import { SafeEncodedSignRequest } from "near-safe"; import { useEffect, useState } from "react"; import { useAccountBalance } from "../../../hooks/useAccountBalance"; diff --git a/tsup.config.ts b/tsup.config.ts index e53bb01..030d05f 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -6,7 +6,8 @@ export default defineConfig({ format: ['cjs', 'esm'], dts: true, clean: true, - external: ['react', 'react-dom', 'bn.js/lib/bn.js'], + external: ['react', 'react-dom'], + noExternal: ['bn.js'], minify: true, outDir: 'dist', sourcemap: true, From 10043c51cb560122ba72de4f2e6ee9726949d431 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 13:57:16 +0000 Subject: [PATCH 6/9] no external bn --- src/components/chat/transactions/ReviewTransaction.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/chat/transactions/ReviewTransaction.tsx b/src/components/chat/transactions/ReviewTransaction.tsx index 7f46243..df8fe6a 100644 --- a/src/components/chat/transactions/ReviewTransaction.tsx +++ b/src/components/chat/transactions/ReviewTransaction.tsx @@ -1,5 +1,5 @@ import { Transaction } from "@near-wallet-selector/core"; -import BN from "bn.js/lib/bn.js"; +import BN from "bn.js"; import { SafeEncodedSignRequest } from "near-safe"; import { useEffect, useState } from "react"; import { useAccountBalance } from "../../../hooks/useAccountBalance"; From ab6b7f9d7abe54bcf9341d23a5c3b91faf858115 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 17 Mar 2025 14:22:54 +0000 Subject: [PATCH 7/9] bn.js --- src/components/chat/transactions/ReviewTransaction.tsx | 2 +- src/global.d.ts | 4 ++++ src/hooks/useTxnFees.ts | 2 +- src/lib/utils.ts | 2 +- src/types/transaction.ts | 2 +- src/types/types.ts | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 src/global.d.ts diff --git a/src/components/chat/transactions/ReviewTransaction.tsx b/src/components/chat/transactions/ReviewTransaction.tsx index df8fe6a..7f46243 100644 --- a/src/components/chat/transactions/ReviewTransaction.tsx +++ b/src/components/chat/transactions/ReviewTransaction.tsx @@ -1,5 +1,5 @@ import { Transaction } from "@near-wallet-selector/core"; -import BN from "bn.js"; +import BN from "bn.js/lib/bn.js"; import { SafeEncodedSignRequest } from "near-safe"; import { useEffect, useState } from "react"; import { useAccountBalance } from "../../../hooks/useAccountBalance"; diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 0000000..82463a1 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1,4 @@ +declare module "bn.js/lib/bn.js" { + import BN from "bn.js/lib/bn.js"; + export default BN; +} \ No newline at end of file diff --git a/src/hooks/useTxnFees.ts b/src/hooks/useTxnFees.ts index ba09b0d..d5c1ce8 100644 --- a/src/hooks/useTxnFees.ts +++ b/src/hooks/useTxnFees.ts @@ -1,5 +1,5 @@ import { Transaction } from "@near-wallet-selector/core"; -import BN from "bn.js"; +import BN from "bn.js/lib/bn.js"; import { formatNearAmount } from "near-api-js/lib/utils/format.js"; import { formatUnits } from "viem"; import { removeTrailingZeros } from "../lib/utils"; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c492402..1da85ee 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,4 +1,4 @@ -import BN from "bn.js"; +import BN from "bn.js/lib/bn.js"; import { clsx, type ClassValue } from "clsx"; import { formatNearAmount } from "near-api-js/lib/utils/format.js"; import { twMerge } from "tailwind-merge"; diff --git a/src/types/transaction.ts b/src/types/transaction.ts index e4f9026..f5178f9 100644 --- a/src/types/transaction.ts +++ b/src/types/transaction.ts @@ -2,7 +2,7 @@ import type { FinalExecutionOutcome, Transaction, } from "@near-wallet-selector/core"; -import BN from "bn.js"; +import BN from "bn.js/lib/bn.js"; import { Account } from "near-api-js"; import { SafeEncodedSignRequest } from "near-safe"; import { SuccessInfo } from "../hooks/useTransaction"; diff --git a/src/types/types.ts b/src/types/types.ts index d37f85d..e21ff28 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -11,7 +11,7 @@ import { AssistantTool, FunctionTool } from "openai/resources/beta/assistants"; import { FunctionDefinition } from "openai/resources/index"; import { OpenAPIV3 } from "openapi-types"; -import BN from "bn.js"; +import BN from "bn.js/lib/bn.js"; import { Account } from "near-api-js/lib/account"; import { SignRequestData } from "near-safe"; import { Hex } from "viem"; From da1a405655431b357546127ff94a675c825fd2e8 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Mon, 24 Mar 2025 13:54:05 +0000 Subject: [PATCH 8/9] test new config --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e8c607..c213c33 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "files": [ "dist" ], + "main": "dist/index.js", + "module": "dist/index.mjs.js", "scripts": { "build": "tsup --config tsup.config.ts", "lint": "eslint src --ext .ts,tsx,js,jsx", @@ -17,7 +19,8 @@ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.mjs", - "require": "./dist/index.js" + "require": "./dist/index.js", + "default": "./dist/index.mjs" }, "./style.css": "./dist/style.css" }, From 909947c03974269e87c4f8e3dd43b6aaab909661 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Wed, 26 Mar 2025 14:00:53 +0000 Subject: [PATCH 9/9] fix build of css --- package.json | 2 +- src/{style.css => styles.css} | 0 tsup.config.ts | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) rename src/{style.css => styles.css} (100%) diff --git a/package.json b/package.json index c213c33..51b9542 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "require": "./dist/index.js", "default": "./dist/index.mjs" }, - "./style.css": "./dist/style.css" + "./styles.css": "./dist/styles.css" }, "repository": { "type": "git", diff --git a/src/style.css b/src/styles.css similarity index 100% rename from src/style.css rename to src/styles.css diff --git a/tsup.config.ts b/tsup.config.ts index 030d05f..a4c1e3b 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,5 +1,4 @@ -import { defineConfig } from 'tsup' - +import { defineConfig } from 'tsup'; export default defineConfig({ entry: ['src/index.ts'], @@ -24,4 +23,5 @@ export default defineConfig({ loader: { '.css': 'copy', }, -}); \ No newline at end of file + onSuccess: 'npx tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify', +});