@abcpros/xpi-js 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

bch-js

版本下载/周许可证js-standard-style

bch-js 是一个 JavaScript npm 库,用于创建可以与比特币现金 (BCH) 区块链交互的 Web 和移动应用程序。 它可以免费使用,但需要在 FullStack.cash 上有一个帐户才能提高速率限制。 从这篇文章了解更多关于全栈比特币现金开发的信息。

Quick Start Videos:

以下是两个 YouTube 演练视频,可帮助您入门:

Quick Notes

  • 安装库:npm install @psf/bch-js

  • 在您的代码中实例化该库:

const BCHJS = require("@psf/bch-js")
let bchjs = new BCHJS() // Defaults to BCHN network.

// testnet
bchjs = new BCHJS({ restURL: 'https://testnet3.fullstack.cash/v4/' })

该库旨在与 bch-api REST API,以及 FullStack.cashrestURL 属性可以更改以适用于不同

  • BCHN Mainnet REST API server: https://bchn.fullstack.cash/v4/
  • ABC Mainnet REST API server: https://abc.fullstack.cash/v4/
  • Testnet3 REST API server: https://testnet3.fullstack.cash/v4/
  • Check server status: https://metrics.fullstack.cash

API Key

的比特币现金网络:bch-api< /a> FullStack.cash 托管的 REST API 使用 JWT 代币支付增加的费用 与后端服务器交互时的速率限制。 如果您想了解系统即服务,请参阅这篇文章 -所有的。 JWT 令牌可以隐式显式提供给 bch-js。

  • Implicitly: bch-js will detect your JWT token if you set the BCHJSTOKEN environment variable.
  • Explicitly: You can directly feed in the JWT token with the apiToken property when instantiating the library. Here is an example:
const BCHJS = require("@psf/bch-js")
let bchjs = new BCHJS({
  restURL: 'https://bchn.fullstack.cash/v5/',
  apiToken: 'eyJhbGciO...' // Your JWT token here.
})

Gatsby

bch-js 包含在这个 gatsby-ipfs-template 中,用于构建可以交互的不可审查的网络应用程序与区块链。 在构建 Gatsby(或其他使用 Webpack 的前端应用程序)时,您需要根据 这个问题

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    node: {
      fs: 'empty'
    }
  })
}

这是因为bch-js中新增的IPFS类使用fs库上传文件,Gatsby不支持。

我们还提供 minimal-slp-wallet-web 作为支持 SLP 的基本比特币现金钱包,对于前端项目。 bch-js 被封装在类库的实例化中。

Features

  • 使用 ECMAScript 2017 标准 JavaScript 代替 TypeScript。 作品 本机使用 node.js v10 或更高版本。

  • 完整的 SLP 令牌支持:bch-js 完全支持所有 SLP 令牌功能,包括发送、铸币和创世交易。 它还完全支持不可替代代币 (NFT) 的所有方面。

  • 语义发布 使用语义版本控制的持续交付。

  • Greenkeeper 自动依赖管理 自动维护最新、最安全的依赖项。

  • IPFS 上传所有文件和依赖项,以进行备份 依赖项,以防它们无法从 GitHub 或 npm 访问。

Documentation:

这个库的完整文档可以在这里找到:

bch-js 使用 APIDOC 以便文档和工作代码 住在同一个存储库中。 生成文档:

  • npm run docs
  • Open the generated docs/index.html file in a web browser.

Support

有问题吗? 需要帮忙? 加入我们的社区支持 Telegram 频道

IPFS Releases

此存储库的副本也发布在 IPFS 上。

  • v4.5.4: QmWv3pxJy3MH8vU5nLUVyzqFxfNKXLQQEnz1rgStNuQijd

License

麻省理工学院

bch-js

VersionDownloads/weekLicensejs-standard-style

bch-js is a JavaScript npm library for creating web and mobile apps that can interact with the Bitcoin Cash (BCH) blockchains. It can be used for free, but requires an account on FullStack.cash for increased rate limits. Learn more from this article about Full Stack Bitcoin Cash development.

Quick Start Videos:

Here are two YouTube walk-through videos to help you get started:

Quick Notes

  • Install library: npm install @psf/bch-js

  • Instantiate the library in your code:

const BCHJS = require("@psf/bch-js")
let bchjs = new BCHJS() // Defaults to BCHN network.

// testnet
bchjs = new BCHJS({ restURL: 'https://testnet3.fullstack.cash/v4/' })

This library is intended to be paired with the bch-api REST API, and the infrastructure provided by FullStack.cash. The restURL property can be changed to work with different Bitcoin Cash networks:

  • BCHN Mainnet REST API server: https://bchn.fullstack.cash/v4/
  • ABC Mainnet REST API server: https://abc.fullstack.cash/v4/
  • Testnet3 REST API server: https://testnet3.fullstack.cash/v4/
  • Check server status: https://metrics.fullstack.cash

API Key

The bch-api REST API hosted by FullStack.cash uses JWT tokens to pay for increased rate limits when interacting with the back end server. See this article if you want to understand the system-as-a-whole. The JWT token can be fed to bch-js implicitly or explicitly.

  • Implicitly: bch-js will detect your JWT token if you set the BCHJSTOKEN environment variable.
  • Explicitly: You can directly feed in the JWT token with the apiToken property when instantiating the library. Here is an example:
const BCHJS = require("@psf/bch-js")
let bchjs = new BCHJS({
  restURL: 'https://bchn.fullstack.cash/v5/',
  apiToken: 'eyJhbGciO...' // Your JWT token here.
})

Gatsby

bch-js is included in this gatsby-ipfs-template for building uncensorable web apps that can interact with the blockchain. When building a Gatsby (or other front-end app that uses Webpack), you'll need to add these lines to your gatsby-node.js file, as per this issue:

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    node: {
      fs: 'empty'
    }
  })
}

This is because the new IPFS class in bch-js uses the fs library for uploading files, which is not supported by Gatsby.

We also provide minimal-slp-wallet-web as a basic Bitcoin Cash wallet with SLP support, for front end projects. bch-js is encapsulated inside the instantiation of the library Class.

Features

  • ECMAScript 2017 standard JavaScript used instead of TypeScript. Works natively with node.js v10 or higher.

  • Full SLP tokens support: bch-js has full support for all SLP token functionality, including send, mint, and genesis transactions. It also fully support all aspects of non-fugible tokans (NFTs).

  • Semantic Release for continuous delivery using semantic versioning.

  • Greenkeeper automatic dependency management for automatically maintaining the latest, most secure dependencies.

  • IPFS uploads of all files and dependencies, to backup dependencies in case they are ever inaccessible from GitHub or npm.

Documentation:

Full documentation for this library can be found here:

bch-js uses APIDOC so that documentation and working code live in the same repository. To generate the documentation:

  • npm run docs
  • Open the generated docs/index.html file in a web browser.

Support

Have questions? Need help? Join our community support Telegram channel

IPFS Releases

Copies of this repository are also published on IPFS.

  • v4.5.4: QmWv3pxJy3MH8vU5nLUVyzqFxfNKXLQQEnz1rgStNuQijd

License

MIT

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文