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

@mcintyre94/compat

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcintyre94/compat

Helpers for converting from legacy web3js classes

  • 2.0.0-experimental.f9b30bb
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

@solana/compat

This package contains utilities for converting from legacy web3js classes to the new data structures. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK @solana/web3.js@experimental.

Functions

fromLegacyPublicKey()

This can be used to convert a legacy PublicKey object to an Address type

import { fromLegacyPublicKey } from '@solana/compat';
const address = fromLegacyPublicKey(new PublicKey('49XBVQsvSW44ULKL9qufS9YqQPbdcps1TQRijx4FQ9sH'));

fromLegacyKeypair()

This can be used to convert a legacy Keypair object to a native Ed25519 CryptoKeyPair object

import { fromLegaycKeypair } from '@solana/compat';
const { privateKey, publicKey } = await fromLegacyKeypair(Keypair.generate());

fromVersionedTransactionWithBlockhash()

This can be used to convert a legacy VersionedTransaction object that uses a blockhash lifetime to a Transaction object. The returned transaction fulfils both the ITransactionWithFeePayer and ITransactionWithBlockhash interfaces.

import { fromVersionedTransactionWithBlockhash } from '@solana/compat';

// imagine a function that returns a legacy `VersionedTransaction`
const legacyVersionedTransaction = getMyLegacyVersionedTransaction();
const transaction = fromVersionedTransactionWithBlockhash(legacyVersionedTransaction);

fromVersionedTransactionWithDurableNonce()

This can be used to convert a legacy VersionedTransaction object that uses a durable nonce lifetime to a Transaction object. The returned transaction fulfils both the ITransactionWithFeePayer and IDurableNonceTransaction interfaces.

import { fromVersionedTransactionWithDurableNonce } from '@solana/compat';

// imagine a function that returns a legacy `VersionedTransaction`
const legacyVersionedTransaction = getMyLegacyVersionedTransaction();
const transaction = fromVersionedTransactionWithDurableNonce(legacyVersionedTransaction);

Keywords

FAQs

Package last updated on 29 Nov 2023

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