Skip to content

Commit

Permalink
debug(paywall, unlock-app): adding more debugging for Paywall (#15287)
Browse files Browse the repository at this point in the history
* fixing siwe auth

* when closing the modal, reset account

* debug(paywall): adding Postmate.debug
  • Loading branch information
julien51 committed Dec 23, 2024
1 parent 88a7c5e commit d3f9ac4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/paywall/src/Paywall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { unlockAppUrl } from './urls'

export const checkoutIframeClassName = 'unlock-protocol-checkout'

Postmate.debug = true

// TODO move to newer format for provider
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#request

Expand Down
8 changes: 6 additions & 2 deletions unlock-app/src/components/interface/checkout/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function Checkout({
paywallConfig,
},
})
const { account } = useAuthenticate()
const { account, signOut } = useAuthenticate()

const { mint, messageToSign } = state.context
const matched = state.value.toString()
Expand Down Expand Up @@ -84,7 +84,7 @@ export function Checkout({
const messageToSignSigner = messageToSign?.address

const onClose = useCallback(
(params: Record<string, string> = {}) => {
async (params: Record<string, string> = {}) => {
// Reset the Paywall State!
checkoutService.send({ type: 'RESET_CHECKOUT' })
if (handleClose) {
Expand Down Expand Up @@ -113,6 +113,10 @@ export function Checkout({
} else if (!isInIframe() || !communication) {
window.history.back()
} else {
if (paywallConfig?.useDelegatedProvider) {
signOut()
checkoutService.send({ type: 'DISCONNECT' })
}
communication.emitCloseModal()
}
},
Expand Down
2 changes: 2 additions & 0 deletions unlock-app/src/hooks/usePostmateParent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useState, useEffect } from 'react'
import Postmate from 'postmate'

Postmate.debug = true

export const usePostmateParent = (model: any = {}) => {
const [parent, setParent] = useState<Postmate.ChildAPI | undefined>(undefined)

Expand Down

0 comments on commit d3f9ac4

Please sign in to comment.