Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/functional

Package Overview
Dependencies
Maintainers
15
Versions
1224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/functional

Functional JavaScript helpers

  • 2.0.0-preview.3.20240509031147.b7aa602fe1910f8826513453eb302a3177335da5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
increased by24.31%
Maintainers
15
Weekly downloads
 
Created
Source

npm npm-downloads semantic-release
code-style-prettier

@solana/functional

This package contains generalized functional helpers and functional helpers specific to Solana application components. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK @solana/web3.js@experimental.

Functions

pipe()

Until the pipe operator becomes part of JavaScript you can use this utility to create pipelines.

const add = (a, b) => a + b;
const add10 = x => add(x, 10);
const add100 = x => add(x, 100);
const sum = pipe(1, add10, add100);
sum === 111; // true

A pipeline is one solution to performing consecutive operations on a value using functions, such as you would when building a transaction.

const transferTransaction = pipe(
    // The result of the first expression...
    createTransaction({ version: 0 }),
    // ...gets passed as the sole argument to the next function in the pipeline.
    tx => setTransactionFeePayer(myAddress, tx),
    // The return value of that function gets passed to the next...
    tx => setTransactionLifetimeUsingBlockhash(latestBlockhash, tx),
    // ...and so on.
    tx => appendTransactionInstruction(createTransferInstruction(myAddress, toAddress, amountInLamports), tx),
);

Keywords

FAQs

Package last updated on 09 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc