Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: few non-functional updates #2

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
web3-plugin-template
===========

This is a template for creating a repository for web3.js plugin.

How to use
------------

1. Create your project out of this template.

You can do so by pressing on `Use this template` on the above right corner and then select `Create new Repositor`. Please, use the convention `web3-plugin-<name>` for your repo name.
2. Update the `name` and `description` fileds at your `package.json`.

Chose a name like: `@<organization>/web3-plugin-<name>` (or the less better `web3-plugin-<name>`).
3. Update the code inside `src` folder.

4. Modify and add tests inside `test` folder.

5. Publish to the npm registry.

You can publish with something like: `yarn build && npm publish --access public`.

Contributing
------------

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3",
"web3": "^4.0.3"
"web3": "^4.2.2"
},
"peerDependencies": {
"web3": ">= 4.0.3"
Expand Down
12 changes: 6 additions & 6 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Web3, { core } from "web3";
import { Web3, core } from "web3";
import { TemplatePlugin } from "../src";

describe("TemplatePlugin Tests", () => {
it("should register TokensPlugin plugin on Web3Context instance", () => {
it("should register TemplatePlugin plugin on Web3Context instance", () => {
const web3Context = new core.Web3Context("http://127.0.0.1:8545");
web3Context.registerPlugin(new TemplatePlugin());
expect(web3Context.template).toBeDefined();
Expand All @@ -11,11 +11,11 @@ describe("TemplatePlugin Tests", () => {
describe("TemplatePlugin method tests", () => {
let consoleSpy: jest.SpiedFunction<typeof global.console.log>;

let web3Context: Web3;
let web3: Web3;

beforeAll(() => {
web3Context = new Web3("http://127.0.0.1:8545");
web3Context.registerPlugin(new TemplatePlugin());
web3 = new Web3("http://127.0.0.1:8545");
web3.registerPlugin(new TemplatePlugin());
consoleSpy = jest.spyOn(global.console, "log").mockImplementation();
});

Expand All @@ -24,7 +24,7 @@ describe("TemplatePlugin Tests", () => {
});

it("should call TempltyPlugin test method with expected param", () => {
web3Context.template.test("test-param");
web3.template.test("test-param");
expect(consoleSpy).toHaveBeenCalledWith("test-param");
});
});
Expand Down
Loading
Loading