Needlessly Promiscuous, Modularize!

    @brok/sdk
    TypeScript icon, indicating that this package has built-in type declarations

    0.17.0 • Public • Published

    Downloads Issues

    Documentation

    About

    BRØK SDK is a browser and node library to manage cap tables within the BRØK ecosystem.

    Cap tables consist of "immutable" data like transactions and balances, handled on a blockchain. It also consist of more personal information about the owner, which is handled on Ceramic. You can interact with your assets throught a wallet (some signing functionality). There are also some services to make data more indexable and quikly accessible. All this is packaged in this library for easier access.

    Getting started

    Install library from npm

    npm i @brok/sdk

    ... or yarn yarn add @brok/sdk

    ... or pnpm pnpm i @brok/sdk

    Then init the SDK

    const sdk = await SDK.init({
      ceramicUrl: 'https://ceramic-clay.3boxlabs.com',
      ethereumRpc: 'https://goerli-rollup.arbitrum.io/rpc',
      secret: 'test test test test test test test test test test test junk',
      theGraphUrl: 'https://api.thegraph.com/subgraphs/name/broklab/captable_dev_11',
      env: 'brokDev',
    });

    Read more about inputs to init SDK in documentation

    You can see examples here:

    Instances

    You can read current deployments from npm captable

    CapTableRegistry.sol

    • dev brokDEV: 0xaC7349fc43fEc778f1FA2475b3F850Ca17163557
    • stage brokStage: 0x5f97A62c01FAe8280344ec7Eb505ADf8397D9a1C
    • prod brokProd: 0x4e33Adb3A77B5685E351A61f6bFb20d9dfF71E76

    Blockchain index TheGraph

    Development on SDK

    Clone repo

    Run pnpm i

    To clean everything up. Run make clean

    Requirements

    👩‍💻 Running locally with VSCode tasks (preferred)

    In VScode, run task dev ( ⇧⌘B workbench.action.tasks.runTask).

    This will fire up all projects in watch mode so you can develop and experience imdiate results (hopefully across pacakges). The graph takes some time to start. Once it is started it will keep running in docker as long as your captable contracts terminal is running. terminal_tabs

    Deployments

    Release packages of SDK and CapTable (you can choose what to publish update on with changeset)

    pnpm changeset
    pnpm changeset version
    pnpm install
    # commit the changes, need to update lockfiles.
    pnpm publish -r
    

    Deploy TheGraphCapTable service

    Make sure @brok/graph package is useing desired @brok/captable version in package.json

    pnpm --filter @brok/graph deploy:brokDev # deploy:brokLocal deploy:brokStage deploy:brokProd

    Deploy frontends and servers

    Will deploy by instructions of render.yaml file.

    Packages

    So SDK and Captable are NPM packages that needs to be published for changes to propegate. Graph, demo-server and demo-frontend needs to be deployed to their enviroments to progegate changes.

    Environment variables

    The main enviorment variables that you need to familirize with:

    Environment setup

    1. Copy .env.example to .env in packages/captable, packages/demo-frontend and packages/demo-server. There is a make command for this.
    2. Get yourself an Ethereum RPC and Ethereum secret and put these into /.env and ./packages/captable/.env
    3. Then you should be able to generate the SDK for any chain.

    SDK will look for environment variable BROK_ENVIRONMENT to determine which contracts to choose. Set this envrioment in your runtime.

    • local brokLocal - Will use local blockchain
    • dev brokDev - Will use Arbitrum Rinkeby
    • stage brokStage - Will use Arbitrum Rinkeby
    • prod brokProd - Will use Arbitrum mainnet (not currently)

    To create an approved CapTable, the wallet for fagsystem must first be authorized by BRREG. Contact us.

    Ugly hacks

    • If the blockchain node (running inside the captable contracts terminal) is killed, the graph node will stop indexing. To fire it up again run make graph-stop then make graph-start.
    • Problems with Key DID provider secp256k1 so we are deriving ED25519 from secp256k1 private key.

    Install

    npm i @brok/sdk

    DownloadsWeekly Downloads

    8

    Version

    0.17.0

    License

    none

    Unpacked Size

    376 kB

    Total Files

    40

    Last publish

    Collaborators

    • robertosnap