Skip to content

Commit

Permalink
fix: use safe address for a tx instead of signer address
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Nov 6, 2023
1 parent e1c0024 commit 5bfc126
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 69 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,16 @@ $ BLUMEN_PK=0x2... blumen ens bafybeibp54tslsez36quqptgzwyda3vo66za3rraujksmsb3d

If you are doing testing, you can pass `--chain goerli` to use Goerli network instead of mainnet.

You can also update your ENS name as a [Safe](https://safe.global) owner or delegate by specifying the safe's address and the operation type (0 - (default) for owners, 1 - for delegates).
##### Safe multisig

You can also update your ENS name as a [Safe](https://safe.global) owner or delegate by specifying the safe's address and the operation type (0 - (default) for owners, 1 - for delegates). ENS name should be owned by a Safe, and a delegate's private key has to be provided to generate a transaction signature for Safe.

> [EIP-3770](https://eips.ethereum.org/EIPS/eip-3770) addresses are also supported.
```sh
$ BLUMEN_PK=0x2... blumen ens bafybeibp54tslsez36quqptgzwyda3vo66za3rraujksmsb3d5q247uht4 v1rtl.eth --safe eth:0x0000000000000000000000000000000000000000 --operation-type 1

# ℹ Validating transaction for wallet 0x0000000000000000000000000000000000000000 with balance 0.284910788000486236
# ℹ Validating transaction for wallet 0x0000000000000000000000000000000000000000
# ℹ Preparing a transaction for Safe eth:0x0000000000000000000000000000000000000000
# ℹ Signing a Safe transaction
# ℹ Proposing a Safe transaction
Expand Down
12 changes: 0 additions & 12 deletions build.js

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ipld/car": "^5.2.4",
"@ipld/dag-cbor": "^9.0.6",
"@ipld/unixfs": "^2.1.2",
"@stauro/piggybank": "^0.0.3",
"@stauro/piggybank": "^0.0.4",
"ascii-bar": "^1.0.3",
"cac": "^6.7.14",
"consola": "^3.2.3",
Expand All @@ -41,7 +41,7 @@
"semver": "^7.5.4",
"table": "^6.8.1",
"varint": "^6.0.0",
"viem": "^1.18.3"
"viem": "^1.18.6"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^1.0.0",
Expand Down
100 changes: 50 additions & 50 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/actions/ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { privateKeyToAccount } from 'viem/accounts'
import { goerli, mainnet } from 'viem/chains'
import { walletSafeActions, publicSafeActions } from '@stauro/piggybank/actions'
import { EIP3770Address, OperationType } from '@stauro/piggybank/types'
import { getEip3770Address } from '@stauro/piggybank/utils'
import { ApiClient } from '@stauro/piggybank/api'
import { chainIdToSafeApiUrl } from '../utils/safe.js'
import { colors } from 'consola/utils'
Expand Down Expand Up @@ -67,7 +68,7 @@ export const ensAction = async (
const { request } = await publicClient.simulateContract({
abi,
functionName: 'setContenthash',
account,
account: safeAddress ? getEip3770Address({ fullAddress: safeAddress, chainId: chain.id }).address : account.address,
address: PUBLIC_RESOLVER_ADDRESS[chain.id as 1 | 5],
args: [node, `0x${contentHash}`],
chain
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node16",
"allowJs": true,
"allowJs": false,
"outDir": "dist",
"declaration": true,
"declarationDir": "dist",
"isolatedModules": true,
"preserveSymlinks": true,
"resolveJsonModule": true
},
"exclude": ["node_modules", "**/node_modules/*"],
Expand Down

0 comments on commit 5bfc126

Please sign in to comment.