Skip to content

Commit cc8f1dd

Browse files
committed
fix deriveWallet
1 parent 483c9c7 commit cc8f1dd

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/context/W3PK.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ interface W3pkType {
126126
logout: () => Promise<void>
127127
signMessage: (message: string) => Promise<string | null>
128128
sendTransaction: (tx: Transaction, options?: TxOptions) => Promise<TxResponse>
129-
deriveWallet: (mode?: string, tag?: string) => Promise<DerivedWallet>
129+
deriveWallet: (
130+
mode?: string,
131+
tag?: string,
132+
options?: { requireAuth?: boolean; origin?: string }
133+
) => Promise<DerivedWallet>
130134
getAddress: (mode?: string, tag?: string) => Promise<string>
131135
getBackupStatus: () => Promise<BackupStatus>
132136
createBackup: (password: string) => Promise<Blob>
@@ -558,14 +562,18 @@ export const W3pkProvider: React.FC<W3pkProviderProps> = ({ children }) => {
558562
}
559563

560564
const deriveWallet = useCallback(
561-
async (mode?: string, tag?: string): Promise<DerivedWallet> => {
565+
async (
566+
mode?: string,
567+
tag?: string,
568+
options?: { requireAuth?: boolean; origin?: string }
569+
): Promise<DerivedWallet> => {
562570
if (!user) {
563571
throw new Error('Not authenticated. Please log in first.')
564572
}
565573

566574
try {
567575
await ensureAuthentication()
568-
const derivedWallet = await w3pk.deriveWallet(mode as any, tag as any)
576+
const derivedWallet = await w3pk.deriveWallet(mode as any, tag as any, options)
569577

570578
// Extend session after successful operation
571579
w3pk.extendSession()
@@ -580,7 +588,7 @@ export const W3pkProvider: React.FC<W3pkProviderProps> = ({ children }) => {
580588
) {
581589
try {
582590
await w3pk.login()
583-
const derivedWallet = await w3pk.deriveWallet(mode as any, tag as any)
591+
const derivedWallet = await w3pk.deriveWallet(mode as any, tag as any, options)
584592

585593
// Extend session after successful retry
586594
w3pk.extendSession()

0 commit comments

Comments
 (0)