Skip to content

Commit

Permalink
keep up with the latest client and hypersdk (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
containerman17 authored Sep 30, 2024
1 parent 206ce84 commit 9162622
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 58 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
59 changes: 8 additions & 51 deletions web_wallet/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web_wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web_wallet/src/screens/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function App() {

return (
<div className="flex items-center justify-center min-h-screen">
<Faucet myAddr={myAddr} minBalance={vmClient.fromFormattedBalance("1")}>
<Faucet myAddr={myAddr} minBalance={vmClient.convertToNativeTokens("1")}>
<Wallet myAddr={myAddr} />
</Faucet>
</div>
Expand Down
8 changes: 4 additions & 4 deletions web_wallet/src/screens/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -166,7 +166,7 @@ export default function Wallet({ myAddr }: { myAddr: string }) {
) : balance !== null ? (
<div className="flex items-center">
<div className="text-4xl font-bold mr-2">
{parseFloat(vmClient.formatBalance(balance)).toFixed(6)} {"COIN"}
{parseFloat(vmClient.formatNativeTokens(balance)).toFixed(6)} {"COIN"}
</div>
<button onClick={() => fetchBalance()} className="p-2 rounded-full hover:bg-gray-200">
<ArrowPathIcon className="h-5 w-5" />
Expand Down

0 comments on commit 9162622

Please sign in to comment.