@explorins/pers-sdk-react-native 1.5.6 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AA6EA,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,oBAAoB;
|
|
1
|
+
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AA6EA,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,oBAAoB;IAsL7B;;OAEG;2BAvE2C,MAAM,KAAG,QAAQ,wBAAwB,CAAC;IA0ExF;;OAEG;gCAjJgD;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;IAgJC;;OAEG;;IAGH;;OAEG;;CAGN,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E;;GAEG;AACH,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -71,12 +71,12 @@ const DEFAULT_ETHERS_PROVIDER = "https://sepolia.infura.io/v3/2781b4b5242343d5b0
|
|
|
71
71
|
* ```
|
|
72
72
|
*/
|
|
73
73
|
export const useTransactionSigner = () => {
|
|
74
|
-
const { sdk, isInitialized, isAuthenticated, user } = usePersSDK();
|
|
74
|
+
const { sdk, isInitialized, isAuthenticated, user, authProvider } = usePersSDK();
|
|
75
75
|
const [isSignerInitialized, setIsSignerInitialized] = useState(false);
|
|
76
76
|
const signerSDKRef = useRef(null);
|
|
77
77
|
// Auto-initialize signer when user is authenticated and real SDK is available
|
|
78
78
|
useEffect(() => {
|
|
79
|
-
if (isInitialized && isAuthenticated && user && !isSignerInitialized && sdk) {
|
|
79
|
+
if (isInitialized && isAuthenticated && user && !isSignerInitialized && sdk && authProvider) {
|
|
80
80
|
console.log('[useTransactionSigner] Auto-initializing PERS transaction signer...');
|
|
81
81
|
// Get configuration from the PERS SDK
|
|
82
82
|
const sdkConfig = sdk.config || {};
|
|
@@ -92,7 +92,7 @@ export const useTransactionSigner = () => {
|
|
|
92
92
|
console.error('[useTransactionSigner] Auto-initialization failed:', error);
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
}, [isInitialized, isAuthenticated, user, isSignerInitialized, sdk]);
|
|
95
|
+
}, [isInitialized, isAuthenticated, user, isSignerInitialized, sdk, authProvider]);
|
|
96
96
|
/**
|
|
97
97
|
* Initialize the blockchain signer with configuration
|
|
98
98
|
*
|
|
@@ -194,8 +194,7 @@ export const useTransactionSigner = () => {
|
|
|
194
194
|
email: currentUser.email || jwtUserInfo.email,
|
|
195
195
|
id: currentUser.id || jwtUserInfo.userId
|
|
196
196
|
};
|
|
197
|
-
// Get PERS access token from the
|
|
198
|
-
const authProvider = sdk.authProvider || sdk._authProvider;
|
|
197
|
+
// Get PERS access token from the auth provider
|
|
199
198
|
console.log('[useTransactionSigner] Auth provider found:', !!authProvider);
|
|
200
199
|
const persAccessToken = authProvider ? await authProvider.getToken() : '';
|
|
201
200
|
console.log('[useTransactionSigner] PERS access token extracted:', persAccessToken ? 'Token found' : 'No token');
|
|
@@ -203,7 +202,7 @@ export const useTransactionSigner = () => {
|
|
|
203
202
|
console.log('[useTransactionSigner] Authenticating user with signer:', signerUserInfo.identifier);
|
|
204
203
|
const signerUser = await signerSDKRef.current.authenticateUser({
|
|
205
204
|
...signerUserInfo,
|
|
206
|
-
persAccessToken: persAccessToken
|
|
205
|
+
persAccessToken: persAccessToken || undefined
|
|
207
206
|
});
|
|
208
207
|
// Sign the PERS transaction using JWT
|
|
209
208
|
console.log('[useTransactionSigner] Signing PERS transaction with JWT containing transaction data');
|
package/dist/index.js
CHANGED
|
@@ -30313,12 +30313,12 @@ const DEFAULT_ETHERS_PROVIDER = "https://sepolia.infura.io/v3/2781b4b5242343d5b0
|
|
|
30313
30313
|
* ```
|
|
30314
30314
|
*/
|
|
30315
30315
|
const useTransactionSigner = () => {
|
|
30316
|
-
const { sdk, isInitialized, isAuthenticated, user } = usePersSDK();
|
|
30316
|
+
const { sdk, isInitialized, isAuthenticated, user, authProvider } = usePersSDK();
|
|
30317
30317
|
const [isSignerInitialized, setIsSignerInitialized] = react.useState(false);
|
|
30318
30318
|
const signerSDKRef = react.useRef(null);
|
|
30319
30319
|
// Auto-initialize signer when user is authenticated and real SDK is available
|
|
30320
30320
|
react.useEffect(() => {
|
|
30321
|
-
if (isInitialized && isAuthenticated && user && !isSignerInitialized && sdk) {
|
|
30321
|
+
if (isInitialized && isAuthenticated && user && !isSignerInitialized && sdk && authProvider) {
|
|
30322
30322
|
console.log('[useTransactionSigner] Auto-initializing PERS transaction signer...');
|
|
30323
30323
|
// Get configuration from the PERS SDK
|
|
30324
30324
|
const sdkConfig = sdk.config || {};
|
|
@@ -30334,7 +30334,7 @@ const useTransactionSigner = () => {
|
|
|
30334
30334
|
console.error('[useTransactionSigner] Auto-initialization failed:', error);
|
|
30335
30335
|
});
|
|
30336
30336
|
}
|
|
30337
|
-
}, [isInitialized, isAuthenticated, user, isSignerInitialized, sdk]);
|
|
30337
|
+
}, [isInitialized, isAuthenticated, user, isSignerInitialized, sdk, authProvider]);
|
|
30338
30338
|
/**
|
|
30339
30339
|
* Initialize the blockchain signer with configuration
|
|
30340
30340
|
*
|
|
@@ -30436,8 +30436,7 @@ const useTransactionSigner = () => {
|
|
|
30436
30436
|
email: currentUser.email || jwtUserInfo.email,
|
|
30437
30437
|
id: currentUser.id || jwtUserInfo.userId
|
|
30438
30438
|
};
|
|
30439
|
-
// Get PERS access token from the
|
|
30440
|
-
const authProvider = sdk.authProvider || sdk._authProvider;
|
|
30439
|
+
// Get PERS access token from the auth provider
|
|
30441
30440
|
console.log('[useTransactionSigner] Auth provider found:', !!authProvider);
|
|
30442
30441
|
const persAccessToken = authProvider ? await authProvider.getToken() : '';
|
|
30443
30442
|
console.log('[useTransactionSigner] PERS access token extracted:', persAccessToken ? 'Token found' : 'No token');
|
|
@@ -30445,7 +30444,7 @@ const useTransactionSigner = () => {
|
|
|
30445
30444
|
console.log('[useTransactionSigner] Authenticating user with signer:', signerUserInfo.identifier);
|
|
30446
30445
|
const signerUser = await signerSDKRef.current.authenticateUser({
|
|
30447
30446
|
...signerUserInfo,
|
|
30448
|
-
persAccessToken: persAccessToken
|
|
30447
|
+
persAccessToken: persAccessToken || undefined
|
|
30449
30448
|
});
|
|
30450
30449
|
// Sign the PERS transaction using JWT
|
|
30451
30450
|
console.log('[useTransactionSigner] Signing PERS transaction with JWT containing transaction data');
|