@lumiapassport/ui-kit 1.2.0 → 1.3.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 +26 -4
- package/dist/iframe/main.js +1282 -2
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +913 -703
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +974 -764
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -261,7 +261,7 @@ function BackendSubmissionExample() {
|
|
|
261
261
|
**Backend example (using @lumiapassport/core):**
|
|
262
262
|
|
|
263
263
|
```typescript
|
|
264
|
-
import { sendUserOperationRaw } from '@lumiapassport/core';
|
|
264
|
+
import { sendUserOperationRaw, getUserOperationReceipt } from '@lumiapassport/core';
|
|
265
265
|
import { recoverAddress } from 'viem';
|
|
266
266
|
|
|
267
267
|
// Receive from frontend
|
|
@@ -277,9 +277,31 @@ if (recoveredAddress.toLowerCase() !== ownerAddress.toLowerCase()) {
|
|
|
277
277
|
throw new Error('Invalid signature');
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
// Submit to bundler
|
|
281
|
-
const
|
|
282
|
-
|
|
280
|
+
// Submit to bundler - returns userOpHash
|
|
281
|
+
const submittedUserOpHash = await sendUserOperationRaw(userOp);
|
|
282
|
+
|
|
283
|
+
// Poll for receipt to get transaction hash and status
|
|
284
|
+
const waitForReceipt = async (userOpHash: string, maxAttempts = 60, delayMs = 1000) => {
|
|
285
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
286
|
+
const receipt = await getUserOperationReceipt(userOpHash as `0x${string}`);
|
|
287
|
+
if (receipt) {
|
|
288
|
+
return {
|
|
289
|
+
success: receipt.success,
|
|
290
|
+
transactionHash: receipt.receipt?.transactionHash,
|
|
291
|
+
blockNumber: receipt.receipt?.blockNumber,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
await new Promise(resolve => setTimeout(resolve, delayMs));
|
|
295
|
+
}
|
|
296
|
+
throw new Error('Transaction timeout');
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const result = await waitForReceipt(submittedUserOpHash);
|
|
300
|
+
return {
|
|
301
|
+
success: result.success,
|
|
302
|
+
transactionHash: result.transactionHash,
|
|
303
|
+
blockNumber: result.blockNumber
|
|
304
|
+
};
|
|
283
305
|
```
|
|
284
306
|
|
|
285
307
|
## Components
|