diff --git a/go.mod b/go.mod index eb80508..9f58996 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.5 require ( github.com/ava-labs/avalanchego v1.11.11-0.20240827034238-fc892827880a - github.com/ava-labs/hypersdk v0.0.18-0.20240925020906-5e56020fc97a + github.com/ava-labs/hypersdk v0.0.18-0.20240927214628-f1150a1a8113 github.com/fatih/color v1.13.0 github.com/gorilla/mux v1.8.0 github.com/joho/godotenv v1.5.1 diff --git a/go.sum b/go.sum index 445e16d..96229e4 100644 --- a/go.sum +++ b/go.sum @@ -82,6 +82,8 @@ github.com/ava-labs/hypersdk v0.0.18-0.20240924140531-778461f7b593 h1:QI7SQgRDLd github.com/ava-labs/hypersdk v0.0.18-0.20240924140531-778461f7b593/go.mod h1:IH+fJyFJWfrwRR4YHwKVpdPIJUqO9n3URH2odigGfDE= github.com/ava-labs/hypersdk v0.0.18-0.20240925020906-5e56020fc97a h1:PBw0DXM4uE7yfp+qhqPxtEcZmYvm0Od2DxokHw5q2gM= github.com/ava-labs/hypersdk v0.0.18-0.20240925020906-5e56020fc97a/go.mod h1:IH+fJyFJWfrwRR4YHwKVpdPIJUqO9n3URH2odigGfDE= +github.com/ava-labs/hypersdk v0.0.18-0.20240927214628-f1150a1a8113 h1:6sgbTFvSw/jE5BjIOESlHAC+c6J5cRpzzQCNp7d3fTs= +github.com/ava-labs/hypersdk v0.0.18-0.20240927214628-f1150a1a8113/go.mod h1:2ihwQLh3Szf8MnzoL1u6zeD/hCSz9L4nSB14uJJljNU= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/web_wallet/package-lock.json b/web_wallet/package-lock.json index 74013fc..cb45a88 100644 --- a/web_wallet/package-lock.json +++ b/web_wallet/package-lock.json @@ -13,7 +13,7 @@ "@metamask/sdk": "^0.26.5", "@noble/curves": "^1.4.2", "@scure/base": "^1.1.7", - "hypersdk-client": "^0.4.6", + "hypersdk-client": "^0.4.7", "lossless-json": "^4.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -35,50 +35,6 @@ "vite": "^5.3.4" } }, - "../../hypersdk-client": { - "version": "0.4.6", - "extraneous": true, - "license": "NOT_DECIDED_YET_TODO_FIX", - "dependencies": { - "@metamask/sdk": "^0.28.2", - "@metamask/snaps-sdk": "^6.5.0", - "@noble/curves": "^1.6.0", - "@scure/base": "^1.1.8", - "buffer": "^6.0.3", - "lossless-json": "^4.0.1", - "tweetnacl": "^1.0.3" - }, - "devDependencies": { - "@jest/globals": "^29.5.0", - "@metamask/auto-changelog": "^3.4.4", - "@metamask/eslint-config": "^12.2.0", - "@metamask/eslint-config-jest": "^12.1.0", - "@metamask/eslint-config-nodejs": "^12.1.0", - "@metamask/eslint-config-typescript": "^12.1.0", - "@metamask/snaps-cli": "^6.2.1", - "@metamask/snaps-jest": "^8.2.0", - "@types/react": "^18.3.5", - "@typescript-eslint/eslint-plugin": "^5.42.1", - "@typescript-eslint/parser": "^5.42.1", - "eslint": "^8.45.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-import": "~2.26.0", - "eslint-plugin-jest": "^27.1.5", - "eslint-plugin-jsdoc": "^43.2.0", - "eslint-plugin-n": "^15.7.0", - "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-promise": "^6.1.1", - "jest": "^29.5.0", - "prettier": "^2.7.1", - "prettier-plugin-packagejson": "^2.2.11", - "rimraf": "^3.0.2", - "ts-jest": "^29.1.0", - "typescript": "~5.0" - }, - "engines": { - "node": ">=18.6.0" - } - }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -3477,9 +3433,9 @@ } }, "node_modules/@metamask/snaps-sdk": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/@metamask/snaps-sdk/-/snaps-sdk-6.6.0.tgz", - "integrity": "sha512-KHPcf6F4oMw9rJTqL8gYW77zp/Zd+MCxAmxOHVCyRGAxmXwc/lpWUYweEH4qX8409p/R6zVYE73y/2d35pA1qQ==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/@metamask/snaps-sdk/-/snaps-sdk-6.7.0.tgz", + "integrity": "sha512-OEOEbPq5twegqVCbgXZEEwKf7Bw28zxh72t+4ASvBm1M3bh9qedponX8StuwVVJdNsOfnPxB/iZGRUJKc9hYnw==", "license": "ISC", "dependencies": { "@metamask/key-tree": "^9.1.2", @@ -8439,14 +8395,15 @@ } }, "node_modules/hypersdk-client": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/hypersdk-client/-/hypersdk-client-0.4.6.tgz", - "integrity": "sha512-D1IlMH+doinLWFlJDpze4H9gake2wcQOUKaJcy/7jluuXYxmRm37fV9bbNy9d3G4UXOrDe1d8JStOTG8YCmJLQ==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/hypersdk-client/-/hypersdk-client-0.4.7.tgz", + "integrity": "sha512-1e2YWRJbULRQ/rYONX//f3sO1sTg/AgH+bXxtuoXMb2WHRm/om+Hsi2Y1jPwVCmOKGInFzE1AqUQ0MprXg9Q/Q==", "license": "NOT_DECIDED_YET_TODO_FIX", "dependencies": { "@metamask/sdk": "^0.28.2", "@metamask/snaps-sdk": "^6.5.0", "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0", "@scure/base": "^1.1.8", "buffer": "^6.0.3", "lossless-json": "^4.0.1", diff --git a/web_wallet/package.json b/web_wallet/package.json index ec4a7cd..dd797f0 100644 --- a/web_wallet/package.json +++ b/web_wallet/package.json @@ -17,7 +17,7 @@ "@metamask/sdk": "^0.26.5", "@noble/curves": "^1.4.2", "@scure/base": "^1.1.7", - "hypersdk-client": "^0.4.6", + "hypersdk-client": "^0.4.7", "lossless-json": "^4.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/web_wallet/src/screens/App.tsx b/web_wallet/src/screens/App.tsx index dd2ea54..bc4ecfb 100644 --- a/web_wallet/src/screens/App.tsx +++ b/web_wallet/src/screens/App.tsx @@ -35,7 +35,7 @@ function App() { return (
- +
diff --git a/web_wallet/src/screens/Wallet.tsx b/web_wallet/src/screens/Wallet.tsx index 87bd29b..c7a4d91 100644 --- a/web_wallet/src/screens/Wallet.tsx +++ b/web_wallet/src/screens/Wallet.tsx @@ -40,10 +40,10 @@ function Action({ actionName, abi, fetchBalance }: { actionName: string, abi: VM try { setActionLogs(prev => [...prev, `Action data for ${actionName}: ${JSON.stringify(actionInputs, null, 2)}`]) const result = isReadOnly - ? await vmClient.executeReadonlyAction({ actionName, data: actionInputs }) - : await vmClient.sendTx([{ actionName, data: actionInputs }]) + ? await vmClient.simulateAction({ actionName, data: actionInputs }) + : await vmClient.sendTransaction([{ actionName, data: actionInputs }]) const endTime = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' }); - setActionLogs(prev => [...prev, `${endTime} - Success: ${stringify(result)}`]) + setActionLogs(prev => [...prev, `${endTime} - Success: ${stringify(result, null, 2)}`]) if (!isReadOnly) { fetchBalance(true) } @@ -166,7 +166,7 @@ export default function Wallet({ myAddr }: { myAddr: string }) { ) : balance !== null ? (
- {parseFloat(vmClient.formatBalance(balance)).toFixed(6)} {"COIN"} + {parseFloat(vmClient.formatNativeTokens(balance)).toFixed(6)} {"COIN"}