npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@erc-3643/vue-usedapp

v1.0.4

Published

VueJS components for ERC3643 interaction

Downloads

9

Readme

@erc-3643/vue-usedapp

Build Status npm version NPM Downloads

Table of contents

What is @erc-3643/vue-usedapp

The @erc-3643/vue-usedapp package provides a set of Vue composables for ERC3643 tokens.

Installation

  1. Install module

    npm i @erc-3643/vue-usedapp --save

  2. reflect-metadata is required, install it too:

    npm install reflect-metadata --save

    and make sure to import it in a global place, like app.ts:

    import 'reflect-metadata';

Usage examples

Token API

<script setup lang="ts">
import { useToken } from '@erc-3643/vue-usedapp';
import { ref, watch } from 'vue';
import { useEthers } from 'vue-dapp';
import { TOKEN_ADDRESS } from '@/constants';

const { signer } = useEthers()

const tokenData = ref<{ [key: string]: any }>({});

watch(signer, async (signer) => {
  if (signer) {
    const {
      token,
      isPaused
    } = await useToken(TOKEN_ADDRESS, signer);
    tokenData.value.decimals = await token.decimals()
    tokenData.value.name = await token.name()
    tokenData.value.owner = await token.owner()
    tokenData.value.totalSupply = await token.totalSupply()
    tokenData.value.balanceOf = await token.balanceOf()
    tokenData.value.frozenTokens = await token.frozenTokens()
    tokenData.value.realBalanceOf = await token.realBalanceOf()
    tokenData.value.isPaused = isPaused;
    tokenData.value.walletIsFrozen = await token.walletIsFrozen(await signer.getAddress())
  }
})
</script>

<template>
  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
    <q-card class="token-info">
      <q-card-section>
        <div class="text-h6">Token info:</div>
      </q-card-section>
      <q-card-section>
        <p>Decimals: {{ tokenData.decimals }}</p>
        <p>Name: {{ tokenData.name }}</p>
        <p>Owner: {{ tokenData.owner }}</p>
        <p>Total Supply: {{ tokenData.totalSupply }}</p>
        <p>Balance Of: {{ tokenData.balanceOf }}</p>
        <p>Frozen Tokens: {{ tokenData.frozenTokens }}</p>
        <p>Real Balance Of: {{ tokenData.realBalanceOf }}</p>
        <p>
          Wallet Is Frozen: {{  }}
          <q-chip v-if="tokenData.walletIsFrozen" color="negative" text-color="white">
            Yes
          </q-chip>
          <q-chip v-else color="positive" text-color="white">
            No
          </q-chip>
        </p>
        <p>
          Token Is Paused:
          <q-chip v-if="tokenData.isPaused" color="negative" text-color="white">
            Yes
          </q-chip>
          <q-chip v-else color="positive" text-color="white">
            No
          </q-chip>
        </p>
      </q-card-section>
    </q-card>
  </div>
</template>

Transfer compliance

<script setup lang="ts">
import { useTransferCompliance } from '@erc-3643/vue-usedapp';
import { ref, watch } from 'vue';
import { Signer } from 'ethers';
import { useEthers } from 'vue-dapp';
import { BOB_WALLET, TOKEN_ADDRESS } from '@/constants';

const { signer } = useEthers();

const signerAddress = ref('');
const addressToTransfer = ref('');
const amountToTransfer = ref(0);
const transferOk = ref(null);
const complianceErrors = ref([]);

watch(signer, async (signer) => {
  if (signer) {
    signerAddress.value = await signer.getAddress()
  }
});

const canTransfer = async () => {
  const transferCompliant = useTransferCompliance();
  const { result, errors } = await transferCompliant.isTransferCompliant(
    signer.value as Signer,
    TOKEN_ADDRESS,
    signerAddress.value,
    addressToTransfer.value,
    amountToTransfer.value
  );
  transferOk.value = result as any;
  complianceErrors.value = errors as any;
}
</script>

<template>
  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
    <div class="row q-col-gutter-sm q-py-sm">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <q-card class="compliance-info">
          <q-card-section>
            <div class="text-h6">Compliance Info:</div>
          </q-card-section>
          <q-card-section>
            <p>
              Can transfer?
              <q-chip v-if="transferOk" color="positive" text-color="white">
                Yes
              </q-chip>
              <q-chip v-else color="negative" text-color="white">
                No
              </q-chip>
            </p>
            <p>
              From: {{ signerAddress }}
            </p>
            <p>
              <q-input
                v-model="addressToTransfer"
                label="Transfer to wallet"
                :hint="`ex. Bob wallet ${BOB_WALLET}`"
                dense
              />
            </p>
            <p>
              <q-input
                v-model="amountToTransfer"
                label="Amount of tokens"
                dense
              />
            </p>
            <p>
              <q-btn color="primary" @click="canTransfer" label="Can transfer?" dense />
            </p>
          </q-card-section>
        </q-card>
      </div>
    </div>
    <div class="row q-col-gutter-sm q-py-sm">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <q-card class="compliance-errors" style="display: block;" v-if="transferOk == false">
          <q-card-section>
            <div class="text-h6">Compliance Errors:</div>
          </q-card-section>
          <div
            v-for="(error, index) in complianceErrors"
            :key="index"
          >
            <q-card-section :class="[index === 0 ? 'q-pt-none': '']">
              <q-chip style="height: 100%;" color="negative" text-color="white">
                <div style="white-space: normal; word-wrap: break-word;">
                  {{ error }}
                </div>
              </q-chip>
            </q-card-section>
            <q-separator inset />
          </div>
        </q-card>
      </div>
    </div>
  </div>
</template>