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

@jccdex/nft-cross-chain-protocol

v0.1.1

Published

nft crosss chain protocol

Downloads

1

Readme

nft-cross-chain-protocol

NFT cross chain protocol on jingtum chain

ETH -> SWTC

NFT 从以太坊跨链到井通

交易分两步:

  1. 用户在以太坊调用 nft dao 合约 deposit,将 721 转账给以太坊合约。
  2. 用户调用 submitDepositOrder 在井通链上转账 1 swt 到井通 nft 银关地址, 附带相关跨链信息。
import { NFTDao } from "@jccdex/ethereum-contract";
import NFTTransaction from "@jccdex/nft-cross-chain-protocol";

const options = {
  account: ethereum.selectedAddress,
  chainId: "以太坊chain id",
  web3: this.web3,
  nftDaoContract: "以太坊nft dao合约地址",
  multicallAddress: "以太坊multicall合约地址"
};
const nftDao = new NFTDao(options);

const nft = "NFT合约地址";
const id = "NFT id";
const jingtum = "井通地址";
const fee = "手续费,默认为0";

// 充币,从以太坊到井通

// 充币前需检查nft是否授权给nft dao合约,调用erc-721.ts isApprovedForAll方法
// 如果未授权,调用setApprovalForAll方法
const result = await nftDao.deposit(nft, id, jingtum, fee);

const jingtumNft = "井通NFT银关地址";
// 井通rpc节点数组
const nodes = [""];
const nftTransaction = new NFTTransaction(jingtumNft, nodes);

const depositData = {
  from: "用户以太坊地址",

  address: "用户井通地址",

  secret: "用户井通密钥",

  nft: "以太坊nft合约地址",

  id: "以太坊nft id",

  depositHash: "上述deposit交易hash"
};

const hash = await nftTransaction.submitDepositOrder(depositData);

SWTC -> ETH

NFT 从井通跨链到以太坊

交易分两步:

  1. 用户调用 transfer721 在井通链上将 721 转账给井通 721 银关地址。
  2. 用户调用 submitWithdrawOrder 支付 0.0075 jeth 作为手续费到井通 721 银关地址,附带相关跨链信息。
import NFTTransaction from "@jccdex/nft-cross-chain-protocol";

const jingtumNft = "井通NFT银关地址";
// 井通rpc节点数组
const nodes = [""];

// 测试链手续费
const fee = {
  currency: "JETH",
  value: "0.0075",
  issuer: "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"
};

// 主链fee可不设
// 主链默认手续费
// {
//     currency: "JETH",
//     value: "0.0075",
//     issuer: "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"
// }
const nftTransaction = new NFTTransaction(jingtumNft, nodes, fee);

const address = "";
const secret = "";
const id = "";

const hash721 = await nftTransaction.transfer721(address, secret, id);

const withdrawData = {
  address: "用户井通地址",

  secret: "用户井通密钥",

  to: "用户以太坊地址",

  publisher: "井通nft发行方地址",

  tokenId: "井通nft token id",

  fundCode: "井通nft fund code",

  depositHash: "上述transfer721 hash"
};

const hash = await nftTransaction.submitWithdrawOrder(withdrawData);