Account storage stores objects under paths. Paths consist of a domain and an identifier.
Paths start with the character
/, followed by the domain, the path separator
and finally the identifier.
For example, the path
/storage/test has the domain
storage and the identifier
There are two valid domains:
Paths in the storage domain have type
and paths in the public domain have the type
PublicPath are subtypes of
storage domain stores storable objects, such as resources and structs.
Objects stored under the
storage domain are only accessible through account references
which are authorized with a storage entitlement.
public domain stores capabilities,
which are accessible by anyone.
_10fun toString(): String
Returns the string representation of the path.
_10let storagePath = /storage/path_10_10storagePath.toString() // is "/storage/path"
There are also utilities to produce paths from strings:
_10fun PublicPath(identifier: string): PublicPath?_10fun StoragePath(identifier: string): StoragePath?
Each of these functions take an identifier and produce a path of the appropriate domain:
_10let pathID = "foo"_10let path = PublicPath(identifier: pathID) // is /public/foo