Skip to content

Commit

Permalink
update cjs import
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeexcoin committed Sep 16, 2024
1 parent 9e2eaff commit 27ff60e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/agw-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@abstract-foundation/agw-react",
"description": "Abstract Global Wallet React Components",
"version": "0.0.1-alpha.2",
"version": "0.0.1-alpha.3",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions packages/agw-react/src/agwProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use client'
import {
import PrivyAuth from "@privy-io/react-auth";
const {
PrivyProvider
} from "@privy-io/react-auth";
} = PrivyAuth;
import React from "react";
import {
type Chain,
Expand Down
13 changes: 6 additions & 7 deletions packages/agw-react/src/smartAccountContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import {
createAbstractClient,
} from '@abstract-foundation/agw-sdk';
import { toPrivyWalletProvider } from '@privy-io/cross-app-connect';
import {
type SignTypedDataParams,
import PrivyAuth from '@privy-io/react-auth'
const {
useCrossAppAccounts,
usePrivy,
type User,
} from '@privy-io/react-auth';
} = PrivyAuth;
import React, {
createContext,
useContext,
Expand Down Expand Up @@ -56,7 +55,7 @@ export const SmartAccountProvider = ({
const { user, ready, authenticated } = usePrivy();

const account = useMemo(() => {
const getAccountFromCrossAppUser = (user: User) => {
const getAccountFromCrossAppUser = (user: PrivyAuth.User) => {
const crossAppAccount = user.linkedAccounts.find(
(account) => account.type === 'cross_app',
);
Expand Down Expand Up @@ -110,7 +109,7 @@ export const SmartAccountProvider = ({
data,
) => {
sanitizeMessage(data.message);
return signTypedData(data as SignTypedDataParams, {
return signTypedData(data as PrivyAuth.SignTypedDataParams, {
address,
}) as Promise<`0x${string}`>;
};
Expand All @@ -125,7 +124,7 @@ export const SmartAccountProvider = ({

if (!ready) return;
if (!authenticated) return;
return getAccountFromCrossAppUser(user as User);
return getAccountFromCrossAppUser(user as PrivyAuth.User);
}, [ready, authenticated, user, signMessage, signTypedData]);

// States to store the smart account and its status
Expand Down
5 changes: 3 additions & 2 deletions packages/agw-react/src/useLoginWithAbstract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCrossAppAccounts, usePrivy, type User } from '@privy-io/react-auth';
import PrivyAuth from '@privy-io/react-auth';
const { useCrossAppAccounts, usePrivy } = PrivyAuth;
import { useCallback } from 'react';

const AGW_APP_ID = 'cm04asygd041fmry9zmcyn5o5';
Expand All @@ -9,7 +10,7 @@ interface AbstractGlobalWalletInterface {
/** Boolean to indicate whether the user is authenticated */
authenticated: boolean;
/** Privy user object */
user: User | undefined;
user: PrivyAuth.User | undefined;
/** Function to login with the Abstract global wallet */
login: () => Promise<void>;
/** Function to logout of the abstract global wallet */
Expand Down

0 comments on commit 27ff60e

Please sign in to comment.