Skip to main content

Push SDK playground

This tutorial is designed to get you up and going by providing playground containing all API calls coverage for Push SDK. Checkout Push SDK example that utlizes @pushprotocol/restapi and @pushprotocol/socket for more info!

Step 1: Clone the Push SDK Repository

Download the Push SDK repository to your local machine.

git clone https://github.com/push-protocol/push-sdk.git

Step 2: Install Dependencies

Navigate to the SDK directory and install required dependencies.

cd push-sdk
yarn install

Step 3: Setup Push SDK Playground

Navigate to the directory and install required dependencies.

cd packages/examples/sdk-backend-node
yarn install

Step 4: Setup Environment Variables

Create a .env file and add values to it according to the given .env.sample.

Note - It is possible to run a bare minimum examples without .env. All other examples will be skipped.

# WALLET PRIVATE KEY
WALLET_PRIVATE_KEY=your_channel_private_key

# ENVIRONMENT OF PUSH NETWORK - prod, staging OR dev
PUSH_NODE_NETWORK=staging

# TO ENABLE API RESPONSES TO BE SHOWN OR HIDDEN - true OR false
SHOW_API_RESPONSE=false

# NFT CONTRACT ADDRESS
NFT_CONTRACT_ADDRESS_1=your_nft_contract_address

# NFT CHAIN ID
NFT_CHAIN_ID_1=your_nft_chain_id

# NFT TOKEN ID
NFT_TOKEN_ID_1=your_nft_token_id

# NFT HOLDER WALLET PRIVATE KEY
NFT_HOLDER_WALLET_PRIVATE_KEY_1=your_nft_holder_wallet_private_key

# NFT PROFILE WALLET PASSWORD
NFT_PROFILE_PASSWORD_1=your_nft_profile_password

# NFT CONTRACT ADDRESS
NFT_CONTRACT_ADDRESS_2=your_nft_contract_address

# NFT CHAIN ID
NFT_CHAIN_ID_2=your_nft_chain_id

# NFT TOKEN ID
NFT_TOKEN_ID_2=your_nft_token_id

# NFT HOLDER WALLET PRIVATE KEY
NFT_HOLDER_WALLET_PRIVATE_KEY_2=your_nft_holder_wallet_private_key

# NFT PROFILE WALLET PASSWORD
NFT_PROFILE_PASSWORD_2=your_nft_profile_password

# VIDEO CHAIN ID
VIDEO_CHAIN_ID=your_video_chain_id

# VIDEO SENDER ADDRESS
VIDEO_SENDER_ADDRESS=your_video_sender_address

# VIDEO RECIPEINT ADDRESS
VIDEO_RECIPEINT_ADDRESS=your_video_recipient_address

# VIDEO CHAT ID
VIDEO_CHAT_ID=your_video_chat_id
# Create .env file
touch .env

# Add different key values according to .env.sample

Step 5: Run Playground Examples

yarn start

Expected Output

"Push SDK API Playground"