![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@owlprotocol/contracts-api
Advanced tools
Our API for the contracts, with TRPC support.
pnpm run codegen
build
scriptpnpm run build && pnpm run express
pnpm run express
# In a separate terminal
pnpm run ngrok
From the workspace root:
docker build . -f Dockerfile -t vulcanlink/contracts-api:${VERSION:-test} --target contracts-api
Relevant management consoles for tech stack:
Clone the safe-contracts repo on your computer.
git clone git@github.com:safe-global/safe-contracts.git && cd safe-contracts
Set the .env
file.
MNEMONIC="test test test test test test test test test test test junk"
NODE_URL="http://localhost:8545"
Compile and deploy locally.
yarn build && yarn deploy-all custom
https://firebase.google.com/docs/emulator-suite
curl -sL https://firebase.tools | bash
# Either works
firebase emulators:start
pnpm run firebase-emulator
Go to http://127.0.0.1:4000/firestore/data to view data.
# Either works
npm run test
pnpm exec vitest src/path_to_file.ts #install vitest globally, broken when run directly
# Start Firebase Emulator
pnpm run firebase-emulator
# Start Anvil Node
pnpm run anvil
# Run Dev Server Setup (Upload Firebase Data, Deploy Contracts) & Start Express Server
# Note: Error logs are to be expected for invalid abis
pnpm run express:dev
# Run the indexer (from packages/contracts-indexer folder)
cd ../contracts-indexer && pnpm run start
While you can test the endpoints locally via Swaggerhub, certain features such as the Readme webhook & Readme recipes can only be tested via the readme.io UI. To test these features without having to re-deploy the API, we can create a local proxy using ngrok.
Install and configure ngrok using at dashboard.ngrok.com/get-started/setup We first run build & run the server, and then expose it publicly using ngrok.
npm run build & npm run express # Run localhost server
ngrok http 3000 # Expose localhost server
Copy the "Forwarding" endpoint.
Now we configure a new OAS spec. This will enable us to define new routes we've developed and set the url endpoint to be our ngrok endpoint.
rdme
CLIGenerate a new OpenAPI spec but patch it with the ngrok endpoint. We have a script for this that saves the new spec under readme/v0.0/openapi.json
node lib/esm/openapiSave.js v0.0 <ngrokUrl>
Install the CLI if not present already. Login with your readme.io login info.
pnpm install -g rdme
rdme login --email <email> --password <password>
Sync openapi spec by fetching the spec from localhost. We set version as v0.0
as the private version we use for testing (this is ignored but useful to keep in mind for other operations). We use the hardcoded 64cfafdc8cc6da00656ad092
spec to just update it.
rdme openapi readme/v0.0/openapi.json --version v0.0 --id "64cfafdc8cc6da00656ad092" --update
We create a user and have it associated with one of our generated api keys.
https://XXXX-XXX-XXX-XX-XXX.ngrok-free.app/api/webhooks/readme
and an emailThis should kick start the signup process:
Readme metadata is stored under ./readme indexed by version. We store 3 core types of data:
See above section "Readme.io OpenAPI config".
npm run build & npm run express
node lib/esm/openapiSave.js <version> <url>
(this updates local json)rdme openapi readme/<version>/openapi.json --version <version> --update
rdme docs readme/<version>/guides --version=<version> --dryRun
Overview of general API routes.
# Webhook
/webhooks/readme # Readme.io webhook for signups
# OpenAPI Swagger UI
/ # OpenAPI UI
# OpenAPI Spec
/api/openapi.json # OpenAPI Spec
# TRPC
/api/trpc # TRPC endpoint
# TRPC w/OpenAPI
## Webhooks
/api/webhooks/readme # Readme webhook
## User routes
/api/user/me # Get current user info
/api/user/me/contracts # Get current user contracts
/api/user/<userId> # Get by id user info (Disabled: Requires proper permissions)
/api/user/<userId>/contracts # Get by id contracts (Disabled: Requires proper permissions)
/api/user/requestTemplates # Get user request templates
## Eth routes
/api/<networkId>/broadcastTx # Broadcast transaction
/api/<networkId>/signTx # Sign transaction
/api/<networkId>/rpc # RPC Proxy
/api/<networkId>/ws # Websocket Proxy
## Contract routes
/api/<networkId>/interfaces/<contract>/read/<address>/<function> # Read data
/api/<networkId>/interfaces/<contract>/write/<address>/<function> # Write data, sending transaction
/api/<networkId>/interfaces/<contract>/writeUnsigned/<address>/<function> # Write data, get unsigned payload
/api/<networkId>/deploy/<contract> # Deploy smart contract
## Business Abstraction routes
/api/<networkId>/collection # Deploy NFT collection
## Topup Routes (abstraction for credits)
/api/<networkId>/topup/erc20/<address> # Topup ERC20 (eg. LINK)
/api/<networkId>/topup/native # Topup native tokens (eg. Eth)
/api/<networkId>/
## Gnosis Safe Routes (abstraction over smart wallet)
/api/<networkId>/safe/<address> # Gnosis Safe info
FAQs
Our API for the contracts, with TRPC support.
The npm package @owlprotocol/contracts-api receives a total of 0 weekly downloads. As such, @owlprotocol/contracts-api popularity was classified as not popular.
We found that @owlprotocol/contracts-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.