Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! wip
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonlesisz committed Aug 19, 2024
1 parent 3556f78 commit b621c58
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions packages/connect/test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ const initDebugLink = async () => {
}
};

const debugLinkState = async () => {
const enumerate = await debugTransport.enumerate().promise;
console.warn('DebugLinkGetState enumerate', enumerate);
if (!enumerate.success) {
return;
}
const acquire = await debugTransport.acquire({ input: enumerate.payload[0] }).promise;

await debugTransport
.call({ name: 'DebugLinkGetState', data: {}, session: acquire.payload })
.promise.then(res => {
console.warn('DebugLinkGetState result ', res);

return res;
});

await debugTransport.release(enumerate.payload[0]).promise;
await debugTransport.enumerate().promise;
};

const debugLinkDecision = async () => {
const enumerate = await debugTransport.enumerate().promise;
console.warn('debugLinkDecision enumerate', enumerate);
Expand Down Expand Up @@ -129,16 +149,17 @@ const run = async () => {
}

if (event.type === 'ui-request_thp_pairing') {
const state = await debugLinkState();
// TODO: TrezorConnect.cancel();
// await new Promise(resolve => setTimeout(resolve, 2000));
// TrezorConnect.cancel();
TrezorConnect.uiResponse({
type: 'ui-receive_thp_pairing_tag',
payload: {
source: 'code-entry',
value: '000000', // get from debuglink
},
});
// TrezorConnect.uiResponse({
// type: 'ui-receive_thp_pairing_tag',
// payload: {
// source: 'code-entry',
// value: '000000', // get from debuglink
// },
// });
}

if (event.type === 'ui-button') {
Expand Down

0 comments on commit b621c58

Please sign in to comment.