Skip to content

Commit

Permalink
Merge pull request #399 from blocto/feat/passing-urlparams-to-iframe
Browse files Browse the repository at this point in the history
feat: passing urlParams to iframe
  • Loading branch information
q20274982 authored Mar 12, 2024
2 parents 6f1af32 + bd6b11c commit 426f4a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/early-eels-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blocto/sdk': minor
---

passing dApp's urlParams to login & authz Iframe
11 changes: 10 additions & 1 deletion packages/blocto-sdk/src/providers/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ export default class EthereumProvider
const params = new URLSearchParams();
params.set('l6n', window.location.origin);
params.set('v', SDK_VERSION);
params.set('q', `${window.location.pathname}${window.location.search}`);
const emailParam = email && isEmail(email) ? `/${email}` : '';
const loginFrame = await this.setIframe(
`/authn${emailParam}?${params.toString()}`
Expand Down Expand Up @@ -994,7 +995,15 @@ export default class EthereumProvider
method: 'POST',
body: JSON.stringify([params, revert]),
});
const authzFrame = await this.setIframe(`/authz/${authorizationId}`);
const iframeParams = new URLSearchParams();
iframeParams.set('l6n', window.location.origin);
iframeParams.set(
'q',
`${window.location.pathname}${window.location.search}`
);
const authzFrame = await this.setIframe(
`/authz/${authorizationId}?${iframeParams.toString()}`
);
return this.responseListener(authzFrame, 'txHash');
}

Expand Down

0 comments on commit 426f4a0

Please sign in to comment.