prividium 0.10.0 → 0.10.1
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/README.md +3 -3
- package/dist/sdk/siwe-chain.js +10 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,7 +164,7 @@ const request = await walletClient.prepareTransactionRequest({
|
|
|
164
164
|
// Authorize transaction
|
|
165
165
|
await prividium.authorizeTransaction({
|
|
166
166
|
walletAddress: address,
|
|
167
|
-
|
|
167
|
+
toAddress: greeterContract,
|
|
168
168
|
nonce: Number(request.nonce),
|
|
169
169
|
calldata: request.data,
|
|
170
170
|
value: request.value
|
|
@@ -190,7 +190,7 @@ page at the `redirectUrl` you configured:
|
|
|
190
190
|
<head>
|
|
191
191
|
<title>Authentication Callback</title>
|
|
192
192
|
<script type="module">
|
|
193
|
-
import { handleAuthCallback } from '
|
|
193
|
+
import { handleAuthCallback } from 'prividium';
|
|
194
194
|
|
|
195
195
|
// Handle the callback - this will post the token back to the parent window
|
|
196
196
|
handleAuthCallback((error) => {
|
|
@@ -324,7 +324,7 @@ Handles the OAuth callback on the redirect page. Call this function from your ca
|
|
|
324
324
|
authentication flow.
|
|
325
325
|
|
|
326
326
|
```typescript
|
|
327
|
-
import { handleAuthCallback } from '
|
|
327
|
+
import { handleAuthCallback } from 'prividium';
|
|
328
328
|
|
|
329
329
|
handleAuthCallback((error) => {
|
|
330
330
|
// Optional: Handle errors (e.g., display error message to user)
|
package/dist/sdk/siwe-chain.js
CHANGED
|
@@ -118,13 +118,17 @@ export function createPrividiumSiweChain(config) {
|
|
|
118
118
|
headers: getAuthHeaders() || {}
|
|
119
119
|
},
|
|
120
120
|
onFetchRequest(_request, init) {
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
// Don't throw on expired token — let the request go through
|
|
122
|
+
// so onFetchResponse can handle the 401 and trigger reauthentication.
|
|
123
|
+
// Throwing here creates a deadlock: no request is sent, so onFetchResponse
|
|
124
|
+
// (which is the only reauth trigger for RPC calls) never fires.
|
|
125
|
+
const authHeaders = getAuthHeaders();
|
|
126
|
+
if (authHeaders) {
|
|
127
|
+
init.headers = {
|
|
128
|
+
...init.headers,
|
|
129
|
+
...authHeaders
|
|
130
|
+
};
|
|
123
131
|
}
|
|
124
|
-
init.headers = {
|
|
125
|
-
...init.headers,
|
|
126
|
-
...getAuthHeaders()
|
|
127
|
-
};
|
|
128
132
|
},
|
|
129
133
|
onFetchResponse: async (response) => {
|
|
130
134
|
if (await hasPrividiumUnauthorizedError(response)) {
|