Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Latest commit

 

History

History
47 lines (35 loc) · 1.53 KB

different-ways-to-create-a-safe.md

File metadata and controls

47 lines (35 loc) · 1.53 KB

Different Ways to Create a Safe

Here are some different ways to create a Safe account:

// yarn install [email protected] @safe-global/safe-core-sdk @safe-global/safe-ethers-lib
import { ethers } from 'ethers'
import Safe, { SafeFactory } from '@safe-global/safe-core-sdk'
import EthersAdapter from '@safe-global/safe-ethers-lib'

const provider = new ethers.providers.JsonRpcProvider('...'); //1
const signerWallet = new ethers.Wallet('<PRIVATE_KEY>', provider); //2
const ethAdapter = new EthersAdapter({ethers, signerOrProvider: signerWallet}); //3

const safeFactory = await SafeFactory.create({ ethAdapter }); //4
const safeSdk: Safe = await safeFactory.deploySafe({ safeAccountConfig: { threshold: 2, owners: ['0x...', '0x...', '0x..'] }}); //5

Command Line

Safe CLI: Python

pip3 install -U safe-cli
safe-cli <checksummed_safe_address> <ethereum_node_url>
load_cli_owners <account_private_key>
safe-creator <node_url> <private_key> --owners <checksummed_address_1> <checksummed_address_2>\
  --threshold <uint> --salt-nonce <uint256>
tx-service asign-tx <safe-tx-hash>
git clone https://github.com/5afe/safe-tasks
yarn install
cat "export PK=<YOUR_PRIVATE_KEY>" > .env
cat "export NODE_URL=<YOUR_NODE_URL>" >> .env


yarn safe create
yarn safe propose <address> --to <target>
yarn safe sign-proposal <safeTxHash>
yarn safe submit-proposal <safeTxHash>