Socket
Book a DemoInstallSign in
Socket

@tiplink/util

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiplink/util

Shared TypeScript code accross TipLink products.

0.0.1
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

Shared TypeScript code accross TipLink products.

Notes

This is an evolving package but some initial proposals:

  • This package is meant for internal use, published on npm for convenience, not maintained for third parties
  • Keep a low dependency footprint; that said, we'll have core libraries like @solana/web3.js
  • Libraries of functions over classes
  • Higher code quality
    • JSDocs over complicated functions
    • Performant, reliable, clean functions
    • Good test coverage, linting

Style Guide

  • For exported functions, params, constants, fields, etc., use full words

Examples

Common transaction

Custom transaction using modular parts

try {
  const instructions = [
    SystemProgram.transfer({
      fromPubkey,
      toPubkey: to,
      lamports: amount,
    }),
  ];

  const { transaction } = await buildTransaction({
    connection,
    instructions,
    feePayer: fromPubkey,
    priorityFeesConfig: prioFeesConfig,
    signers,
    signTransaction: signFn,
  });

  await simulateTransaction({
    connection,
    transaction,
    simulateTransactionConfig: {
      sigVerify: true,
    },
  });

  const { signature } = await sendTransaction({
    connection,
    rawTransaction: transaction.serialize(),
  });
} catch (err) {
  if (err instanceof TxnError) {
    if (err instanceof InsufficientFundsError) {
      // Handle
    }
    if (err instanceof UnexpectedSendError) {
    // Handle
    }

    // etc.
  }
}

Pre-built common transaction

try {
  const { sig } = await sendLamports({
    connection: CONNECTION,
    from: TEST_KEYPAIR,
    to,
    amount,
    prioFeesConfig: { cuPrice: DEFAULT_CU_PRICE },
  });
} catch (err) {
  // Similar to above
}

FAQs

Package last updated on 05 Dec 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

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.