Developer Questions
Can't set up xApp
almost 2 years ago by Jake
Hi. I'm trying to set up xApp on a Typescript project but to no avail.
Package version: "xumm-xapp-sdk": "1.5.1"
Code sample:
export const useLoginPrompt = (uuid: string | undefined): void => {
// Initialized xapp client, basically `xapp = new xApp()`
const { xapp } = useXappClient();
useEffect(() => {
if (uuid) {
xapp
.openSignRequest({ uuid })
?.then((d) => {
console.log(
'openSignRequest response:',
d instanceof Error ? d.message : d
);
})
// eslint-disable-next-line no-console
.catch((e) => console.log('Error:', e.message));
xapp.on('payload', (response) => {
if (response.reason === 'DECLINED') {
// Declined handlers…
}
if (response.reason === 'SIGNED') {
// Signed handlers…
}
});
}
}, [xapp, uuid]);
};
My questions:
- Why doesn't
openSignRequest()
open sign request prompt? - Why do I receive
could not contact Xumm App Host
? - Why at the beginning of the log I see "Doc not alive >= 1 sec, stalling for 0.401"?
Debugger log:
Log:
(readystatechange: [ complete ])
Log:
Doc Ready...
Log:
Doc not alive >= 1 sec, stalling for 0.401
Log:
documentReadyPromise resolved
Log:
["xAppActionAttempt Attempt 0 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 1 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 2 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 3 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 4 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 5 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 6 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Attempt 7 » Retry","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["xAppActionAttempt Failed after attempt 8","openSignRequest",{"uuid":"my-uuid-string"}]
Log:
["XAPP openSignRequest response:","xApp.openSignRequest: could not contact Xumm App Host"]