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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-near

v0.2.1

Published

NEAR Protocol plugin for Vue 3, enabling easy methods within common vuejs patterns

Downloads

11

Readme

Vue Near

A vue 3 plugin for NEAR API. Useful for building dapps with NEAR blockchain quickly! This plugin combines the simplicity of near-api-js to the convenience of vuejs methods available to all components.

Installation

1. Install Plugin

# yarn
yarn add vue-near

# npm
npm install vue-near

2. Add CDN NEAR-API-JS

Add this script tag to your index.html file.

<script src="https://cdn.jsdelivr.net/gh/nearprotocol/near-api-js/dist/near-api-js.js" ></script>

3. Import

// In main.js
import { createApp } from 'vue'
import VueNear from "vue-near"

const app = createApp(App)

app.use(VueNear, {
  // Needs the environment for the correct RPC to use
  env: process.env.NODE_ENV || 'development',
  config: {
    appTite: 'Cool dApp',
    contractName: 'cool_dapp.testnet',
  },
})

app.mount('#app')

Usage

// this.$near -- has all the bootstrapped near-api-js methods
// in addition to some quick helpers
// ALL methods available within any component
console.log(this.$near.user.accountId)
// -> 'cool_user.testnet'

// Sign in a user, via web wallet
this.$near.loginAccount()

// logout a user
this.$near.logoutAccount()

// get a contract with executable methods
this.$near.getContractInstance('cool_contract.testnet', {
  changeMethods: ['set_something'],
  viewMethods: ['get_something'],
})

API methods

$near

This is the base global instance of near-api-js, upon application start this instance utilizes a fully configured connection, allowing immediate use within all components. For more information on what is available (not documented below) see full docs here. Specific methods available here

await this.$near.sendTokens(10, 'from_account.testnet', 'to_account.testnet')

loginAccount()

Sign in a user, via web wallet. Will redirect user to the near web wallet configured based on environment. Upon success, user will land back on this application with permissions. This will continue to use any user data that is already logged in (see localStorage) if available.

this.$near.loginAccount()

logoutAccount()

Fully removes user data in localStorage as well as within all $near instances.

this.$near.logoutAccount()

getContractInstance()

Load a contract with all available methods for easy interaction with the blockchain deployed contract. Configure which account the contract is available at, and provide method names for each type, then contract methods can be executed with returned instance.

const contract = this.$near.getContractInstance('cool_contract.testnet', {
  changeMethods: ['set_something'],
  viewMethods: ['get_something'],
})

// call method
await contract.set_something()

// view method
await contrat.get_something()

loadAccount()

Load the user account into $near instance, making all helper methods and details available.

this.$near.loadAccount()

// Now user info and methods are available:
this.$near.user

// Where you can access things like:
this.near.user.accountId
this.near.user.balance

$nearInit

In rare cases, you may want to fully re-instantiate the base $near instance. Using this method will fully clear any/all data configured within $near and re-bind a new near-api-js class, configured with built env variables.

Tests

I would love help writing tests. ❤️

License

MIT License


Refill My ☕️?

If you feel this helped you in some way, you can tip tjtc.near