Skip to content

Revert #30 #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 24, 2025
Merged
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
31 changes: 13 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,27 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Cache pnpm dependencies
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
~/.bun/install/cache
node_modules
packages/*/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-pnpm-
${{ runner.os }}-bun-

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install Dependencies
run: pnpm install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Lint & Build
run: |
pnpm lint
pnpm run test
pnpm run build
bun lint
bun run test
bun run build
29 changes: 8 additions & 21 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
node-version: '20'
bun-version: latest

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
node_modules
packages/*/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
run: bun install --frozen-lockfile

- name: Build
run: pnpm run build

run: bun run build
- name: Set Version from Tag
run: |
VERSION=${GITHUB_REF#refs/tags/}
Expand All @@ -51,4 +38,4 @@ jobs:
cd packages/agent-sdk
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1,306 changes: 1,306 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@
"name": "@bitte/core",
"version": "1.0.0",
"private": true,
"packageManager": "pnpm@9.14.2",
"packageManager": "bun@1.1.37",
"workspaces": [
"packages/*"
],
"type": "module",
"scripts": {
"build": "pnpm run --filter agent-sdk build",
"tokenMap": "pnpm run scripts/genTokenMap.ts",
"build": "bun run --cwd packages/agent-sdk build",
"tokenMap": "bun run scripts/genTokenMap.ts",
"lint": "prettier --check {scripts,packages}/**/* && eslint packages/",
"fmt": "prettier --write {scripts,packages}/**/* && eslint packages/ --fix",
"test": "jest"
},
"devDependencies": {
"@duneanalytics/client-sdk": "^0.2.5",
"@types/bun": "latest",
"@types/jest": "^29.5.14",
"@typescript-eslint/eslint-plugin": "^8.27.0",
"@typescript-eslint/parser": "^8.27.0",
"@typescript-eslint/eslint-plugin": "^8.31.0",
"@typescript-eslint/parser": "^8.31.0",
"csv-parser": "^3.2.0",
"dotenv": "^16.4.7",
"eslint": "^9.22.0",
"dotenv": "^16.5.0",
"eslint": "^9.25.1",
"jest": "^29.7.0",
"next": "^15.2.3",
"next": "^15.3.1",
"prettier": "^3.5.3",
"ts-jest": "^29.2.6",
"typescript": "^5.8.2",
"viem": "^2.23.13"
"ts-jest": "^29.3.2",
"typescript": "^5.8.3",
"viem": "^2.28.0"
}
}
2 changes: 1 addition & 1 deletion packages/agent-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dist/**/*"
],
"scripts": {
"build": "rm -fr dist/* && pnpm build:esm && pnpm build:cjs",
"build": "rm -fr dist/* && bun build:esm && bun build:cjs",
"build:esm": "tsc -p tsconfig.esm.json",
"build:cjs": "tsc -p tsconfig.cjs.json"
},
Expand Down
34 changes: 0 additions & 34 deletions packages/agent-sdk/tests/evm/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
validateRequest,
} from "../../src/evm";
import { getAddress, zeroAddress } from "viem";
import { NextRequest, NextResponse } from "next/server";
import type { BaseRequest } from "../../src/evm";
import { hexifyValue } from "../../src/evm";

Expand Down Expand Up @@ -158,37 +157,4 @@ describe("evm/index", () => {
expect(result).toBeNull();
});
});

describe("validateNextRequest", () => {
it("should validate a real request", async () => {
const request = new NextRequest(
new Request("https://example.com", {
method: "POST",
headers: new Headers({
"mb-metadata": JSON.stringify({
accountId: "max-normal.near",
evmAddress: zeroAddress,
}),
}),
body: JSON.stringify({ test: "data" }),
}),
);

const result = await validateNextRequest(request);
expect(result).toBeNull();
});
});
});

// TODO: Use in Next Agents.
export async function validateNextRequest(
req: NextRequest,
): Promise<NextResponse | null> {
const result = await validateRequest<NextRequest, NextResponse>(
req,
(data: unknown, init?: { status?: number }) =>
NextResponse.json(data, init),
);

return result;
}
Loading