WalrusClient class
A client for interacting with the Walrus decentralized storage network.
Initialization
Initialize once in your app's main function:
Future<void> main() async {
await WalrusClient.initialize(
publisherUrl: 'https://publisher.walrus-testnet.walrus.space',
aggregatorUrl: 'https://aggregator.walrus-testnet.walrus.space',
);
runApp(MyApp());
}
Usage
After initialization, use the singleton instance anywhere:
final walrus = WalrusClient.instance;
final result = await walrus.store(data);
Properties
- aggregatorUrl → String
-
Aggregator node URL for downloading blobs.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- publisherUrl → String
-
Publisher node URL for uploading blobs.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
exists(
String blobId) → Future< bool> - Checks if a blob exists on the network.
-
getBlobUrl(
String blobId) → String - Returns the HTTP URL for accessing a blob.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String blobId) → Future< Uint8List> - Retrieves a blob from the Walrus network.
-
store(
Uint8List data, {int? epochs, bool? deletable, bool? permanent}) → Future< StoreResponse> - Uploads a blob to the Walrus network.
-
storeFile(
String path, {int? epochs, bool? deletable, bool? permanent}) → Future< StoreResponse> - Uploads a file to the Walrus network.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → WalrusClient
-
Returns the singleton instance.
no setter
- isInitialized → bool
-
Whether the client has been initialized.
no setter
Static Methods
-
initialize(
{required String publisherUrl, required String aggregatorUrl, Dio? dio}) → Future< void> - Initializes the singleton instance with the given configuration.
-
reset(
) → void - Resets the singleton instance. Useful for testing or re-initialization.