Skip to content

Commit

Permalink
Rename Workspace Packages (#310)
Browse files Browse the repository at this point in the history
This PR just renames some workspace packages to be (hopefully) more
consistent:

- `safe-4337-passkey` example is now `4337-passkey`. Since the path was
`safe-global/safe-modules/examples/safe-4337-passkey`, it felt like the
last `safe` was already implicit...
- Changed the `package.json` names to include the
`safe-modules-example-` prefix (kind of like scoping). Since they are
private packages, it doesn't really matter.
- `safe-erc4337` -> `safe-4337`, it is more succinct and IMO the ERC is
superfluous in the package name.

Additionally, I added the missing example to the root `README`.
  • Loading branch information
nlordell authored Mar 7, 2024
1 parent 92e5bc0 commit e907b6c
Show file tree
Hide file tree
Showing 42 changed files with 258 additions and 230 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci_passkey_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
paths:
- 'modules/4337/**'
- 'modules/passkey/**'
- 'examples/safe-4337-passkeys/**'
- 'examples/4337-passkeys/**'

jobs:
checks:
Expand All @@ -22,8 +22,8 @@ jobs:
npm run build -w modules/4337
# Reinstall the dependencies so the 4337 dependency includes artifacts
npm ci
npm run lint -w examples/safe-4337-passkeys
npm run build -w examples/safe-4337-passkeys
npm run lint -w examples/4337-passkeys
npm run build -w examples/4337-passkeys
env:
VITE_WC_CLOUD_PROJECT_ID: ${{ secrets.VITE_WC_CLOUD_PROJECT_ID }}
VITE_WC_4337_BUNDLER_URL: ${{ secrets.VITE_WC_4337_BUNDLER_URL }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This repository contains a collection of modules for the [Safe Smart Account](ht

## Examples

- [Safe + 4337 + Passkeys](./examples/safe-4337-passkeys)
- [Safe + 4337 + Passkeys](./examples/4337-passkeys)
- [4337 Gas Metering](./examples/4337-gas-metering)

## Security and Liability

Expand Down
2 changes: 1 addition & 1 deletion examples/4337-gas-metering/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@safe-global/4337-gas-metering",
"name": "@safe-global/safe-modules-example-4337-gas-metering",
"version": "1.0.0",
"description": "Gas Metering Analysis for Safe with 4337 Module",
"homepage": "https://github.com/safe-global/safe-modules/4337-gas-metering",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Helpful links:
### Run the app in development mode

```bash
npm run dev -w examples/safe-4337-passkeys
npm run dev -w examples/4337-passkeys
```

## Config adjustments
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "safe-4337-passkeys",
"name": "@safe-global/safe-modules-example-4337-passkeys",
"private": true,
"version": "0.0.0",
"type": "module",
Expand All @@ -11,7 +11,7 @@
},
"dependencies": {
"@web3modal/ethers": "^4.0.5",
"@safe-global/safe-erc4337": "^0.3.0",
"@safe-global/safe-4337": "^0.3.0",
"ethers": "^6.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { ethers } from 'ethers'
import { abi as SafeSignerLaunchpadAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/experimental/SafeSignerLaunchpad.sol/SafeSignerLaunchpad.json'
import { abi as WebAuthnSignerFactoryAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSignerFactory.json'
import { abi as SetupModuleSetupAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/SafeModuleSetup.sol/SafeModuleSetup.json'
import { abi as SafeSignerLaunchpadAbi } from '@safe-global/safe-4337/build/artifacts/contracts/experimental/SafeSignerLaunchpad.sol/SafeSignerLaunchpad.json'
import { abi as WebAuthnSignerFactoryAbi } from '@safe-global/safe-4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSignerFactory.json'
import { abi as SetupModuleSetupAbi } from '@safe-global/safe-4337/build/artifacts/contracts/SafeModuleSetup.sol/SafeModuleSetup.json'
import {
abi as WebAuthnSignerAbi,
bytecode as WebAuthSignerBytecode,
} from '@safe-global/safe-erc4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSigner.json'
import { abi as Safe4337ModuleAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/Safe4337Module.sol/Safe4337Module.json'
import { abi as SafeProxyFactoryAbi } from '@safe-global/safe-erc4337/build/artifacts/@safe-global/safe-contracts/contracts/proxies/SafeProxyFactory.sol/SafeProxyFactory.json'
} from '@safe-global/safe-4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSigner.json'
import { abi as Safe4337ModuleAbi } from '@safe-global/safe-4337/build/artifacts/contracts/Safe4337Module.sol/Safe4337Module.json'
import { abi as SafeProxyFactoryAbi } from '@safe-global/safe-4337/build/artifacts/@safe-global/safe-contracts/contracts/proxies/SafeProxyFactory.sol/SafeProxyFactory.json'
import type {
SafeSignerLaunchpad,
Safe4337Module,
SafeProxyFactory,
WebAuthnSigner,
WebAuthnSignerFactory,
SafeModuleSetup,
} from '@safe-global/safe-erc4337/typechain-types/'
} from '@safe-global/safe-4337/typechain-types/'

import {
SAFE_SIGNER_LAUNCHPAD_ADDRESS,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/4337/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@safe-global/safe-erc4337",
"name": "@safe-global/safe-4337",
"version": "0.3.0",
"description": "Safe Module for ERC-4337 support",
"homepage": "https://github.com/safe-global/safe-modules/tree/main/modules/4337",
Expand Down
2 changes: 1 addition & 1 deletion modules/passkey/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@account-abstraction/contracts": "^0.7.0",
"@noble/curves": "^1.3.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@safe-global/safe-erc4337": "^0.3.0",
"@safe-global/safe-4337": "^0.3.0",
"@simplewebauthn/server": "^9.0.3",
"cbor": "^9.0.2",
"dotenv": "^16.4.5",
Expand Down
4 changes: 2 additions & 2 deletions modules/passkey/src/deploy/safe.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import MultiSend from '@safe-global/safe-contracts/build/artifacts/contracts/libraries/MultiSend.sol/MultiSend.json'
import SafeProxyFactory from '@safe-global/safe-contracts/build/artifacts/contracts/proxies/SafeProxyFactory.sol/SafeProxyFactory.json'
import SafeL2 from '@safe-global/safe-contracts/build/artifacts/contracts/SafeL2.sol/SafeL2.json'
import Safe4337Module from '@safe-global/safe-erc4337/build/artifacts/contracts/Safe4337Module.sol/Safe4337Module.json'
import SafeModuleSetup from '@safe-global/safe-erc4337/build/artifacts/contracts/SafeModuleSetup.sol/SafeModuleSetup.json'
import Safe4337Module from '@safe-global/safe-4337/build/artifacts/contracts/Safe4337Module.sol/Safe4337Module.json'
import SafeModuleSetup from '@safe-global/safe-4337/build/artifacts/contracts/SafeModuleSetup.sol/SafeModuleSetup.json'
import { DeployFunction } from 'hardhat-deploy/types'

const deploy: DeployFunction = async ({ deployments, getNamedAccounts, network }) => {
Expand Down
2 changes: 1 addition & 1 deletion modules/passkey/test/4337/WebAuthnSigner.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai'
import { deployments, ethers, network } from 'hardhat'
import { packGasParameters, unpackUserOperation } from '@safe-global/safe-erc4337/dist/src/utils/userOp'
import { packGasParameters, unpackUserOperation } from '@safe-global/safe-4337/dist/src/utils/userOp'
import { bundlerRpc, prepareAccounts, waitForUserOp } from '../utils/e2e'
import { chainId } from '../utils/encoding'
import { WebAuthnCredentials, decodePublicKey, encodeWebAuthnSignature } from '../utils/webauthn'
Expand Down
2 changes: 1 addition & 1 deletion modules/passkey/test/utils/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deployments, ethers } from 'hardhat'
import { MultiProvider4337 } from '@safe-global/safe-erc4337/dist/src/utils/safe'
import { MultiProvider4337 } from '@safe-global/safe-4337/dist/src/utils/safe'
import { AddressLike, BigNumberish, BytesLike, HDNodeWallet } from 'ethers'
import { PackedUserOperationStruct } from '../../typechain-types/@account-abstraction/contracts/interfaces/IAccount'

Expand Down
Loading

0 comments on commit e907b6c

Please sign in to comment.