npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kinora-sdk

v1.0.66

Published

An open source typescript SDK that combines automated on-chain Livepeer videometric logging with decentralized social quests on Lens Protocol.

Downloads

121

Readme

Kinora

An open source typescript SDK, with an easy interface to combine on-chain Livepeer videometric recording with decentralized social quests on Lens Protocol.

The Kinora SDK delineates three principle segments: Envoker, Dispatch and the Kinora Player Wrapper. Each segment can be used in isolation for greater flexibility in programming Quest deployment and player interaction.

Kinora

Check out the documentation for in depth implementation details.

To install the SDK run:

npm i kinora-sdk

Quick Start

Envoker

The Envoker class simplifies Quest setup.

It handles deployment and instantiation from the Kinora Contract Suite, publishing to Lens Protocol with integrated Kinora Open Actions and the configuration of milestones, escrowed rewards and token gated participation.

import { Envoker } from "kinora-sdk";

const apolloClient = new ApolloClient({
  link: new HttpLink({ uri: "https://api-v2.lens.dev/" }),
  headers: {
    "x-access-token": `Bearer ${authToken}`,
  },
  cache: new InMemoryCache(),
});

const polygonProvider = new ethers.providers.JsonRpcProvider(
  "https://polygonprovider.com",
  137,
);

const newEnvoker = new Envoker({
  authedApolloClient: apolloClient,
  signer: new ethers.Wallet(process.env.ENVOKER_PRIVATE_KEY, polygonProvider),
});

const { postId, factoryId, questId, transactionHash, factoryQuestData } =
  await newEnvoker.instantiateNewQuest({
    factoryId: 0,
    questDetails: {
      title: "Chromadin Chronicle",
      description:
        "Engage in a Chromadin video binge session for Season 1 and Season 2 of The Dial Pirate Radio . Interactions, mirrors and comments on episodes accrue bonus points.",
      cover: "ipfs://QmQk9TqFivUqc6ktosoZVVih9o1uiY3r5Z7F3GCC1FpaJS",
    },
    maxPlayerCount: 100,
    milestones,
    joinQuestTokenGatedLogic: tokenGatedLogic,
  });

Dispatch

The Dispatch class orchestrates player engagements with Quests, encompassing the joining of quests pursuant to entry conditions, and the accomplishment of milestones to obtain rewards upon satisfying milestone completion requisites.

import { Dispatch } from "kinora-sdk";

const apolloClient = new ApolloClient({
  link: new HttpLink({ uri: "https://api-v2.lens.dev/" }),
  headers: {
    "x-access-token": `Bearer ${authToken}`,
  },
  cache: new InMemoryCache(),
});

const polygonProvider = new ethers.providers.JsonRpcProvider(
  "https://polygonprovider.com",
  137,
);

const newDispatch = new Dispatch({
  playerAuthedApolloClient: apolloClient,
});

await newDispatch.playerJoinQuest(
  postId,
  new ethers.Wallet(process.env.PLAYER_PRIVATE_KEY, polygonProvider),
);

Kinora Player Wrapper

The Kinora Player Wrapper, a React Function Component, extends the functionality of the Livepeer Player Component to facilitate optionally encrypted videometric logging for a connected Lens Profile.

It empowers personalized on-chain video feeds, links to quest milestone criteria, and grants meticulous control over style properties, callback properties, and instance methods.

These improvements enable deeper media integration, more efficient state management, customized visual layout options, and a direct interface with corresponding Lens Protocol data.

import { Player } from "@livepeer/react";
import dynamic from "next/dynamic";
import { useWalletClient } from "wagmi";
import { KinoraProvider, KinoraPlayerWrapper } from "kinora-sdk";
import { apolloClient } from "../../lib/lens/client";
import {
  createReactClient,
  studioProvider,
  LivepeerConfig,
} from "@livepeer/react";

const livepeerClient = createReactClient({
  provider: studioProvider({
    apiKey: process.env.LIVEPEER_STUDIO_KEY!,
  }),
});

function App() {
  return (
    <LivepeerConfig client={livepeerClient}>
      <KinoraProvider playerAuthedApolloClient={apolloClient}>
        <Component {...pageProps} />
      </KinoraProvider>
    </LivepeerConfig>
  );
}

function Page() {
  return (
    <div id="parentId" className="w-20 h-20 flex">
      <KinoraPlayerWrapper
        parentId={"parentId"}
        postId={postId}
        customControls={true}
        fillWidthHeight={true}
      >
        {(setMediaElement: (node: HTMLVideoElement) => void) => (
          <Player
            mediaElementRef={setMediaElement}
            playbackId="f5eese9wwl88k4g8"
            objectFit="cover"
          />
        )}
      </KinoraPlayerWrapper>
    </div>
  );
}

Keen to venture on quests without the code entanglement?

Unlock the gateway to a no code implementation of the Quest Dispatch here.

Abstracted

Usage Terms

By using this project or its source code, for any purpose and in any shape or form, you grant your implicit agreement to all the following statements:

  • You condemn Russia and its military aggression against Ukraine
  • You recognize that Russia is an occupant that unlawfully invaded a sovereign state
  • You support Ukraine's territorial integrity, including its claims over temporarily occupied territories of Crimea and Donbas
  • You reject false narratives perpetuated by Russian state propaganda
  • To learn more about the war and how you can help, click here. Glory to Ukraine! 🇺🇦

og source