-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stencil webcomponents from sdk-dapp-core-ui (#37)
- Loading branch information
1 parent
fbd76e9
commit 7f8ed37
Showing
23 changed files
with
1,841 additions
and
2,372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { LedgerConnectModal } from '@multiversx/sdk-dapp-core-ui/dist/components/ledger-connect-modal'; | ||
import { defineCustomElements } from '@multiversx/sdk-dapp-core-ui/loader'; | ||
import { safeWindow } from 'constants/index'; | ||
import { | ||
IProviderConfig, | ||
ProviderTypeEnum | ||
} from '../types/providerFactory.types'; | ||
|
||
export const getConfig = async (config: IProviderConfig = {}) => { | ||
if (!safeWindow.document) { | ||
return config; | ||
} | ||
|
||
defineCustomElements(safeWindow); | ||
const ledgerModalElement = document.createElement( | ||
'ledger-connect-modal' | ||
) as LedgerConnectModal; | ||
document.body.appendChild(ledgerModalElement); | ||
await customElements.whenDefined('ledger-connect-modal'); | ||
const eventBus = await ledgerModalElement.getEventBus(); | ||
|
||
const ui = { | ||
[ProviderTypeEnum.ledger]: { | ||
eventBus, | ||
mount: () => { | ||
document.body.appendChild(ledgerModalElement); | ||
} | ||
} | ||
}; | ||
|
||
return { | ||
...config, | ||
ui: { | ||
...ui, | ||
...config.ui | ||
} | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.