-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Export a method to check whether a provider exists (#267)
* feat: Remove debug code * fix: Fix type error * feat: Remove unused packages * feat: Update demo * feat: Export a method to check whether a provider exists
- Loading branch information
Showing
6 changed files
with
31 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@node-real/walletkit': patch | ||
--- | ||
|
||
Export a method to check whether a provider exists |
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
export function getSolanaInjectedProvider(flag: string): any { | ||
export type SolanaFlagType = 'isPhantom' | 'isTrust'; | ||
|
||
export function getSolanaInjectedProvider(flag: SolanaFlagType): any { | ||
if (typeof window === 'undefined' || typeof window.solana === 'undefined') return; | ||
|
||
return window.solana[flag] ? window.solana : undefined; | ||
} | ||
|
||
export function hasSolanaInjectedProvider(flag: string): boolean { | ||
export function hasSolanaInjectedProvider(flag: SolanaFlagType): boolean { | ||
return Boolean(getSolanaInjectedProvider(flag)); | ||
} |
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
export function getTronInjectedProvider(flag: string): any { | ||
export type TronFlagType = 'isTronLink'; | ||
|
||
export function getTronInjectedProvider(flag: TronFlagType): any { | ||
if (typeof window === 'undefined' || typeof window.tron === 'undefined') return; | ||
|
||
return window.tron[flag] ? window.tron : undefined; | ||
} | ||
|
||
export function hasTronInjectedProvider(flag: string): boolean { | ||
export function hasTronInjectedProvider(flag: TronFlagType): boolean { | ||
return Boolean(getTronInjectedProvider(flag)); | ||
} |