Code Monkey home page Code Monkey logo

js-sdk's Introduction

Streamflow

Streamflow is a token vesting and streaming payments platform.

There are several ways to use Streamflow:

Security audit passed ✅

Protocol audits available here.
Partner oracle audit available here here.

Documentation

API Documentation available here: docs site →

JS SDK to interact with Streamflow protocols

This repo consists of js-sdk to interact with several protocol exposed by streamflow:

  • packages/stream - Core Streamflow Protocol that allows to create a vesting/payment/lock Stream to a Recipient;
  • packages/distributor - Distirbutor Streamflow Protocol that allows to Airdrop tokens to large amount of Recipients (thousands or even millions);
  • packages/common - Common utilities and types used by Streamflow SDK;

Installation

Instal Stream Protocol SDK

npm i -s @streamflow/stream

or

yarn add @streamflow/stream

Install Distributor Protocol SDK

npm i -s @streamflow/common @streamflow/distributor

or

yarn add @streamflow/common @streamflow/distributor

js-sdk's People

Contributors

andjelboskovic avatar diksipav avatar ibrica avatar imprfekt avatar johnny3223 avatar lukastreamflow avatar nemanjab17 avatar nikarm22 avatar rolginroman avatar schananas avatar tatomir-streamflow avatar yolley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-sdk's Issues

Can't get vesting payouts to work

Great work on the project, from my research it seems like it should be the most complete and user friendly solution to implement SPL token vesting schemes. I would like to use it for our project which requires different vesting schemes for different participants and it looks like a perfect fit as it allows setting up custom schemes via JS (seems like the easiest way to go about setting up bulk payments) or via UI (for one-offs, which we'll have as well), as well as letting recipients to track their vesting status via UI.

So far so good, however the part where I'm having issues is getting the vesting payments to actually reach the final recipients. It doesn't seem to work neither on devnet, nor mainnet. As an example, I have initiated 2 very simple contracts on mainnet (only one payment to be made), however the payments are actually not getting sent to the recipient.

Here's an example of one of the contracts returned by Stream.get:
image

My assumption is that by the end time the entire amount minus the fees should have been transferred to the recipient. Am I correct to assume that all the payouts take place automatically without user intervention (or having to "crank" the program to trigger the payouts)?

In addition, I can't see the contracts in the UI either. I tried connecting both as a sender and as a recipient, and the list is always empty:
image

I would appreciate any tips if there's something I might be doing wrong. If it helps, I'm attaching a JSON with data returned by Stream.get:
stream-get.txt

Life after Solana decided to freeze its token-list

It seems that none of Streamflow versions (both v1 and v2) support tokens not listed at Solana'ss Token List which was frozen on June, 21, 2022. Now Solana uses the Token Metadata Program from Metaplex to achieve the same purpose.

Are you aware of the situation and is there any planning on solving this?

Withdraw issue with [email protected] library installed

Hello,

I have an issue when I'm trying to withdraw the funds using the JS SDK. I guess there is a conflict with the new version of [email protected] that I have installed.

The error:

Withdraw error TypeError: Cannot read properties of undefined (reading 'getAssociatedTokenAddress')
    at eval (sdk.js?e986:495:1)
    at step (sdk.js?e986:44:1)
    at Object.eval [as next] (sdk.js?e986:25:46)
    at eval (sdk.js?e986:19:1)
    at new Promise (<anonymous>)
    at __awaiter (sdk.js?e986:15:1)
    at ata (sdk.js?e986:492:1)
    at Function.eval (sdk.js?e986:206:1)
    at step (sdk.js?e986:44:1)
    at Object.eval [as next] (sdk.js?e986:25:46)
    at fulfilled (sdk.js?e986:16:43)

package.json

    "@project-serum/anchor": "^0.22.0",
    "@solana/spl-token": "^0.2.0",
    "@solana/wallet-adapter-base": "^0.9.3",
    "@solana/wallet-adapter-react": "^0.15.3",
    "@solana/wallet-adapter-react-ui": "^0.9.5",
    "@solana/wallet-adapter-wallets": "^0.15.4",
    "@solana/web3.js": "^1.35.1",
    "@streamflow/stream": "^2.2.1"

using an older version (0.1.8) is working fine.

Thank you!

Wrap new release

Once #13 and #14 are done, we need to:

  • implement those changes within our Anchor wrapper program

Token Unlock

Hi Team,

I discovered a month ago if not more that the process of unlocking your locked token doesn't automatically deposit in your provided destination wallet address. The process is meant to be automatic following that of vesting. In my humble opinion, it makes no sense that up till date, I have not received my unlocked tokens and the official streamflow docs doesn't address this issue rather it focuses on "Vesting" or "Payments" which is not the section of concern (Token lock). The docs provides no aid on this issue I'm afraid.

Kindly fix this issues especially because my token has been unlocked since the 31st of January 2024 and I am yet to receive it via my recipient address wallet.

Thanks.

Developer exerience feedback

Based on discussion with a user, things to improve for users using sdk:

  • on withdraw/cancel actions, it's not clear what id field represents
  • getBN function is not intuitive, is it adding decimals or removing them? docs are missleading
  • custom program errors are not serialized in the sdk, and since error map is close sourced, theres no way a user could interpret these
  • unlocked amount and percentage are not calculated in the sdk, so every user has to implement this logic

Ownership transfer

Need to enable vesting contract ownership transfer.
On a UI side:
Something simple as a Transfer button next to the action buttons (Cancel/Withdraw), and a popup with an input and confirm/cancel button.

On the program side:
Switching owner, I'll dig into it...

Token Vesting

Build upon #3

  • Stream any SPL token
  • Support custom release rate
  • Add Cliff(s)
  • Transfer beneficiary

cargo build fails

I'm not sure how can I build everything and run tests.
I'm not sure where can I find a usage example of the package.

git clone [email protected]:StreamFlow-Finance/timelock.git tmp
cd tmp
cargo build

gives error

(venv) vladimirsmelov@Vladimirs-Air tmp % cargo build            
   Compiling proc-macro2 v1.0.29
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.77
   Compiling serde_derive v1.0.130
   Compiling serde v1.0.130
   Compiling version_check v0.9.3
   Compiling typenum v1.14.0
   Compiling libc v0.2.102
   Compiling cfg-if v1.0.0
   Compiling block-padding v0.2.1
   Compiling opaque-debug v0.3.0
   Compiling subtle v2.4.1
   Compiling bs58 v0.3.1
   Compiling semver-parser v0.7.0
   Compiling memchr v2.4.1
   Compiling crunchy v0.2.2
   Compiling ryu v1.0.5
   Compiling getrandom v0.1.16
   Compiling autocfg v1.0.1
   Compiling serde_json v1.0.68
   Compiling anyhow v1.0.44
   Compiling regex-syntax v0.6.25
   Compiling yansi v0.5.0
   Compiling log v0.4.14
   Compiling itoa v0.4.8
   Compiling unicode-segmentation v1.8.0
   Compiling feature-probe v0.1.1
   Compiling rustversion v1.0.5
   Compiling ppv-lite86 v0.2.10
   Compiling termcolor v1.1.2
   Compiling cc v1.0.70
   Compiling humantime v2.1.0
   Compiling ahash v0.4.7
   Compiling lazy_static v1.4.0
   Compiling ucd-trie v0.1.3
   Compiling arrayref v0.3.6
   Compiling arrayvec v0.5.2
   Compiling zeroize v1.4.2
   Compiling constant_time_eq v0.1.5
   Compiling byteorder v1.4.3
   Compiling keccak v0.1.0
   Compiling cfg-if v0.1.10
   Compiling base64 v0.12.3
   Compiling either v1.6.1
   Compiling hex v0.4.3
   Compiling bytemuck v1.7.2
   Compiling alloc-traits v0.1.1
   Compiling bs58 v0.4.0
   Compiling base64 v0.13.0
   Compiling safe-transmute v0.11.2
   Compiling static_assertions v1.1.0
   Compiling generic-array v0.14.4
   Compiling proc-macro2-diagnostics v0.9.1
   Compiling semver v0.9.0
   Compiling num-traits v0.2.14
   Compiling memoffset v0.6.4
   Compiling bv v0.11.1
   Compiling heck v0.3.3
   Compiling hashbrown v0.9.1
   Compiling pest v2.1.3
   Compiling itertools v0.9.0
   Compiling without-alloc v0.2.1
   Compiling blake3 v0.3.8
   Compiling rustc_version v0.2.3
   Compiling cpufeatures v0.2.1
   Compiling atty v0.2.14
   Compiling memmap2 v0.1.0
   Compiling semver-parser v0.10.2
   Compiling solana-frozen-abi-macro v1.7.11
   Compiling solana-frozen-abi v1.7.11
   Compiling solana-program v1.7.11
   Compiling quote v1.0.9
   Compiling aho-corasick v0.7.18
   Compiling generic-array v0.12.4
   Compiling rand_core v0.5.1
   Compiling digest v0.8.1
   Compiling semver v0.11.0
   Compiling rand_chacha v0.2.2
   Compiling regex v1.5.4
   Compiling curve25519-dalek v2.1.3
   Compiling rand v0.7.3
   Compiling rustc_version v0.3.3
   Compiling field-offset v0.3.4
   Compiling env_logger v0.8.4
   Compiling solana-logger v1.7.11
   Compiling borsh-schema-derive-internal v0.9.1
   Compiling borsh-derive-internal v0.9.1
   Compiling thiserror-impl v1.0.29
   Compiling solana-sdk-macro v1.7.11
   Compiling num-derive v0.3.3
   Compiling derivative v2.2.0
   Compiling enumflags2_derive v0.6.4
   Compiling enumflags2 v0.6.4
   Compiling thiserror v1.0.29
   Compiling toml v0.5.8
   Compiling bincode v1.3.3
   Compiling serde_bytes v0.11.5
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling crypto-mac v0.8.0
   Compiling sha2 v0.9.8
   Compiling libsecp256k1-core v0.2.2
   Compiling hmac v0.8.1
   Compiling sha3 v0.9.1
   Compiling proc-macro-crate v0.1.5
   Compiling proc-macro-crate v1.1.0
   Compiling hmac-drbg v0.3.0
   Compiling anchor-syn v0.17.0
   Compiling libsecp256k1-gen-genmult v0.2.1
   Compiling libsecp256k1-gen-ecmult v0.2.1
   Compiling libsecp256k1 v0.5.0
   Compiling borsh-derive v0.9.1
   Compiling num_enum_derive v0.5.4
   Compiling borsh v0.9.1
   Compiling num_enum v0.5.4
   Compiling anchor-attribute-program v0.17.0
   Compiling anchor-attribute-event v0.17.0
   Compiling anchor-attribute-error v0.17.0
   Compiling anchor-attribute-state v0.17.0
   Compiling anchor-attribute-access-control v0.17.0
   Compiling anchor-derive-accounts v0.17.0
   Compiling anchor-attribute-interface v0.17.0
   Compiling anchor-attribute-account v0.17.0
   Compiling anchor-lang v0.17.0
   Compiling spl-token v3.2.0
   Compiling spl-associated-token-account v1.0.3
   Compiling serum_dex v0.4.0
   Compiling streamflow-timelock v0.2.0 (https://github.com/streamflow-finance/streamflow-timelock?rev=769a2629168ec273710a66e150ecb0a0124f3723#769a2629)
   Compiling anchor-spl v0.17.0
   Compiling timelock v0.1.0 (/Users/vladimirsmelov/PycharmProjects/hashex/tmp/programs/timelock)
error[E0433]: failed to resolve: could not find `token` in `streamflow_timelock`
  --> programs/timelock/src/lib.rs:53:30
   |
53 |         streamflow_timelock::token::create(ctx.program_id, acc, ix)
   |                              ^^^^^ could not find `token` in `streamflow_timelock`

error[E0433]: failed to resolve: could not find `token` in `streamflow_timelock`
  --> programs/timelock/src/lib.rs:68:30
   |
68 |         streamflow_timelock::token::withdraw(ctx.program_id, acc, amount)
   |                              ^^^^^ could not find `token` in `streamflow_timelock`

error[E0433]: failed to resolve: could not find `token` in `streamflow_timelock`
  --> programs/timelock/src/lib.rs:83:30
   |
83 |         streamflow_timelock::token::cancel(ctx.program_id, acc)
   |                              ^^^^^ could not find `token` in `streamflow_timelock`

error[E0433]: failed to resolve: could not find `token` in `streamflow_timelock`
   --> programs/timelock/src/lib.rs:100:30
    |
100 |         streamflow_timelock::token::transfer_recipient(ctx.program_id, acc)
    |                              ^^^^^ could not find `token` in `streamflow_timelock`

error[E0560]: struct `streamflow_timelock::state::StreamInstruction` has no field named `is_cancelable_by_sender`
  --> programs/timelock/src/lib.rs:32:13
   |
32 |             is_cancelable_by_sender: true,
   |             ^^^^^^^^^^^^^^^^^^^^^^^ `streamflow_timelock::state::StreamInstruction` does not have this field
   |
   = note: available fields are: `start_time`, `end_time`, `deposited_amount`, `total_amount`, `period` ... and 2 others

error[E0560]: struct `streamflow_timelock::state::StreamInstruction` has no field named `is_cancelable_by_recipient`
  --> programs/timelock/src/lib.rs:33:13
   |
33 |             is_cancelable_by_recipient: false,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ `streamflow_timelock::state::StreamInstruction` does not have this field
   |
   = note: available fields are: `start_time`, `end_time`, `deposited_amount`, `total_amount`, `period` ... and 2 others

error[E0560]: struct `streamflow_timelock::state::StreamInstruction` has no field named `is_withdrawal_public`
  --> programs/timelock/src/lib.rs:34:13
   |
34 |             is_withdrawal_public: false,
   |             ^^^^^^^^^^^^^^^^^^^^ `streamflow_timelock::state::StreamInstruction` does not have this field
   |
   = note: available fields are: `start_time`, `end_time`, `deposited_amount`, `total_amount`, `period` ... and 2 others

error[E0560]: struct `streamflow_timelock::state::StreamInstruction` has no field named `is_transferable`
  --> programs/timelock/src/lib.rs:35:13
   |
35 |             is_transferable: true,
   |             ^^^^^^^^^^^^^^^ `streamflow_timelock::state::StreamInstruction` does not have this field
   |
   = note: available fields are: `start_time`, `end_time`, `deposited_amount`, `total_amount`, `period` ... and 2 others

error[E0560]: struct `streamflow_timelock::state::StreamInstruction` has no field named `padding`
  --> programs/timelock/src/lib.rs:36:13
   |
36 |             padding: 0,
   |             ^^^^^^^ `streamflow_timelock::state::StreamInstruction` does not have this field
   |
   = note: available fields are: `start_time`, `end_time`, `deposited_amount`, `total_amount`, `period` ... and 2 others

error[E0560]: struct `streamflow_timelock::state::WithdrawAccounts<'_>` has no field named `withdraw_authority`
  --> programs/timelock/src/lib.rs:58:13
   |
58 |             withdraw_authority: ctx.accounts.withdraw_authority.to_account_info(),
   |             ^^^^^^^^^^^^^^^^^^ `streamflow_timelock::state::WithdrawAccounts<'_>` does not have this field
   |
   = note: available fields are: `recipient`, `recipient_tokens`, `metadata`, `escrow_tokens`, `mint`, `token_program`

error[E0560]: struct `streamflow_timelock::state::WithdrawAccounts<'_>` has no field named `sender`
  --> programs/timelock/src/lib.rs:59:13
   |
59 |             sender: ctx.accounts.sender.to_account_info(),
   |             ^^^^^^ `streamflow_timelock::state::WithdrawAccounts<'_>` does not have this field
   |
   = note: available fields are: `recipient`, `recipient_tokens`, `metadata`, `escrow_tokens`, `mint`, `token_program`

error[E0560]: struct `streamflow_timelock::state::CancelAccounts<'_>` has no field named `cancel_authority`
  --> programs/timelock/src/lib.rs:73:13
   |
73 |             cancel_authority: ctx.accounts.cancel_authority.to_account_info(),
   |             ^^^^^^^^^^^^^^^^ `streamflow_timelock::state::CancelAccounts<'_>` does not have this field
   |
   = note: available fields are: `sender`, `sender_tokens`, `recipient`, `recipient_tokens`, `metadata` ... and 3 others

Some errors have detailed explanations: E0433, E0560.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `timelock` due to 12 previous errors
(venv) vladimirsmelov@Vladimirs-Air tmp % 

Test Case Documentation

Create

Valid

  • Create a stream without a cliff
  • Create a stream with a cliff
  • Cliff exists, cliff amount = 0
  • Recipient token account uninitialized
  • Recipient token account initialized

Invalid

Data parameters

Timestamps

Check inclusive (e.g. "<=" in addition to "<")

  • start < now
  • cliff < now
  • end < now
  • cliff < start
  • start > end
  • cliff > end

Amounts

  • deposit amount < 0
  • deposit amount overflow
  • deposit amount > sender token acc balance

Accounts

Sender associated token account (sata)

  • sata.owner != token program
  • sata.mint != mint
  • not derived from sender
  • uninitialized
  • invalid address

Recipient associated token account (rata)

  • rata.owner != token program
  • rata.mint != mint
  • not derived from recipient
  • invalid address

Sender

  • invalid address
  • insufficient balance (for fees)

Recipient

  • invalid address

Signers

  • missing sender
  • missing metadata

Withdraw

Valid

  • Withdraw before the cliff (cliff > start date)
  • Withdraw after 1 period passed
  • Withdraw after N periods passed
  • Withdraw after end date passed
  • Withdraw MAX
  • Withdraw 0 (???)

Invalid

  • Withdraw before start date
  • Withdraw

Cancel

Valid

Invalid

Transfer

Valid

Invalid

Timelock npm package jazz

import from "@streamflow/timelock"
instead of
import { decode, TokenStreamData } from "@streamflow/timelock/dist/packages/timelock/layout";

Give npm publish access to @didi.

Unresolved symbol (sol_get_fees_sysvar)

Hi guys,
I'm having an issue when I'm trying to deploy the contract on the local network.

Error: ELF error: ELF error: Unresolved symbol (sol_get_fees_sysvar) at instruction #32779 (ELF file offset 0x3ff70)
There was a problem deploying: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "" }.

solana-cli 1.9.5 (src:39a4cc95; feat:3125401026
anchor-cli 0.21.0

Do you have any idea how to fix this?
Thanks!

[urgent] cancel: miscalculation

*** CREATE ***
┌────────────────────┬────────┐
│      (index)       │ Values │
├────────────────────┼────────┤
│ depositedAmountNum │ 10000  │
│ escrowTokensAmount │ 10025  │
└────────────────────┴────────┘
    ✓ Creates a stream (423ms)
*** TOP UP ***
Seconds after stream start:  1.7709999084472656
┌──────────────────────────┬────────┐
│         (index)          │ Values │
├──────────────────────────┼────────┤
│          topup           │ 10000  │
│    escrowAmountBefore    │ 10025  │
│    escrowAmountAfter     │ 20050  │
│ netDepositedAmountBefore │ 10000  │
│ netDepositedAmountAfter  │ 20000  │
│          gross           │ 20050  │
└──────────────────────────┴────────┘
    ✓ Top-ups the original stream (411ms)
*** WITHDRAW ***
Seconds after stream start:  3.684000015258789
┌──────────────────────────┬────────┐
│         (index)          │ Values │
├──────────────────────────┼────────┤
│       withdrawing        │   9    │
│ withdrawn (in contract)  │   9    │
│    escrowAmountBefore    │ 20050  │
│    escrowAmountAfter     │ 20041  │
│  recipientAmountBefore   │   0    │
│   recipientAmountAfter   │   9    │
│ netDepositedAmountBefore │ 20000  │
│ netDepositedAmountAfter  │ 20000  │

and then upon cancelling

    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
    'Program log: Instruction: Transfer',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3035 of 159708 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program log: Withdrawn: 0.00000020 s2D8uYqFymuePp8gobEj2WctizXs3azyyPrqfL8wBi5 tokens',
    'Program log: Remaining: 0.00019971 s2D8uYqFymuePp8gobEj2WctizXs3azyyPrqfL8wBi5 tokens',
    'Program log: Transferring remains back to sender',
    'Program log: Available recipient: 19980, Available strm: 50, Available partner: 0',
    'Program log: Returning total: 20030',
    'Program log: Gross calculated: 20050, net deposited: 20000, withdrawn: 29',
    'Program log: strm fees total: 50, strm fees withdrawn: 0, partner fee withdrawn: 0',
    'Program log: Total on escrow account: 20041',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
    'Program log: Instruction: Transfer',
    'Program log: Error: insufficient funds',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2268 of 124556 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x1',

Cannot read properties of undefined (reading 'getAssociatedTokenAddress')

Hi,

I'm trying to test vesting with my next js project, and when I tried creating a stream, I got:

TypeError: Cannot read properties of undefined (reading 'getAssociatedTokenAddress') at eval (StreamClient.js?d945:745:1) at step (StreamClient.js?d945:45:1) at Object.eval [as next] (StreamClient.js?d945:26:46) at eval (StreamClient.js?d945:20:1) at new Promise (<anonymous>) at __awaiter (StreamClient.js?d945:16:1) at ata (StreamClient.js?d945:742:1) at StreamClient.eval (StreamClient.js?d945:152:1) at step (StreamClient.js?d945:45:1) at Object.eval [as next] (StreamClient.js?d945:26:46) at fulfilled (StreamClient.js?d945:17:43)

I use a keypair for sender params:

Keypair.fromSecretKey(
Uint8Array.from([secret key])

I don't know if it is the problem. Any ideas to pass this error? Thank you.

Error handling and passing

Do we just pass the error from the backend (chain)?
If all those errors are of the same format, then we can just pass them to the client side.

pls check Didi.

GUI Use Cases

Login:

Positive:

  • Connect with Phantom
  • Connect with Solflare
  • Connect with Solet
    .....

Assertion:

Positive:

  • Assert entire app is loaded (all input fields, balance, buttons etc)
    .....

Negative:

...

Payment:

Positive:

  • Take 10 free sol with gimme sol button
  • Stream 1 sol, approve
  • Assert
    .....

Negative:

...

SOL streaming (test flight)

Re-create existing functionality (previously written in Rust) with Anchor.

  • sender, receiver, amount, start, end
  • released per second (no custom release rate)
  • withdraws maximum (cannot chose withdrawal amount)

Restrict exports

Currently we allow importing from dist and also do not re-export sum useful modules from namespaces, so it requires our users to import from dist like so import {IChain} from '@streamflow/stream/dist/common/types.

We should make restricted exports in package.json like so

  "exports": {
    ".": "./dist/index.js",
    "./aptos": "./dist/aptos/index.js",
    "./evm": "./dist/evm/index.js",
    "./solana": "./dist/solana/index.js",
    "./sui": "./dist/sui/index.js"
  },
  "typesVersions": {
    "*": {
      ".": [
        "./dist/index.d.ts"
      ],
      "aptos": [
        "./dist/aptos/index.d.ts"
      ],
      "evm": [
        "./dist/evm/index.d.ts"
      ],
      "solana": [
        "./dist/solana/index.d.ts"
      ],
      "sui": [
        "./dist/sui/index.d.ts"
      ]
    }
  },

It will be a major release

Wrapping SOL on client

senderTokens = await Token.createWrappedNativeAccount(provider.connection, TOKEN_PROGRAM_ID, sender.publicKey, sender.payer, 10 * LAMPORTS_PER_SOL);//todo check for Number overflow here.

When I create new stream I got error in the console

The error comes from the try catch - Error: ReferenceError: Buffer is not defined

try {
    const { ixs, tx, metadata } = await client.create(createStreamParams);

    console.log(ixs, tx, metadata)

} catch (exception) {
    console.log('Error: ' + exception)
}

problem in audited version of stream-flow

there is problem in audit version of stream-flow
the audit version is e8cca5f

if you checkout and build with anchor 0.17.0 and try to deploy
you get error : Unresolved symbol (sol_get_fees_sysvar)
for all network is same DEVNET and MAINNET
its seems not possible to use community version!

solana-cli 1.10.10 (src:27424497; feat:1030935714)
anchor 0.17.0 (same as program version)

Prepare for mainnet

  • Legal disclaimers
  • Code audit (if Anchor stable and audits available)
  • Edit Solana docs afterwards
  • QA & Testing

Adapt JS app to use Anchor-generated client

Current React app uses Flow syntax and custom RPC calls.
Anchor requires TypeScript (which is good) and provides us with the IDL that minimizes room for error.

Adjust the current app to cater the Anchor needs. Needed for #8 Mainnet launch.

Unable to execute claim

Hey, I'm following the steps from the https://github.com/streamflow-finance/js-sdk/blob/master/packages/distributor/README.md for doing an airdrop and keep on stumbling on this error

/Users/x/Desktop/literate-lamp/node_modules/@streamflow/distributor/node_modules/@solana/web3.js/src/connection.ts:5735
      throw new SendTransactionError(
            ^
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: custom program error: 0x1771
    at Connection.sendEncodedTransaction (/Users/x/Desktop/literate-lamp/node_modules/@streamflow/distributor/node_modules/@solana/web3.js/src/connection.ts:5735:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/Users/x/Desktop/literate-lamp/node_modules/@streamflow/distributor/node_modules/@solana/web3.js/src/connection.ts:5694:20)
    at async sendAndConfirmRawTransaction (/Users/x/Desktop/literate-lamp/node_modules/@streamflow/common/node_modules/@solana/web3.js/src/utils/send-and-confirm-raw-transaction.ts:87:21) {
  contractErrorCode: 'InvalidProof',
  description: 'Invalid Merkle proof',
  name: 'ContractError'
}

any pointers would be appreciated

Error in just import the lib

Hello, once I import your library I got error

`import {
StreamClient
} from "@streamflow/stream";

const client = new StreamClient(
// "https://api.mainnet-beta.solana.com",
"https://api.devnet.solana.com",
Cluster.Devnet,
"confirmed"
);`

token.ts:3 Uncaught TypeError: (void 0) is not a constructor at node_modules/@streamflow/stream/node_modules/@project-serum/anchor/dist/esm/utils/token.js (token.ts:3:26) at __init (@streamflow_stream.js?v=f3e769a7:8:56) at node_modules/@streamflow/stream/node_modules/@project-serum/anchor/dist/esm/utils/index.js (token.ts:7:49) at __init (@streamflow_stream.js?v=f3e769a7:8:56) at node_modules/@streamflow/stream/node_modules/@project-serum/anchor/dist/esm/index.js (index.ts:21:1) at __init (@streamflow_stream.js?v=f3e769a7:8:56) at node_modules/@streamflow/stream/dist/Stream.js (Stream.js:81:16) at __require (@streamflow_stream.js?v=f3e769a7:11:50) at node_modules/@streamflow/stream/dist/index.js (index.js:21:16) at __require (@streamflow_stream.js?v=f3e769a7:11:50) node_modules/@streamflow/stream/node_modules/@project-serum/anchor/dist/esm/utils/token.js @ token.ts:3 __init @ @streamflow_stream.js?v=f3e769a7:8 node_modules/@streamflow/stream/node_modules/@project-serum/anchor/dist/esm/utils/index.js @ token.ts:7 __init @ @streamflow_stream.js?v=f3e769a7:8 node_modules/@streamflow/stream/node_modules/@project-serum/anchor/dist/esm/index.js @ index.ts:21 __init @ @streamflow_stream.js?v=f3e769a7:8 node_modules/@streamflow/stream/dist/Stream.js @ Stream.js:81 __require @ @streamflow_stream.js?v=f3e769a7:11 node_modules/@streamflow/stream/dist/index.js @ index.js:21 __require @ @streamflow_stream.js?v=f3e769a7:11 (anonymous) @ dep:@streamflow_stream:1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.