Socket
Book a DemoInstallSign in
Socket

@solana/functional

Package Overview
Dependencies
Maintainers
1
Versions
1651
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/functional

Functional JavaScript helpers

2.2.0-canary-20250605191539
Source
npmnpm
Version published
Weekly downloads
203K
-5.65%
Maintainers
1
Weekly downloads
 
Created
Source

npm npm-downloads
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 Kit @solana/kit.

Functions

pipe()

A pipeline is a solution that allows you to perform successive transforms of a value using functions. This is useful when building up a transaction message.

Until the pipeline 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
const transferTransactionMessage = pipe(
    // The result of the first expression...
    createTransactionMessage({ version: 0 }),
    // ...gets passed as the sole argument to the next function in the pipeline.
    tx => setTransactionMessageFeePayer(myAddress, tx),
    // The return value of that function gets passed to the next...
    tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx),
    // ...and so on.
    tx => appendTransactionMessageInstruction(getTransferSolInstruction({ source, destination, amount }), tx),
);

Keywords

blockchain

FAQs

Package last updated on 05 Jun 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.