Skip to content

Think-and-Dev/safe-client

Repository files navigation

Safe-Client

  • POC for Safe Multisig management from backend using Safe-SDK.

Stack

  • Node v18
  • Typescript
  • Express
  • Ethers v5.x
  • TRPC

Resources


Install

nvm use
yarn

Run server

yarn dev: server

Endpoints

  • Get Owners: Get Safe Owners addresses.

  • Create transaction: Create Safe transaction. This will mean it will get proposed to the network.

  • Get transaction: Get transaction details by knowing tx hash.

  • Get pending transactions: Get all pending transactions.

  • Confirm transaction: Accept a transaction. Fot that purpose a valid signer|owner of the safe must be provided.

  • Postman collection could be found on /src/postman.

Safe-SDK initialization

  1. Create Ethers Adapter: You will have to provide a signer or provider to sign or view transactions from the SafeAPIKit.
return new EthersAdapter({
  ethers,
  signerOrProvider: safeOwner
})
  1. Create SafeAPIKit: Using the ethersAdapter and the Transaction Service URL you will initialize your safeService. For the complete list of the safe transction services url please refer to: https://docs.safe.global/learn/safe-core/safe-core-api/available-services
const safeService = new SafeApiKit({ txServiceUrl, ethAdapter: adapter })
  1. Create Safe Factory:
const safeFactory = await SafeFactory.create({ ethAdapter: adapter })
  1. Initialize SafeSDK: Here you will need to provide your Safe public Address
await Safe.create({
  ethAdapter: this.adapter,
  safeAddress: address
})

Query request example with TRPC

  • Get your input formatted where INPUT is a URI-encoded JSON string.
const tRPC2 = encodeURIComponent(JSON.stringify('hola'))
curl --location 'localhost:2021/trpc/greet?input=%2522hola%2522'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors