0.1.2 • Published 7 months ago

@safer-sh/core v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@safer-sh/core

Core logic module for Safer - a minimal Ethereum Safe multi-signature wallet client.


⚠️ Disclaimer ⚠️

This tool is NOT intended for production environments or for managing significant funds.

Overview

The @safer-sh/core module provides the essential functionality for interacting with Safe multi-signature wallets on Ethereum networks. It's designed with minimal dependencies and a focus on supply chain attack risk mitigation.

This package implements the core logic needed to:

  • Create and manage Safe wallets
  • Generate and sign transactions
  • Handle owner management operations
  • Interact with Safe contracts

Installation

npm install @safer-sh/core

Usage

const { services } = require('@safer-sh/core');
const { ethers } = require('ethers');

// Initialize services with provider
const provider = new ethers.providers.JsonRpcProvider('https://rpc-endpoint.example');

// Get Safe information
const safeInfo = await services.safeService.getSafeInfo({
  safeAddress: '0xYourSafeAddress',
  rpcUrl: 'https://rpc-endpoint.example',
  chainId: 1  // Mainnet
});

// Create ETH transfer transaction
const txData = await services.transactionService.createEthTransferTx({
  safeAddress: '0xYourSafeAddress',
  rpcUrl: 'https://rpc-endpoint.example',
  chainId: 1,
  receiverAddress: '0xRecipientAddress',
  amount: '1.5'  // ETH amount
});

// Sign a transaction
const signedTx = await services.signService.signTransaction({
  safeAddress: '0xYourSafeAddress',
  rpcUrl: 'https://rpc-endpoint.example',
  chainId: 1,
  transaction: txData,
  signer: yourSigner  // Must implement ISaferSigner interface
});

// Execute a transaction
const receipt = await services.executeService.executeTransaction({
  safeAddress: '0xYourSafeAddress',
  rpcUrl: 'https://rpc-endpoint.example',
  chainId: 1,
  transaction: signedTx,
  signer: yourSigner
});

Key Components

  • SafeService: Get Safe information, owners, and balances
  • TransactionService: Create various transaction types (ETH, ERC20, contract)
  • SignService: Sign transactions with hardware wallets or private keys
  • ExecuteService: Submit transactions to the blockchain

Dependencies

This package is designed with minimal dependencies to reduce supply chain attack risks:

  • @safe-global official packages
  • ethers.js v5.x (as the only external dependency)

Security Considerations

This module is part of the Safer project, which takes a security-first approach:

  • Modular dependency management
  • All dependencies are carefully vetted and version-locked
  • Security patches are regularly applied

License

MIT License

Related Packages