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

eas-lib

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eas-lib

EAS attestations via Ethereum Account Abstraction

  • 0.1.0
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-90.48%
Maintainers
0
Weekly downloads
 
Created
Source

EAS Library Documentation

Intro

The following documents the method to work with EAS attestations via Ethereum Account Abstraction.

Methods

generate12Words

Generates 12 words phrase (BIP39) for wallet creation.

static generateMnemonic(): string[]

derivePrivateKeyFrom12Words

Derives the private key from the 12-word mnemonic.

static getPrivateKeyFromMnemonic(mnemonic: string[]): string

derivePublicKeyAndAddress

Derives the Ethereum address from the provided private key.

static getAddressFromPrivateKey(privateKey: string): string

loadEASSchema

Load the EAS schema to an address.

static async loadEASSchema(schema: string): Promise<void>

createAbstractAccount

Creates an abstract account for the wallet using the provided address. Throws an error on fail.

static async createAbstractAccount(address: string): Promise<void>

prepareEASTx

Prepares an EAS transaction by signing it with the provided private key.

static prepareEASTx(data: any, privateKey: string): string

prepareEASBatchTx

Prepares a batch of EAS transactions by signing each transaction in the batch.

static prepareEASBatchTx(dataArray: any[], privateKey: string): string

sendEASTx

Sends the transaction to the network.

static async sendEASTx(signedTx: string): Promise<string>

Returns the EAS explorer link for the given UID.

static getEASExplorerLink(uid: string): string

Example Usage

async function main() {
  // Generate 12 words
  const mnemonic: string[] = WalletLibrary.generate12Words()

  // Derive private key from mnemonic
  const privateKey: string = WalletLibrary.derivePrivateKeyFrom12Words(mnemonic)

  // Derive public key and address from private key
  const keyInfo = WalletLibrary.derivePublicKeyAndAddress(privateKey)
  const address: string = keyInfo.address

  // Create abstract account for wallet
  await WalletLibrary.createAbstractAccount(address)

  // Prepare EAS transaction
  const easTransaction: string = WalletLibrary.prepareEASTx({ data: 'sample' }, privateKey)

  // Prepare batch of EAS transactions
  const easBatchTransaction: string = WalletLibrary.prepareEASBatchTx(
    [{ data: 'sample1' }, { data: 'sample2' }],
    privateKey
  )

  // Get EAS explorer link from UID
  const explorerLink: string = WalletLibrary.getEASExplorerLink('uid123')
}

Other Considerations

  • A method to create attestation shemes on-chain

FAQs

Package last updated on 25 Oct 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

  • 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