Skip to content

Commit e88cba4

Browse files
committed
fix: Buffer issue
1 parent 6c82513 commit e88cba4

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

frontend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"truncate-eth-address": "^1.0.2"
2929
},
3030
"devDependencies": {
31-
"@rollup/plugin-inject": "^5.0.5",
3231
"@types/node": "^20.14.2",
3332
"@types/react": "^18.2.66",
3433
"@types/react-dom": "^18.2.22",

frontend/src/components/ChatBox/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { hexlify, ethers } from "ethers";
1919
import { ADD_SUB_CONTRACT } from "@/config/snap";
2020

2121
import { AbiCoder } from "ethers";
22-
import { Buffer } from "buffer";
2322

2423
const defaultMessage = [
2524
<>
@@ -58,7 +57,9 @@ export const ChatBox = () => {
5857
return;
5958
}
6059

61-
const txData = hexlify(Buffer.from(inputMessage, "utf8"));
60+
const funcSelector = FunctionFragment.getSelector("do_it", ["string"]);
61+
const encodedParams = abiCoder.encode(["string"], [inputMessage]);
62+
const txData = hexlify(concat([funcSelector, encodedParams]));
6263

6364
const transactionDetails = {
6465
payload: {

frontend/vite.config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
33
import path from 'path'
4-
import inject from "@rollup/plugin-inject";
54
// https://vitejs.dev/config/
65
export default defineConfig({
76
resolve: {
87
alias: {
98
"@": path.resolve(__dirname, "src"),
109
},
1110
},
12-
build: {
13-
rollupOptions: {
14-
plugins: [inject({ Buffer: ['Buffer', 'Buffer'] })],
15-
},
16-
},
1711
server: {
1812
port: 8000
1913
},

0 commit comments

Comments
 (0)