Owl Protocol API Example using our TRPC client.
This guide assumes you are integrating Owl API with an existing app with your own user base.
import { createClient } from "@owlprotocol/contracts-api-client-trpc";
(async () => {
const projectId = await client.project.projectCreate.mutate({
projectName: "MyWeb3App",
description: ""
});
const {safeAddress, owlUserId: userId} = await client.user.getOrCreateByEmail.mutate({
projectId,
email
});
})();
Docs coming soon...
-
Generate unique, universal, multichain Owl Smart Wallets for any user using just their email. These wallets are fully controlled by the email account owner.
-
Deploy on-chain collections of unique digital cards or items for a variety of use cases, including:
- Art or Real-World Assets - tie real world items to a unique on-chain item with metadata.
- Gaming or Avatars - create on-chain ownable items of your in-game items or characters to give your users more control of their assets.
- Loyalty or Reward Cards - track your user loyalty on Web3 with truly unique loyalty cards that open up a variety of ways to collaborating with other brands and apps.how'
-
Connect your back-end or database with your on-chain digital items, and synchronize data with our API or using our webhooks.
Generally for integrating an existing app you would do the following:
- Create an Owl API Project associated with your app.
- Use our API to generate Smart Wallets for each of your users, and "store" the associated
owlUserId
.You will need the
owlUserId
in subsequent calls to send them items or update data. - Deploy a Digital Item Collection
If you do not have Node 18 installed, we recommend using nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
nvm install 18
We recommend using pnpm as a package manager.
npm install --global pnpm
git clone https://github.com/owlprotocol/contracts-api-starter.git && cd contracts-api-starter
pnpm install
- Sign up on dashboard.owlprotocol.xyz
- Go to the Dashboard's Settings page to get your API key
Create a .env
file similar to .env.example
:
In this example we are using the Polygon testnet (Mumbai) chainId
: 80001
API_KEY="<YOUR_API_KEY>"
API_URL="https://contracts-api.owlprotocol.xyz/api/trpc"
NETWORK_ID=80001
These recipes are meant to showcase example use cases of the Owl Protocol API. Check out docs-api.owlprotocol.xyz to learn how to leverage our API.
You MUST run this recipe FIRST before any other recipe. A Gnosis Safe is required for each wallet to use Account Abstraction features (gas sponsorship, batch transactions).
This Recipe has the following steps:
- Deploy a Gnosis Safe smart wallet
pnpm run recipes:deploy-safe
Run this recipe to deploy an ERC721 collection called "My Collection" with a "MY" ticker symbol.
This Recipe has the following steps:
- Deploy an ERC721 collection
- Mint one asset to address
0xb3BEc97C92A4aEA1371A9184eeD7646CB64146D3
pnpm run recipes:deploy-erc721-owl-collection