Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: react #815

Draft
wants to merge 59 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3cd7230
feat: init react
IsaccoSordo Sep 5, 2024
3aede90
fix: info styles
IsaccoSordo Sep 5, 2024
5b7b405
feat: add info alert
IsaccoSordo Sep 5, 2024
d0a3c41
fix: render
IsaccoSordo Sep 6, 2024
4d844ce
feat: add useConnect
IsaccoSordo Sep 6, 2024
667a1b2
feat: init useConnect
IsaccoSordo Sep 9, 2024
a86e906
feat: use useConnect
IsaccoSordo Sep 9, 2024
3fd930d
fix: removed unnecessary async
IsaccoSordo Sep 9, 2024
220d73a
fix: onClose
IsaccoSordo Sep 9, 2024
c022318
chore: removed css files
IsaccoSordo Sep 9, 2024
1df7e38
feat: init mui
IsaccoSordo Sep 9, 2024
816fcd1
fix: render
IsaccoSordo Sep 9, 2024
ddd0ece
fix: styling
IsaccoSordo Sep 9, 2024
3cdf412
fix: display full list
IsaccoSordo Sep 10, 2024
1af8324
fix: showMore
IsaccoSordo Sep 10, 2024
f1ef712
fix: removed content in favor of children
IsaccoSordo Sep 10, 2024
ed898cf
chore: rename
IsaccoSordo Sep 10, 2024
86f7b23
fix: conversion issue
IsaccoSordo Sep 10, 2024
defeba3
fix: add all logic back
IsaccoSordo Sep 11, 2024
ad1331f
fix: heder style
IsaccoSordo Sep 11, 2024
d7e20ba
fix: styling
IsaccoSordo Sep 11, 2024
dda0c46
fix: button size
IsaccoSordo Sep 11, 2024
3df7420
fix: style
IsaccoSordo Sep 11, 2024
945b03a
fix: styling
IsaccoSordo Sep 11, 2024
22779d7
fix: useWallets
IsaccoSordo Sep 11, 2024
811fd76
fix: styling
IsaccoSordo Sep 11, 2024
902ebc8
fix: positioning
IsaccoSordo Sep 12, 2024
371889c
fix: merge
IsaccoSordo Nov 29, 2024
114d24b
fix: unnecessary hooks
IsaccoSordo Jan 7, 2025
011e457
fix: style
IsaccoSordo Jan 7, 2025
0cfc29f
fix: styles
IsaccoSordo Jan 7, 2025
2aea7e3
feat: bug-report form mui converstion
IsaccoSordo Jan 7, 2025
1894872
feat: pair-other mui migration
IsaccoSordo Jan 9, 2025
adff46e
feat: wc error mui migration
IsaccoSordo Jan 9, 2025
b7b92fe
fix: styling
IsaccoSordo Jan 9, 2025
7811024
fix: wallets rendering
IsaccoSordo Jan 10, 2025
11a5bcf
fix: padding
IsaccoSordo Jan 10, 2025
6cf0728
fix: size
IsaccoSordo Jan 10, 2025
e888c0e
feat: completed card styles migration
IsaccoSordo Jan 10, 2025
fd142d6
Revert "chore: removed css files"
IsaccoSordo Jan 13, 2025
45b7df8
fix: css bundling
IsaccoSordo Jan 13, 2025
0321cf8
fix: revert
IsaccoSordo Jan 13, 2025
ba0e496
fix: revert
IsaccoSordo Jan 13, 2025
881c107
fix: onClose
IsaccoSordo Jan 13, 2025
c698ba7
Merge pull request #841 from airgap-it/feat/beacon_styles
IsaccoSordo Jan 13, 2025
b63c4ed
fix: background-color
IsaccoSordo Jan 13, 2025
ac347f2
chore: code cleanup
IsaccoSordo Jan 15, 2025
086df57
fix: alert animations
IsaccoSordo Jan 15, 2025
a6a4d69
feat: add toast back
IsaccoSordo Jan 14, 2025
828160d
Merge pull request #842 from airgap-it/feat/toast_migration
IsaccoSordo Jan 15, 2025
f0bea2f
feat: mount&unmount on root
IsaccoSordo Jan 16, 2025
30cad52
fix: disable loader on dragging
IsaccoSordo Jan 16, 2025
08dbc03
fix: toast animation
IsaccoSordo Jan 16, 2025
bb10002
feat: add props to toast
IsaccoSordo Jan 16, 2025
59a0431
fix: double next
IsaccoSordo Jan 16, 2025
ffb571d
fix: styles
IsaccoSordo Jan 16, 2025
6947f2a
fix: improved dragging
IsaccoSordo Jan 16, 2025
51787d4
fix: max width on desktop
IsaccoSordo Jan 16, 2025
c16de97
fix: draggable image
IsaccoSordo Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,051 changes: 314 additions & 737 deletions package-lock.json

Large diffs are not rendered by default.

124 changes: 65 additions & 59 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ export class DAppClient extends Client {
connectionInfo.origin === Origin.P2P
? this.p2pTransport
: connectionInfo.origin === Origin.WALLETCONNECT
? this.walletConnectTransport
: this.postMessageTransport ?? (await this.transport)
? this.walletConnectTransport
: this.postMessageTransport ?? (await this.transport)

if (relevantTransport) {
const peers: ExtendedPeerInfo[] = await relevantTransport.getPeers()
Expand Down Expand Up @@ -440,8 +440,8 @@ export class DAppClient extends Client {
res.status === 426
? console.error('Metrics are no longer supported for this version, please upgrade.')
: console.warn(
'Network error encountered. Metrics sharing have been automatically disabled.'
)
'Network error encountered. Metrics sharing have been automatically disabled.'
)
}
this.enableMetrics = res.ok
this.storage.set(StorageKey.ENABLE_METRICS, res.ok)
Expand Down Expand Up @@ -785,14 +785,20 @@ export class DAppClient extends Client {
console.error(error)
})

await p2pTransport.connect()

const serializer = new Serializer()
const p2pPeerInfo = await serializer.serialize(await p2pTransport.getPairingRequestInfo())
const walletConnectPeerInfo = (await walletConnectTransport.getPairingRequestInfo()).uri
const postmessagePeerInfo = await serializer.serialize(
await postMessageTransport.getPairingRequestInfo()
)

this.events
.emit(BeaconEvent.PAIR_INIT, {
p2pPeerInfo: () => {
p2pTransport.connect().then().catch(console.error)
return p2pTransport.getPairingRequestInfo()
},
postmessagePeerInfo: () => postMessageTransport.getPairingRequestInfo(),
walletConnectPeerInfo: () => walletConnectTransport.getPairingRequestInfo(),
p2pPeerInfo,
postmessagePeerInfo,
walletConnectPeerInfo,
networkType: this.network.type,
abortedHandler: async () => {
logger.log('init', 'ABORTED')
Expand All @@ -808,7 +814,7 @@ export class DAppClient extends Client {
this.postMessageTransport =
this.walletConnectTransport =
this.p2pTransport =
undefined
undefined
this._activeAccount.isResolved() && this.clearActiveAccount()
this._initPromise = undefined
},
Expand Down Expand Up @@ -1374,9 +1380,9 @@ export class DAppClient extends Client {
logger.time(true, logId)
const res = (await this.checkMakeRequest())
? this.makeRequestV3<
BlockchainRequestV3<string>,
BeaconMessageWrapper<BlockchainResponseV3<string>>
>(request)
BlockchainRequestV3<string>,
BeaconMessageWrapper<BlockchainResponseV3<string>>
>(request)
: this.makeRequestBC<any, any>(request)

res.catch(async (requestError: ErrorResponse) => {
Expand Down Expand Up @@ -1588,13 +1594,13 @@ export class DAppClient extends Client {

const res = (await this.checkMakeRequest())
? this.makeRequest<
SimulatedProofOfEventChallengeRequest,
SimulatedProofOfEventChallengeResponse
>(request)
SimulatedProofOfEventChallengeRequest,
SimulatedProofOfEventChallengeResponse
>(request)
: this.makeRequestBC<
SimulatedProofOfEventChallengeRequest,
SimulatedProofOfEventChallengeResponse
>(request)
SimulatedProofOfEventChallengeRequest,
SimulatedProofOfEventChallengeResponse
>(request)

res.catch(async (requestError: ErrorResponse) => {
requestError.errorType === BeaconErrorType.ABORTED_ERROR
Expand Down Expand Up @@ -2058,50 +2064,50 @@ export class DAppClient extends Client {
request: BeaconRequestInputMessage,
response:
| {
account: AccountInfo
output: PermissionResponseOutput
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
account: AccountInfo
output: PermissionResponseOutput
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
| {
account: AccountInfo
output: ProofOfEventChallengeResponse
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
account: AccountInfo
output: ProofOfEventChallengeResponse
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
| {
account: AccountInfo
output: SimulatedProofOfEventChallengeResponse
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
account: AccountInfo
output: SimulatedProofOfEventChallengeResponse
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
| {
account: AccountInfo
output: OperationResponseOutput
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
account: AccountInfo
output: OperationResponseOutput
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
| {
output: SignPayloadResponseOutput
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
output: SignPayloadResponseOutput
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
// | {
// output: EncryptPayloadResponseOutput
// connectionContext: ConnectionContext
// walletInfo: WalletInfo
// }
| {
network: Network
output: BroadcastResponseOutput
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
network: Network
output: BroadcastResponseOutput
blockExplorer: BlockExplorer
connectionContext: ConnectionContext
walletInfo: WalletInfo
}
): Promise<void> {
this.events
.emit(messageEvents[request.type].success, response)
Expand Down Expand Up @@ -2342,7 +2348,7 @@ export class DAppClient extends Client {

logger.log('makeRequest', 'sending message', request)
try {
; (await this.transport).send(payload, peer)
;(await this.transport).send(payload, peer)
if (
request.type !== BeaconMessageType.PermissionRequest ||
(this._activeAccount.isResolved() && (await this._activeAccount.promise))
Expand Down Expand Up @@ -2458,7 +2464,7 @@ export class DAppClient extends Client {

logger.log('makeRequest', 'sending message', request)
try {
; (await this.transport).send(payload, peer)
;(await this.transport).send(payload, peer)
if (
request.message.type !== BeaconMessageType.PermissionRequest ||
(this._activeAccount.isResolved() && (await this._activeAccount.promise))
Expand Down Expand Up @@ -2505,9 +2511,9 @@ export class DAppClient extends Client {
request: Optional<T, IgnoredRequestInputProperties>
): Promise<
| {
message: U
connectionInfo: ConnectionContext
}
message: U
connectionInfo: ConnectionContext
}
| undefined
> {
if (!this._transport.isResolved()) {
Expand Down
Loading
Loading