Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 1.94 KB

README.md

File metadata and controls

71 lines (48 loc) · 1.94 KB

Examples

You can run any of the following example scripts using the command:

npx tsx examples/*.ts

NEAR Credentials

Before using NEAR-CA, ensure you have the following environment variables set in your .env file:

  • NEAR_ACCOUNT_ID: Your NEAR account identifier.
  • MPC_CONTRACT_ID: The NEAR contract that handles multichain operations.
  • NETWORK: Either near or testnet.
  • NEAR_ACCOUNT_PRIVATE_KEY: Your NEAR account private key.

Copy the .env.example file and add these values to the .env file.

For setting up a wallet, use the NEAR testnet wallet. The testnet wallet is different from the main wallet. For example, you can use the Bitte Wallet.

Fund your account

Get your address

npx tsx examples/getEthAddress.ts

After getting your address fund it from one of your own wallets.

Here are some of the available examples:

  1. Basic:
  2. WETH Operations:
  3. NFT Operations:
  4. Advanced:

Example: Buy NFT by Collection Slug

To buy an NFT using a collection slug, follow these steps:

# Install dependencies
yarn

# Set up credentials
cp .env.example .env  # Paste your NEAR credentials into the .env file

# Run the OpenSea example script
npx tsx examples/opensea.ts

You will be prompted to provide a collectionSlug.

What is a Collection Slug?

A collection slug identifies a specific collection on OpenSea. To find a collection slug:

  1. Visit testnet.opensea.
  2. Browse and find a collection you like.
  3. Copy the slug from the URL: https://testnets.opensea.io/collection/[slug].

For example, if the URL is https://testnets.opensea.io/collection/the-monkey-chainz, the collection slug is the-monkey-chainz.