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

ng-blockchainx

v1.0.12

Published

Find Complete documentation here [Open docs ](https://blockchainxtech.github.io/ng-blockchain-x/docs/intro)

Downloads

35

Readme

NgBlockchainX

Find Complete documentation here Open docs

This library was generated with Angular CLI version 12.2.0.

Meta mask service


// import Metamask service on component in which you need
import { MetaMaskService } from "ng-blockchainx";

// add metamask service as DI ( dependency injection )
constructor(private metaMaskService: MetaMaskService) {}

To connect metamask wallet


this.metaMaskService.connectMetaMask()
.then((response:any) => {
    // DO your success logic here
})
.catch((error:any) => {
    // DO your failure logic here
});

To change active network on metamask wallet

// 'chainId = chain id of the network which to be active
this.metaMaskService.changeNetwork('chainID')
.then((response:any) => {
    // DO your success logic here
})
.catch((error:any) => {
    // DO your failure logic here
});

export interface Response {
    status: boolean;
    code: number;
    message: string;
    data: Data | undefined | any;
}

this.metaMaskService.connectionListener.subscribe((response:Response) => {
    console.log(response);
    // Do your logic here
});

| Response code | Message | Description | | :---: | :---: | :---: | | 250511 | Metamask not installed on browser | | | 250512 | Metamask not connected | | | 250500 | Un expected error | | | 250601 | Metamask connected successfully | | | 250609 | Service init success | Just ignore this event | | 250610 | Chain changed | | | 250611 | account changed | | | 250612 | metamask connection closed | |

Web3 service

If you are using Angular version >11 and run into an issue building. This is because polyfills are not included in the newest version of Angular.

  • Install the required dependencies within your angular project:
npm install --save-dev crypto-browserify next-tick stream-browserify assert stream-http https-browserify os-browserify
  • Within tsconfig.json add the following paths in compilerOptions so Webpack can get the correct dependencies
{
    "compilerOptions": {
        "paths" : {
        "crypto": ["./node_modules/crypto-browserify"],
        "stream": ["./node_modules/stream-browserify"],
        "assert": ["./node_modules/assert"],
        "http": ["./node_modules/stream-http"],
        "https": ["./node_modules/https-browserify"],
        "os": ["./node_modules/os-browserify"],
    }
}
  • Add the following lines to polyfills.ts file:
import { Buffer } from 'buffer';

(window as any).global = window;
global.Buffer = Buffer;
global.process = {
    env: { DEBUG: undefined },
    version: '',
    nextTick: require('next-tick')
} as any;
  • Create webpack.config.js file on root path and add below code

{
    resolve: {
        fallback: {
            url: require.resolve("url/")
        }
    }
}

after run npm install url

Once above setup done add below code into the component where you need web3service


// import Web3Service on component in which you need by adding below line
import { Web3Service } from "ng-blockchainx";

// add metamask service as DI ( dependency injection )
constructor(private web3Service: Web3Service) {}