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

@solyjs/sdk

v1.0.5

Published

### Nodejs Solidity CRUD generator

Downloads

13

Readme

SolyJS

Nodejs Solidity CRUD generator

Sometimes creating CRUDS in solidity and connecting with javascript can be a painful.\

  • Grab your access token here
  • Define your JS object
  • Compile and deploy with SolyJS cli
  • ✨ Magic ✨

Installation

$ npm install @solyjs/sdk # for library

Start using SolyJS solyjs init
This command will create directories which solyjs need for works

on your app init

import { SolyModule } from '@solyjs/sdk';
import { Photo } from './photo/photo.contract';
import { User } from './user/user.contract';

await SolyJS.initialize({
  accessKey: 'eyJhbxxxxx',
  privateKey: 'e26ec8xxxx',
  provider: 'https://rpc-mumbai.maticvigil.com/',
  contracts: [User, { name: 'Photo', contract: Photo }],
});

Compile and deploy

await SolyJS.deploy();
await SolyJS.compile();

With SolyJs you can define your contract like user.contract.ts:

import { Contract, Column } from '@solyjs/sdk';

@Contract()
export class User {
  @Column()
  firstName: string;

  @Column()
  lastName: string;
}

OR

const User = {
  columns: {
    firstName: 'string',
    lastName: 'string',
  },
};
import {CrudContract, AbstractCrudContract} from 'solyjs'

@CrudContract(User)
export class UserContract extends AbstractCrudContract<User> {

    // SolyJs will automaticaly create _id for your user
    async createUser(){
        return this.contract.create({firstName: 'John', lastName: 'Doe'});
    }

    async getUser(id){
        return this.contract.get(id);
    }

    async getAllUsers(){
        return this.contract.getAll();
    }
    ....
}

OR

import {SolyJS} from '@solyjs/sdk'

const userContract = SolyModule.getContract('User');
await userContract.create({firstName: 'John', lastName: 'Doe'});
 ....

Allowed methods: create(data), getAll(), get(_id), count(), updateById(_id, data), deleteById(_id)

Restrictions

| Restriction | Description | | :---------: | :---------------------------------------------------------------------------------------------------: | | public | Everyone can create/update/delete default | | owner | Only contract owner (the address that deployed the contract) can create/update/delete | | editors | List of provided editors on deploy can create/update/delete (manipulation with editors coming soon) |

How to use?

Restriction type owner

@Contract({ restriction: 'owner' })
export class User {
  @Column()
  firstName: string;

  @Column()
  lastName: string;
}

const User = {
  options: { restriction: 'owner' },
  columns: { firstName: 'string', lastName: 'string' },
};

export const UserContract = SolyModule.registerContract('User', User);

Restriction type editors

@Contract({
  restriction: 'editors',
  editors: [
    '0x25a39f7E0b8b2D6b2Ebe1f155B09EE6FfB7D11F9',
    '0xbAce2110fA28910B48a5ed08F7ad844d8f1Af6c2',
  ],
})
export class User {
  @Column()
  firstName: string;

  @Column()
  lastName: string;
}

Disable Methods

@Contract({ disabledMethods: ['delete', 'update'] })
export class User {
  @Column()
  firstName: string;

  @Column()
  lastName: string;
}

const User = {
  options: { disabledMethods: ['update'] },
  columns: { firstName: 'string', lastName: 'string' },
};

export const UserContract = SolyModule.registerContract('User', User);

List of methods: 'delete' | 'create' | 'update' | 'get' | 'count' | 'getAll'

IMPORTANT

This package is in development phase, so a lot of new features coming soon

Roadmap

In next version:

  1. CLI for compile and deploy
  2. Relations between contracts