This package contains the TypeScript SDK for interacting with the NOMO Nouns smart contracts.
This package was automatically generated by eth-sdk. Don't edit its source code, it will be rewritten when you run eth-sdk next time.
index.cjs
, index.d.ts
, index.mjs
, types.d.ts
and package.json
here are static files copied from
eth-sdk/static
to the generated package.
You can find your generated files in ./esm
and ./cjs
directories.
The contract SDK has the following structure:
eth-sdk/
- Configuration for eth-sdk toolabis/
- Contract ABIs for different networksconfig.ts
- Contract addresses configuration
cjs/
- CommonJS output (generated)esm/
- ES Modules output (generated)
When you need to add support for a new network or update contract addresses:
-
Update the configuration file:
# Edit the eth-sdk config file nano eth-sdk/config.ts
Add or update the network configuration:
export default defineConfig({ contracts: { // Existing networks... // Add new network (e.g., optimismSepolia) optimismSepolia: { nomoToken: "0x0a84d15E7Ed226a5934Fa33A1d73d62152d59Da7", nomoSeeder: "0x8E5870B947703E3073C15033Cc7522FDFcc7332A", } }, outputPath: "./", });
-
Add contract ABIs:
Ensure the ABIs for the contracts are available in the corresponding network directory:
# Create directory for the new network (if it doesn't exist) mkdir -p eth-sdk/abis/optimismSepolia # Add the contract ABIs cp path/to/NomoToken.json eth-sdk/abis/optimismSepolia/nomoToken.json cp path/to/NomoSeeder.json eth-sdk/abis/optimismSepolia/nomoSeeder.json
You can typically find the ABIs in the artifacts directory of the contracts package after compilation.
To build the SDK with the updated configuration:
-
Install ts-node (if not already installed, required by eth-sdk):
yarn add -D ts-node
-
Update the package version:
# Edit package.json to increment the version nano package.json
Update the version number (e.g., from 1.2.2 to 1.2.3).
-
Generate the SDK:
# Run eth-sdk to generate the TypeScript files npx @dethcrypto/eth-sdk -p ./eth-sdk
-
Create a tarball:
# Create a tarball of the package npm pack
This will create a file like
nomo-nouns-contract-sdks-1.2.3.tgz
. -
Move the tarball to the functions directory:
# Move the tarball to the functions directory mv nomo-nouns-contract-sdks-1.2.3.tgz ../nomo-nouns-webapp/functions/
To use the updated SDK in your project:
-
Update the functions package.json:
# Navigate to the functions directory cd ../nomo-nouns-webapp/functions # Edit package.json nano package.json
Update the dependency:
"dependencies": { "nomo-nouns-contract-sdks": "file:./nomo-nouns-contract-sdks-1.2.3.tgz" }
-
Install the updated package:
# Install the package yarn add file:./nomo-nouns-contract-sdks-1.2.3.tgz
-
Update the webapp package.json (if needed):
# Navigate to the webapp directory cd ../ # Edit package.json nano package.json
Update the dependency version to match if the webapp directly uses the SDK.
-
Build the functions project:
# Build the project cd functions yarn build
If you encounter issues with the SDK:
-
Check if eth-sdk generated the files correctly:
# Look for files related to the new network find . -name "*optimismSepolia*" -type f
-
Verify the type declarations:
# Check for type declarations grep -r "optimismSepolia" --include="*.d.ts" .
-
Clean and rebuild:
If necessary, you can back up and remove the generated files before rebuilding:
# Back up existing files mkdir -p backup mv cjs esm backup/ # Regenerate the SDK npx @dethcrypto/eth-sdk -p ./eth-sdk
-
Check for missing dependencies:
If you get errors about missing dependencies when running eth-sdk:
# Install common dependencies needed by eth-sdk yarn add -D ts-node typescript @types/node