@explorins/pers-sdk-react-native 2.3.6 → 2.3.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.
- package/dist/hooks/useTransactions.d.ts.map +1 -1
- package/dist/hooks/useTransactions.js +13 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useTransactions.ts +15 -6
- package/src/index.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@explorins/pers-sdk-react-native",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"description": "React Native SDK for PERS Platform - Tourism Loyalty System with Blockchain Transaction Signing and WebAuthn Authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
TransactionIncludeRelation
|
|
11
11
|
} from '@explorins/pers-sdk';
|
|
12
12
|
import type { TransactionQueryOptions } from '@explorins/pers-sdk/transaction';
|
|
13
|
+
import { needsSubmission } from '@explorins/pers-sdk/transaction';
|
|
13
14
|
|
|
14
15
|
// Re-export for consumers
|
|
15
16
|
export type { TransactionQueryOptions } from '@explorins/pers-sdk/transaction';
|
|
@@ -89,18 +90,26 @@ export const useTransactions = () => {
|
|
|
89
90
|
|
|
90
91
|
try {
|
|
91
92
|
const result = await sdk.transactions.createTransaction(request);
|
|
93
|
+
|
|
94
|
+
// If backend already signed custodially, return as-is so caller can build QR
|
|
95
|
+
// from result.signatureData directly (no client signing needed)
|
|
96
|
+
if (needsSubmission(result)) {
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// If client signer is unavailable, return as-is so caller can fall back to
|
|
101
|
+
// result.actionable.actionUrl (external signing URL) if present
|
|
102
|
+
if (!isSignerAvailable) {
|
|
103
|
+
console.warn('[useTransactions] Transaction signer not available, returning result for caller to handle');
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
92
106
|
|
|
93
|
-
// Check if transaction requires signing (contains actionable authToken)
|
|
107
|
+
// Check if transaction requires client signing (contains actionable authToken)
|
|
94
108
|
// Type assertion needed as TransactionRequestResponseDTO type may not include all dynamic properties
|
|
95
109
|
const txToken = result?.actionable?.authToken;
|
|
96
110
|
if (txToken) {
|
|
97
111
|
|
|
98
112
|
try {
|
|
99
|
-
if (!isSignerAvailable) {
|
|
100
|
-
console.warn('[useTransactions] Transaction signer not available, skipping automatic signing');
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
113
|
// Automatically sign the transaction using the authToken
|
|
105
114
|
const signingResult = await signAndSubmitTransactionWithJWT(txToken, onStatusUpdate);
|
|
106
115
|
|
package/src/index.ts
CHANGED
|
@@ -473,7 +473,10 @@ export {
|
|
|
473
473
|
buildSubmissionRequest,
|
|
474
474
|
ClientTransactionType,
|
|
475
475
|
extractDeadlineFromSigningData,
|
|
476
|
-
buildPendingTransactionData
|
|
476
|
+
buildPendingTransactionData,
|
|
477
|
+
needsSubmission,
|
|
478
|
+
needsExternalSigning,
|
|
479
|
+
getSigningUrl
|
|
477
480
|
} from '@explorins/pers-sdk/transaction';
|
|
478
481
|
|
|
479
482
|
export type { POSAuthorizationOptions, PendingTransactionParams } from '@explorins/pers-sdk/transaction';
|