Umi and Web3js Differences

Differences

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 PublicKeys and Signersarrow-up-right. There are also converters between both Umi and web3js Web3Js Adaptersarrow-up-right

Keypairs

Umi Keypair

JavaScript

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

Web3js Keypair

JavaScript

These are just basic examples. To learn more about Umi's keypairs check out PublicKeys and Signersarrow-up-right. There are also converters between both Umi and web3js keypair types Web3Js Adaptersarrow-up-right

Transactions

Umi Transaction

JavaScript

Web3js Transaction

JavaScript

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

Last updated