-
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.
- Loading branch information
1 parent
740cff6
commit a6f08d8
Showing
7 changed files
with
75 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,10 @@ | |
"url": "git+https://github.com/multiversx/mx-sdk-dapp-core.git" | ||
}, | ||
"scripts": { | ||
"unpublish-verdaccio": "npm unpublish @multiversx/[email protected] --registry http://localhost:4873", | ||
"publish-verdaccio": "npm run unpublish-verdaccio && npm run compile && npm publish --registry http://localhost:4873/", | ||
"compile": "tsc && tsc-alias", | ||
"build-esbuild": "rimraf out && node esbuild.js", | ||
"publish-verdaccio": "npm unpublish --registry http://localhost:4873 @multiversx/[email protected] && rimraf out && yarn compile && npm publish --registry http://localhost:4873", | ||
"build": "yarn build-esbuild && yarn compile", | ||
"test": "jest", | ||
"compile-next": "rimraf out && tsc --p tsconfig.next.json && tsc-alias --project tsconfig.next.json" | ||
|
@@ -38,6 +39,7 @@ | |
"@multiversx/sdk-opera-provider": "1.0.0-alpha.1", | ||
"@multiversx/sdk-wallet": "4.5.1", | ||
"@multiversx/sdk-wallet-connect-provider": "4.1.2", | ||
"@multiversx/sdk-web-wallet-iframe-provider": "2.0.0", | ||
"@multiversx/sdk-web-wallet-provider": "3.2.1", | ||
"isomorphic-fetch": "3.0.0", | ||
"lodash": "4.17.21", | ||
|
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
21 changes: 21 additions & 0 deletions
21
src/core/providers/helpers/crossWindow/createCrossWindowProvider.ts
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,21 @@ | ||
import { isBrowserWithPopupConfirmation } from 'constants/browser.constants'; | ||
import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider'; | ||
|
||
export async function createCrossWindowProvider({ | ||
address, | ||
walletAddress | ||
}: { | ||
address: string; | ||
walletAddress: string; | ||
}) { | ||
const provider = CrossWindowProvider.getInstance(); | ||
await provider.init(); | ||
provider.setWalletUrl(String(walletAddress)); | ||
provider.setAddress(address); | ||
|
||
if (isBrowserWithPopupConfirmation) { | ||
provider.setShouldShowConsentPopup(true); | ||
} | ||
|
||
return provider; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/core/providers/helpers/extension/createExtensionProvider.ts
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,7 @@ | ||
import { ExtensionProvider } from '@multiversx/sdk-extension-provider/out/extensionProvider'; | ||
|
||
export async function createExtensionProvider() { | ||
const provider = ExtensionProvider.getInstance(); | ||
await provider.init(); | ||
return provider; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/core/providers/helpers/iframe/createMetamaskProvider.ts
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,18 @@ | ||
import { IframeProvider } from '@multiversx/sdk-web-wallet-iframe-provider/out'; | ||
import { IframeLoginTypes } from '@multiversx/sdk-web-wallet-iframe-provider/out/constants'; | ||
import { networkSelector } from 'store/selectors'; | ||
import { getState } from 'store/store'; | ||
|
||
export async function createMetamaskProvider( | ||
customMetamaskSnapWalletAddress?: string | ||
) { | ||
const network = networkSelector(getState()); | ||
const provider = IframeProvider.getInstance(); | ||
provider.setLoginType(IframeLoginTypes.metamask); | ||
provider.setWalletUrl( | ||
customMetamaskSnapWalletAddress || network.metamaskSnapWalletAddress || '' | ||
); | ||
|
||
await provider.init(); | ||
return provider; | ||
} |