NamespaceUtils class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
Static Methods
buildNamespacesFromAuth ({required Set <String > methods , required Set <String > accounts })
→ Map <String , Namespace >
constructNamespaces ({required Set <String > availableAccounts , required Set <String > availableMethods , required Set <String > availableEvents , required Map <String , RequiredNamespace > requiredNamespaces , Map <String , RequiredNamespace > ? optionalNamespaces })
→ Map <String , Namespace >
Using the availabe accounts, methods, and events, construct the namespaces
If optional namespaces are provided, then they will be added to the namespaces as well
getAccount (String namespaceAccount )
→ String
getChainFromAccount (String account )
→ String
getChainIdsFromNamespace ({required String nsOrChainId , required Namespace namespace })
→ List <String >
Gets the chains from the namespace.
If the namespace is a chain, then it returns the chain.
Otherwise it gets the chains from the accounts in the namespace.
getChainIdsFromNamespaces ({required Map <String , Namespace > namespaces })
→ List <String >
Gets the chainIds from the namespace.
getChainIdsFromRequiredNamespaces ({required Map <String , RequiredNamespace > requiredNamespaces })
→ List <String >
Gets the chains from the required namespaces
If keys value is provided, it will only get the chains for the provided keys
getChainsFromAccounts (List <String > accounts )
→ List <String >
Gets all unique chains from the provided list of accounts
This function assumes that all accounts are valid
getChainsFromRequiredNamespace ({required String nsOrChainId , required RequiredNamespace requiredNamespace })
→ List <String >
If the namespace is a chain, add it to the list and return it
Otherwise, get the chains from the required namespaces
getNamespaceFromChain (String chainId )
→ String
Gets the namespace string id from the chainId
If the chain id is not valid, then it returns the chain id
getNamespacesEventsForChain ({required String chainId , required Map <String , Namespace > namespaces })
→ List <String >
Gets the methods from a namespace map for the given chain id
getNamespacesFromAccounts (List <String > accounts )
→ Map <String , Namespace >
Gets all unique namespaces from the provided list of accounts
This function assumes that all accounts are valid
getNamespacesMethodsForChainId ({required String chainId , required Map <String , Namespace > namespaces })
→ List <String >
Gets the methods from a namespace map for the given chain
getOptionalMethodsForChainId ({required String chainId , required Map <String , RequiredNamespace > optionalNamespaces })
→ List <String >
Gets the optional methods from a namespace map for the given chain
isValidAccount (String value )
→ bool
Checks if the string is an account
isValidChainId (String value )
→ bool
Checks if the string is a chain
isValidUrl (String value )
→ bool
regenerateNamespacesWithChains (Map <String , Namespace > generatedNamespaces )
→ Map <String , Namespace >
To be used by Wallet to regenerate already generatedNamespaces but adding chains
parameter