Skip to content

Commit

Permalink
fix(repo): sc wallet (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
poolsar42 authored Aug 18, 2023
1 parent e2dfab0 commit 3671c90
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/galaxy-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type MutationDisconnectAccountArgs = {

export type MutationRegisterSessionKeyArgs = {
sessionPublicKey: Scalars['String'];
smartContractWalletAccount: Scalars['String'];
smartContractWalletAddress: Scalars['String'];
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { generateSmartWalletAccountUrn } from '../../utils'

export const RegisterSessionKeyInput = z.object({
sessionPublicKey: z.string(),
smartContractWalletAccount: z.string(),
smartContractWalletAddress: z.string(),
paymaster: PaymasterSchema,
})

Expand All @@ -34,10 +34,10 @@ export const registerSessionKeyMethod = async ({
// This method is being called only from galaxy
// All authorization checks are done in galaxy

const { paymaster, smartContractWalletAccount, sessionPublicKey } = input
const { paymaster, smartContractWalletAddress, sessionPublicKey } = input

const { baseAccountURN } = await generateSmartWalletAccountUrn(
smartContractWalletAccount,
smartContractWalletAddress,
'' // empty string because we only care about base urn
)

Expand Down
10 changes: 5 additions & 5 deletions platform/galaxy/src/schema/resolvers/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ const accountResolvers: Resolvers = {
_parent: any,
{
sessionPublicKey,
smartContractWalletAccount,
smartContractWalletAddress,
}: {
sessionPublicKey: string
smartContractWalletAccount: string
smartContractWalletAddress: string
},
{ env, jwt, traceSpan, identityURN, clientId, apiKey }: ResolverContext
) => {
Expand All @@ -147,7 +147,7 @@ const accountResolvers: Resolvers = {
!userInfo ||
!userInfo.erc_4337.some(
(scWallet: { nickname: string; address: string }) =>
scWallet.address === smartContractWalletAccount
scWallet.address === smartContractWalletAddress
)
) {
throw new GraphQLError('Invalid smart contract wallet address.')
Expand All @@ -156,7 +156,7 @@ const accountResolvers: Resolvers = {
try {
const sessionKey = await coreClient.account.registerSessionKey.mutate({
paymaster,
smartContractWalletAccount,
smartContractWalletAddress,
sessionPublicKey,
})

Expand All @@ -166,7 +166,7 @@ const accountResolvers: Resolvers = {

const smartWalletSessionKeys = appData?.smartWalletSessionKeys || []
const { baseAccountURN } = generateSmartWalletAccountUrn(
smartContractWalletAccount,
smartContractWalletAddress,
'' // empty string because we only need a base urn
)

Expand Down
2 changes: 1 addition & 1 deletion platform/galaxy/src/schema/types/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default /* GraphQL */ `
): Boolean
registerSessionKey(
sessionPublicKey: String!
smartContractWalletAccount: String!
smartContractWalletAddress: String!
): String!
}
`

0 comments on commit 3671c90

Please sign in to comment.