? addresses,
@@ -96,6 +134,7 @@ class InputV2 {
}) {
return InputV2.isarCantDoRequiredInDefaultConstructor(
scriptSigHex: scriptSigHex ?? this.scriptSigHex,
+ scriptSigAsm: scriptSigAsm ?? this.scriptSigAsm,
sequence: sequence ?? this.sequence,
outpoint: outpoint ?? this.outpoint,
addresses: addresses ?? this.addresses,
@@ -111,6 +150,7 @@ class InputV2 {
String toString() {
return 'InputV2(\n'
' scriptSigHex: $scriptSigHex,\n'
+ ' scriptSigAsm: $scriptSigAsm,\n'
' sequence: $sequence,\n'
' outpoint: $outpoint,\n'
' addresses: $addresses,\n'
diff --git a/lib/models/isar/models/blockchain_data/v2/input_v2.g.dart b/lib/models/isar/models/blockchain_data/v2/input_v2.g.dart
index eb3bc3cd3..c1a3b781b 100644
--- a/lib/models/isar/models/blockchain_data/v2/input_v2.g.dart
+++ b/lib/models/isar/models/blockchain_data/v2/input_v2.g.dart
@@ -357,28 +357,33 @@ const InputV2Schema = Schema(
type: IsarType.object,
target: r'OutpointV2',
),
- r'scriptSigHex': PropertySchema(
+ r'scriptSigAsm': PropertySchema(
id: 4,
+ name: r'scriptSigAsm',
+ type: IsarType.string,
+ ),
+ r'scriptSigHex': PropertySchema(
+ id: 5,
name: r'scriptSigHex',
type: IsarType.string,
),
r'sequence': PropertySchema(
- id: 5,
+ id: 6,
name: r'sequence',
type: IsarType.long,
),
r'valueStringSats': PropertySchema(
- id: 6,
+ id: 7,
name: r'valueStringSats',
type: IsarType.string,
),
r'walletOwns': PropertySchema(
- id: 7,
+ id: 8,
name: r'walletOwns',
type: IsarType.bool,
),
r'witness': PropertySchema(
- id: 8,
+ id: 9,
name: r'witness',
type: IsarType.string,
)
@@ -422,6 +427,12 @@ int _inputV2EstimateSize(
value, allOffsets[OutpointV2]!, allOffsets);
}
}
+ {
+ final value = object.scriptSigAsm;
+ if (value != null) {
+ bytesCount += 3 + value.length * 3;
+ }
+ }
{
final value = object.scriptSigHex;
if (value != null) {
@@ -453,11 +464,12 @@ void _inputV2Serialize(
OutpointV2Schema.serialize,
object.outpoint,
);
- writer.writeString(offsets[4], object.scriptSigHex);
- writer.writeLong(offsets[5], object.sequence);
- writer.writeString(offsets[6], object.valueStringSats);
- writer.writeBool(offsets[7], object.walletOwns);
- writer.writeString(offsets[8], object.witness);
+ writer.writeString(offsets[4], object.scriptSigAsm);
+ writer.writeString(offsets[5], object.scriptSigHex);
+ writer.writeLong(offsets[6], object.sequence);
+ writer.writeString(offsets[7], object.valueStringSats);
+ writer.writeBool(offsets[8], object.walletOwns);
+ writer.writeString(offsets[9], object.witness);
}
InputV2 _inputV2Deserialize(
@@ -475,11 +487,12 @@ InputV2 _inputV2Deserialize(
OutpointV2Schema.deserialize,
allOffsets,
);
- object.scriptSigHex = reader.readStringOrNull(offsets[4]);
- object.sequence = reader.readLongOrNull(offsets[5]);
- object.valueStringSats = reader.readString(offsets[6]);
- object.walletOwns = reader.readBool(offsets[7]);
- object.witness = reader.readStringOrNull(offsets[8]);
+ object.scriptSigAsm = reader.readStringOrNull(offsets[4]);
+ object.scriptSigHex = reader.readStringOrNull(offsets[5]);
+ object.sequence = reader.readLongOrNull(offsets[6]);
+ object.valueStringSats = reader.readString(offsets[7]);
+ object.walletOwns = reader.readBool(offsets[8]);
+ object.witness = reader.readStringOrNull(offsets[9]);
return object;
}
@@ -505,12 +518,14 @@ P _inputV2DeserializeProp(
case 4:
return (reader.readStringOrNull(offset)) as P;
case 5:
- return (reader.readLongOrNull(offset)) as P;
+ return (reader.readStringOrNull(offset)) as P;
case 6:
- return (reader.readString(offset)) as P;
+ return (reader.readLongOrNull(offset)) as P;
case 7:
- return (reader.readBool(offset)) as P;
+ return (reader.readString(offset)) as P;
case 8:
+ return (reader.readBool(offset)) as P;
+ case 9:
return (reader.readStringOrNull(offset)) as P;
default:
throw IsarError('Unknown property with id $propertyId');
@@ -1055,6 +1070,154 @@ extension InputV2QueryFilter
});
}
+ QueryBuilder scriptSigAsmIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'scriptSigAsm',
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptSigAsmIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'scriptSigAsm',
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmEqualTo(
+ String? value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'scriptSigAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmGreaterThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'scriptSigAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmLessThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'scriptSigAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmBetween(
+ String? lower,
+ String? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'scriptSigAsm',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmStartsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.startsWith(
+ property: r'scriptSigAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmEndsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.endsWith(
+ property: r'scriptSigAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmContains(
+ String value,
+ {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.contains(
+ property: r'scriptSigAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmMatches(
+ String pattern,
+ {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.matches(
+ property: r'scriptSigAsm',
+ wildcard: pattern,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder scriptSigAsmIsEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'scriptSigAsm',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptSigAsmIsNotEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ property: r'scriptSigAsm',
+ value: '',
+ ));
+ });
+ }
+
QueryBuilder scriptSigHexIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
diff --git a/lib/models/isar/models/blockchain_data/v2/output_v2.dart b/lib/models/isar/models/blockchain_data/v2/output_v2.dart
index 30e24539e..f096d8a90 100644
--- a/lib/models/isar/models/blockchain_data/v2/output_v2.dart
+++ b/lib/models/isar/models/blockchain_data/v2/output_v2.dart
@@ -6,6 +6,7 @@ part 'output_v2.g.dart';
@Embedded()
class OutputV2 {
late final String scriptPubKeyHex;
+ late final String? scriptPubKeyAsm;
late final String valueStringSats;
late final List addresses;
@@ -18,24 +19,28 @@ class OutputV2 {
static OutputV2 isarCantDoRequiredInDefaultConstructor({
required String scriptPubKeyHex,
+ String? scriptPubKeyAsm,
required String valueStringSats,
required List addresses,
required bool walletOwns,
}) =>
OutputV2()
..scriptPubKeyHex = scriptPubKeyHex
+ ..scriptPubKeyAsm = scriptPubKeyAsm
..valueStringSats = valueStringSats
..walletOwns = walletOwns
..addresses = List.unmodifiable(addresses);
OutputV2 copyWith({
String? scriptPubKeyHex,
+ String? scriptPubKeyAsm,
String? valueStringSats,
List? addresses,
bool? walletOwns,
}) {
return OutputV2.isarCantDoRequiredInDefaultConstructor(
scriptPubKeyHex: scriptPubKeyHex ?? this.scriptPubKeyHex,
+ scriptPubKeyAsm: scriptPubKeyAsm ?? this.scriptPubKeyAsm,
valueStringSats: valueStringSats ?? this.valueStringSats,
addresses: addresses ?? this.addresses,
walletOwns: walletOwns ?? this.walletOwns,
@@ -46,6 +51,7 @@ class OutputV2 {
Map json, {
required bool walletOwns,
required int decimalPlaces,
+ bool isFullAmountNotSats = false,
}) {
try {
List addresses = [];
@@ -60,9 +66,11 @@ class OutputV2 {
return OutputV2.isarCantDoRequiredInDefaultConstructor(
scriptPubKeyHex: json["scriptPubKey"]["hex"] as String,
+ scriptPubKeyAsm: json["scriptPubKey"]["asm"] as String?,
valueStringSats: parseOutputAmountString(
json["value"].toString(),
decimalPlaces: decimalPlaces,
+ isFullAmountNotSats: isFullAmountNotSats,
),
addresses: addresses,
walletOwns: walletOwns,
@@ -75,6 +83,7 @@ class OutputV2 {
static String parseOutputAmountString(
String amount, {
required int decimalPlaces,
+ bool isFullAmountNotSats = false,
}) {
final temp = Decimal.parse(amount);
if (temp < Decimal.zero) {
@@ -82,7 +91,9 @@ class OutputV2 {
}
final String valueStringSats;
- if (temp.isInteger) {
+ if (isFullAmountNotSats) {
+ valueStringSats = temp.shift(decimalPlaces).toBigInt().toString();
+ } else if (temp.isInteger) {
valueStringSats = temp.toString();
} else {
valueStringSats = temp.shift(decimalPlaces).toBigInt().toString();
@@ -95,27 +106,10 @@ class OutputV2 {
String toString() {
return 'OutputV2(\n'
' scriptPubKeyHex: $scriptPubKeyHex,\n'
+ ' scriptPubKeyAsm: $scriptPubKeyAsm,\n'
' value: $value,\n'
' walletOwns: $walletOwns,\n'
' addresses: $addresses,\n'
')';
}
}
-
-bool _listEquals(List a, List b) {
- if (T != U) {
- return false;
- }
-
- if (a.length != b.length) {
- return false;
- }
-
- for (int i = 0; i < a.length; i++) {
- if (a[i] != b[i]) {
- return false;
- }
- }
-
- return true;
-}
diff --git a/lib/models/isar/models/blockchain_data/v2/output_v2.g.dart b/lib/models/isar/models/blockchain_data/v2/output_v2.g.dart
index bf966d5ec..e26075d44 100644
--- a/lib/models/isar/models/blockchain_data/v2/output_v2.g.dart
+++ b/lib/models/isar/models/blockchain_data/v2/output_v2.g.dart
@@ -18,18 +18,23 @@ const OutputV2Schema = Schema(
name: r'addresses',
type: IsarType.stringList,
),
- r'scriptPubKeyHex': PropertySchema(
+ r'scriptPubKeyAsm': PropertySchema(
id: 1,
+ name: r'scriptPubKeyAsm',
+ type: IsarType.string,
+ ),
+ r'scriptPubKeyHex': PropertySchema(
+ id: 2,
name: r'scriptPubKeyHex',
type: IsarType.string,
),
r'valueStringSats': PropertySchema(
- id: 2,
+ id: 3,
name: r'valueStringSats',
type: IsarType.string,
),
r'walletOwns': PropertySchema(
- id: 3,
+ id: 4,
name: r'walletOwns',
type: IsarType.bool,
)
@@ -53,6 +58,12 @@ int _outputV2EstimateSize(
bytesCount += value.length * 3;
}
}
+ {
+ final value = object.scriptPubKeyAsm;
+ if (value != null) {
+ bytesCount += 3 + value.length * 3;
+ }
+ }
bytesCount += 3 + object.scriptPubKeyHex.length * 3;
bytesCount += 3 + object.valueStringSats.length * 3;
return bytesCount;
@@ -65,9 +76,10 @@ void _outputV2Serialize(
Map> allOffsets,
) {
writer.writeStringList(offsets[0], object.addresses);
- writer.writeString(offsets[1], object.scriptPubKeyHex);
- writer.writeString(offsets[2], object.valueStringSats);
- writer.writeBool(offsets[3], object.walletOwns);
+ writer.writeString(offsets[1], object.scriptPubKeyAsm);
+ writer.writeString(offsets[2], object.scriptPubKeyHex);
+ writer.writeString(offsets[3], object.valueStringSats);
+ writer.writeBool(offsets[4], object.walletOwns);
}
OutputV2 _outputV2Deserialize(
@@ -78,9 +90,10 @@ OutputV2 _outputV2Deserialize(
) {
final object = OutputV2();
object.addresses = reader.readStringList(offsets[0]) ?? [];
- object.scriptPubKeyHex = reader.readString(offsets[1]);
- object.valueStringSats = reader.readString(offsets[2]);
- object.walletOwns = reader.readBool(offsets[3]);
+ object.scriptPubKeyAsm = reader.readStringOrNull(offsets[1]);
+ object.scriptPubKeyHex = reader.readString(offsets[2]);
+ object.valueStringSats = reader.readString(offsets[3]);
+ object.walletOwns = reader.readBool(offsets[4]);
return object;
}
@@ -94,10 +107,12 @@ P _outputV2DeserializeProp(
case 0:
return (reader.readStringList(offset) ?? []) as P;
case 1:
- return (reader.readString(offset)) as P;
+ return (reader.readStringOrNull(offset)) as P;
case 2:
return (reader.readString(offset)) as P;
case 3:
+ return (reader.readString(offset)) as P;
+ case 4:
return (reader.readBool(offset)) as P;
default:
throw IsarError('Unknown property with id $propertyId');
@@ -330,6 +345,160 @@ extension OutputV2QueryFilter
});
}
+ QueryBuilder
+ scriptPubKeyAsmIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'scriptPubKeyAsm',
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'scriptPubKeyAsm',
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmEqualTo(
+ String? value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'scriptPubKeyAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmGreaterThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'scriptPubKeyAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmLessThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'scriptPubKeyAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmBetween(
+ String? lower,
+ String? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'scriptPubKeyAsm',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmStartsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.startsWith(
+ property: r'scriptPubKeyAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmEndsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.endsWith(
+ property: r'scriptPubKeyAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmContains(String value, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.contains(
+ property: r'scriptPubKeyAsm',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmMatches(String pattern, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.matches(
+ property: r'scriptPubKeyAsm',
+ wildcard: pattern,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmIsEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'scriptPubKeyAsm',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ scriptPubKeyAsmIsNotEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ property: r'scriptPubKeyAsm',
+ value: '',
+ ));
+ });
+ }
+
QueryBuilder
scriptPubKeyHexEqualTo(
String value, {
diff --git a/lib/models/isar/models/blockchain_data/v2/transaction_v2.dart b/lib/models/isar/models/blockchain_data/v2/transaction_v2.dart
index eaa548453..470bd483b 100644
--- a/lib/models/isar/models/blockchain_data/v2/transaction_v2.dart
+++ b/lib/models/isar/models/blockchain_data/v2/transaction_v2.dart
@@ -1,3 +1,4 @@
+import 'dart:convert';
import 'dart:math';
import 'package:isar/isar.dart';
@@ -5,7 +6,8 @@ import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'
import 'package:stackwallet/models/isar/models/blockchain_data/v2/input_v2.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/v2/output_v2.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
-import 'package:stackwallet/utilities/enums/coin_enum.dart';
+import 'package:stackwallet/utilities/extensions/extensions.dart';
+import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
part 'transaction_v2.g.dart';
@@ -37,6 +39,8 @@ class TransactionV2 {
@enumerated
final TransactionSubType subType;
+ final String? otherData;
+
TransactionV2({
required this.walletId,
required this.blockHash,
@@ -49,8 +53,21 @@ class TransactionV2 {
required this.version,
required this.type,
required this.subType,
+ required this.otherData,
});
+ bool get isEpiccashTransaction =>
+ _getFromOtherData(key: "isEpiccashTransaction") == true;
+ int? get numberOfMessages =>
+ _getFromOtherData(key: "numberOfMessages") as int?;
+ String? get slateId => _getFromOtherData(key: "slateId") as String?;
+ String? get onChainNote => _getFromOtherData(key: "onChainNote") as String?;
+ bool get isCancelled => _getFromOtherData(key: "isCancelled") == true;
+
+ String? get contractAddress =>
+ _getFromOtherData(key: "contractAddress") as String?;
+ int? get nonce => _getFromOtherData(key: "nonce") as int?;
+
int getConfirmations(int currentChainHeight) {
if (height == null || height! <= 0) return 0;
return max(0, currentChainHeight - (height! - 1));
@@ -61,37 +78,63 @@ class TransactionV2 {
return confirmations >= minimumConfirms;
}
- Amount getFee({required Coin coin}) {
+ Amount getFee({required int fractionDigits}) {
+ // check for override fee
+ final fee = _getOverrideFee();
+ if (fee != null) {
+ return fee;
+ }
+
final inSum =
inputs.map((e) => e.value).reduce((value, element) => value += element);
final outSum = outputs
.map((e) => e.value)
.reduce((value, element) => value += element);
- return Amount(rawValue: inSum - outSum, fractionDigits: coin.decimals);
+ return Amount(rawValue: inSum - outSum, fractionDigits: fractionDigits);
}
- Amount getAmountReceivedThisWallet({required Coin coin}) {
+ Amount getAmountReceivedInThisWallet({required int fractionDigits}) {
final outSum = outputs
.where((e) => e.walletOwns)
.fold(BigInt.zero, (p, e) => p + e.value);
- return Amount(rawValue: outSum, fractionDigits: coin.decimals);
+ return Amount(rawValue: outSum, fractionDigits: fractionDigits);
}
- Amount getAmountSentFromThisWallet({required Coin coin}) {
+ Amount getAmountSparkSelfMinted({required int fractionDigits}) {
+ final outSum = outputs.where((e) {
+ final op = e.scriptPubKeyHex.substring(0, 2).toUint8ListFromHex.first;
+ return e.walletOwns && (op == OP_SPARKMINT);
+ }).fold(BigInt.zero, (p, e) => p + e.value);
+
+ return Amount(rawValue: outSum, fractionDigits: fractionDigits);
+ }
+
+ Amount getAmountSentFromThisWallet({required int fractionDigits}) {
final inSum = inputs
.where((e) => e.walletOwns)
.fold(BigInt.zero, (p, e) => p + e.value);
- return Amount(
+ Amount amount = Amount(
rawValue: inSum,
- fractionDigits: coin.decimals,
+ fractionDigits: fractionDigits,
) -
- getAmountReceivedThisWallet(
- coin: coin,
- ) -
- getFee(coin: coin);
+ getAmountReceivedInThisWallet(
+ fractionDigits: fractionDigits,
+ );
+
+ if (subType != TransactionSubType.ethToken) {
+ amount = amount - getFee(fractionDigits: fractionDigits);
+ }
+
+ // negative amounts are likely an error or can happen with coins such as eth
+ // that don't use the btc style inputs/outputs
+ if (amount.raw < BigInt.zero) {
+ return Amount.zeroWith(fractionDigits: fractionDigits);
+ }
+
+ return amount;
}
Set associatedAddresses() => {
@@ -99,6 +142,95 @@ class TransactionV2 {
...outputs.map((e) => e.addresses).expand((e) => e),
};
+ Amount? _getOverrideFee() {
+ try {
+ return Amount.fromSerializedJsonString(
+ _getFromOtherData(key: "overrideFee") as String,
+ );
+ } catch (_) {
+ return null;
+ }
+ }
+
+ String statusLabel({
+ required int currentChainHeight,
+ required int minConfirms,
+ }) {
+ if (subType == TransactionSubType.cashFusion ||
+ subType == TransactionSubType.mint ||
+ (subType == TransactionSubType.sparkMint &&
+ type == TransactionType.sentToSelf)) {
+ if (isConfirmed(currentChainHeight, minConfirms)) {
+ return "Anonymized";
+ } else {
+ return "Anonymizing";
+ }
+ }
+
+ if (isEpiccashTransaction) {
+ if (slateId == null) {
+ return "Restored Funds";
+ }
+
+ if (isCancelled) {
+ return "Cancelled";
+ } else if (type == TransactionType.incoming) {
+ if (isConfirmed(currentChainHeight, minConfirms)) {
+ return "Received";
+ } else {
+ if (numberOfMessages == 1) {
+ return "Receiving (waiting for sender)";
+ } else if ((numberOfMessages ?? 0) > 1) {
+ return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no)
+ } else {
+ return "Receiving";
+ }
+ }
+ } else if (type == TransactionType.outgoing) {
+ if (isConfirmed(currentChainHeight, minConfirms)) {
+ return "Sent (confirmed)";
+ } else {
+ if (numberOfMessages == 1) {
+ return "Sending (waiting for receiver)";
+ } else if ((numberOfMessages ?? 0) > 1) {
+ return "Sending (waiting for confirmations)";
+ } else {
+ return "Sending";
+ }
+ }
+ }
+ }
+
+ if (type == TransactionType.incoming) {
+ // if (_transaction.isMinting) {
+ // return "Minting";
+ // } else
+ if (isConfirmed(currentChainHeight, minConfirms)) {
+ return "Received";
+ } else {
+ return "Receiving";
+ }
+ } else if (type == TransactionType.outgoing) {
+ if (isConfirmed(currentChainHeight, minConfirms)) {
+ return "Sent";
+ } else {
+ return "Sending";
+ }
+ } else if (type == TransactionType.sentToSelf) {
+ return "Sent to self";
+ } else {
+ return type.name;
+ }
+ }
+
+ dynamic _getFromOtherData({required dynamic key}) {
+ if (otherData == null) {
+ return null;
+ }
+ final map = jsonDecode(otherData!);
+ return map[key];
+ }
+
@override
String toString() {
return 'TransactionV2(\n'
@@ -113,15 +245,7 @@ class TransactionV2 {
' version: $version,\n'
' inputs: $inputs,\n'
' outputs: $outputs,\n'
+ ' otherData: $otherData,\n'
')';
}
}
-
-enum TxDirection {
- outgoing,
- incoming;
-}
-
-enum TxType {
- normal,
-}
diff --git a/lib/models/isar/models/blockchain_data/v2/transaction_v2.g.dart b/lib/models/isar/models/blockchain_data/v2/transaction_v2.g.dart
index 47fd5b936..83006da89 100644
--- a/lib/models/isar/models/blockchain_data/v2/transaction_v2.g.dart
+++ b/lib/models/isar/models/blockchain_data/v2/transaction_v2.g.dart
@@ -22,57 +22,97 @@ const TransactionV2Schema = CollectionSchema(
name: r'blockHash',
type: IsarType.string,
),
- r'hash': PropertySchema(
+ r'contractAddress': PropertySchema(
id: 1,
+ name: r'contractAddress',
+ type: IsarType.string,
+ ),
+ r'hash': PropertySchema(
+ id: 2,
name: r'hash',
type: IsarType.string,
),
r'height': PropertySchema(
- id: 2,
+ id: 3,
name: r'height',
type: IsarType.long,
),
r'inputs': PropertySchema(
- id: 3,
+ id: 4,
name: r'inputs',
type: IsarType.objectList,
target: r'InputV2',
),
+ r'isCancelled': PropertySchema(
+ id: 5,
+ name: r'isCancelled',
+ type: IsarType.bool,
+ ),
+ r'isEpiccashTransaction': PropertySchema(
+ id: 6,
+ name: r'isEpiccashTransaction',
+ type: IsarType.bool,
+ ),
+ r'nonce': PropertySchema(
+ id: 7,
+ name: r'nonce',
+ type: IsarType.long,
+ ),
+ r'numberOfMessages': PropertySchema(
+ id: 8,
+ name: r'numberOfMessages',
+ type: IsarType.long,
+ ),
+ r'onChainNote': PropertySchema(
+ id: 9,
+ name: r'onChainNote',
+ type: IsarType.string,
+ ),
+ r'otherData': PropertySchema(
+ id: 10,
+ name: r'otherData',
+ type: IsarType.string,
+ ),
r'outputs': PropertySchema(
- id: 4,
+ id: 11,
name: r'outputs',
type: IsarType.objectList,
target: r'OutputV2',
),
+ r'slateId': PropertySchema(
+ id: 12,
+ name: r'slateId',
+ type: IsarType.string,
+ ),
r'subType': PropertySchema(
- id: 5,
+ id: 13,
name: r'subType',
type: IsarType.byte,
enumMap: _TransactionV2subTypeEnumValueMap,
),
r'timestamp': PropertySchema(
- id: 6,
+ id: 14,
name: r'timestamp',
type: IsarType.long,
),
r'txid': PropertySchema(
- id: 7,
+ id: 15,
name: r'txid',
type: IsarType.string,
),
r'type': PropertySchema(
- id: 8,
+ id: 16,
name: r'type',
type: IsarType.byte,
enumMap: _TransactionV2typeEnumValueMap,
),
r'version': PropertySchema(
- id: 9,
+ id: 17,
name: r'version',
type: IsarType.long,
),
r'walletId': PropertySchema(
- id: 10,
+ id: 18,
name: r'walletId',
type: IsarType.string,
)
@@ -152,6 +192,12 @@ int _transactionV2EstimateSize(
bytesCount += 3 + value.length * 3;
}
}
+ {
+ final value = object.contractAddress;
+ if (value != null) {
+ bytesCount += 3 + value.length * 3;
+ }
+ }
bytesCount += 3 + object.hash.length * 3;
bytesCount += 3 + object.inputs.length * 3;
{
@@ -161,6 +207,18 @@ int _transactionV2EstimateSize(
bytesCount += InputV2Schema.estimateSize(value, offsets, allOffsets);
}
}
+ {
+ final value = object.onChainNote;
+ if (value != null) {
+ bytesCount += 3 + value.length * 3;
+ }
+ }
+ {
+ final value = object.otherData;
+ if (value != null) {
+ bytesCount += 3 + value.length * 3;
+ }
+ }
bytesCount += 3 + object.outputs.length * 3;
{
final offsets = allOffsets[OutputV2]!;
@@ -169,6 +227,12 @@ int _transactionV2EstimateSize(
bytesCount += OutputV2Schema.estimateSize(value, offsets, allOffsets);
}
}
+ {
+ final value = object.slateId;
+ if (value != null) {
+ bytesCount += 3 + value.length * 3;
+ }
+ }
bytesCount += 3 + object.txid.length * 3;
bytesCount += 3 + object.walletId.length * 3;
return bytesCount;
@@ -181,26 +245,34 @@ void _transactionV2Serialize(
Map> allOffsets,
) {
writer.writeString(offsets[0], object.blockHash);
- writer.writeString(offsets[1], object.hash);
- writer.writeLong(offsets[2], object.height);
+ writer.writeString(offsets[1], object.contractAddress);
+ writer.writeString(offsets[2], object.hash);
+ writer.writeLong(offsets[3], object.height);
writer.writeObjectList(
- offsets[3],
+ offsets[4],
allOffsets,
InputV2Schema.serialize,
object.inputs,
);
+ writer.writeBool(offsets[5], object.isCancelled);
+ writer.writeBool(offsets[6], object.isEpiccashTransaction);
+ writer.writeLong(offsets[7], object.nonce);
+ writer.writeLong(offsets[8], object.numberOfMessages);
+ writer.writeString(offsets[9], object.onChainNote);
+ writer.writeString(offsets[10], object.otherData);
writer.writeObjectList(
- offsets[4],
+ offsets[11],
allOffsets,
OutputV2Schema.serialize,
object.outputs,
);
- writer.writeByte(offsets[5], object.subType.index);
- writer.writeLong(offsets[6], object.timestamp);
- writer.writeString(offsets[7], object.txid);
- writer.writeByte(offsets[8], object.type.index);
- writer.writeLong(offsets[9], object.version);
- writer.writeString(offsets[10], object.walletId);
+ writer.writeString(offsets[12], object.slateId);
+ writer.writeByte(offsets[13], object.subType.index);
+ writer.writeLong(offsets[14], object.timestamp);
+ writer.writeString(offsets[15], object.txid);
+ writer.writeByte(offsets[16], object.type.index);
+ writer.writeLong(offsets[17], object.version);
+ writer.writeString(offsets[18], object.walletId);
}
TransactionV2 _transactionV2Deserialize(
@@ -211,31 +283,32 @@ TransactionV2 _transactionV2Deserialize(
) {
final object = TransactionV2(
blockHash: reader.readStringOrNull(offsets[0]),
- hash: reader.readString(offsets[1]),
- height: reader.readLongOrNull(offsets[2]),
+ hash: reader.readString(offsets[2]),
+ height: reader.readLongOrNull(offsets[3]),
inputs: reader.readObjectList(
- offsets[3],
+ offsets[4],
InputV2Schema.deserialize,
allOffsets,
InputV2(),
) ??
[],
+ otherData: reader.readStringOrNull(offsets[10]),
outputs: reader.readObjectList(
- offsets[4],
+ offsets[11],
OutputV2Schema.deserialize,
allOffsets,
OutputV2(),
) ??
[],
subType:
- _TransactionV2subTypeValueEnumMap[reader.readByteOrNull(offsets[5])] ??
+ _TransactionV2subTypeValueEnumMap[reader.readByteOrNull(offsets[13])] ??
TransactionSubType.none,
- timestamp: reader.readLong(offsets[6]),
- txid: reader.readString(offsets[7]),
- type: _TransactionV2typeValueEnumMap[reader.readByteOrNull(offsets[8])] ??
+ timestamp: reader.readLong(offsets[14]),
+ txid: reader.readString(offsets[15]),
+ type: _TransactionV2typeValueEnumMap[reader.readByteOrNull(offsets[16])] ??
TransactionType.outgoing,
- version: reader.readLong(offsets[9]),
- walletId: reader.readString(offsets[10]),
+ version: reader.readLong(offsets[17]),
+ walletId: reader.readString(offsets[18]),
);
object.id = id;
return object;
@@ -251,10 +324,12 @@ P _transactionV2DeserializeProp(
case 0:
return (reader.readStringOrNull(offset)) as P;
case 1:
- return (reader.readString(offset)) as P;
+ return (reader.readStringOrNull(offset)) as P;
case 2:
- return (reader.readLongOrNull(offset)) as P;
+ return (reader.readString(offset)) as P;
case 3:
+ return (reader.readLongOrNull(offset)) as P;
+ case 4:
return (reader.readObjectList(
offset,
InputV2Schema.deserialize,
@@ -262,7 +337,19 @@ P _transactionV2DeserializeProp(
InputV2(),
) ??
[]) as P;
- case 4:
+ case 5:
+ return (reader.readBool(offset)) as P;
+ case 6:
+ return (reader.readBool(offset)) as P;
+ case 7:
+ return (reader.readLongOrNull(offset)) as P;
+ case 8:
+ return (reader.readLongOrNull(offset)) as P;
+ case 9:
+ return (reader.readStringOrNull(offset)) as P;
+ case 10:
+ return (reader.readStringOrNull(offset)) as P;
+ case 11:
return (reader.readObjectList(
offset,
OutputV2Schema.deserialize,
@@ -270,20 +357,22 @@ P _transactionV2DeserializeProp(
OutputV2(),
) ??
[]) as P;
- case 5:
+ case 12:
+ return (reader.readStringOrNull(offset)) as P;
+ case 13:
return (_TransactionV2subTypeValueEnumMap[
reader.readByteOrNull(offset)] ??
TransactionSubType.none) as P;
- case 6:
+ case 14:
return (reader.readLong(offset)) as P;
- case 7:
+ case 15:
return (reader.readString(offset)) as P;
- case 8:
+ case 16:
return (_TransactionV2typeValueEnumMap[reader.readByteOrNull(offset)] ??
TransactionType.outgoing) as P;
- case 9:
+ case 17:
return (reader.readLong(offset)) as P;
- case 10:
+ case 18:
return (reader.readString(offset)) as P;
default:
throw IsarError('Unknown property with id $propertyId');
@@ -297,6 +386,9 @@ const _TransactionV2subTypeEnumValueMap = {
'join': 3,
'ethToken': 4,
'cashFusion': 5,
+ 'sparkMint': 6,
+ 'sparkSpend': 7,
+ 'ordinal': 8,
};
const _TransactionV2subTypeValueEnumMap = {
0: TransactionSubType.none,
@@ -305,6 +397,9 @@ const _TransactionV2subTypeValueEnumMap = {
3: TransactionSubType.join,
4: TransactionSubType.ethToken,
5: TransactionSubType.cashFusion,
+ 6: TransactionSubType.sparkMint,
+ 7: TransactionSubType.sparkSpend,
+ 8: TransactionSubType.ordinal,
};
const _TransactionV2typeEnumValueMap = {
'outgoing': 0,
@@ -892,6 +987,160 @@ extension TransactionV2QueryFilter
});
}
+ QueryBuilder
+ contractAddressIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'contractAddress',
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'contractAddress',
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressEqualTo(
+ String? value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'contractAddress',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressGreaterThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'contractAddress',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressLessThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'contractAddress',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressBetween(
+ String? lower,
+ String? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'contractAddress',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressStartsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.startsWith(
+ property: r'contractAddress',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressEndsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.endsWith(
+ property: r'contractAddress',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressContains(String value, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.contains(
+ property: r'contractAddress',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressMatches(String pattern, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.matches(
+ property: r'contractAddress',
+ wildcard: pattern,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressIsEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'contractAddress',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ contractAddressIsNotEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ property: r'contractAddress',
+ value: '',
+ ));
+ });
+ }
+
QueryBuilder hashEqualTo(
String value, {
bool caseSensitive = true,
@@ -1244,6 +1493,482 @@ extension TransactionV2QueryFilter
});
}
+ QueryBuilder
+ isCancelledEqualTo(bool value) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'isCancelled',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ isEpiccashTransactionEqualTo(bool value) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'isEpiccashTransaction',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ nonceIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'nonce',
+ ));
+ });
+ }
+
+ QueryBuilder
+ nonceIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'nonce',
+ ));
+ });
+ }
+
+ QueryBuilder
+ nonceEqualTo(int? value) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'nonce',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ nonceGreaterThan(
+ int? value, {
+ bool include = false,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'nonce',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ nonceLessThan(
+ int? value, {
+ bool include = false,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'nonce',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ nonceBetween(
+ int? lower,
+ int? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'nonce',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ ));
+ });
+ }
+
+ QueryBuilder
+ numberOfMessagesIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'numberOfMessages',
+ ));
+ });
+ }
+
+ QueryBuilder
+ numberOfMessagesIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'numberOfMessages',
+ ));
+ });
+ }
+
+ QueryBuilder
+ numberOfMessagesEqualTo(int? value) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'numberOfMessages',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ numberOfMessagesGreaterThan(
+ int? value, {
+ bool include = false,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'numberOfMessages',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ numberOfMessagesLessThan(
+ int? value, {
+ bool include = false,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'numberOfMessages',
+ value: value,
+ ));
+ });
+ }
+
+ QueryBuilder
+ numberOfMessagesBetween(
+ int? lower,
+ int? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'numberOfMessages',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'onChainNote',
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'onChainNote',
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteEqualTo(
+ String? value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'onChainNote',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteGreaterThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'onChainNote',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteLessThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'onChainNote',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteBetween(
+ String? lower,
+ String? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'onChainNote',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteStartsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.startsWith(
+ property: r'onChainNote',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteEndsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.endsWith(
+ property: r'onChainNote',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteContains(String value, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.contains(
+ property: r'onChainNote',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteMatches(String pattern, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.matches(
+ property: r'onChainNote',
+ wildcard: pattern,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteIsEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'onChainNote',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ onChainNoteIsNotEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ property: r'onChainNote',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'otherData',
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'otherData',
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataEqualTo(
+ String? value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'otherData',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataGreaterThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'otherData',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataLessThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'otherData',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataBetween(
+ String? lower,
+ String? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'otherData',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataStartsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.startsWith(
+ property: r'otherData',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataEndsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.endsWith(
+ property: r'otherData',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataContains(String value, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.contains(
+ property: r'otherData',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataMatches(String pattern, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.matches(
+ property: r'otherData',
+ wildcard: pattern,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataIsEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'otherData',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ otherDataIsNotEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ property: r'otherData',
+ value: '',
+ ));
+ });
+ }
+
QueryBuilder
outputsLengthEqualTo(int length) {
return QueryBuilder.apply(this, (query) {
@@ -1333,6 +2058,160 @@ extension TransactionV2QueryFilter
});
}
+ QueryBuilder
+ slateIdIsNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNull(
+ property: r'slateId',
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdIsNotNull() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(const FilterCondition.isNotNull(
+ property: r'slateId',
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdEqualTo(
+ String? value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'slateId',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdGreaterThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ include: include,
+ property: r'slateId',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdLessThan(
+ String? value, {
+ bool include = false,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.lessThan(
+ include: include,
+ property: r'slateId',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdBetween(
+ String? lower,
+ String? upper, {
+ bool includeLower = true,
+ bool includeUpper = true,
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.between(
+ property: r'slateId',
+ lower: lower,
+ includeLower: includeLower,
+ upper: upper,
+ includeUpper: includeUpper,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdStartsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.startsWith(
+ property: r'slateId',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdEndsWith(
+ String value, {
+ bool caseSensitive = true,
+ }) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.endsWith(
+ property: r'slateId',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdContains(String value, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.contains(
+ property: r'slateId',
+ value: value,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdMatches(String pattern, {bool caseSensitive = true}) {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.matches(
+ property: r'slateId',
+ wildcard: pattern,
+ caseSensitive: caseSensitive,
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdIsEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.equalTo(
+ property: r'slateId',
+ value: '',
+ ));
+ });
+ }
+
+ QueryBuilder
+ slateIdIsNotEmpty() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addFilterCondition(FilterCondition.greaterThan(
+ property: r'slateId',
+ value: '',
+ ));
+ });
+ }
+
QueryBuilder
subTypeEqualTo(TransactionSubType value) {
return QueryBuilder.apply(this, (query) {
@@ -1863,6 +2742,20 @@ extension TransactionV2QuerySortBy
});
}
+ QueryBuilder
+ sortByContractAddress() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'contractAddress', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ sortByContractAddressDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'contractAddress', Sort.desc);
+ });
+ }
+
QueryBuilder sortByHash() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'hash', Sort.asc);
@@ -1887,6 +2780,97 @@ extension TransactionV2QuerySortBy
});
}
+ QueryBuilder sortByIsCancelled() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isCancelled', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ sortByIsCancelledDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isCancelled', Sort.desc);
+ });
+ }
+
+ QueryBuilder
+ sortByIsEpiccashTransaction() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isEpiccashTransaction', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ sortByIsEpiccashTransactionDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isEpiccashTransaction', Sort.desc);
+ });
+ }
+
+ QueryBuilder sortByNonce() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'nonce', Sort.asc);
+ });
+ }
+
+ QueryBuilder sortByNonceDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'nonce', Sort.desc);
+ });
+ }
+
+ QueryBuilder
+ sortByNumberOfMessages() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'numberOfMessages', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ sortByNumberOfMessagesDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'numberOfMessages', Sort.desc);
+ });
+ }
+
+ QueryBuilder sortByOnChainNote() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'onChainNote', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ sortByOnChainNoteDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'onChainNote', Sort.desc);
+ });
+ }
+
+ QueryBuilder sortByOtherData() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'otherData', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ sortByOtherDataDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'otherData', Sort.desc);
+ });
+ }
+
+ QueryBuilder sortBySlateId() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'slateId', Sort.asc);
+ });
+ }
+
+ QueryBuilder sortBySlateIdDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'slateId', Sort.desc);
+ });
+ }
+
QueryBuilder sortBySubType() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'subType', Sort.asc);
@@ -1977,6 +2961,20 @@ extension TransactionV2QuerySortThenBy
});
}
+ QueryBuilder
+ thenByContractAddress() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'contractAddress', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ thenByContractAddressDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'contractAddress', Sort.desc);
+ });
+ }
+
QueryBuilder thenByHash() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'hash', Sort.asc);
@@ -2013,6 +3011,97 @@ extension TransactionV2QuerySortThenBy
});
}
+ QueryBuilder thenByIsCancelled() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isCancelled', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ thenByIsCancelledDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isCancelled', Sort.desc);
+ });
+ }
+
+ QueryBuilder
+ thenByIsEpiccashTransaction() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isEpiccashTransaction', Sort.asc);
+ });
+ }
+
+ QueryBuilder
+ thenByIsEpiccashTransactionDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'isEpiccashTransaction', Sort.desc);
+ });
+ }
+
+ QueryBuilder thenByNonce() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'nonce', Sort.asc);
+ });
+ }
+
+ QueryBuilder thenByNonceDesc() {
+ return QueryBuilder.apply(this, (query) {
+ return query.addSortBy(r'nonce', Sort.desc);
+ });
+ }
+
+ QueryBuilder