SPK Network - Using GraphQL for 3Speak Mobile App

▶️ Watch on 3Speak


spknetowrkcovergrql.png


Hey everyone!

With this 3Speak Video & Hive post, @sagarkothari88 illustrates how to use GraphQL Queries based on Union Indexer.

SPK Network is always Open-source:

What is GraphQL?

  • GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data
  • GraphQL provides an interactive way of building the queries & play around them.
  • You can select the attributes/fields/properties of your choice for the response.

Why is GraphQL now on Mobile App?

  • The mobile app shows different feeds but is not sorted as per the curation amount.
  • For each video, payout info, votes, etc., values are fetched, over & over, when displayed on the screen.
  • This consumes internet bandwidth & you may want to avoid it if you are on mobile data.
  • There are other issues with the existing feed.
  • Feed needs to be updated.
  • With GraphQL, we can fix these issues & have needed data in a single request.
  • @sagarkothari88 is now implementing GraphQL-based feeds on 3Speak-Mobile application.

How to use GraphQL?

Screenshot 2023-07-27 at 12.29.43 AM.png

  • Select attributes that you need for your User Interface

Screenshot 2023-07-27 at 12.31.17 AM.png

  • Do not forget to apply this filter if you only want the data for Videos.

Screenshot 2023-07-27 at 12.34.46 AM.png

  • Hit the run button.

Screenshot 2023-07-27 at 12.41.13 AM.png

Ready-made GraphQL Queries for you

Trending feed

query MyQuery {
  trendingFeed(spkvideo: {only: true}) {
      items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
    }
  }
}

New Videos Feed

query MyQuery {
  socialFeed(spkvideo: {only: true}) {
          items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
  }
}

First Uploads Feed

query MyQuery {
  socialFeed(spkvideo: {only: true, firstUpload: true}) {
    items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
    }
  }
}

Related Videos

query MyQuery {
  relatedFeed(permlink: "sdltslwo", author: "leofinance") {
        items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
    }
  }
}

My Published Videos

query MyQuery {
  socialFeed(
    spkvideo: {only: true}
    feedOptions: {byCreator: {_eq: "sagarkothari88"}}
  ) {
    items {
      ... on HivePost {
        body
        title
        tags
        stats {
          num_comments
          num_votes
          total_hive_reward
        }
        spkvideo
        permlink
        lang
        community
        created_at
      }
    }
  }
}

3Shorts

query MyQuery {
  socialFeed(
    spkvideo: {only: true, isShort: true}
  ) {
    items {
      ... on HivePost {
        body
        title
        tags
        stats {
          num_comments
          num_votes
          total_hive_reward
        }
        spkvideo
        permlink
        lang
        community
        created_at
      }
    }
  }
}

Leaderboard

Coming soon.

Community Details

query MyQuery {
  community(id: "hive-181335") {
    title
    about
    created_at
    images {
      avatar
      cover
    }
    roles {
      role
      title
      username
    }
    subscribers
  }
}

Videos from a community

query MyQuery {
  community(id: "hive-181335") {
    title
    about
    created_at
    images {
      avatar
      cover
    }
    roles {
      role
      title
      username
    }
    subscribers
    trendingFeed {
      items {
        ... on HivePost {
          spkvideo
          stats {
            num_comments
            num_votes
            total_hive_reward
          }
          lang
          title
          tags
          permlink
          created_at
          body
        }
      }
    }
  }
}

About the SPK Network:

The SPK Network is a decentralized Web 3.0 protocol that rewards value creators and infrastructure providers appropriately and autonomously by distributing reward tokens so that every user, creator, and platform can earn rewards on a level playing field.


color3speak.png

Important Links:

3Speak LinktreeSPK Network Linktree
3Speak.tv3Speak Twitter3Speak Hive Blog3Speak Telegram
3Speak in SpanishDownload Android AppDownload iOS AppDownload Desktop App
Join 3Speak DiscordSetup Encoder NodeVote for SPK Network ProposalBadge Recipients
appStoreGooglePlayStore

Vote for 3Speak as Witness - Support @threespeak

Vote for Sagarkothari88 as Witness - Support @sagarkothari88


▶️ 3Speak



0
0
0.000
20 comments
avatar

1


This post has been selected for upvote from our token accounts by @seckorama! Based on your tags you received upvotes from the following account(s):

- @dhedge.bonus
- @dhedge.leo
- @dhedge.ctp

@seckorama has 9 vote calls left today.

Hold 10 or more DHEDGE to unlock daily dividends and gain access to upvote rounds on your posts from @dhedge. Hold 100 or more DHEDGE to unlock thread votes. Calling in our curation accounts currently has a minimum holding requirement of 100 DHEDGE. The more DHEDGE you hold, the higher upvote you can call in. Buy DHEDGE on Tribaldex or earn some daily by joining one of our many delegation pools at app.dhedge.cc.

0
0
0.000
avatar

This may be an ignorant question but how does SPK benefit Hive? I believe I've asked before, so forgive me.

0
0
0.000
avatar

Provides peer to peer incentivised, offchain storage, content deliver networks and encoding of content as well as offchain content indexing, easy to spin up content platforms amongst other things such as community liquidity pools, wrapping hive to btc and community tokens

0
0
0.000
avatar

This reminds me the following intro scene of Queen of the Dragon (in game of thrones)

MISSANDEI INTRODUCING DAENERYS TARGARYEN TO JON SNOW

You stand in the presence of Daenerys Stormborn of House Targaryen, rightful heir to the Iron Throne, rightful Queen of the Andals and the First Men, Protector of the Seven Kingdoms, the Mother of Dragons, the Khaleesi of the Great Grass Sea, the Unburnt, the Breaker of Chains.

@neopch - Can you do a mix video of above context? It will gain a lot of traction.

@neopch / @starkerz giving intro of @threespeak (in the way Missandei gave intro of Queen of Dragon)

0
0
0.000
avatar

When you say off-chain storage is it more focused on persistence or integrity of data? For instance, IPFS is great until no one is storing the files any longer. Is this an additional layer on top of an existing technology or is it completely novel?

0
0
0.000
avatar

it allows platforms or communities or creators to autonomously incentivise peers with crypto for storing data on IPFS. nothing else like it out there

0
0
0.000
avatar

So essentially it's a layer written on top of IPFS? What's the expected cost and estimated persistence of the data?

0
0
0.000
avatar

The system is built so that the market will sort that out to the cheapest possible, longest storage period. When ppl are using spare storage space and agreeing on variable time locked storage contracts, the market will find its way

0
0
0.000
avatar

So free market economics. I'm down with that.

0
0
0.000
avatar

We are working with SPK to build the next generation of BTC, LTC, DOGE and more wrapping onto HIVE in a fully decentralzied secure and autonomous manner.

0
0
0.000
avatar

What value does VSC offer that HiveEngine could not? I have some assumptions, but I was curious about your take.

0
0
0.000
avatar
(Edited)

Here is a list:

  • Wrapping as stated above, but actually decentralized whereas Hive Engine is one account doing all sending/receiving of tokens
  • Versatile and open smart contract engine. Smart contracts on Hive Engine are closed and only approved persons may deploy smart contracts. Hive Engine restricts smart contracts to be only "common use cases", meaning dapps needing custom smart contracts are out of luck.
  • Smart contract interface: we plan to build a powerful smart contract interface that will unlock many more use cases not supported by Hive Engine. For example being able to create a Hive account & control it using smart contract code directly.
  • Offchain & scalable: most transactions can remain offchain reducing chain bloat & competition for resources long term
  • This list will only grow as time goes on

Hive Engine only focuses on a set of a few use cases. VSC aims to handle so much more.

0
0
0.000
avatar

I suspected a lot of this. EVM based engine or something else completely?

0
0
0.000
avatar

!PGM

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 1 SBT - 0.1 THG - 0.000001 SQM - 0.1 BUDS - 0.01 WOO - 0.005 SCRAP tokens

remaining commands 13

BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!

The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]

5000 PGM IN STAKE = 2x rewards!

image.png
Discord image.png

Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP

Get potential votes from @ pgm-curator by paying in PGM, here is a guide

I'm a bot, if you want a hand ask @ zottone444


0
0
0.000
avatar

hello @spknetwork thank you for sharing your story, I always follow you, always inspiring many people, thank you

0
0
0.000