diff --git a/examples/simple-dapp/src/main.ts b/examples/simple-dapp/src/main.ts index 60c191b7..c5081059 100644 --- a/examples/simple-dapp/src/main.ts +++ b/examples/simple-dapp/src/main.ts @@ -28,7 +28,12 @@ content.innerHTML = ` -
+
+ +
+
+ +

   

@@ -49,6 +54,9 @@ const state = document.getElementById('state')!
 const gatewayConfig = document.getElementById('gatewayConfig')!
 const gatewayStatus = document.getElementById('gatewayStatus')!
 const oneTimeRequest = document.getElementById('one-time-request')!
+const proofOfOwnershipRequest = document.getElementById(
+  'proof-of-ownership-request',
+)!
 
 const logger = Logger()
 
@@ -128,6 +136,29 @@ oneTimeRequest.onclick = () => {
   )
 }
 
+proofOfOwnershipRequest.onclick = async () => {
+  const connectedAccounts =
+    dAppToolkit.walletApi.getWalletData()?.accounts ?? []
+  const connectedPersona = dAppToolkit.walletApi.getWalletData()?.persona
+
+  if (connectedAccounts.length === 0 || !connectedPersona) {
+    alert('No connected account or persona')
+    return
+  }
+
+  const result = await dAppToolkit.walletApi
+    .sendOneTimeRequest(
+      OneTimeDataRequestBuilder.accounts().exactly(1),
+      OneTimeDataRequestBuilder.proofOfOwnership()
+        .accounts(connectedAccounts.map((account) => account.address))
+        .identity(connectedPersona.identityAddress),
+    )
+    .map(() => 'success')
+    .unwrapOr('error')
+
+  alert(result)
+}
+
 setInterval(() => {
   requestsStore.getState().map((value: any) => {
     requests.innerHTML = JSON.stringify({ requests: value ?? {} }, null, 2)
diff --git a/packages/dapp-toolkit/src/modules/wallet-request/request-resolver/resolvers/data-response.ts b/packages/dapp-toolkit/src/modules/wallet-request/request-resolver/resolvers/data-response.ts
index 72c569c7..724d24b4 100644
--- a/packages/dapp-toolkit/src/modules/wallet-request/request-resolver/resolvers/data-response.ts
+++ b/packages/dapp-toolkit/src/modules/wallet-request/request-resolver/resolvers/data-response.ts
@@ -59,17 +59,19 @@ const handleAuthorizedRequestResponse = ({
   stateModule
     .getState()
     .andThen((state) =>
-      stateModule.setState({
-        loggedInTimestamp:
-          requestItem.type === 'loginRequest'
-            ? Date.now().toString()
-            : state!.loggedInTimestamp,
-        walletData,
-        sharedData: transformWalletRequestToSharedData(
-          walletInteraction,
-          state!.sharedData,
-        ),
-      }),
+      stateModule
+        .setState({
+          loggedInTimestamp:
+            requestItem.type === 'loginRequest'
+              ? Date.now().toString()
+              : state!.loggedInTimestamp,
+          walletData,
+          sharedData: transformWalletRequestToSharedData(
+            walletInteraction,
+            state!.sharedData,
+          ),
+        })
+        .andTee(() => stateModule.emitWalletData()),
     )
     .orElse(() =>
       err(SdkError('FailedToUpdateRdtState', walletInteraction.interactionId)),