CIP-23 TypedData builder librairie

APPLICATION INTRODUCTION

Title & Description:

Title: CIP-23 TypedData builder

Description: CIP-23 typed builder is a JS utility class used for CIP-23 schema creation.
The goal is to help developper to manage message structure.
Generic format can be intanciate easily with a constructor.
Each attributes can be modified with setters.
Some utilities methods will be available as getString, getHash, sign…
The fields will be parsed to check validity, for example type, size for string, format…
A error manager will help to get all wrong fields in Schema.
This will help to create faster a sample signed message with valid format
An interface will provide a typeData structure.

Example:

Here is the constructor for typedData mail creation

const typedData = new CIP23Mail(fromName, fromWallet, toName, toWallet, contents)

will generate :

{
  "types": {
    "CIP23Domain": [
      { "name": "name", "type": "string" },
      { "name": "version", "type": "string" },
      { "name": "chainId", "type": "uint256" },
      { "name": "verifyingContract", "type": "address" }
    ],
    "Person": [
      { "name": "name", "type": "string" },
      { "name": "wallet", "type": "address" }
    ],
    "Mail": [
      { "name": "from", "type": "Person" },
      { "name": "to", "type": "Person" },
      { "name": "contents", "type": "string" }
    ]
  },
  "primaryType": "Mail",
  "domain": {
    "name": "Ether Mail",
    "version": "1",
    "chainId": 1,
    "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
  },
  "message": {
    "from": {
      "name": "Cow",
      "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"
    },
    "to": {
      "name": "Bob",
      "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"
    },
    "contents": "Hello, Bob!"
  }
}

More constructors will be added for example CIP23NftTransfert()…

Utils example:

Some utils methods will be added to object, for example:

typedData.switchTestNet() will change chainID to testNet

typedData.setDomainVerifyingContract(‘0xaaaaaa’) will change verifiying contract

typedData.setDomainVersion(‘someString’) will throw an error: Version should be numeric in string format

typedData.sign() will open Fluent popup to sign message.

And more…

SPECIFICATIONS:

Developments will be done in JS, using typescript. Strong typed data to avoid errors.
Lib will be deployed on NPM (or if needed, integrated to SDK).
Code will be open-sourced.
An article will be write to share informations.

This project requires no smart contracts.
Similar projects: EPI-712 structs in Python
Known challenges: Understanding typed signatures CIP-23 and EIP-712

TEAM

Alone on the project, I’am fullstack developper since 9 years. I already work with CIP-23 and EIP-712 because I am the creator of sign In with Conflux
I am familiar with front end and securities constraints

LinkedIn :
https://www.linkedin.com/in/mickaël-poulhazan-59158761/ 1

Github :

Example of personals projects:

Apod-Sky
https://apod-sky.firebaseapp.com/

Chatbot :
https://parobot.fr/

Curriculum vitae :
https://cv-mpoulhazan.herokuapp.com/

Sign In with Conflux

TOTAL BUDGET AND FUNDING TIER

The estimated budget is 100$ x 38h = 3800$ (TIER 1)

ROADMAP

Init project, create github, initialize linter, write README 2h
Development of builders (Generic and customs) 12h
Parser for each attributes 10h
Utilities class 10h
Deploy lib on NPM 2h
Writing of article 2h

38h => 3800$

TECHNOS
Typescript / Javascript / NPM / Webpack

Strong linter conditions for easy maintenance and clear code.
Comments and documentation for easy understanding for new developers

MAINTENANCE CONSIDERATIONS

I can maintain or give the privileges on git to new maintainer.

2 Likes

Seems there is already one library that can do this, if you find there are some missing features, you can create issues in this repository https://github.com/conflux-fans/cip-23