@0xcert/ethereum-sandbox 中文文档教程
用于在以太坊区块链上对模块进行本地运行测试的测试服务器。
您可以将其用作独立服务器。
import { Sandbox } from '@0xcert/ethereum-sandbox';
const sandbox = new Sandbox();
await sandbox.listen();
您可以将它与 Specron 集成。
import { Spec } from '@specron/spec';
import { Protocol } from '@0xcert/ethereum-sandbox';
const spec = new Spec();
spec.before(async (stage) => {
stage.set('protocol', await Protocol.deploy(stage.web3));
});
export default spec;
您可以将它与 Hayspec 集成。
import { Spec } from '@hayspec/spec';
import { Sandbox } from '@0xcert/ethereum-sandbox';
interface Data {
sandbox: Sandbox;
}
const spec = new Spec<Data>();
spec.before(async (stage) => {
stage.set('sandbox', await Sandbox.listen());
stage.set('protocol', stage.get('sandbox').protocol);
});
spec.after(async (stage) => {
await stage.get('sandbox').close();
});
export default spec;
0xcert Framework 是一个免费的开源 JavaScript 库,它提供用于构建强大的去中心化应用程序的工具。 请参阅官方文档了解更多详情。
该模块是 0xcert Framework 的组成部分之一。 它是用 TypeScript 编写的,并且得到积极维护。 源代码可在 GitHub 上找到,您还可以在其中找到我们的 问题跟踪器。
Test server for local running testing of modules on the Ethereum blockchain.
You can use it as a standalone server.
import { Sandbox } from '@0xcert/ethereum-sandbox';
const sandbox = new Sandbox();
await sandbox.listen();
You can integrate it with Specron.
import { Spec } from '@specron/spec';
import { Protocol } from '@0xcert/ethereum-sandbox';
const spec = new Spec();
spec.before(async (stage) => {
stage.set('protocol', await Protocol.deploy(stage.web3));
});
export default spec;
You can integrate it with Hayspec.
import { Spec } from '@hayspec/spec';
import { Sandbox } from '@0xcert/ethereum-sandbox';
interface Data {
sandbox: Sandbox;
}
const spec = new Spec<Data>();
spec.before(async (stage) => {
stage.set('sandbox', await Sandbox.listen());
stage.set('protocol', stage.get('sandbox').protocol);
});
spec.after(async (stage) => {
await stage.get('sandbox').close();
});
export default spec;
The 0xcert Framework is a free and open-source JavaScript library that provides tools for building powerful decentralized applications. Please refer to the official documentation for more details.
This module is one of the bricks of the 0xcert Framework. It's written with TypeScript and it's actively maintained. The source code is available on GitHub where you can also find our issue tracker.