@explorins/pers-sdk-react-native 1.5.4 → 1.5.6

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;IAiK7B;;OAEG;2BAtE2C,MAAM,KAAG,QAAQ,wBAAwB,CAAC;IAyExF;;OAEG;gCA9HgD;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;IA6HC;;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"}
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;IAuL7B;;OAEG;2BAxE2C,MAAM,KAAG,QAAQ,wBAAwB,CAAC;IA2ExF;;OAEG;gCAlJgD;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B;IAiJC;;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"}
@@ -80,7 +80,9 @@ export const useTransactionSigner = () => {
80
80
  console.log('[useTransactionSigner] Auto-initializing PERS transaction signer...');
81
81
  // Get configuration from the PERS SDK
82
82
  const sdkConfig = sdk.config || {};
83
+ console.log('[useTransactionSigner] SDK config:', sdkConfig);
83
84
  const apiProjectKey = sdkConfig.apiProjectKey || 'demo-project-key';
85
+ console.log('[useTransactionSigner] Extracted API project key:', apiProjectKey);
84
86
  const tenantId = sdkConfig.tenantId || 'vq-demo';
85
87
  initializeSigner({
86
88
  tenantId: tenantId,
@@ -114,10 +116,27 @@ export const useTransactionSigner = () => {
114
116
  }
115
117
  try {
116
118
  console.log('[useTransactionSigner] Initializing PERS transaction signer...');
117
- // TODO: accept direct project key in signer sdk
119
+ // Configure the PERS service with the project key before creating SDK
120
+ if (config?.projectKey) {
121
+ console.log('[useTransactionSigner] Configuring PERS service with project key:', config.projectKey);
122
+ try {
123
+ // Import and configure the PERS service
124
+ const { PersService } = await import('@explorins/pers-signer/react-native');
125
+ console.log('[useTransactionSigner] PersService imported successfully');
126
+ PersService.configure({
127
+ projectKey: config.projectKey
128
+ });
129
+ console.log('[useTransactionSigner] PERS service configured with project key');
130
+ // Verify configuration
131
+ const persConfig = PersService.getConfig();
132
+ console.log('[useTransactionSigner] PERS service config after configuration:', persConfig);
133
+ }
134
+ catch (configError) {
135
+ console.error('[useTransactionSigner] Failed to configure PERS service:', configError);
136
+ }
137
+ }
118
138
  const signerSDK = await createPersSignerSDK({
119
139
  tenantId: config?.tenantId,
120
- // projectKey: config?.projectKey,
121
140
  ethersProviderUrl: config?.ethersProviderUrl || DEFAULT_ETHERS_PROVIDER
122
141
  });
123
142
  signerSDKRef.current = signerSDK;
@@ -177,7 +196,9 @@ export const useTransactionSigner = () => {
177
196
  };
178
197
  // Get PERS access token from the main SDK
179
198
  const authProvider = sdk.authProvider || sdk._authProvider;
199
+ console.log('[useTransactionSigner] Auth provider found:', !!authProvider);
180
200
  const persAccessToken = authProvider ? await authProvider.getToken() : '';
201
+ console.log('[useTransactionSigner] PERS access token extracted:', persAccessToken ? 'Token found' : 'No token');
181
202
  // Authenticate user with blockchain signer and pass PERS token
182
203
  console.log('[useTransactionSigner] Authenticating user with signer:', signerUserInfo.identifier);
183
204
  const signerUser = await signerSDKRef.current.authenticateUser({
package/dist/index.js CHANGED
@@ -30322,7 +30322,9 @@ const useTransactionSigner = () => {
30322
30322
  console.log('[useTransactionSigner] Auto-initializing PERS transaction signer...');
30323
30323
  // Get configuration from the PERS SDK
30324
30324
  const sdkConfig = sdk.config || {};
30325
+ console.log('[useTransactionSigner] SDK config:', sdkConfig);
30325
30326
  const apiProjectKey = sdkConfig.apiProjectKey || 'demo-project-key';
30327
+ console.log('[useTransactionSigner] Extracted API project key:', apiProjectKey);
30326
30328
  const tenantId = sdkConfig.tenantId || 'vq-demo';
30327
30329
  initializeSigner({
30328
30330
  tenantId: tenantId,
@@ -30356,10 +30358,27 @@ const useTransactionSigner = () => {
30356
30358
  }
30357
30359
  try {
30358
30360
  console.log('[useTransactionSigner] Initializing PERS transaction signer...');
30359
- // TODO: accept direct project key in signer sdk
30361
+ // Configure the PERS service with the project key before creating SDK
30362
+ if (config?.projectKey) {
30363
+ console.log('[useTransactionSigner] Configuring PERS service with project key:', config.projectKey);
30364
+ try {
30365
+ // Import and configure the PERS service
30366
+ const { PersService } = await Promise.resolve().then(function () { return require('./react-native.esm-BtyCg4n1.js'); });
30367
+ console.log('[useTransactionSigner] PersService imported successfully');
30368
+ PersService.configure({
30369
+ projectKey: config.projectKey
30370
+ });
30371
+ console.log('[useTransactionSigner] PERS service configured with project key');
30372
+ // Verify configuration
30373
+ const persConfig = PersService.getConfig();
30374
+ console.log('[useTransactionSigner] PERS service config after configuration:', persConfig);
30375
+ }
30376
+ catch (configError) {
30377
+ console.error('[useTransactionSigner] Failed to configure PERS service:', configError);
30378
+ }
30379
+ }
30360
30380
  const signerSDK = await createPersSignerSDK({
30361
30381
  tenantId: config?.tenantId,
30362
- // projectKey: config?.projectKey,
30363
30382
  ethersProviderUrl: config?.ethersProviderUrl || DEFAULT_ETHERS_PROVIDER
30364
30383
  });
30365
30384
  signerSDKRef.current = signerSDK;
@@ -30419,7 +30438,9 @@ const useTransactionSigner = () => {
30419
30438
  };
30420
30439
  // Get PERS access token from the main SDK
30421
30440
  const authProvider = sdk.authProvider || sdk._authProvider;
30441
+ console.log('[useTransactionSigner] Auth provider found:', !!authProvider);
30422
30442
  const persAccessToken = authProvider ? await authProvider.getToken() : '';
30443
+ console.log('[useTransactionSigner] PERS access token extracted:', persAccessToken ? 'Token found' : 'No token');
30423
30444
  // Authenticate user with blockchain signer and pass PERS token
30424
30445
  console.log('[useTransactionSigner] Authenticating user with signer:', signerUserInfo.identifier);
30425
30446
  const signerUser = await signerSDKRef.current.authenticateUser({