Skip to content

Commit

Permalink
feat: removed networkId from signer
Browse files Browse the repository at this point in the history
  • Loading branch information
acaldas committed Apr 15, 2024
1 parent 6a3241d commit 89c2a1c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@sentry/react": "^7.109.0",
"did-key-creator": "^1.2.0",
"document-drive": "^1.0.0-alpha.34",
"document-model": "^1.0.37",
"document-model": "^1.0.39",
"electron-is-dev": "^3.0.1",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/editors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const DocumentEditor: React.FC<IProps> = ({
},
user: {
address: user.address,
chainId: user.chainId.toString(),
chainId: user.chainId,
},
signature: '',
};
Expand Down
7 changes: 2 additions & 5 deletions src/services/renown/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { User } from './types';

export function parsePkhDid(
did: string,
): Pick<User, 'networkId' | 'chainId' | 'address'> {
export function parsePkhDid(did: string): Pick<User, 'chainId' | 'address'> {
const parts = did.split(':');
if (!did.startsWith('did:pkh:') || parts.length !== 5) {
throw new Error('Invalid pkh did');
}
const [, , networkId, chainIdStr, address] = parts;
const [, , , chainIdStr, address] = parts;

if (!address.startsWith('0x')) {
throw new Error(`Invalid address: ${address}`);
Expand All @@ -19,7 +17,6 @@ export function parsePkhDid(
}

return {
networkId,
chainId,
address: address as `0x${string}`,
};
Expand Down

0 comments on commit 89c2a1c

Please sign in to comment.