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

zebecprotocol-sdk

v1.1.6

Published

The Zebec Protocol is a Solana based modern day Payroll solution which allows employers to pay employees every second. Our protocol allows employers to pay team members in crypto, by second, through its continuous settlement mechanism.

Downloads

3

Readme

What is Zebec Protocol?

The Zebec Protocol is a Solana based modern day Payroll solution which allows employers to pay employees every second. Our protocol allows employers to pay team members in crypto, by second, through its continuous settlement mechanism.

The Zebec Protocol is not just limited to streamlined payments. On top of pay per second, we aim to enable real time liquidity through features such as automated dollar cost averaging, yield farming, crypto IRA, 401k accounts, free fiat off-ramp and custom debit card.

Zebec Program

Devnet - AknC341xog56SrnoK6j3mUvaD1Y7tYayx1sxUGpeYWdX Mainnet - AknC341xog56SrnoK6j3mUvaD1Y7tYayx1sxUGpeYWdX

Latest version

https://www.npmjs.com/package/@zebec-protocol/stream

Install The Zebec Protocol js sdk

Devnet: $ npm i zebecprotocol-sdk @solana/web3.js buffer-layout @solana/spl-token

Mainnet: $ npm i zebecprotocol-mainnet @solana/web3.js buffer-layout @solana/spl-token

Import JS Functions

import {
  getProvider,
  depositNativeToken,
  initNativeTransaction,
  withdrawNativeTransaction,
  cancelNativeTransaction,
  pauseNativeTransaction,
  resumeNativeTransaction,
  withdrawNativeTokenDeposit,
} from "zebecprotocol-sdk";

Connect to Phantom Wallet.

getProvider(); // This will connect user's wallet to phantom //For more info visit https://docs.phantom.app/

Deposit Native Token (SOL)

const depositTransac = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9", // wallet public key
    amount: 1,
  };

  const response = await depositNativeToken(data);
};

Withdraw Native Token (SOL) deposit.

const nativeWithdraw = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9", //wallet public key
    amount: 1,
  };
  const response = await withdrawNativeTokenDeposit(data);
};

Initialize Native Token (SOL) Stream

For initializing transactions, we need to send the sender address, receiver address, amount, start time and end time in epoch timestamp.

const sendTransac = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9",
    receiver: "FuEm7UMaCYHThzKaf9DcJ7MdM4t4SALfeNnYQq46foVv",
    amount: 1,
    start_time: 1637182627, // epoch time stamp (unix)
    end_time: 1637192627,
  };
  const response = await initNativeTransaction(data); // pda should be saved.
};

Pause Native Token (SOL) Stream

For Pausing streaming payment,send the sender address, and receiver's address.

const pauseTransac = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9",
    receiver: "FuEm7UMaCYHThzKaf9DcJ7MdM4t4SALfeNnYQq46foVv",
    pda: "3AicfRtVVXzkjU5L3yarWt2oMWSS32jfkPeeK5Hh9Hyz", // use saved pda returned from initNativeTransaction()
  };
  const response = await pauseNativeTransaction(data);
};

Resume Native Token (SOL) Stream

For Resuming streaming payment, send the sender address, and receiver's address.

const resumeTransac = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9",
    receiver: "FuEm7UMaCYHThzKaf9DcJ7MdM4t4SALfeNnYQq46foVv",
    pda: "3AicfRtVVXzkjU5L3yarWt2oMWSS32jfkPeeK5Hh9Hyz",
  };
  const response = await resumeNativeTransaction(data);
};

Cancel Native Token (SOL) Stream

For cancelling streaming payment, send the sender and receiver address, amount.

const cancelTransac = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9",
    receiver: "FuEm7UMaCYHThzKaf9DcJ7MdM4t4SALfeNnYQq46foVv",
    pda: "3AicfRtVVXzkjU5L3yarWt2oMWSS32jfkPeeK5Hh9Hyz",
  };

  const response = await cancelNativeTransaction(data);
};

Withdraw Native Token (SOL) Transaction

For withdrawing from streamed payment or streaming payment, send the sender address , receiver address, and the amount.

const withTransac = async () => {
  const data = {
    sender: "J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9",
    receiver: "FuEm7UMaCYHThzKaf9DcJ7MdM4t4SALfeNnYQq46foVv",
    pda: "3AicfRtVVXzkjU5L3yarWt2oMWSS32jfkPeeK5Hh9Hyz",
    amount: 0.5,
  };
  const response = await withdrawNativeTransaction(data);
};

Time Stamp Calculation :

Initializing Payment (set) Start time ( Unix epoch time) End time ( Unix epoch time) Pda (array) Sender amount Recipient

Withdraw (Get request ) PDA amount Update amount

Formula starts here (transaction per second basis):

By using a given formula , we can show transactions happening per second basis.

End_time - start time = total_seconds Amount / total_seconds = amount that needs to be transfer in second (token_transfer_per_second) Current_timestamp - end_time = remaining seconds spentSeconds = total_Seconds - remaining_seconds tokenGained = token_transfer_per_second*spentSeconds

Example:

start_time = 1632100802 End_time = 1632188102 Total_amount = 10 current_time = 1632144808

total_time_in_seconds = end_timestamp - start_timestamp = 1632100802-1632100862 = 60

total_amount_tranfer_per_seconds = total_amount / total_time_in_seconds =10/60 = 0.1666666666666667

remaining_time_in_seconds = end_timestamp - current_timestamp

spent_time_in_seconds = total_time_in_second - remaining_time_in_seconds

received_token or sent_token = total_amount_tranfer_per_seconds * spent_time_in_seconds

Note : This SDK is more compatible with phantom wallet.