WalletAction class

A class representing different types of actions related to wallet operations.

This class provides a way to model various wallet actions like token transfers, token swaps, staking, unstaking, etc. Each action has its own set of attributes and can be differentiated using the name attribute.

Implemented types
Implementers
Annotations
  • @Freezed(unionKey: 'name')

Constructors

WalletAction.approveToken({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('approveToken') String name, String? txHash, required String status, @Default(0) int? blockNumber, required String userOpHash, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a token approval action on the blockchain.’
const
factory
WalletAction.batchTransaction({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('batchTransaction') String name, String? txHash, required String status, @Default(0) int? blockNumber, required String userOpHash, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a batch transaction action on the blockchain.
const
factory
WalletAction.fromJson(dynamic json)
Creates an WalletAction from a JSON object.
factory
WalletAction.nftReceive({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('nftReceive') String name, String? txHash, String? userOpHash, required String status, @Default(0) int? blockNumber, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a NFT receive action on the blockchain.
const
factory
WalletAction.nftTransfer({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('nftTransfer') String name, String? txHash, required String status, @Default(0) int? blockNumber, required String userOpHash, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a non-fungible token (NFT) transfer action on the blockchain.
const
factory
WalletAction.stakeTokens({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('stakeTokens') String name, String? txHash, required String status, @Default(0) int? blockNumber, required String userOpHash, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a token staking action on the blockchain.
const
factory
WalletAction.swapTokens({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('swapTokens') String name, String? txHash, required String status, @Default(0) int? blockNumber, required String userOpHash, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a token swap action on the blockchain.
const
factory
WalletAction.tokenReceive({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('tokenReceive') String name, String? txHash, String? userOpHash, required String status, @Default(0) int? blockNumber, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a token receive action on the blockchain.
const
factory
WalletAction.tokenTransfer({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('tokenTransfer') String name, String? txHash, required String userOpHash, required String status, @Default(0) int? blockNumber, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a token transfer action on the blockchain.
const
factory
WalletAction.unstakeTokens({@TimestampConverter() @JsonKey(name: 'updatedAt') @Default(0) int timestamp, @JsonKey(name: '_id') required String id, @Default('unstakeTokens') String name, String? txHash, required String status, @Default(0) int? blockNumber, required String userOpHash, required String description, @Default([]) List<TokenEvent> sent, @Default([]) List<TokenEvent> received})
Represents a token unstaking action on the blockchain.
const
factory

Properties

blockNumber int?
no setterinherited
copyWith → $WalletActionCopyWith<WalletAction>
no setterinherited
description String
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
no setterinherited
name String
no setterinherited
received List<TokenEvent>
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sent List<TokenEvent>
no setterinherited
status String
no setterinherited
timestamp int
no setterinherited
txHash String?
no setterinherited
userOpHash String?
no setterinherited

Methods

compareTo(WalletAction? other) int
Compares this WalletAction to other, based on their timestamps.
override
isConfirmed() bool
Checks if the wallet action has been confirmed.
isFailed() bool
Checks if the wallet action has failed.
isPending() bool
Checks if the wallet action is in a pending state.
map<TResult extends Object?>({required TResult batchTransaction(BatchTransaction value), required TResult tokenTransfer(TokenTransfer value), required TResult tokenReceive(TokenReceive value), required TResult nftReceive(NftReceive value), required TResult swapTokens(SwapTokens value), required TResult nftTransfer(NftTransfer value), required TResult approveToken(ApproveToken value), required TResult stakeTokens(StakeTokensAction value), required TResult unstakeTokens(UnstakeTokensAction value)}) → TResult
inherited
mapOrNull<TResult extends Object?>({TResult? batchTransaction(BatchTransaction value)?, TResult? tokenTransfer(TokenTransfer value)?, TResult? tokenReceive(TokenReceive value)?, TResult? nftReceive(NftReceive value)?, TResult? swapTokens(SwapTokens value)?, TResult? nftTransfer(NftTransfer value)?, TResult? approveToken(ApproveToken value)?, TResult? stakeTokens(StakeTokensAction value)?, TResult? unstakeTokens(UnstakeTokensAction value)?}) → TResult?
inherited
maybeMap<TResult extends Object?>({TResult batchTransaction(BatchTransaction value)?, TResult tokenTransfer(TokenTransfer value)?, TResult tokenReceive(TokenReceive value)?, TResult nftReceive(NftReceive value)?, TResult swapTokens(SwapTokens value)?, TResult nftTransfer(NftTransfer value)?, TResult approveToken(ApproveToken value)?, TResult stakeTokens(StakeTokensAction value)?, TResult unstakeTokens(UnstakeTokensAction value)?, required TResult orElse()}) → TResult
inherited
maybeWhen<TResult extends Object?>({TResult batchTransaction(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult tokenTransfer(int timestamp, String id, String name, String? txHash, String userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult tokenReceive(int timestamp, String id, String name, String? txHash, String? userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult nftReceive(int timestamp, String id, String name, String? txHash, String? userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult swapTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult nftTransfer(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult approveToken(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult stakeTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult unstakeTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, required TResult orElse()}) → TResult
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult batchTransaction(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult tokenTransfer(int timestamp, String id, String name, String? txHash, String userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult tokenReceive(int timestamp, String id, String name, String? txHash, String? userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult nftReceive(int timestamp, String id, String name, String? txHash, String? userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult swapTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult nftTransfer(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult approveToken(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult stakeTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received), required TResult unstakeTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)}) → TResult
inherited
whenOrNull<TResult extends Object?>({TResult? batchTransaction(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? tokenTransfer(int timestamp, String id, String name, String? txHash, String userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? tokenReceive(int timestamp, String id, String name, String? txHash, String? userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? nftReceive(int timestamp, String id, String name, String? txHash, String? userOpHash, String status, int? blockNumber, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? swapTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? nftTransfer(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? approveToken(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? stakeTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?, TResult? unstakeTokens(int timestamp, String id, String name, String? txHash, String status, int? blockNumber, String userOpHash, String description, List<TokenEvent> sent, List<TokenEvent> received)?}) → TResult?
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

actionsFromJson(Iterable docs) List<WalletAction>
Creates a list of WalletAction objects from an iterable of dynamic objects.