Skip to content

Commit 058f0bb

Browse files
authored
Optional From (#46)
1 parent 346c42b commit 058f0bb

File tree

9 files changed

+16
-30
lines changed

9 files changed

+16
-30
lines changed

bun.lock

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"name": "@bitte/core",
66
"devDependencies": {
77
"@duneanalytics/client-sdk": "^0.2.5",
8-
"@eslint/js": "^9.30.0",
98
"@types/bun": "latest",
109
"@types/jest": "^30.0.0",
1110
"@typescript-eslint/eslint-plugin": "^8.34.1",
@@ -14,7 +13,6 @@
1413
"dotenv": "^16.5.0",
1514
"eslint": "^9.29.0",
1615
"jest": "^30.0.2",
17-
"jest-util": "^30.0.2",
1816
"next": "^15.3.4",
1917
"prettier": "^3.5.3",
2018
"ts-jest": "^29.4.0",
@@ -26,7 +24,7 @@
2624
"name": "@bitte-ai/agent-sdk",
2725
"version": "0.0.2",
2826
"dependencies": {
29-
"@bitte-ai/types": "^0.5.3",
27+
"@bitte-ai/types": "^0.5.4",
3028
"near-safe": "^0.10.0",
3129
"viem": "^2.31.6",
3230
"zerion-sdk": "^0.1.4",
@@ -282,7 +280,7 @@
282280

283281
"@bitte-ai/agent-sdk": ["@bitte-ai/agent-sdk@workspace:packages/agent-sdk"],
284282

285-
"@bitte-ai/types": ["@bitte-ai/[email protected].3", "", { "dependencies": { "@mysten/sui": "^1.26.0", "@near-wallet-selector/core": "^8.9.0", "@suiet/wallet-kit": "^0.3.4", "ai": "^4.1.51", "bn.js": "^5.2.1", "near-api-js": "^5.0.0", "near-safe": "^0.10.0", "openapi-types": "^12.0.0", "react": "^18.0.0", "viem": "2.29.1", "wagmi": "^2.15.6" } }, "sha512-yj6GaUzvy7/eXz6DgugoSbZVNINTjOT76MOQ8xXwgLAFmBi2IvfUAV0IHeObG07kcyYDBH4GvomFAnflYjenCA=="],
283+
"@bitte-ai/types": ["@bitte-ai/[email protected].4", "", { "dependencies": { "@mysten/sui": "^1.26.0", "@near-wallet-selector/core": "^8.9.0", "@suiet/wallet-kit": "^0.3.4", "ai": "^4.1.51", "bn.js": "^5.2.1", "near-api-js": "^5.0.0", "near-safe": "^0.10.0", "openapi-types": "^12.0.0", "react": "^18.0.0", "viem": "2.29.1", "wagmi": "^2.15.6" } }, "sha512-V5YuQomLFxUk39ZwUvBJOixGm7hV44o8qUTD4kPmtNian+xQkZF/o/p7OVTuLX2h9Q1EvJeSC1EPyD41vSGkwA=="],
286284

287285
"@coinbase/wallet-sdk": ["@coinbase/[email protected]", "", { "dependencies": { "@noble/hashes": "^1.4.0", "clsx": "^1.2.1", "eventemitter3": "^5.0.1", "preact": "^10.24.2" } }, "sha512-h8gMLQNvP5TIJVXFOyQZaxbi1Mg5alFR4Z2/PEIngdyXZEoQGcVhzyQGuDa3t9zpllxvqfAaKfzDhsfCo+nhSQ=="],
288286

@@ -1414,7 +1412,7 @@
14141412

14151413
"loose-envify": ["[email protected]", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="],
14161414

1417-
"lru-cache": ["lru-cache@11.1.0", "", {}, "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A=="],
1415+
"lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
14181416

14191417
"lru_map": ["[email protected]", "", {}, "sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg=="],
14201418

@@ -1880,8 +1878,6 @@
18801878

18811879
"@babel/core/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
18821880

1883-
"@babel/helper-compilation-targets/lru-cache": ["[email protected]", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
1884-
18851881
"@babel/helper-compilation-targets/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
18861882

18871883
"@babel/helper-create-class-features-plugin/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
@@ -2082,6 +2078,8 @@
20822078

20832079
"obj-multiplex/readable-stream": ["[email protected]", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],
20842080

2081+
"path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A=="],
2082+
20852083
"pkg-dir/find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="],
20862084

20872085
"qrcode/yargs": ["[email protected]", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="],

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
"tokenMap": "bun run scripts/genTokenMap.ts",
1313
"lint": "prettier --check {scripts,packages}/**/* && eslint packages/",
1414
"fmt": "prettier --write {scripts,packages}/**/* && eslint packages/ --fix",
15-
"test": "jest"
15+
"test": "jest --config jest.config.cjs"
1616
},
1717
"devDependencies": {
1818
"@duneanalytics/client-sdk": "^0.2.5",
19-
"@eslint/js": "^9.30.0",
2019
"@types/bun": "latest",
2120
"@types/jest": "^30.0.0",
2221
"@typescript-eslint/eslint-plugin": "^8.34.1",
@@ -25,7 +24,6 @@
2524
"dotenv": "^16.5.0",
2625
"eslint": "^9.29.0",
2726
"jest": "^30.0.2",
28-
"jest-util": "^30.0.2",
2927
"next": "^15.3.4",
3028
"prettier": "^3.5.3",
3129
"ts-jest": "^29.4.0",

packages/agent-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"build:cjs": "tsc -p tsconfig.cjs.json"
3333
},
3434
"dependencies": {
35-
"@bitte-ai/types": "^0.5.3",
35+
"@bitte-ai/types": "^0.5.4",
3636
"near-safe": "^0.10.0",
3737
"viem": "^2.31.6",
3838
"zerion-sdk": "^0.1.4"

packages/agent-sdk/src/evm/erc20.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { erc20Abi, zeroAddress } from "viem";
1+
import { erc20Abi } from "viem";
22
import { encodeFunctionData, type Address } from "viem";
33
import type { MetaTransaction } from "@bitte-ai/types";
44
import type { TokenInfo } from "./types";
@@ -16,7 +16,6 @@ export function erc20Transfer(params: {
1616
}): MetaTransaction {
1717
const { token, to, amount } = params;
1818
return {
19-
from: zeroAddress,
2019
to: token,
2120
value: "0x00",
2221
data: encodeFunctionData({
@@ -35,9 +34,8 @@ export function erc20Approve(params: {
3534
}): MetaTransaction {
3635
const { token, spender, amount } = params;
3736
return {
38-
from: zeroAddress,
3937
to: token,
40-
value: "0x0",
38+
value: "0x00",
4139
data: encodeFunctionData({
4240
abi: erc20Abi,
4341
functionName: "approve",

packages/agent-sdk/src/evm/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getAddress, zeroAddress, isHex, toHex, toBytes } from "viem";
1+
import { getAddress, isHex, toHex, toBytes, zeroAddress } from "viem";
22
import { SignRequest, MetaTransaction } from "@bitte-ai/types";
33
import type { Address, Hex } from "viem";
44

packages/agent-sdk/src/evm/weth.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
parseAbi,
77
parseEther,
88
toHex,
9-
zeroAddress,
109
} from "viem";
1110
import { Network } from "near-safe";
1211

@@ -57,7 +56,6 @@ export const unwrapMetaTransaction = (
5756
amount: bigint,
5857
): MetaTransaction => {
5958
return {
60-
from: zeroAddress,
6159
to: getNativeAsset(chainId).address,
6260
value: "0x0",
6361
data: encodeFunctionData({
@@ -73,7 +71,6 @@ export const wrapMetaTransaction = (
7371
amount: bigint,
7472
): MetaTransaction => {
7573
return {
76-
from: zeroAddress,
7774
to: getNativeAsset(chainId).address,
7875
value: toHex(amount),
7976
// methodId for weth.deposit

packages/agent-sdk/tests/evm/erc20.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Address, erc20Abi, zeroAddress } from "viem";
1+
import { type Address, erc20Abi } from "viem";
22
import {
33
erc20Transfer,
44
erc20Approve,
@@ -28,7 +28,6 @@ describe("ERC20 Utilities", () => {
2828
};
2929

3030
expect(erc20Transfer(params)).toEqual({
31-
from: zeroAddress,
3231
data: "0xa9059cbb000000000000000000000000123456789012345678901234567890123456789000000000000000000000000000000000000000000000000000000000000003e8",
3332
to: "0x1234567890123456789012345678901234567890",
3433
value: "0x00",
@@ -45,10 +44,9 @@ describe("ERC20 Utilities", () => {
4544
};
4645

4746
expect(erc20Approve(params)).toEqual({
48-
from: zeroAddress,
4947
data: "0x095ea7b3000000000000000000000000123456789012345678901234567890123456789000000000000000000000000000000000000000000000000000000000000003e8",
5048
to: "0x1234567890123456789012345678901234567890",
51-
value: "0x0",
49+
value: "0x00",
5250
});
5351
});
5452

@@ -59,10 +57,9 @@ describe("ERC20 Utilities", () => {
5957
};
6058

6159
expect(erc20Approve(params)).toEqual({
62-
from: zeroAddress,
6360
data: "0x095ea7b30000000000000000000000001234567890123456789012345678901234567890ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
6461
to: "0x1234567890123456789012345678901234567890",
65-
value: "0x0",
62+
value: "0x00",
6663
});
6764
});
6865
});

packages/agent-sdk/tests/evm/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("evm/index", () => {
3232
describe("signRequestFor", () => {
3333
it("creates a sign request with default from address", () => {
3434
const metaTransactions = [
35-
{ from: zeroAddress, to, value: "0x00" as Hex, data: "0xabc" as Hex },
35+
{ to, value: "0x00" as Hex, data: "0xabc" as Hex },
3636
];
3737

3838
const result = signRequestFor({
@@ -56,7 +56,7 @@ describe("evm/index", () => {
5656

5757
it("creates a sign request with specified from address", () => {
5858
const metaTransactions = [
59-
{ from: zeroAddress, to, value: "0x00" as Hex, data: "0xabc" as Hex },
59+
{ to, value: "0x00" as Hex, data: "0xabc" as Hex },
6060
];
6161

6262
const result = signRequestFor({

packages/agent-sdk/tests/evm/weth.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Network } from "near-safe";
2-
import { parseEther, zeroAddress } from "viem";
2+
import { parseEther } from "viem";
33
import {
44
validateWethInput,
55
getNativeAsset,
@@ -16,7 +16,6 @@ describe("evm/weth", () => {
1616
// Existing tests
1717
it("unwrapMetaTransaction", async () => {
1818
expect(unwrapMetaTransaction(100, 25n)).toStrictEqual({
19-
from: zeroAddress,
2019
to: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
2120
value: "0x0",
2221
data: "0x2e1a7d4d0000000000000000000000000000000000000000000000000000000000000019",
@@ -25,7 +24,6 @@ describe("evm/weth", () => {
2524

2625
it("wrapMetaTransaction", async () => {
2726
expect(wrapMetaTransaction(100, 25n)).toStrictEqual({
28-
from: zeroAddress,
2927
to: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
3028
value: "0x19",
3129
data: "0xd0e30db0",

0 commit comments

Comments
 (0)