Replies: 1 comment
-
|
Hello @robai99 , I saw your demo. This looks interesting, it is possible through 0xGasless/agentkit... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Development # Server Wallet v2: Quickstart
Overview
The v2 Server Wallet allows you to create accounts on EVM compatible networks and the Solana network.
In this quickstart, you will learn how to:
viemfor Typescript orweb3for PythonPrerequisites
Setup all dependencies, export your keys to environment variables, and initialize a new project before you begin.
It is assumed you have:
Once you have setup the prerequisite dependencies, continue reading to create keys to authenticate your requests and initialize a new project.
Create keys
Sign in to the CDP Portal, create a CDP API key and generate a Wallet Secret.
Keep these values handy as you will need them in the following steps.
For more information, see the CDP API Keys and Wallet Secret documentation.
Project setup
After creating your keys, initialize a new project and instantiate the CDP client.
Initialize a new Typescript project by running:1. Create an account
The v2 Server Wallet offers support for both EVM compatible accounts and Solana accounts.
EVM
To create an EVM account, see below:
```typescript main.ts lines wrap import { CdpClient } from "@coinbase/cdp-sdk"; import dotenv from "dotenv";dotenv.config();
const cdp = new CdpClient();
const account = await cdp.evm.createAccount();
console.log(
Created EVM account: ${account.address});After running the above snippet, you should see similar output:
Created EVM account: 0x3c0D84055994c3062819Ce8730869D0aDeA4c3BfSee the Managing Accounts guide for more information.
Solana
To create a Solana account, see below:
```typescript main.ts lines wrap import { CdpClient } from "@coinbase/cdp-sdk"; import dotenv from "dotenv";dotenv.config();
const cdp = new CdpClient();
const account = await cdp.solana.createAccount();
console.log(
Created Solana account: ${account.address});After running the above snippet, you should see similar output:
Created Solana account: 2XBS6naS1v7pXEg25z43FGHnmEgEad53fmiZ9S6LPgKn2. Fund account with test funds
Accounts do not have funds on creation. We provide a Faucet API to easily fund your EVM account with testnet tokens and Solana account with devnet tokens.
Before you request funds, ensure you read about [rate limits when using CDP Faucets](/faucets/introduction/welcome#supported-assets).EVM
```typescript main.ts lines wrap import { CdpClient } from "@coinbase/cdp-sdk"; import dotenv from "dotenv";dotenv.config();
const cdp = new CdpClient();
const account = await cdp.evm.createAccount();
const faucetResponse = await cdp.evm.requestFaucet({
address: account.address,
network: "base-sepolia",
token: "eth"
});
console.log(
Requested funds from ETH faucet: https://sepolia.basescan.org/tx/${faucetResponse.transactionHash});After running the above, you should see similar output:
Requested funds from ETH faucet: https://sepolia.basescan.org/tx/0x9e93a16f2ca67f35bcb1ea2933f19035ae1e71ff3100d2abc6a22ce024d085ecSolana
```typescript main.ts lines wrap import { CdpClient } from "@coinbase/cdp-sdk"; import dotenv from "dotenv";dotenv.config();
const cdp = new CdpClient();
const account = await cdp.solana.createAccount();
const { signature } = await cdp.solana.requestFaucet({
address: account.address,
token: "sol"
});
console.log(
Requested funds from Solana faucet: https://explorer.solana.com/tx/${signature}?cluster=devnet);After running the above, you should see similar output:
Requested funds from Solana faucet: https://explorer.solana.com/tx/4KEPbhkRLTg2FJNqV5bbUd6zv1TNkksxF9PDHw2FodrTha3jq2Cojn4hSKtjPWdrZiRDuYp7okRuc1oYvh3JkLuE?cluster=devnet3. Send a transaction
EVM
You can send transactions using the v2 Server Wallet.Solana
You can send transactions on Solana using the [`@solana/web3.js`](https://solana.com/docs/clients/javascript) v1 library.Video: Watch and learn
Watch the video to learn about CDP Wallets and see a comprehensive demo, which covers:
- Overview of CDP Server Wallet v2 features and capabilities
- Live demonstration of creating accounts and managing wallets
- Best practices for building with CDP Wallets
<iframe width="560" height="315" src="https://www.youtube.com/embed/_XMRgDU9a2Y" title="CDP Wallets Demo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />What to read next
Beta Was this translation helpful? Give feedback.
All reactions