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

@composooor/composooor

v1.0.3

Published

Composooor

Downloads

4

Readme

Composooor

Composooor is a library enabling composability between previously imcompatible Dapps.

Problem

Most modern Dapps are reliant on off chain data/computation to function.

  • OpenSea needs seller/buyer signatures to execute transfers.
  • Blur is the same.
  • Kairos Loan needs signatures of loan offers to provide liquidity against NFTs.
  • NFTfi is the same.
  • Uniswap needs an api to figurate the best route for a trade.
  • It's the same for aggregators such as 1inch/Paraswap/LLamaSwap etc.
  • You need a merkle proof to claim your farmed Morpho tokens.
  • It's the same for all airdrops.

Developing a smart contract using those systems just won't work, as EVM can only access onchain ressources. DeFi effectively evolved to an incomposable state. Worse than this, developers often don't ever try to build some projects as blockchains and rollups are limited in the data and computation they can handle. What is there was a way to let the blockchain only check validity of actions and offload all heavy storage and computation offchain in a composable way ? This would enable composably :

  • Contract access to unlimited storage.
  • Contract access to unlimited computation & solutions to optimization problems.

Solution

Meet Composooor. Composoor is a front-end and smart-contract library made to build hybrid on & off chain composable apps. Building a smart contract that must interact with an hybrid app (e.g OpenSea)? A one-line import of the corresponding composooor adapter does the trick (example). Want to leverage offchain power inside your smart contract without breaking composability? One line import of Composooor register. Need a front-end for all that? One line import of useComposooor.

How it works

schema Composooor design is based on a standardized way for smart contracts to signal missing data that should come from an off chain ressource at transaction-preparation time.

  • When preparing a transaction, our metamask snap wallet will request an estimate gas call on the desired on chain contract.
  • If the contract needs some data or computation made off chain to function, it will revert with a standardized error containing specs on how to find this missing data.
  • The wallet can then decode this error and finds the missing data either by fetching it on a decentralized protocol, or on an API, or by executing some code it fetched from this sources to produce it.
  • The wallet will then estimate gas again, this time adding an instruction to store the fetched data in the standardized registry of the corresponding contract before calling the desired method.
  • In the transaction execution the same or another contract may need another off chain ressource to function. If it's the case, the wallet loops on the transaction preparation steps until no offchain ressource is needed anymore.
  • When the gas estimation is successful, the user is prompted with the signature of the prepared transaction, to execute successfully with all necessary ressources included.

Develop with composooor: Front end dev

Import with import {useComposooor} from "@composooor/composooor".
Example usage:

const { write, data: dataComposooor } = useComposooor({
    address: dappAddress,
    abi: dapp.abi,
    functionName: "action",
    args: [],
});

write() will start the transaction. useComposooor is made for react with wagmi.

Develop with composooor: Smart Contract dev

Import with import "@composooor/ComposooorRegister.sol";.
Example usage :

contract Example is ComposooorRegister {
    function action() public {
        bytes memory data = consumeParameter("http://api.api/number", abi.encode(arguments));
        (uint256 offchainNumber) = abi.decode(data, (uint256));
        (...)
    }
}

ComposooorRegister is made with solidity.