nomo-webon-kit / Exports
- compareSemanticVersions
- getCurrentNomoTheme
- hasMinimumNomoVersion
- injectNomoCSSVariables
- invokeNomoFunction
- invokeNomoFunctionCached
- isFallbackModeActive
- isHexString
- isRunningInHub
- nomoAddCustomToken
- nomoAuthFetch
- nomoAuthHttp
- nomoCheckForWebOnUpdate
- nomoDisableFallbackWallet
- nomoEnableMobileConsoleDebugging
- nomoFallbackQRCode
- nomoGetAllAssets
- nomoGetAssetIcon
- nomoGetAssetPrice
- nomoGetBalance
- nomoGetBalanceWaitUntilSynced
- nomoGetDeviceHashes
- nomoGetDeviceName
- nomoGetEvmAddress
- nomoGetExecutionMode
- nomoGetExtendedPublicKey
- nomoGetInstalledWebOns
- nomoGetLanguage
- nomoGetManifest
- nomoGetMessengerAddress
- nomoGetNFTContracts
- nomoGetPlatformInfo
- nomoGetTransactions
- nomoGetVisibleAssets
- nomoGetWalletAddresses
- nomoGetWebOnParameters
- nomoInjectQRCode
- nomoInstallUrlAsWebOn
- nomoInstallWebOn
- nomoLaunchSmartchainFaucet
- nomoLaunchUrl
- nomoLaunchUrlAsWebOn
- nomoLaunchWebOn
- nomoMigrateAndSelfDestroy
- nomoMnemonicBackupExisted
- nomoOpenFAQPage
- nomoPickFromGallery
- nomoProofOfPayment
- nomoProofOfWork
- nomoQrScan
- nomoRegisterOnWebOnVisible
- nomoReplaceWebOn
- nomoSelectAssetFromDialog
- nomoSelectAssets
- nomoSendAssets
- nomoSetAssetVisibility
- nomoSetWebOnParameters
- nomoShare
- nomoSignAuthMessage
- nomoSignEvmMessage
- nomoSignEvmTransaction
- nomoSubscribeNotification
- nomoTakePicture
- nomoUninstallWebOn
- profile
- runsAsWebOn
- sha256
- sleep
- stringifyWithBigInts
- switchNomoTheme
- urlSearchParamsToJson
Ƭ NomoCoinType: "btc"
| "ltc"
| "ec8"
| "bch"
| "zeniq"
Ƭ NomoEvmNetwork: "zeniq-smart-chain"
| "ethereum"
| "binance-smart-chain"
Ƭ NomoExecutionMode: "PRODUCTION"
| "DEV"
| "DEV_DEV"
| "FALLBACK"
Ƭ NomoHostingMode: "NOMO_INTEGRATED_HOSTING"
| "EXTERNAL_HOSTING"
Ƭ NomoNetwork: NomoEvmNetwork
| "bitcoin"
| "zeniq"
| "litecoin"
| "bitcoincash"
Ƭ NomoTheme: "LIGHT"
| "DARK"
| "AVINOC"
| "XERA"
The themes that are supported by the Nomo App.
Ƭ NomoWebView: "webview_flutter"
| "webview_cef"
| "not_in_nomo_app"
• Const
nomo: Object
The nomo-object exposes WebOn-functions in an easy-to-use way. The nomo-object can be used with only one import and supports the auto-completion of IDEs.
Name | Type |
---|---|
addCustomToken |
(args : NomoAssetSelector & { contractAddress : string ; network : NomoEvmNetwork }) => Promise <void > |
authFetch |
(args : { body? : string | { [key: string] : any ; } ; headers? : { [key: string] : string ; } ; method? : "GET" | "POST" ; signer? : (args : { message : string ; url : string }) => Promise <{ authAddress : string ; authSig : string ; ethAddress : string ; ethSig : string }> ; url : string }) => Promise <{ response : string ; statusCode : number }> |
authHttp |
(args : string | { body? : string | { [key: string] : any ; } ; headers? : { [key: string] : string ; } ; method? : "GET" | "POST" ; url : string }) => Promise <{ response : string ; statusCode : number }> |
checkForWebOnUpdate |
() => Promise <void > |
disableFallbackWallet |
() => void |
enableMobileConsoleDebugging |
() => Promise <void > |
fallbackQRCode |
() => void |
getAllAssets |
() => Promise <{ assets : NomoAsset [] }> |
getAssetIcon |
(args : NomoAssetSelector ) => Promise <{ isPending : boolean ; large : string ; name : string ; small : string ; symbol : string ; thumb : string }> |
getAssetPrice |
(args : NomoAssetSelector ) => Promise <{ currencyDisplayName : string ; currencySymbol : string ; price : number }> |
getBalance |
(args : NomoAssetSelector ) => Promise <NomoAsset & { balance : string }> |
getBalanceWaitUntilSynced |
(args : NomoAssetSelector ) => Promise <NomoAsset & { balance : string }> |
getCurrentNomoTheme |
() => Promise <{ colors : { background : string ; disabledColor : string ; error : string ; foreground1 : string ; foreground2 : string ; foreground3 : string ; onPrimary : string ; onSecondary : string ; primary : string ; primaryContainer : string ; secondary : string ; secondaryContainer : string ; settingsColumnColor : string ; settingsTileColor : string ; snackBarColor : string ; surface : string } ; displayName : string ; name : string }> |
getDeviceHashes |
() => Promise <{ deviceHashes : string }> |
getDeviceName |
() => Promise <{ deviceName : string }> |
getEvmAddress |
() => Promise <string > |
getExecutionMode |
() => Promise <{ executionMode : NomoExecutionMode ; hostingMode : NomoHostingMode | null ; webView : NomoWebView }> |
getExtendedPublicKey |
(args : NomoAssetSelector ) => Promise <any > |
getInstalledWebOns |
() => Promise <{ manifests : NomoManifest [] }> |
getLanguage |
() => Promise <{ language : string }> |
getManifest |
() => Promise <NomoManifest > |
getMessengerAddress |
() => Promise <{ inviteLink : string ; messengerAddress : string }> |
getNFTContracts |
() => Promise <{ nftContracts : string [] }> |
getPlatformInfo |
() => Promise <{ appName : string ; buildNumber : string ; clientName : string ; operatingSystem : string ; version : string }> |
getTransactions |
(args : NomoAssetSelector ) => Promise <{ contractAddress? : string ; decimals : number ; name : string ; network : string ; symbol : string ; txs : any [] }> |
getVisibleAssets |
() => Promise <{ visibleAssets : NomoAsset [] }> |
getWalletAddresses |
() => Promise <{ walletAddresses : Record <string , string > }> |
getWebOnParameters |
() => Promise <{ [key: string] : any ; }> |
hasMinimumNomoVersion |
(args : { minVersion : string }) => Promise <{ minVersionFulfilled : boolean ; nomoVersion : string }> |
injectNomoCSSVariables |
() => Promise <void > |
injectQRCode |
(args : { navigateBack : boolean ; qrCode : string }) => Promise <void > |
installUrlAsWebOn |
(args : { manifest : NomoManifest ; navigateBack : boolean ; skipPermissionDialog : boolean }) => Promise <void > |
installWebOn |
(args : { backgroundInstall? : boolean ; deeplink : string ; navigateBack? : boolean ; skipPermissionDialog? : boolean }) => Promise <void > |
launchSmartchainFaucet |
() => Promise <void > |
launchUrl |
(args : { launchMode : "platformDefault" | "inAppWebView" | "externalApplication" | "externalNonBrowserApplication" ; url : string }) => Promise <any > |
launchUrlAsWebOn |
(args : { manifest : NomoManifest }) => Promise <any > |
launchWebOn |
(args : { manifest : NomoManifest ; payload : string }) => Promise <void > |
localStorage |
{ getItem : (key : string , options? : { webon_id : string }) => Promise <null | String > ; removeItem : (key : string ) => Promise <void > ; setItem : (key : string , value : string ) => Promise <void > } |
localStorage.getItem |
(key : string , options? : { webon_id : string }) => Promise <null | String > |
localStorage.removeItem |
(key : string ) => Promise <void > |
localStorage.setItem |
(key : string , value : string ) => Promise <void > |
migrateAndSelfDestroy |
(args : { new_deeplink : string }) => Promise <void > |
mnemonicBackupExisted |
() => Promise <{ mnemonicBackupExisted : boolean }> |
openFAQPage |
(args : { faqContent : Record <string , Record <string , string >> ; initiallyExpanded : boolean ; supportButtonTitle? : string ; supportButtonUrl? : string }) => Promise <void > |
pickFromGallery |
(args? : { imageQuality? : number ; maxHeight? : number ; maxWidth? : number }) => Promise <{ imageBase64 : string ; path : string }> |
proofOfPayment |
(args : { coin : NomoCoinType ; hash : string ; nonce? : string }) => Promise <NomoProofOfPayment > |
proofOfWork |
(args : { challenge : string ; shaInputPrefix : string }) => Promise <{ shaInput : string }> |
qrScan |
() => Promise <{ qrCode : string }> |
registerOnWebOnVisible |
(callback : () => void ) => Promise <void > |
replaceWebOn |
(args : { navigateBack : boolean ; new_deeplink : string ; old_webon_url : string }) => Promise <void > |
runsAsWebOn |
() => boolean |
selectAssetFromDialog |
() => Promise <{ selectedAsset : NomoAsset & { balance : string } }> |
selectAssets |
(args : NomoAssetSelector ) => Promise <{ selectedAssets : NomoAsset [] }> |
sendAssets |
(args : { amount? : string ; asset? : NomoAssetSelector ; targetAddress? : string }) => Promise <{ hash : string ; intent : { amount : string ; recipient : string ; token : string } }> |
setAssetVisiblity |
(args : { asset : NomoAssetSelector ; visible : boolean }) => Promise <void > |
setWebOnParameters |
(args : { urlParams : { [key: string] : any ; } }) => Promise <void > |
share |
(args : { subject? : string ; text? : string }) => Promise <void > |
signAuthMessage |
(args : { message : string ; url : string }) => Promise <{ authAddress : string ; authSig : string ; ethAddress : string ; ethSig : string }> |
signEvmMessage |
(args : { message : string }) => Promise <{ sigHex : string }> |
signEvmTransaction |
(args : { messageHex : string }) => Promise <{ sigHex : string ; txHex : string }> |
subscribeNotification |
(args : { topic : string }) => Promise <void > |
switchNomoTheme |
(args : { theme : NomoTheme }) => Promise <void > |
takePicture |
(args? : { imageQuality? : number ; maxHeight? : number ; maxWidth? : number }) => Promise <{ imageBase64 : string ; path : string }> |
uninstallWebOn |
(args : { webon_url : string }) => Promise <void > |
• Const
nomoConsole: Object
A set of logging-functions to enable debugging with the Nomo dev mode. You should not need to call this directly, since it will be called automatically when calling console.log/console.error/console.warn/console.info.
Name | Type |
---|---|
error |
(...args : any []) => void |
info |
(...args : any []) => void |
log |
(...args : any []) => void |
warn |
(...args : any []) => void |
• Const
nomoLocalStorage: Object
nomoLocalStorage provides a mechanism for sharing data between WebOns. If a webon_id is passed to nomoLocalStorage.getItem, then it tries to read data from another WebOn with the given webon_id. nomoLocalStorage can also be used as an alternative to the regular localStorage.
Name | Type |
---|---|
getItem |
(key : string , options? : { webon_id : string }) => Promise <null | String > |
removeItem |
(key : string ) => Promise <void > |
setItem |
(key : string , value : string ) => Promise <void > |
▸ compareSemanticVersions(versionA
, versionB
): 0
| 1
| -1
A low-level function. We recommend calling "hasMinimumNomoVersion" instead.
Name | Type |
---|---|
versionA |
string |
versionB |
string |
0
| 1
| -1
▸ getCurrentNomoTheme(): Promise
<{ colors
: { background
: string
; disabledColor
: string
; error
: string
; foreground1
: string
; foreground2
: string
; foreground3
: string
; onPrimary
: string
; onSecondary
: string
; primary
: string
; primaryContainer
: string
; secondary
: string
; secondaryContainer
: string
; settingsColumnColor
: string
; settingsTileColor
: string
; snackBarColor
: string
; surface
: string
} ; displayName
: string
; name
: string
}>
A low-level function. We recommend using "injectNomoCSSVariables" instead.
Promise
<{ colors
: { background
: string
; disabledColor
: string
; error
: string
; foreground1
: string
; foreground2
: string
; foreground3
: string
; onPrimary
: string
; onSecondary
: string
; primary
: string
; primaryContainer
: string
; secondary
: string
; secondaryContainer
: string
; settingsColumnColor
: string
; settingsTileColor
: string
; snackBarColor
: string
; surface
: string
} ; displayName
: string
; name
: string
}>
▸ hasMinimumNomoVersion(args
): Promise
<{ minVersionFulfilled
: boolean
; nomoVersion
: string
}>
This function checks at runtime if the Nomo App has a minimum version. It is also possible to require a minimum Nomo App version in the manifest.
Name | Type |
---|---|
args |
Object |
args.minVersion |
string |
Promise
<{ minVersionFulfilled
: boolean
; nomoVersion
: string
}>
▸ injectNomoCSSVariables(): Promise
<void
>
Injects CSS variables that automatically adjust according to the currently selected Nomo theme.
Promise
<void
>
▸ invokeNomoFunction(functionName
, args
): Promise
<any
>
A low-level function used by other Nomo APIs. This is the main entry point into the native layer.
Name | Type |
---|---|
functionName |
string |
args |
null | object |
Promise
<any
>
▸ invokeNomoFunctionCached(functionName
, args
): Promise
<any
>
A cached wrapper on top of "invokeNomoFunction". For idempotent functions, this cache prevents unnecessary calls to the native layer.
Name | Type |
---|---|
functionName |
string |
args |
null | object |
Promise
<any
>
▸ isFallbackModeActive(): boolean
Returns true if the code is not running within a Nomo App WebView.
boolean
▸ isHexString(str
): boolean
Name | Type |
---|---|
str |
string |
boolean
▸ isRunningInHub(): boolean
Returns true if the code is running within an iframe.
boolean
▸ nomoAddCustomToken(args
): Promise
<void
>
Adds a custom token to the list of visible assets in the Nomo Wallet. Before that, it opens a dialog for the user to confirm.
Needs nomo.permission.ADD_CUSTOM_TOKEN.
Name | Type |
---|---|
args |
NomoAssetSelector & { contractAddress : string ; network : NomoEvmNetwork } |
Promise
<void
>
▸ nomoAuthFetch(args
): Promise
<{ response
: string
; statusCode
: number
}>
A browser-implementation of the Nomo-Auth-Protocol. It is similar to nomoAuthHttp, but it is implemented in JavaScript instead of the native layer. Therefore, is much easier to debug or modify, although it cannot bypass CORS.
Name | Type |
---|---|
args |
Object |
args.body? |
string | { [key: string] : any ; } |
args.headers? |
Object |
args.method? |
"GET" | "POST" |
args.signer? |
(args : { message : string ; url : string }) => Promise <{ authAddress : string ; authSig : string ; ethAddress : string ; ethSig : string }> |
args.url |
string |
Promise
<{ response
: string
; statusCode
: number
}>
▸ nomoAuthHttp(args
): Promise
<{ response
: string
; statusCode
: number
}>
A native implementation of the Nomo-Auth-Protocol. Moreover, even if you do not use Nomo-Auth, you can still use this function for bypassing CORS. At a lower level, Nomo-Auth works by injecting a few HTTP-headers into the request.
Name | Type |
---|---|
args |
string | { body? : string | { [key: string] : any ; } ; headers? : { [key: string] : string ; } ; method? : "GET" | "POST" ; url : string } |
Promise
<{ response
: string
; statusCode
: number
}>
▸ nomoCheckForWebOnUpdate(): Promise
<void
>
This will show a dialog to the user if an update is available. If you need to customize this dialog, then you could re-implement the same functionality in JavaScript. Nevertheless, the Nomo App will automatically check for updates even if you never invoke "nomoCheckForWebOnUpdate".
Promise
<void
>
▸ nomoDisableFallbackWallet(): void
Prevents functions like "nomoGetEvmAddress" from falling back to browser extensions like MetaMask.
void
▸ nomoEnableMobileConsoleDebugging(): Promise
<void
>
After calling this function, console logs are visible in the mobile DevDev-mode of the Nomo App. For the Desktop DevDev-mode, this function is not necessary.
Promise
<void
>
▸ nomoFallbackQRCode(): void
Detects if a WebOn is running outside of Nomo and shows a fallback-dialog if needed.
void
▸ nomoGetAllAssets(): Promise
<{ assets
: NomoAsset
[] }>
Returns a list of supported assets that can be made visible via "nomoSetAssetVisibility". This might also include custom tokens that the user has added.
Since Nomo App 0.4.1.
Promise
<{ assets
: NomoAsset
[] }>
▸ nomoGetAssetIcon(args
): Promise
<{ isPending
: boolean
; large
: string
; name
: string
; small
: string
; symbol
: string
; thumb
: string
}>
Returns a set of URLs that contain icons of the asset. May throw an error if no icons can be found.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<{ isPending
: boolean
; large
: string
; name
: string
; small
: string
; symbol
: string
; thumb
: string
}>
▸ nomoGetAssetPrice(args
): Promise
<{ currencyDisplayName
: string
; currencySymbol
: string
; price
: number
}>
Returns an asset price. Might be slow if a price is not yet in the Nomo App's cache.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<{ currencyDisplayName
: string
; currencySymbol
: string
; price
: number
}>
▸ nomoGetBalance(args
): Promise
<NomoAsset
& { balance
: string
}>
Returns not only the balance of an asset, but also additional information like the network, a contract-address and a receive-address. Typically, the decimals are needed to convert a raw balance into a user-readable balance.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<NomoAsset
& { balance
: string
}>
▸ nomoGetBalanceWaitUntilSynced(args
): Promise
<NomoAsset
& { balance
: string
}>
Internally called by "nomoGetBalance". For EVM-based assets, it is also possible to use ethers.js or similar to fetch a balance.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<NomoAsset
& { balance
: string
}>
▸ nomoGetDeviceHashes(): Promise
<{ deviceHashes
: string
}>
Returns a comma-separated list of device hashes. Can be used for fingerprinting devices.
Needs nomo.permission.DEVICE_FINGERPRINTING.
Promise
<{ deviceHashes
: string
}>
▸ nomoGetDeviceName(): Promise
<{ deviceName
: string
}>
Returns a human-readable name of the device.
Needs nomo.permission.DEVICE_FINGERPRINTING.
Promise
<{ deviceName
: string
}>
▸ nomoGetEvmAddress(): Promise
<string
>
A convenience function to get the Smartchain address of the Nomo Wallet. Internally, it calls "nomoGetWalletAddresses" and caches the result.
Promise
<string
>
▸ nomoGetExecutionMode(): Promise
<{ executionMode
: NomoExecutionMode
; hostingMode
: NomoHostingMode
| null
; webView
: NomoWebView
}>
Gets details about the execution environment of the WebOn. See the advanced docs for more details about execution modes: https://github.com/nomo-app/nomo-webon-kit/tree/main/advanced-docs
Promise
<{ executionMode
: NomoExecutionMode
; hostingMode
: NomoHostingMode
| null
; webView
: NomoWebView
}>
▸ nomoGetExtendedPublicKey(args
): Promise
<any
>
An extended public key is a public key that allows to derive all the addresses of a Nomo Wallet. This is only intended for UTXO-based assets.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<any
>
▸ nomoGetInstalledWebOns(): Promise
<{ manifests
: NomoManifest
[] }>
Gets all manifests of the installed WebOns, including information like name/id/version.
Needs nomo.permission.GET_INSTALLED_WEBONS.
Promise
<{ manifests
: NomoManifest
[] }>
▸ nomoGetLanguage(): Promise
<{ language
: string
}>
Returns the currently selected language of the Nomo App.
Promise
<{ language
: string
}>
▸ nomoGetManifest(): Promise
<NomoManifest
>
Returns the nomo_manifest.json that was used during the installation of the WebOn. For example, this can be used by a WebOn for checking its own version.
Promise
<NomoManifest
>
▸ nomoGetMessengerAddress(): Promise
<{ inviteLink
: string
; messengerAddress
: string
}>
Can be used for chatting with other NOMO-users, but also for push-notifications or chat-bots.
Needs nomo.permission.SEND_MESSAGE.
Promise
<{ inviteLink
: string
; messengerAddress
: string
}>
▸ nomoGetNFTContracts(): Promise
<{ nftContracts
: string
[] }>
Returns a list of NFT-contracts that are declared by the currently installed WebOns. Typically, those NFT-contracts provide some kind of utility for a WebOn.
Needs nomo.permission.GET_INSTALLED_WEBONS.
Promise
<{ nftContracts
: string
[] }>
▸ nomoGetPlatformInfo(): Promise
<{ appName
: string
; buildNumber
: string
; clientName
: string
; operatingSystem
: string
; version
: string
}>
Returns both the NOMO-version and the operating system where the WebOn runs. Can be used for implementing platform-specific functionality. See https://nomo.app/ for an overview of supported platforms.
Promise
<{ appName
: string
; buildNumber
: string
; clientName
: string
; operatingSystem
: string
; version
: string
}>
▸ nomoGetTransactions(args
): Promise
<{ contractAddress?
: string
; decimals
: number
; name
: string
; network
: string
; symbol
: string
; txs
: any
[] }>
Returns a list of transactions from the Nomo Wallet's transaction-cache. Might fail if the transaction-cache is not yet synchronized.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<{ contractAddress?
: string
; decimals
: number
; name
: string
; network
: string
; symbol
: string
; txs
: any
[] }>
▸ nomoGetVisibleAssets(): Promise
<{ visibleAssets
: NomoAsset
[] }>
Returns a list of assets that are currently visible in the Nomo Wallet.
Promise
<{ visibleAssets
: NomoAsset
[] }>
▸ nomoGetWalletAddresses(): Promise
<{ walletAddresses
: Record
<string
, string
> }>
Returns blockchain-addresses of the NOMO-user.
Promise
<{ walletAddresses
: Record
<string
, string
> }>
▸ nomoGetWebOnParameters(): Promise
<{ [key: string]
: any
; }>
Returns the URL-parameters of the WebOn-manifest. This might be a nested object that was previously passed to "nomoSetWebOnParameters".
Promise
<{ [key: string]
: any
; }>
▸ nomoInjectQRCode(args
): Promise
<void
>
Injecting QRCodes is useful for multiple purposes. For example, new chats can be opened by injecting a chat-invitation-link. Also the Nomo-ID protocol works by injecting QRCodes.
Needs nomo.permission.INSTALL_WEBON.
Name | Type |
---|---|
args |
Object |
args.navigateBack |
boolean |
args.qrCode |
string |
Promise
<void
>
▸ nomoInstallUrlAsWebOn(args
): Promise
<void
>
Installs a URL as a WebOn and grants the permissions that are specified in the manifest.
Needs nomo.permission.INSTALL_WEBON. Since Nomo App 0.3.5.
Name | Type |
---|---|
args |
Object |
args.manifest |
NomoManifest |
args.navigateBack |
boolean |
args.skipPermissionDialog |
boolean |
Promise
<void
>
▸ nomoInstallWebOn(args
): Promise
<void
>
Installs and/or launches a WebOn with or without user interaction. If the WebOn is already installed, then the behavior depends on whether "backgroundInstall" is set to true. If "backgroundInstall" is not set, then the already installed WebOn will be launched. If "backgroundInstall" is set, then the already installed manifest will be replaced (including URL-args). See the README for an explanation about deeplinks.
Needs nomo.permission.INSTALL_WEBON.
Name | Type |
---|---|
args |
Object |
args.backgroundInstall? |
boolean |
args.deeplink |
string |
args.navigateBack? |
boolean |
args.skipPermissionDialog? |
boolean |
Promise
<void
>
▸ nomoLaunchSmartchainFaucet(): Promise
<void
>
Launches a free faucet that can be used for paying transaction fees.
Promise
<void
>
▸ nomoLaunchUrl(args
): Promise
<any
>
Passes a URL to the underlying platform for handling. Typically, it will launch a system-browser or an in-app-webview.
Name | Type |
---|---|
args |
Object |
args.launchMode |
"platformDefault" | "inAppWebView" | "externalApplication" | "externalNonBrowserApplication" |
args.url |
string |
Promise
<any
>
▸ nomoLaunchUrlAsWebOn(args
): Promise
<any
>
Launches a URL as a WebOn without installing it. Grants the permissions that are specified in the manifest. If possible, please prefer "nomoLaunchUrl" or "nomoLaunchWebOn" over this function.
Needs nomo.permission.INSTALL_WEBON. Since Nomo App 0.3.5.
Name | Type |
---|---|
args |
Object |
args.manifest |
NomoManifest |
Promise
<any
>
▸ nomoLaunchWebOn(args
): Promise
<void
>
Opens another WebOn on top of the current WebOn. If the WebOn is not yet running, the WebOn will be launched. If the WebOn is not yet installed, an error is thrown. A payload can be passed to the WebOn. Afterwards, the user may navigate back to the current WebOn by pressing the back button.
Name | Type |
---|---|
args |
Object |
args.manifest |
NomoManifest |
args.payload |
string |
Promise
<void
>
▸ nomoMigrateAndSelfDestroy(args
): Promise
<void
>
Replaces the currently running WebOn with another WebOn on a different deeplink.
Needs nomo.permission.INSTALL_WEBON.
Name | Type |
---|---|
args |
Object |
args.new_deeplink |
string |
Promise
<void
>
▸ nomoMnemonicBackupExisted(): Promise
<{ mnemonicBackupExisted
: boolean
}>
If true, then the user has made a backup of their 12 words (at some point in the past). If false, then there exists no backup and the 12 words will get lost with a high probability.
Promise
<{ mnemonicBackupExisted
: boolean
}>
▸ nomoOpenFAQPage(args
): Promise
<void
>
Opens a standardized FAQ page in Nomo design. "faqContent" should be a nested object of questions and answers (with depth=2). Optionally, a button for contacting support is shown below of the FAQs.
Name | Type |
---|---|
args |
Object |
args.faqContent |
Record <string , Record <string , string >> |
args.initiallyExpanded |
boolean |
args.supportButtonTitle? |
string |
args.supportButtonUrl? |
string |
Promise
<void
>
▸ nomoPickFromGallery(args?
): Promise
<{ imageBase64
: string
; path
: string
}>
Opens an image-picker and returns an image in base64-encoding. The promise rejects if the user chooses to cancel.
Needs nomo.permission.READ_MEDIA.
Name | Type |
---|---|
args? |
Object |
args.imageQuality? |
number |
args.maxHeight? |
number |
args.maxWidth? |
number |
Promise
<{ imageBase64
: string
; path
: string
}>
▸ nomoProofOfPayment(args
): Promise
<NomoProofOfPayment
>
Returns a proof-of-payment for a transaction
Needs nomo.permission.SIGN_EVM_MESSAGE.
Name | Type |
---|---|
args |
Object |
args.coin |
NomoCoinType |
args.hash |
string |
args.nonce? |
string |
Promise
<NomoProofOfPayment
>
▸ nomoProofOfWork(args
): Promise
<{ shaInput
: string
}>
Some API-endpoints require this proof-of-work in order to make denial-of-service attacks more expensive.
Name | Type |
---|---|
args |
Object |
args.challenge |
string |
args.shaInputPrefix |
string |
Promise
<{ shaInput
: string
}>
▸ nomoQrScan(): Promise
<{ qrCode
: string
}>
Opens the camera to scan a qrCode. Returns a raw qrCode or a list of comma-separated qrCodes.
Needs nomo.permission.CAMERA.
Promise
<{ qrCode
: string
}>
▸ nomoRegisterOnWebOnVisible(callback
): Promise
<void
>
Registers a callback that will be called every time when the WebOn gets visible within the Nomo App. For example, this can be used to refresh themes or languages when re-opening a WebOn after a pause.
Name | Type |
---|---|
callback |
() => void |
Promise
<void
>
▸ nomoReplaceWebOn(args
): Promise
<void
>
Tries to add a WebOn and then uninstalls another WebOn if it was successfully added.
Needs nomo.permission.INSTALL_WEBON.
Name | Type |
---|---|
args |
Object |
args.navigateBack |
boolean |
args.new_deeplink |
string |
args.old_webon_url |
string |
Promise
<void
>
▸ nomoSelectAssetFromDialog(): Promise
<{ selectedAsset
: NomoAsset
& { balance
: string
} }>
Opens a dialog for the user to select an asset. If the dialog does not look "correct", WebOns are free to call "nomoGetVisibleAssets" and implement their own dialog.
Promise
<{ selectedAsset
: NomoAsset
& { balance
: string
} }>
▸ nomoSelectAssets(args
): Promise
<{ selectedAssets
: NomoAsset
[] }>
Checks whether an asset is available in the Nomo Wallet, and whether the asset is visible. If it is not available, "nomoAddCustomToken" can be used to add the asset. If it is not visible, "nomoSetAssetVisibility" can be used to make the asset visible. May return multiple assets if the NomoAssetSelector is ambiguous.
Name | Type |
---|---|
args |
NomoAssetSelector |
Promise
<{ selectedAssets
: NomoAsset
[] }>
▸ nomoSendAssets(args
): Promise
<{ hash
: string
; intent
: { amount
: string
; recipient
: string
; token
: string
} }>
Opens a confirmation-dialog to send assets away from the Nomo App. Assets are only sent if the user confirms the dialog. "amount" should be a string that can be parsed by "BigInt.parse": https://api.flutter.dev/flutter/dart-core/BigInt/parse.html
Needs nomo.permission.SEND_ASSETS.
Name | Type |
---|---|
args |
Object |
args.amount? |
string |
args.asset? |
NomoAssetSelector |
args.targetAddress? |
string |
Promise
<{ hash
: string
; intent
: { amount
: string
; recipient
: string
; token
: string
} }>
▸ nomoSetAssetVisibility(args
): Promise
<void
>
Adds or hides an asset within the Nomo Wallet.
Name | Type |
---|---|
args |
Object |
args.asset |
NomoAssetSelector |
args.visible |
boolean |
Promise
<void
>
▸ nomoSetWebOnParameters(args
): Promise
<void
>
Changes the URL-parameters in the manifest of the currently running WebOn. This function does not affect the currently running page. Please use regular JavaScript for navigation.
Name | Type | Description |
---|---|---|
args |
Object |
- |
args.urlParams |
Object |
A JSON-serializable object that will be converted to a URL query string. Since Nomo App 0.5.1. |
Promise
<void
>
▸ nomoShare(args
): Promise
<void
>
Summons the platform's share sheet to share a text. If no text is provided, then it will share the deeplink of the WebOn.
Wraps the platform's native share dialog. Can share a text and/or a URL.
It uses the ACTION_SEND
Intent on Android and UIActivityViewController
on iOS.
The optional [subject] parameter can be used to populate a subject if the user chooses to send an email.
Name | Type |
---|---|
args |
Object |
args.subject? |
string |
args.text? |
string |
Promise
<void
>
▸ nomoSignAuthMessage(args
): Promise
<{ authAddress
: string
; authSig
: string
; ethAddress
: string
; ethSig
: string
}>
Returns address/signature-pairs for the Nomo-Auth-Protocol. This is a primitive that can be used for customized authentication. For example, the address/signature-pairs can be put into HTTP-headers.
Needs nomo.permission.SIGN_EVM_MESSAGE. Since Nomo App 0.3.5.
Name | Type |
---|---|
args |
Object |
args.message |
string |
args.url |
string |
Promise
<{ authAddress
: string
; authSig
: string
; ethAddress
: string
; ethSig
: string
}>
▸ nomoSignEvmMessage(args
): Promise
<{ sigHex
: string
}>
Creates an Ethereum-styled message signature. The resulting signature is not usable for submitting transactions, but it can be used as a proof that the user controls a wallet.
Needs nomo.permission.SIGN_EVM_MESSAGE.
Name | Type |
---|---|
args |
Object |
args.message |
string |
Promise
<{ sigHex
: string
}>
▸ nomoSignEvmTransaction(args
): Promise
<{ sigHex
: string
; txHex
: string
}>
Creates a signature for an EVM-based transaction. See EthersjsNomoSigner for an example on how to use this function.
Needs nomo.permission.SIGN_EVM_TRANSACTION.
Name | Type |
---|---|
args |
Object |
args.messageHex |
string |
Promise
<{ sigHex
: string
; txHex
: string
}>
▸ nomoSubscribeNotification(args
): Promise
<void
>
Subscribes Nomo to a notification-topic. Server-side notifications can then be sent to all subscribers of a topic.
Name | Type |
---|---|
args |
Object |
args.topic |
string |
Promise
<void
>
▸ nomoTakePicture(args?
): Promise
<{ imageBase64
: string
; path
: string
}>
Opens the camera and returns a picture in base64-encoding. The promise rejects if the user chooses to cancel. The promise may also reject if the user denied a camera-permission.
Needs nomo.permission.CAMERA.
Name | Type |
---|---|
args? |
Object |
args.imageQuality? |
number |
args.maxHeight? |
number |
args.maxWidth? |
number |
Promise
<{ imageBase64
: string
; path
: string
}>
▸ nomoUninstallWebOn(args
): Promise
<void
>
The reverse operation of nomoInstallWebOn. Throws an error if the WebOn cannot be found.
Needs nomo.permission.INSTALL_WEBON.
Name | Type |
---|---|
args |
Object |
args.webon_url |
string |
Promise
<void
>
▸ profile(fn
, options
): Promise
<void
>
Name | Type |
---|---|
fn |
() => Promise <void > |
options |
Object |
options.name |
string |
Promise
<void
>
▸ runsAsWebOn(): boolean
Returns true if the code is running within a Nomo App WebView.
boolean
▸ sha256(message
): Promise
<string
>
A SHA-256 function based on the Web Crypto API.
Name | Type |
---|---|
message |
string |
Promise
<string
>
▸ sleep(ms
): Promise
<void
>
An asynchronous sleep function.
Name | Type | Description |
---|---|---|
ms |
number |
The number of milliseconds to sleep. |
Promise
<void
>
A promise that resolves after the specified sleep duration.
▸ stringifyWithBigInts(obj
): string
An alternative to JSON.stringify
Name | Type |
---|---|
obj |
any |
string
▸ switchNomoTheme(args
): Promise
<void
>
Switches the Nomo App to a different theme. It is recommended to call "injectNomoCSSVariables" after a theme has changed.
Name | Type |
---|---|
args |
Object |
args.theme |
NomoTheme |
Promise
<void
>
▸ urlSearchParamsToJson(params
): Record
<string
, any
>
Converts URLSearchParams to a (nested) JS-object.
Name | Type |
---|---|
params |
URLSearchParams |
Record
<string
, any
>