SoLibrary
  • Solana
  • The Meme Coin Problem and Solution
  • Developing on Solana
  • From Rust To Deployment
  • Solana Blockchain Explorer
  • Building a Solana dAPP
  • Deploying a Solana dApp
  • Deploying a Solana Memecoin using CLI
  • Solana Smart Contracts
  • Send Solana via javascript functions
  • Candy Machine
  • Pump fun APIs
  • Metaplex
  • Metaplex Program Library
  • Solana Program Library
  • UMI Framework
  • Umi and Web3js Differences
  • Fetching Accounts
  • UMI Helpers
  • HTTP Requests
  • Umi's Interfaces
  • Interface implementations
  • Kinobi
  • UMI Plugins
  • Registering Programs
  • Public keys and Signers
  • Connecting RPCS
  • Serializer
  • Storage
  • Transactions
  • Web 3.JS Adapters
  • Metaplex Umi Plugins
  • Core JS SDK v1.0
  • Local Validator
  • SolScriptions
  • FAQ
  • Initialize
  • Write Inscription Data
  • Fetch
  • Clear
  • Close
  • Authority
  • Sharding
  • Getting Started using JavaScript
  • Getting started using the Inscriptions CLI
  • Core Candy Machine
  • Getting Started using JavaScript
  • Candy Guard
  • Assets
  • Creating a Core Candy Machine
  • Inserting Items
  • Updating The Core Candy Machine
  • Guard Groups
  • Special Guard Instructions
  • Fetching a Core Candy Machine
  • Minting
  • Withdrawing a Core Candy Machine
  • Address Gate Guard
  • Allocation
  • Allowlist Guard
  • Asset Burn Guard
  • Asset Burn Multi
  • Asset Payment Guard
  • Asset Payment Multi
  • Asset Mint Limit
  • Bot Tax Guard
  • End Date Guard
  • Edition
  • Freeze Sol Payment guard
  • Freeze Token Payment Guard
  • Gatekeeper Guard
  • Mint Limit Guard
  • NFT Burn Guard
  • NFT Gate Guard
  • NFT Mint Limit Guard
  • NFT Payment Guard
  • Program Gate Guard
  • Redeemed Amount Guard
  • Sol Fixed Fee Guard
  • Sol Payment Guard
  • Start Date Guard
  • Third Party Signer Guard
  • Token Burn Guard
  • Token Gate Guard
  • Token Payment Guard
  • Token2022 Payment Guard
  • Generating Custom Guard Client for Core Candy Machine
Powered by GitBook
On this page

Umi and Web3js Differences

Differences

PreviousUMI FrameworkNextFetching Accounts

Last updated 10 months ago

When using Umi you may come across some differences between Umi and solana web3js.

Although having the same or similar import names these function differently and are not compatible between the two librarys out the box.

PublicKeys

Umi PublicKey

JavaScript

import { publicKey } from '@metaplex-foundation/umi'
const publicKey = publicKey('tst24HZ6pbcnraCv4r8acexfgXvyQwMSRgZRCg9gEX1')

Solana Web3js PublicKey

JavaScript

import { PublicKey } from '@solana/web3js'
const publicKey = new PublicKey('tst24HZ6pbcnraCv4r8acexfgXvyQwMSRgZRCg9gEX1')

These are just basic examples. To learn more about Umi's keypairs check out . There are also converters between both Umi and web3js

Keypairs

Umi Keypair

JavaScript

const umi = createUmi(...)
const keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secretKey))

Web3js Keypair

JavaScript

import { Keypair } from '@solana/web3js'
const publicKey = Keypair.fromSecretKey(new Uint8Array(JSON.parse(Wallet.DEV1)))

Transactions

Umi Transaction

JavaScript

const blockhash = await umi.rpc.getLatestBlockhash()

const transaction = const tx = umi.transactions.create({
    version: 0,
    payer: umi.identity.publicKey,
    instructions: ix,
    blockhash: blockhash.blockhash,
  });

await umi.rpc.sendTransaction(tx)

Web3js Transaction

JavaScript

const wallet = useWallet()

const messageV0 = new TransactionMessage({
  payerKey: SIGNER_WALLET.publicKey,
  recentBlockhash: latestBlockhash.blockhash,
  instructions: txInstructions,
}).compileToV0Message()

const tx = new VersionedTransaction(messageV0)

// send via useWallet hook
await wallet.sendTransaction(tx)
//or send via connection
await connection.sendTransaction(tx)

These are just basic examples. To learn more about Umi's keypairs check out . There are also converters between both Umi and web3js keypair types

These are just basic examples. To learn more about Umi's Transiactions check out . There are also converters between both Umi and web3js Transaction types

PublicKeys and Signers
Web3Js Adapters
PublicKeys and Signers
Web3Js Adapters
Transactions
Web3Js Adapters