In this quickstart, you will create new user wallets on Story.
This quickstart is under development as new features are added to the Story Protocol daily.
Preparation Steps
Create a Developer Account and Project
To get started, create a developer account in the Crossmint Staging Console. Open that link, sign in, and accept the dialog to continue. Get an API Key
Create a server-side API key with these scopes:
wallets.create,
wallets:transactions.create,
wallets:transactions.sign.This allows your API key to create new server wallets.
Create Server Wallets
Choose a Wallet Type
Below is a summary of available wallet types and their characteristics:| Custodial | Type | Admin Signer |
|---|
| True | evm-smart-wallet | evm-fireblocks-custodial |
| False | evm-smart-wallet | evm-keypair |
Create a Wallet
const response = await fetch("https://staging.crossmint.com/api/2022-06-09/wallets", {
method: "POST",
headers: {
"X-API-KEY": "<YOUR_API_KEY>",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "<WALLET_TYPE>",
// Here you can pass a user ID, email, phone number, twitter handle etc. depending on how the user is identified in your application
linkedUser: "email:user@example.com",
config:{
adminSigner: {type: "<ADMIN_SIGNER>"},
}
}),
});
const wallet = await response.json();
console.log("Wallet created:", wallet);
Now, run the script:
Send Arbitrary Transaction
Prepare the transaction
Set up a Story Protocol client using the wallet created in the previous step and prepare a transaction to create a new NFT collectionconst client = StoryClient.newClient({
transport: http(RPC_PROVIDER_URL),
account: wallet.address,
});
const creationTx = await client.nftClient.createNFTCollection({
name: "A collection of IP fantasy assets",
symbol: "XMT",
contractURI: "ipfs://QmXYnQJjUxojhh6NKkxPkcXNKFo4pU2hxUyJjqzTcQL9rE",
isPublicMinting: true,
mintOpen: true,
mintFeeRecipient: wallet.address,
txOptions: {
encodedTxDataOnly: true,
},
});
Send the transaction
Send the prepared transaction to Crossmint’s API, which handles the blockchain interaction. The transaction creates the NFT collection on Story Protocol’s network without requiring user’s signature or handling of gas fees.const response = await fetch(`https://staging.crossmint.com/api/2022-06-09/wallets/${wallet.address}/transactions`, {
method: "POST",
headers: {
"X-API-KEY": "<YOUR_API_KEY>",
"Content-Type": "application/json",
},
body: JSON.stringify({
params: {
call: {
// Encoded transaction data
data: creationTx.encodedTxData.data,
// Transaction destination
to: creationTx.encodedTxData.to,
},
chain: "story-testnet",
},
}),
});
const transaction = await response.json();
console.log("Transaction created:", transaction.id);
Story Protocol transactions through Crossmint smart wallets are completely gas-free! You can focus on building your
application without worrying about managing gas fees or token balances.
Monitor Transaction Status
Check the transaction status using the transaction ID.const response = await fetch(
`https://staging.crossmint.com/api/2022-06-09/wallets/${wallet.address}/transactions/${transaction.id}`,
{
method: "GET",
headers: {
"X-API-KEY": "<YOUR_API_KEY>",
},
}
);
const status = await response.json();
console.log("Status:", status.status);