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

xdc3-react-native

v1.0.1

Published

Implementing XRC-20 using XDC network , XDC wallet support.

Downloads

3

Readme

xdc3-react-native

xdc3-react-native SDK with support for smart contracts, XRC20 and XRC721.

Usage

Add the following dependency to your package.json:

"dependencies": {
"xdc3-react-native" = "1.0.0"
}

and 

npm i 

or

npm install xdc3-react-native
or
npm i xdc3-react-native

This SDK supports following Read & Write operations:-

| XRC20 Token: Read methods | XRC20 Token: Write methods | | --- | --- | | name(url , token_address) | approve(url , token_address ,privateKey , receiverAddress , owneraddress) | | symbol(url , token_address) | transferToken(url , token_address , privateKey , receiverAddress , owneraddress , amount) | | decimal(url , token_address) | transferFrom(url , token_address , privateKey , receiverAddress , owneraddress , amount) | | totalSupply(url , token_address) | increaseAllowance(url , token_address , privateKey , receiverAddress , owneraddress , value ) | | balanceOf(url , token_address , owneraddress) | decreaseAllowance(url , token_address , privateKey , receiverAddress , owneraddress , value) | | allowance(url , token_address , owneraddress , receiverAddress) | transferXDC(url , privateKey , owneraddress , receiverAddress , send_token_amount) | | | | | | | | | | | XRC721 Token: Read methods | XRC721 Token: Write methods | |_Name(url,token_address)|setApprovalAll(url,token_address,ownerPrivateKey,spenderAddress,owneraddress,booleanValue)| |_Symbol(url,token_address)|_Approve(url,token_address,ownerPrivateKey,spenderAddress,owneraddress,tokenId)| | _TotalSupply(url,token_address)|_TransferFrom(url,token_address,spendarprivateKey,receiverAddress,spenderAddress,tokenId)| |_BalanceOf(url,token_address,owneraddress)|_safeTransferFrom(url,token_address,spendarprivateKey,receiverAddress,spenderAddress,tokenId)| |OwnerOf(url,token_address,tokenId)|| |TokenUri(url,token_address,tokenId)|| |TokenByIndex(url,token_address,tokenIndex)|| |TokenByOwnerIndex(url,token_address,owneraddress,tokenIndex)|| |SupportInterface(url,token_address,interfaceId)|| |GetApproved(url,token_address,tokenId)|| |ApprovalAll(url,token_address,owneraddress,receiverAddress)|| |||

Environment Variable

Create a .env file in the root directory of the react-native project to put the wallet and endpoint information in like so:

export const url = 'wss://ws.apothem.network';

Example for XRC20

Read Method

//import read function Name

import Name from 'xdc-sdk-react-native/src/xrc20/name';

const getName = async () => {
  const url = network-url ;
  const token_address = XRC20-token-address;

  const name = await Name(url , token_address);
}

This example returns name of the specified address.

Write Method

//import write function transfer from

import transferFromAmount from 'xdc-sdk-react-native/src/xrc20/transfer_from';

const transferFrom = async () => {
  const url = network-url ;
  const token_address = XRC20-token-address;
  const sender_address = sender-address;
  const receiver_address = receiver-address;
  const privateKey = sender-private-Key;
  const amount = transfered-amount;

  const transfer = await transferFromAmount(url ,token_address ,privateKey ,receiver_address ,sender_address ,amount);
}

This example returns transfer object .

Example for XRC721

Read Method

//import read function Name

import _Name from 'xdc3-react-native/src/xrc721/name';

const getName = async () => {
  const url = network-url ;
  const token_address = XRC721-token-address;

  const name = await _Name(url , token_address);
}

This example returns name of the specified address.

Write Method

//import write function transfer from

import _TransferFrom from 'xdc-sdk-react-native/src/xrc721/transferFrom';

const transferFrom = async () => {
  const url = network-url ;
  const token_address = XRC721-token-address;
  const sender_address = sender-address;
  const receiver_address = receiver-address;
  const privateKey = sender-private-Key;
  const tokenId = token-id-which-you-need-to-transfer;

  const transfer = await _TransferFrom(url ,token_address ,privateKey ,receiver_address ,sender_address ,tokenId);
}

This example returns transfer object .