Custom Hooks

The utilities here are designed to they can be easily extended. If, for example, you wanted to add functionality to a token object thats returned by useToken. You could make a new hook in your project, and simply use useToken inside it, taking what you need. To make a custom useMyToken hook for example.

// hooks/useMyToken.js
import { useToken } from "../lib/main";

export function useMyToken() {
    const MY_TOKEN_ADDRESS = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"
    const token = useToken(MY_TOKEN_ADDRESS);

    return {
        ...token // return all the existing functionality
        burn() {
            // TODO: Burn Token
        }
    }
}
<script setup>
import { useMyToken } from './hooks/useMyToken';
const myToken = useMyToken();
</script>

<template>
    <p>Name: {{ myToken.name }}</p>
    <button @click="myToken.burn()">Burn</button>
</template>