Skip to content

Commit

Permalink
fix: fix the wrapped signer to work with undeployed accounts (#381)
Browse files Browse the repository at this point in the history
* fix: fix the wrapped signer to work with undeployed accounts

* refactor: update some of the deployment addresses
  • Loading branch information
moldy530 authored Jan 25, 2024
1 parent eb73018 commit 55a3a54
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/accounts/plugindefs/multi-owner/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const MultiOwnerPluginGenConfig: PluginGenConfig = {
name: "MultiOwnerPlugin",
abi: MultiOwnerPluginAbi,
addresses: {
[sepolia.id]: "0x90d4f511c9Ca2B1694eA2A1629130B430853aBeB",
[sepolia.id]: "0xB76734F322b9f2C8F1dA934252dED3bC3C25b109",
},
chain: sepolia,
installConfig: {
Expand Down
2 changes: 1 addition & 1 deletion packages/accounts/plugindefs/token-receiver/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const TokenReceiverPluginGenConfig: PluginGenConfig = {
name: "TokenReceiverPlugin",
abi: TokenReceiverPluginAbi,
addresses: {
[sepolia.id]: "0x4FCDe5A446208a20A1539FC425832334bc8360Fb",
[sepolia.id]: "0x360b59D3D922fe6b015257390b35E7dBA8632A50",
},
chain: sepolia,
installConfig: {
Expand Down
19 changes: 13 additions & 6 deletions packages/accounts/src/msca/builder/wrapped-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
isBytes,
type Hash,
} from "viem";
import { MultiOwnerPlugin } from "../plugins/multi-owner/plugin.js";
import {
MultiOwnerPlugin,
MultiOwnerPluginAbi,
} from "../plugins/multi-owner/plugin.js";
import type { SignerMethods } from "./types";

export const WrapWith712SignerMethods: SignerMethods = (acct) => {
Expand All @@ -17,17 +20,21 @@ export const WrapWith712SignerMethods: SignerMethods = (acct) => {
}

const signWith712Wrapper = async (msg: Hash): Promise<`0x${string}`> => {
const { readEip712Domain } = MultiOwnerPlugin.accountMethods(acct);

const [, name, version, chainId, verifyingContract, salt] =
await readEip712Domain();
// TODO: right now this is hard coded to one Plugin address, but we should make this configurable somehow
const [, name, version, chainId, , salt] =
await acct.rpcProvider.readContract({
abi: MultiOwnerPluginAbi,
address: MultiOwnerPlugin.meta.addresses[acct.rpcProvider.chain.id],
functionName: "eip712Domain",
account: await acct.getAddress(),
});

return owner.signTypedData({
domain: {
chainId: Number(chainId),
name,
salt,
verifyingContract,
verifyingContract: await acct.getAddress(),
version,
},
types: {
Expand Down
4 changes: 2 additions & 2 deletions packages/accounts/src/msca/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const getDefaultMultiOwnerMSCAFactoryAddress = (
switch (chain.id) {
case sepolia.id:
return excludeDefaultTokenReceiverPlugin
? "0xFD14c78640d72f73CC88238E2f7Df3273Ee84043" // MultiOwnerMSCAFactory
: "0x22322E35c1850F26DD54Ed8F59a27C1c79847A15";
? "0xC69731F267760466663470256A7ba28F79eDC4d6" // MultiOwnerMSCAFactory
: "0x852B3a676684031Cb77b69B50D8d7879f4c4807d";
case mainnet.id:
case goerli.id:
case polygon.id:
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/signer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
parseAbiParameters,
type Address,
type Hash,
type PublicClient,
type Hex,
type PublicClient,
} from "viem";

export type SignWith6492Params = {
Expand Down

0 comments on commit 55a3a54

Please sign in to comment.