@blocto/sdk

中文文档
0.10.4发布于 2024/10/14MITTypeScriptESM + CJS近 30 天下载 3.4万

npm (lastest) npm (beta) [![npm bundle size](https://img.shield

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录7 节
  1. Looking for the documentation?
  2. What can I do with Blocto SDK?
  3. Installing
  4. Usage
  5. Testing on local
  6. Scripts
  7. Develop

Blocto JavaScript SDK

npm (lastest) npm (beta) npm bundle size Github Checks npm downloads LICENSE Discord

Use Blocto SDK in your dApp to provide excellent user experience!

Looking for the documentation?

https://docs.blocto.app/blocto-sdk/javascript-sdk

What can I do with Blocto SDK?

  • Interact with multiple blockchains
    • Interact with Ethereum-compatible blockchains
      Ethereum Mainnet & Goerli Testnet
      Arbitrum Mainnet & Arbitrum Goerli Testnet
      Optimism Mainnet & Optimism Goerli Testnet
      Polygon Mainnet & Testnet
      BNB Smart Chain Mainnet & Tetsnet
      Avalanche Mainnet & Testnet
    • Interact with Aptos
    • Sign messages
    • Send transactions
    • ... and a lot more
  • Seamless onboarding experience
    Users can sign up easily with email and start exploring you dApp in seconds.
  • Fee subsidization
    You have the option to pay transaction fee for your users and provide a better experience. In that case, we will generate daily fee reports for you to review.
  • Integrated payment
    Get paid easily with our payment APIs. Users can pay easily with credit cards or other crypto currencies like Bitcoin, Ethereum, Tron, USDT, ...
  • Connected to Blocto App
    Once you've integrated with Blocto SDK, your users can manage their assets easily and securely through Blocto App. Your dApp can tap into the vast blockchain ecosystem instantly.

Installing

$ yarn add @blocto/sdk
# or
$ npm i @blocto/sdk

Usage

import BloctoSDK from '@blocto/sdk';

const bloctoSDK = new BloctoSDK({
  // advance settings please refer to docs
  ethereum: {
    // (required) chainId to be used
    chainId: '0x5',
    // (required for Ethereum) JSON RPC endpoint
    rpc: 'https://mainnet.infura.io/v3/YOUR_INFURA_ID',
  },

  // (optional) Blocto app ID
  appId: 'YOUR_BLOCTO_APP_ID',
});

Testing on local

yarn

# generate local https cert
brew install mkcert
mkcert -install
cd dev-cert
mkcert localhost

# make dev directory
mkdir dev
ln -s src/main.js dev/main.js

Scripts

build: build dist
start: run live-reload dev server on https://localhost:7777

Develop

open browser and navigate to https://localhost:7777/test.html

版本与发布记录

@blocto/sdk 共发布 162 个版本,首次发布于 2021/06/10;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.10.4latest2024/10/142 年前
0.10.4-beta.12024/10/112 年前
0.10.4-beta.0beta2024/10/092 年前
0.10.32024/06/062 年前
0.10.3-beta.02024/05/172 年前
0.10.22024/05/032 年前

其他发布通道:alpha → 0.7.0-alpha.3,beta → 0.10.4-beta.0。

关于 @blocto/sdk 的常见问题

@blocto/sdk 是什么?

[![npm bundle size](https://img.shield注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @blocto/sdk?

在项目目录运行 npm install @blocto/sdk,或使用 pnpm add / yarn add / bun add。

@blocto/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@blocto/sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@blocto/sdk 可以商用吗?

@blocto/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@blocto/sdk 的下载量有多少?

根据 npm 官方下载统计,@blocto/sdk 在 2026/10/09 – 2026/11/07 这 30 天内被下载 33,680 次,日均约 1,123 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blocto/sdk 还在维护吗?

最新版本 0.10.4 发布于 2024/10/14(2 年前);至今共发布 162 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/06/10。作者已将其标记为弃用,新项目建议寻找替代方案。