Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • DanBaDo/ginkgo
  • flodef/ginkgo
  • zicmama/ginkgo
  • vjrj/ginkgo
  • pokapow/ginkgo
  • weblate/ginkgo
6 results
Show changes
Showing
with 4298 additions and 0 deletions
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i5;
import '../../sp_core/crypto/account_id32.dart' as _i4;
import '../../sp_distance/computation_result.dart' as _i3;
/// Contains a variant per dispatchable extrinsic that this pallet has.
abstract class Call {
const Call();
factory Call.decode(_i1.Input input) {
return codec.decode(input);
}
static const $CallCodec codec = $CallCodec();
static const $Call values = $Call();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, dynamic> toJson();
}
class $Call {
const $Call();
RequestDistanceEvaluation requestDistanceEvaluation() {
return RequestDistanceEvaluation();
}
RequestDistanceEvaluationFor requestDistanceEvaluationFor(
{required int target}) {
return RequestDistanceEvaluationFor(target: target);
}
UpdateEvaluation updateEvaluation(
{required _i3.ComputationResult computationResult}) {
return UpdateEvaluation(computationResult: computationResult);
}
ForceUpdateEvaluation forceUpdateEvaluation({
required _i4.AccountId32 evaluator,
required _i3.ComputationResult computationResult,
}) {
return ForceUpdateEvaluation(
evaluator: evaluator,
computationResult: computationResult,
);
}
ForceValidDistanceStatus forceValidDistanceStatus({required int identity}) {
return ForceValidDistanceStatus(identity: identity);
}
}
class $CallCodec with _i1.Codec<Call> {
const $CallCodec();
@override
Call decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return const RequestDistanceEvaluation();
case 4:
return RequestDistanceEvaluationFor._decode(input);
case 1:
return UpdateEvaluation._decode(input);
case 2:
return ForceUpdateEvaluation._decode(input);
case 3:
return ForceValidDistanceStatus._decode(input);
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
switch (value.runtimeType) {
case RequestDistanceEvaluation:
(value as RequestDistanceEvaluation).encodeTo(output);
break;
case RequestDistanceEvaluationFor:
(value as RequestDistanceEvaluationFor).encodeTo(output);
break;
case UpdateEvaluation:
(value as UpdateEvaluation).encodeTo(output);
break;
case ForceUpdateEvaluation:
(value as ForceUpdateEvaluation).encodeTo(output);
break;
case ForceValidDistanceStatus:
(value as ForceValidDistanceStatus).encodeTo(output);
break;
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Call value) {
switch (value.runtimeType) {
case RequestDistanceEvaluation:
return 1;
case RequestDistanceEvaluationFor:
return (value as RequestDistanceEvaluationFor)._sizeHint();
case UpdateEvaluation:
return (value as UpdateEvaluation)._sizeHint();
case ForceUpdateEvaluation:
return (value as ForceUpdateEvaluation)._sizeHint();
case ForceValidDistanceStatus:
return (value as ForceValidDistanceStatus)._sizeHint();
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// Request evaluation of the caller's identity distance.
///
/// This function allows the caller to request an evaluation of their distance.
/// A positive evaluation will lead to claiming or renewing membership, while a negative
/// evaluation will result in slashing for the caller.
class RequestDistanceEvaluation extends Call {
const RequestDistanceEvaluation();
@override
Map<String, dynamic> toJson() => {'request_distance_evaluation': null};
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
}
@override
bool operator ==(Object other) => other is RequestDistanceEvaluation;
@override
int get hashCode => runtimeType.hashCode;
}
/// Request evaluation of a target identity's distance.
///
/// This function allows the caller to request an evaluation of a specific target identity's distance.
/// This action is only permitted for unvalidated identities.
class RequestDistanceEvaluationFor extends Call {
const RequestDistanceEvaluationFor({required this.target});
factory RequestDistanceEvaluationFor._decode(_i1.Input input) {
return RequestDistanceEvaluationFor(
target: _i1.U32Codec.codec.decode(input));
}
/// T::IdtyIndex
final int target;
@override
Map<String, Map<String, int>> toJson() => {
'request_distance_evaluation_for': {'target': target}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(target);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
4,
output,
);
_i1.U32Codec.codec.encodeTo(
target,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is RequestDistanceEvaluationFor && other.target == target;
@override
int get hashCode => target.hashCode;
}
/// Push an evaluation result to the pool.
///
/// This inherent function is called internally by validators to push an evaluation result
/// to the evaluation pool.
class UpdateEvaluation extends Call {
const UpdateEvaluation({required this.computationResult});
factory UpdateEvaluation._decode(_i1.Input input) {
return UpdateEvaluation(
computationResult: _i3.ComputationResult.codec.decode(input));
}
/// ComputationResult
final _i3.ComputationResult computationResult;
@override
Map<String, Map<String, Map<String, List<int>>>> toJson() => {
'update_evaluation': {'computationResult': computationResult.toJson()}
};
int _sizeHint() {
int size = 1;
size = size + _i3.ComputationResult.codec.sizeHint(computationResult);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i3.ComputationResult.codec.encodeTo(
computationResult,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is UpdateEvaluation && other.computationResult == computationResult;
@override
int get hashCode => computationResult.hashCode;
}
/// Force push an evaluation result to the pool.
///
/// It is primarily used for testing purposes.
///
/// - `origin`: Must be `Root`.
class ForceUpdateEvaluation extends Call {
const ForceUpdateEvaluation({
required this.evaluator,
required this.computationResult,
});
factory ForceUpdateEvaluation._decode(_i1.Input input) {
return ForceUpdateEvaluation(
evaluator: const _i1.U8ArrayCodec(32).decode(input),
computationResult: _i3.ComputationResult.codec.decode(input),
);
}
/// <T as frame_system::Config>::AccountId
final _i4.AccountId32 evaluator;
/// ComputationResult
final _i3.ComputationResult computationResult;
@override
Map<String, Map<String, dynamic>> toJson() => {
'force_update_evaluation': {
'evaluator': evaluator.toList(),
'computationResult': computationResult.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.AccountId32Codec().sizeHint(evaluator);
size = size + _i3.ComputationResult.codec.sizeHint(computationResult);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
evaluator,
output,
);
_i3.ComputationResult.codec.encodeTo(
computationResult,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ForceUpdateEvaluation &&
_i5.listsEqual(
other.evaluator,
evaluator,
) &&
other.computationResult == computationResult;
@override
int get hashCode => Object.hash(
evaluator,
computationResult,
);
}
/// Force set the distance evaluation status of an identity.
///
/// It is primarily used for testing purposes.
///
/// - `origin`: Must be `Root`.
class ForceValidDistanceStatus extends Call {
const ForceValidDistanceStatus({required this.identity});
factory ForceValidDistanceStatus._decode(_i1.Input input) {
return ForceValidDistanceStatus(identity: _i1.U32Codec.codec.decode(input));
}
/// <T as pallet_identity::Config>::IdtyIndex
final int identity;
@override
Map<String, Map<String, int>> toJson() => {
'force_valid_distance_status': {'identity': identity}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(identity);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
_i1.U32Codec.codec.encodeTo(
identity,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ForceValidDistanceStatus && other.identity == identity;
@override
int get hashCode => identity.hashCode;
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
/// The `Error` enum of this pallet.
enum Error {
/// Distance is already under evaluation.
alreadyInEvaluation('AlreadyInEvaluation', 0),
/// Too many evaluations requested by author.
tooManyEvaluationsByAuthor('TooManyEvaluationsByAuthor', 1),
/// Too many evaluations for this block.
tooManyEvaluationsInBlock('TooManyEvaluationsInBlock', 2),
/// No author for this block.
noAuthor('NoAuthor', 3),
/// Caller has no identity.
callerHasNoIdentity('CallerHasNoIdentity', 4),
/// Caller identity not found.
callerIdentityNotFound('CallerIdentityNotFound', 5),
/// Caller not member.
callerNotMember('CallerNotMember', 6),
callerStatusInvalid('CallerStatusInvalid', 7),
/// Target identity not found.
targetIdentityNotFound('TargetIdentityNotFound', 8),
/// Evaluation queue is full.
queueFull('QueueFull', 9),
/// Too many evaluators in the current evaluation pool.
tooManyEvaluators('TooManyEvaluators', 10),
/// Evaluation result has a wrong length.
wrongResultLength('WrongResultLength', 11),
/// Targeted distance evaluation request is only possible for an unvalidated identity.
targetMustBeUnvalidated('TargetMustBeUnvalidated', 12);
const Error(
this.variantName,
this.codecIndex,
);
factory Error.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $ErrorCodec codec = $ErrorCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $ErrorCodec with _i1.Codec<Error> {
const $ErrorCodec();
@override
Error decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Error.alreadyInEvaluation;
case 1:
return Error.tooManyEvaluationsByAuthor;
case 2:
return Error.tooManyEvaluationsInBlock;
case 3:
return Error.noAuthor;
case 4:
return Error.callerHasNoIdentity;
case 5:
return Error.callerIdentityNotFound;
case 6:
return Error.callerNotMember;
case 7:
return Error.callerStatusInvalid;
case 8:
return Error.targetIdentityNotFound;
case 9:
return Error.queueFull;
case 10:
return Error.tooManyEvaluators;
case 11:
return Error.wrongResultLength;
case 12:
return Error.targetMustBeUnvalidated;
default:
throw Exception('Error: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Error value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i5;
import '../../sp_arithmetic/per_things/perbill.dart' as _i4;
import '../../sp_core/crypto/account_id32.dart' as _i3;
/// The `Event` enum of this pallet
abstract class Event {
const Event();
factory Event.decode(_i1.Input input) {
return codec.decode(input);
}
static const $EventCodec codec = $EventCodec();
static const $Event values = $Event();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, Map<String, dynamic>> toJson();
}
class $Event {
const $Event();
EvaluationRequested evaluationRequested({
required int idtyIndex,
required _i3.AccountId32 who,
}) {
return EvaluationRequested(
idtyIndex: idtyIndex,
who: who,
);
}
EvaluatedValid evaluatedValid({
required int idtyIndex,
required _i4.Perbill distance,
}) {
return EvaluatedValid(
idtyIndex: idtyIndex,
distance: distance,
);
}
EvaluatedInvalid evaluatedInvalid({
required int idtyIndex,
required _i4.Perbill distance,
}) {
return EvaluatedInvalid(
idtyIndex: idtyIndex,
distance: distance,
);
}
}
class $EventCodec with _i1.Codec<Event> {
const $EventCodec();
@override
Event decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return EvaluationRequested._decode(input);
case 1:
return EvaluatedValid._decode(input);
case 2:
return EvaluatedInvalid._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case EvaluationRequested:
(value as EvaluationRequested).encodeTo(output);
break;
case EvaluatedValid:
(value as EvaluatedValid).encodeTo(output);
break;
case EvaluatedInvalid:
(value as EvaluatedInvalid).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case EvaluationRequested:
return (value as EvaluationRequested)._sizeHint();
case EvaluatedValid:
return (value as EvaluatedValid)._sizeHint();
case EvaluatedInvalid:
return (value as EvaluatedInvalid)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A distance evaluation was requested.
class EvaluationRequested extends Event {
const EvaluationRequested({
required this.idtyIndex,
required this.who,
});
factory EvaluationRequested._decode(_i1.Input input) {
return EvaluationRequested(
idtyIndex: _i1.U32Codec.codec.decode(input),
who: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// T::AccountId
final _i3.AccountId32 who;
@override
Map<String, Map<String, dynamic>> toJson() => {
'EvaluationRequested': {
'idtyIndex': idtyIndex,
'who': who.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i3.AccountId32Codec().sizeHint(who);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
who,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is EvaluationRequested &&
other.idtyIndex == idtyIndex &&
_i5.listsEqual(
other.who,
who,
);
@override
int get hashCode => Object.hash(
idtyIndex,
who,
);
}
/// Distance rule was found valid.
class EvaluatedValid extends Event {
const EvaluatedValid({
required this.idtyIndex,
required this.distance,
});
factory EvaluatedValid._decode(_i1.Input input) {
return EvaluatedValid(
idtyIndex: _i1.U32Codec.codec.decode(input),
distance: _i1.U32Codec.codec.decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// Perbill
final _i4.Perbill distance;
@override
Map<String, Map<String, int>> toJson() => {
'EvaluatedValid': {
'idtyIndex': idtyIndex,
'distance': distance,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i4.PerbillCodec().sizeHint(distance);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
_i1.U32Codec.codec.encodeTo(
distance,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is EvaluatedValid &&
other.idtyIndex == idtyIndex &&
other.distance == distance;
@override
int get hashCode => Object.hash(
idtyIndex,
distance,
);
}
/// Distance rule was found invalid.
class EvaluatedInvalid extends Event {
const EvaluatedInvalid({
required this.idtyIndex,
required this.distance,
});
factory EvaluatedInvalid._decode(_i1.Input input) {
return EvaluatedInvalid(
idtyIndex: _i1.U32Codec.codec.decode(input),
distance: _i1.U32Codec.codec.decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// Perbill
final _i4.Perbill distance;
@override
Map<String, Map<String, int>> toJson() => {
'EvaluatedInvalid': {
'idtyIndex': idtyIndex,
'distance': distance,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i4.PerbillCodec().sizeHint(distance);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
_i1.U32Codec.codec.encodeTo(
distance,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is EvaluatedInvalid &&
other.idtyIndex == idtyIndex &&
other.distance == distance;
@override
int get hashCode => Object.hash(
idtyIndex,
distance,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
enum HoldReason {
distanceHold('DistanceHold', 0);
const HoldReason(
this.variantName,
this.codecIndex,
);
factory HoldReason.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $HoldReasonCodec codec = $HoldReasonCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $HoldReasonCodec with _i1.Codec<HoldReason> {
const $HoldReasonCodec();
@override
HoldReason decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return HoldReason.distanceHold;
default:
throw Exception('HoldReason: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
HoldReason value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i5;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i6;
import '../../bounded_collections/bounded_btree_set/bounded_b_tree_set.dart'
as _i4;
import '../../sp_core/crypto/account_id32.dart' as _i7;
import '../../tuples.dart' as _i2;
import '../median/median_acc.dart' as _i3;
class EvaluationPool {
const EvaluationPool({
required this.evaluations,
required this.evaluators,
});
factory EvaluationPool.decode(_i1.Input input) {
return codec.decode(input);
}
/// BoundedVec<(IdtyIndex, MedianAcc<Perbill, MAX_EVALUATORS_PER_SESSION>),
///ConstU32<MAX_EVALUATIONS_PER_SESSION>,>
final List<_i2.Tuple2<int, _i3.MedianAcc>> evaluations;
/// BoundedBTreeSet<AccountId, ConstU32<MAX_EVALUATORS_PER_SESSION>>
final _i4.BoundedBTreeSet evaluators;
static const $EvaluationPoolCodec codec = $EvaluationPoolCodec();
_i5.Uint8List encode() {
return codec.encode(this);
}
Map<String, List<List<dynamic>>> toJson() => {
'evaluations': evaluations
.map((value) => [
value.value0,
value.value1.toJson(),
])
.toList(),
'evaluators': evaluators.map((value) => value.toList()).toList(),
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is EvaluationPool &&
_i6.listsEqual(
other.evaluations,
evaluations,
) &&
other.evaluators == evaluators;
@override
int get hashCode => Object.hash(
evaluations,
evaluators,
);
}
class $EvaluationPoolCodec with _i1.Codec<EvaluationPool> {
const $EvaluationPoolCodec();
@override
void encodeTo(
EvaluationPool obj,
_i1.Output output,
) {
const _i1.SequenceCodec<_i2.Tuple2<int, _i3.MedianAcc>>(
_i2.Tuple2Codec<int, _i3.MedianAcc>(
_i1.U32Codec.codec,
_i3.MedianAcc.codec,
)).encodeTo(
obj.evaluations,
output,
);
const _i1.SequenceCodec<_i7.AccountId32>(_i7.AccountId32Codec()).encodeTo(
obj.evaluators,
output,
);
}
@override
EvaluationPool decode(_i1.Input input) {
return EvaluationPool(
evaluations: const _i1.SequenceCodec<_i2.Tuple2<int, _i3.MedianAcc>>(
_i2.Tuple2Codec<int, _i3.MedianAcc>(
_i1.U32Codec.codec,
_i3.MedianAcc.codec,
)).decode(input),
evaluators:
const _i1.SequenceCodec<_i7.AccountId32>(_i7.AccountId32Codec())
.decode(input),
);
}
@override
int sizeHint(EvaluationPool obj) {
int size = 0;
size = size +
const _i1.SequenceCodec<_i2.Tuple2<int, _i3.MedianAcc>>(
_i2.Tuple2Codec<int, _i3.MedianAcc>(
_i1.U32Codec.codec,
_i3.MedianAcc.codec,
)).sizeHint(obj.evaluations);
size = size + const _i4.BoundedBTreeSetCodec().sizeHint(obj.evaluators);
return size;
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
/// Contains a variant per dispatchable extrinsic that this pallet has.
enum Call {
/// Unlink the identity associated with the account.
unlinkIdentity('unlink_identity', 0);
const Call(
this.variantName,
this.codecIndex,
);
factory Call.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $CallCodec codec = $CallCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $CallCodec with _i1.Codec<Call> {
const $CallCodec();
@override
Call decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Call.unlinkIdentity;
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i4;
import '../../sp_core/crypto/account_id32.dart' as _i3;
/// The `Event` enum of this pallet
abstract class Event {
const Event();
factory Event.decode(_i1.Input input) {
return codec.decode(input);
}
static const $EventCodec codec = $EventCodec();
static const $Event values = $Event();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, dynamic> toJson();
}
class $Event {
const $Event();
AccountLinked accountLinked({
required _i3.AccountId32 who,
required int identity,
}) {
return AccountLinked(
who: who,
identity: identity,
);
}
AccountUnlinked accountUnlinked(_i3.AccountId32 value0) {
return AccountUnlinked(value0);
}
}
class $EventCodec with _i1.Codec<Event> {
const $EventCodec();
@override
Event decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return AccountLinked._decode(input);
case 1:
return AccountUnlinked._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case AccountLinked:
(value as AccountLinked).encodeTo(output);
break;
case AccountUnlinked:
(value as AccountUnlinked).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case AccountLinked:
return (value as AccountLinked)._sizeHint();
case AccountUnlinked:
return (value as AccountUnlinked)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// account linked to identity
class AccountLinked extends Event {
const AccountLinked({
required this.who,
required this.identity,
});
factory AccountLinked._decode(_i1.Input input) {
return AccountLinked(
who: const _i1.U8ArrayCodec(32).decode(input),
identity: _i1.U32Codec.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 who;
/// IdtyIdOf<T>
final int identity;
@override
Map<String, Map<String, dynamic>> toJson() => {
'AccountLinked': {
'who': who.toList(),
'identity': identity,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(who);
size = size + _i1.U32Codec.codec.sizeHint(identity);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
who,
output,
);
_i1.U32Codec.codec.encodeTo(
identity,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is AccountLinked &&
_i4.listsEqual(
other.who,
who,
) &&
other.identity == identity;
@override
int get hashCode => Object.hash(
who,
identity,
);
}
/// The account was unlinked from its identity.
class AccountUnlinked extends Event {
const AccountUnlinked(this.value0);
factory AccountUnlinked._decode(_i1.Input input) {
return AccountUnlinked(const _i1.U8ArrayCodec(32).decode(input));
}
/// T::AccountId
final _i3.AccountId32 value0;
@override
Map<String, List<int>> toJson() => {'AccountUnlinked': value0.toList()};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(value0);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
value0,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is AccountUnlinked &&
_i4.listsEqual(
other.value0,
value0,
);
@override
int get hashCode => value0.hashCode;
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
class AccountData {
const AccountData({
required this.free,
required this.reserved,
required this.feeFrozen,
this.linkedIdty,
});
factory AccountData.decode(_i1.Input input) {
return codec.decode(input);
}
/// Balance
final BigInt free;
/// Balance
final BigInt reserved;
/// Balance
final BigInt feeFrozen;
/// Option<IdtyId>
final int? linkedIdty;
static const $AccountDataCodec codec = $AccountDataCodec();
_i2.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'free': free,
'reserved': reserved,
'feeFrozen': feeFrozen,
'linkedIdty': linkedIdty,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is AccountData &&
other.free == free &&
other.reserved == reserved &&
other.feeFrozen == feeFrozen &&
other.linkedIdty == linkedIdty;
@override
int get hashCode => Object.hash(
free,
reserved,
feeFrozen,
linkedIdty,
);
}
class $AccountDataCodec with _i1.Codec<AccountData> {
const $AccountDataCodec();
@override
void encodeTo(
AccountData obj,
_i1.Output output,
) {
_i1.U64Codec.codec.encodeTo(
obj.free,
output,
);
_i1.U64Codec.codec.encodeTo(
obj.reserved,
output,
);
_i1.U64Codec.codec.encodeTo(
obj.feeFrozen,
output,
);
const _i1.OptionCodec<int>(_i1.U32Codec.codec).encodeTo(
obj.linkedIdty,
output,
);
}
@override
AccountData decode(_i1.Input input) {
return AccountData(
free: _i1.U64Codec.codec.decode(input),
reserved: _i1.U64Codec.codec.decode(input),
feeFrozen: _i1.U64Codec.codec.decode(input),
linkedIdty: const _i1.OptionCodec<int>(_i1.U32Codec.codec).decode(input),
);
}
@override
int sizeHint(AccountData obj) {
int size = 0;
size = size + _i1.U64Codec.codec.sizeHint(obj.free);
size = size + _i1.U64Codec.codec.sizeHint(obj.reserved);
size = size + _i1.U64Codec.codec.sizeHint(obj.feeFrozen);
size = size +
const _i1.OptionCodec<int>(_i1.U32Codec.codec).sizeHint(obj.linkedIdty);
return size;
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
class Parameters {
const Parameters({
required this.babeEpochDuration,
required this.certPeriod,
required this.certMaxByIssuer,
required this.certMinReceivedCertToIssueCert,
required this.certValidityPeriod,
required this.idtyConfirmPeriod,
required this.idtyCreationPeriod,
required this.membershipPeriod,
required this.membershipRenewalPeriod,
required this.udCreationPeriod,
required this.udReevalPeriod,
required this.smithCertMaxByIssuer,
required this.smithWotMinCertForMembership,
required this.smithInactivityMaxDuration,
required this.wotFirstCertIssuableOn,
required this.wotMinCertForCreateIdtyRight,
required this.wotMinCertForMembership,
});
factory Parameters.decode(_i1.Input input) {
return codec.decode(input);
}
/// PeriodCount
final BigInt babeEpochDuration;
/// BlockNumber
final int certPeriod;
/// CertCount
final int certMaxByIssuer;
/// CertCount
final int certMinReceivedCertToIssueCert;
/// BlockNumber
final int certValidityPeriod;
/// BlockNumber
final int idtyConfirmPeriod;
/// BlockNumber
final int idtyCreationPeriod;
/// BlockNumber
final int membershipPeriod;
/// BlockNumber
final int membershipRenewalPeriod;
/// PeriodCount
final BigInt udCreationPeriod;
/// PeriodCount
final BigInt udReevalPeriod;
/// CertCount
final int smithCertMaxByIssuer;
/// CertCount
final int smithWotMinCertForMembership;
/// SessionCount
final int smithInactivityMaxDuration;
/// BlockNumber
final int wotFirstCertIssuableOn;
/// CertCount
final int wotMinCertForCreateIdtyRight;
/// CertCount
final int wotMinCertForMembership;
static const $ParametersCodec codec = $ParametersCodec();
_i2.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'babeEpochDuration': babeEpochDuration,
'certPeriod': certPeriod,
'certMaxByIssuer': certMaxByIssuer,
'certMinReceivedCertToIssueCert': certMinReceivedCertToIssueCert,
'certValidityPeriod': certValidityPeriod,
'idtyConfirmPeriod': idtyConfirmPeriod,
'idtyCreationPeriod': idtyCreationPeriod,
'membershipPeriod': membershipPeriod,
'membershipRenewalPeriod': membershipRenewalPeriod,
'udCreationPeriod': udCreationPeriod,
'udReevalPeriod': udReevalPeriod,
'smithCertMaxByIssuer': smithCertMaxByIssuer,
'smithWotMinCertForMembership': smithWotMinCertForMembership,
'smithInactivityMaxDuration': smithInactivityMaxDuration,
'wotFirstCertIssuableOn': wotFirstCertIssuableOn,
'wotMinCertForCreateIdtyRight': wotMinCertForCreateIdtyRight,
'wotMinCertForMembership': wotMinCertForMembership,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Parameters &&
other.babeEpochDuration == babeEpochDuration &&
other.certPeriod == certPeriod &&
other.certMaxByIssuer == certMaxByIssuer &&
other.certMinReceivedCertToIssueCert ==
certMinReceivedCertToIssueCert &&
other.certValidityPeriod == certValidityPeriod &&
other.idtyConfirmPeriod == idtyConfirmPeriod &&
other.idtyCreationPeriod == idtyCreationPeriod &&
other.membershipPeriod == membershipPeriod &&
other.membershipRenewalPeriod == membershipRenewalPeriod &&
other.udCreationPeriod == udCreationPeriod &&
other.udReevalPeriod == udReevalPeriod &&
other.smithCertMaxByIssuer == smithCertMaxByIssuer &&
other.smithWotMinCertForMembership == smithWotMinCertForMembership &&
other.smithInactivityMaxDuration == smithInactivityMaxDuration &&
other.wotFirstCertIssuableOn == wotFirstCertIssuableOn &&
other.wotMinCertForCreateIdtyRight == wotMinCertForCreateIdtyRight &&
other.wotMinCertForMembership == wotMinCertForMembership;
@override
int get hashCode => Object.hash(
babeEpochDuration,
certPeriod,
certMaxByIssuer,
certMinReceivedCertToIssueCert,
certValidityPeriod,
idtyConfirmPeriod,
idtyCreationPeriod,
membershipPeriod,
membershipRenewalPeriod,
udCreationPeriod,
udReevalPeriod,
smithCertMaxByIssuer,
smithWotMinCertForMembership,
smithInactivityMaxDuration,
wotFirstCertIssuableOn,
wotMinCertForCreateIdtyRight,
wotMinCertForMembership,
);
}
class $ParametersCodec with _i1.Codec<Parameters> {
const $ParametersCodec();
@override
void encodeTo(
Parameters obj,
_i1.Output output,
) {
_i1.U64Codec.codec.encodeTo(
obj.babeEpochDuration,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.certPeriod,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.certMaxByIssuer,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.certMinReceivedCertToIssueCert,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.certValidityPeriod,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.idtyConfirmPeriod,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.idtyCreationPeriod,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.membershipPeriod,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.membershipRenewalPeriod,
output,
);
_i1.U64Codec.codec.encodeTo(
obj.udCreationPeriod,
output,
);
_i1.U64Codec.codec.encodeTo(
obj.udReevalPeriod,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.smithCertMaxByIssuer,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.smithWotMinCertForMembership,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.smithInactivityMaxDuration,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.wotFirstCertIssuableOn,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.wotMinCertForCreateIdtyRight,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.wotMinCertForMembership,
output,
);
}
@override
Parameters decode(_i1.Input input) {
return Parameters(
babeEpochDuration: _i1.U64Codec.codec.decode(input),
certPeriod: _i1.U32Codec.codec.decode(input),
certMaxByIssuer: _i1.U32Codec.codec.decode(input),
certMinReceivedCertToIssueCert: _i1.U32Codec.codec.decode(input),
certValidityPeriod: _i1.U32Codec.codec.decode(input),
idtyConfirmPeriod: _i1.U32Codec.codec.decode(input),
idtyCreationPeriod: _i1.U32Codec.codec.decode(input),
membershipPeriod: _i1.U32Codec.codec.decode(input),
membershipRenewalPeriod: _i1.U32Codec.codec.decode(input),
udCreationPeriod: _i1.U64Codec.codec.decode(input),
udReevalPeriod: _i1.U64Codec.codec.decode(input),
smithCertMaxByIssuer: _i1.U32Codec.codec.decode(input),
smithWotMinCertForMembership: _i1.U32Codec.codec.decode(input),
smithInactivityMaxDuration: _i1.U32Codec.codec.decode(input),
wotFirstCertIssuableOn: _i1.U32Codec.codec.decode(input),
wotMinCertForCreateIdtyRight: _i1.U32Codec.codec.decode(input),
wotMinCertForMembership: _i1.U32Codec.codec.decode(input),
);
}
@override
int sizeHint(Parameters obj) {
int size = 0;
size = size + _i1.U64Codec.codec.sizeHint(obj.babeEpochDuration);
size = size + _i1.U32Codec.codec.sizeHint(obj.certPeriod);
size = size + _i1.U32Codec.codec.sizeHint(obj.certMaxByIssuer);
size =
size + _i1.U32Codec.codec.sizeHint(obj.certMinReceivedCertToIssueCert);
size = size + _i1.U32Codec.codec.sizeHint(obj.certValidityPeriod);
size = size + _i1.U32Codec.codec.sizeHint(obj.idtyConfirmPeriod);
size = size + _i1.U32Codec.codec.sizeHint(obj.idtyCreationPeriod);
size = size + _i1.U32Codec.codec.sizeHint(obj.membershipPeriod);
size = size + _i1.U32Codec.codec.sizeHint(obj.membershipRenewalPeriod);
size = size + _i1.U64Codec.codec.sizeHint(obj.udCreationPeriod);
size = size + _i1.U64Codec.codec.sizeHint(obj.udReevalPeriod);
size = size + _i1.U32Codec.codec.sizeHint(obj.smithCertMaxByIssuer);
size = size + _i1.U32Codec.codec.sizeHint(obj.smithWotMinCertForMembership);
size = size + _i1.U32Codec.codec.sizeHint(obj.smithInactivityMaxDuration);
size = size + _i1.U32Codec.codec.sizeHint(obj.wotFirstCertIssuableOn);
size = size + _i1.U32Codec.codec.sizeHint(obj.wotMinCertForCreateIdtyRight);
size = size + _i1.U32Codec.codec.sizeHint(obj.wotMinCertForMembership);
return size;
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
/// The `Error` enum of this pallet.
enum Error {
/// Insufficient certifications received.
notEnoughCerts('NotEnoughCerts', 0),
/// Target status is incompatible with this operation.
targetStatusInvalid('TargetStatusInvalid', 1),
/// Identity creation period not respected.
idtyCreationPeriodNotRespected('IdtyCreationPeriodNotRespected', 2),
/// Insufficient received certifications to create identity.
notEnoughReceivedCertsToCreateIdty('NotEnoughReceivedCertsToCreateIdty', 3),
/// Maximum number of emitted certifications reached.
maxEmittedCertsReached('MaxEmittedCertsReached', 4),
/// Issuer cannot emit a certification because it is not member.
issuerNotMember('IssuerNotMember', 5),
/// Issuer or receiver not found.
idtyNotFound('IdtyNotFound', 6),
/// Membership can only be renewed after an antispam delay.
membershipRenewalPeriodNotRespected('MembershipRenewalPeriodNotRespected', 7);
const Error(
this.variantName,
this.codecIndex,
);
factory Error.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $ErrorCodec codec = $ErrorCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $ErrorCodec with _i1.Codec<Error> {
const $ErrorCodec();
@override
Error decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Error.notEnoughCerts;
case 1:
return Error.targetStatusInvalid;
case 2:
return Error.idtyCreationPeriodNotRespected;
case 3:
return Error.notEnoughReceivedCertsToCreateIdty;
case 4:
return Error.maxEmittedCertsReached;
case 5:
return Error.issuerNotMember;
case 6:
return Error.idtyNotFound;
case 7:
return Error.membershipRenewalPeriodNotRespected;
default:
throw Exception('Error: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Error value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import '../../sp_consensus_grandpa/equivocation_proof.dart' as _i3;
import '../../sp_session/membership_proof.dart' as _i4;
/// Contains a variant per dispatchable extrinsic that this pallet has.
abstract class Call {
const Call();
factory Call.decode(_i1.Input input) {
return codec.decode(input);
}
static const $CallCodec codec = $CallCodec();
static const $Call values = $Call();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, Map<String, dynamic>> toJson();
}
class $Call {
const $Call();
ReportEquivocation reportEquivocation({
required _i3.EquivocationProof equivocationProof,
required _i4.MembershipProof keyOwnerProof,
}) {
return ReportEquivocation(
equivocationProof: equivocationProof,
keyOwnerProof: keyOwnerProof,
);
}
ReportEquivocationUnsigned reportEquivocationUnsigned({
required _i3.EquivocationProof equivocationProof,
required _i4.MembershipProof keyOwnerProof,
}) {
return ReportEquivocationUnsigned(
equivocationProof: equivocationProof,
keyOwnerProof: keyOwnerProof,
);
}
NoteStalled noteStalled({
required int delay,
required int bestFinalizedBlockNumber,
}) {
return NoteStalled(
delay: delay,
bestFinalizedBlockNumber: bestFinalizedBlockNumber,
);
}
}
class $CallCodec with _i1.Codec<Call> {
const $CallCodec();
@override
Call decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return ReportEquivocation._decode(input);
case 1:
return ReportEquivocationUnsigned._decode(input);
case 2:
return NoteStalled._decode(input);
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
switch (value.runtimeType) {
case ReportEquivocation:
(value as ReportEquivocation).encodeTo(output);
break;
case ReportEquivocationUnsigned:
(value as ReportEquivocationUnsigned).encodeTo(output);
break;
case NoteStalled:
(value as NoteStalled).encodeTo(output);
break;
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Call value) {
switch (value.runtimeType) {
case ReportEquivocation:
return (value as ReportEquivocation)._sizeHint();
case ReportEquivocationUnsigned:
return (value as ReportEquivocationUnsigned)._sizeHint();
case NoteStalled:
return (value as NoteStalled)._sizeHint();
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// Report voter equivocation/misbehavior. This method will verify the
/// equivocation proof and validate the given key ownership proof
/// against the extracted offender. If both are valid, the offence
/// will be reported.
class ReportEquivocation extends Call {
const ReportEquivocation({
required this.equivocationProof,
required this.keyOwnerProof,
});
factory ReportEquivocation._decode(_i1.Input input) {
return ReportEquivocation(
equivocationProof: _i3.EquivocationProof.codec.decode(input),
keyOwnerProof: _i4.MembershipProof.codec.decode(input),
);
}
/// Box<EquivocationProof<T::Hash, BlockNumberFor<T>>>
final _i3.EquivocationProof equivocationProof;
/// T::KeyOwnerProof
final _i4.MembershipProof keyOwnerProof;
@override
Map<String, Map<String, Map<String, dynamic>>> toJson() => {
'report_equivocation': {
'equivocationProof': equivocationProof.toJson(),
'keyOwnerProof': keyOwnerProof.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i3.EquivocationProof.codec.sizeHint(equivocationProof);
size = size + _i4.MembershipProof.codec.sizeHint(keyOwnerProof);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i3.EquivocationProof.codec.encodeTo(
equivocationProof,
output,
);
_i4.MembershipProof.codec.encodeTo(
keyOwnerProof,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ReportEquivocation &&
other.equivocationProof == equivocationProof &&
other.keyOwnerProof == keyOwnerProof;
@override
int get hashCode => Object.hash(
equivocationProof,
keyOwnerProof,
);
}
/// Report voter equivocation/misbehavior. This method will verify the
/// equivocation proof and validate the given key ownership proof
/// against the extracted offender. If both are valid, the offence
/// will be reported.
///
/// This extrinsic must be called unsigned and it is expected that only
/// block authors will call it (validated in `ValidateUnsigned`), as such
/// if the block author is defined it will be defined as the equivocation
/// reporter.
class ReportEquivocationUnsigned extends Call {
const ReportEquivocationUnsigned({
required this.equivocationProof,
required this.keyOwnerProof,
});
factory ReportEquivocationUnsigned._decode(_i1.Input input) {
return ReportEquivocationUnsigned(
equivocationProof: _i3.EquivocationProof.codec.decode(input),
keyOwnerProof: _i4.MembershipProof.codec.decode(input),
);
}
/// Box<EquivocationProof<T::Hash, BlockNumberFor<T>>>
final _i3.EquivocationProof equivocationProof;
/// T::KeyOwnerProof
final _i4.MembershipProof keyOwnerProof;
@override
Map<String, Map<String, Map<String, dynamic>>> toJson() => {
'report_equivocation_unsigned': {
'equivocationProof': equivocationProof.toJson(),
'keyOwnerProof': keyOwnerProof.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i3.EquivocationProof.codec.sizeHint(equivocationProof);
size = size + _i4.MembershipProof.codec.sizeHint(keyOwnerProof);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i3.EquivocationProof.codec.encodeTo(
equivocationProof,
output,
);
_i4.MembershipProof.codec.encodeTo(
keyOwnerProof,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ReportEquivocationUnsigned &&
other.equivocationProof == equivocationProof &&
other.keyOwnerProof == keyOwnerProof;
@override
int get hashCode => Object.hash(
equivocationProof,
keyOwnerProof,
);
}
/// Note that the current authority set of the GRANDPA finality gadget has stalled.
///
/// This will trigger a forced authority set change at the beginning of the next session, to
/// be enacted `delay` blocks after that. The `delay` should be high enough to safely assume
/// that the block signalling the forced change will not be re-orged e.g. 1000 blocks.
/// The block production rate (which may be slowed down because of finality lagging) should
/// be taken into account when choosing the `delay`. The GRANDPA voters based on the new
/// authority will start voting on top of `best_finalized_block_number` for new finalized
/// blocks. `best_finalized_block_number` should be the highest of the latest finalized
/// block of all validators of the new authority set.
///
/// Only callable by root.
class NoteStalled extends Call {
const NoteStalled({
required this.delay,
required this.bestFinalizedBlockNumber,
});
factory NoteStalled._decode(_i1.Input input) {
return NoteStalled(
delay: _i1.U32Codec.codec.decode(input),
bestFinalizedBlockNumber: _i1.U32Codec.codec.decode(input),
);
}
/// BlockNumberFor<T>
final int delay;
/// BlockNumberFor<T>
final int bestFinalizedBlockNumber;
@override
Map<String, Map<String, int>> toJson() => {
'note_stalled': {
'delay': delay,
'bestFinalizedBlockNumber': bestFinalizedBlockNumber,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(delay);
size = size + _i1.U32Codec.codec.sizeHint(bestFinalizedBlockNumber);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
_i1.U32Codec.codec.encodeTo(
delay,
output,
);
_i1.U32Codec.codec.encodeTo(
bestFinalizedBlockNumber,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is NoteStalled &&
other.delay == delay &&
other.bestFinalizedBlockNumber == bestFinalizedBlockNumber;
@override
int get hashCode => Object.hash(
delay,
bestFinalizedBlockNumber,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
/// The `Error` enum of this pallet.
enum Error {
/// Attempt to signal GRANDPA pause when the authority set isn't live
/// (either paused or already pending pause).
pauseFailed('PauseFailed', 0),
/// Attempt to signal GRANDPA resume when the authority set isn't paused
/// (either live or already pending resume).
resumeFailed('ResumeFailed', 1),
/// Attempt to signal GRANDPA change with one already pending.
changePending('ChangePending', 2),
/// Cannot signal forced change so soon after last.
tooSoon('TooSoon', 3),
/// A key ownership proof provided as part of an equivocation report is invalid.
invalidKeyOwnershipProof('InvalidKeyOwnershipProof', 4),
/// An equivocation proof provided as part of an equivocation report is invalid.
invalidEquivocationProof('InvalidEquivocationProof', 5),
/// A given equivocation report is valid but already previously reported.
duplicateOffenceReport('DuplicateOffenceReport', 6);
const Error(
this.variantName,
this.codecIndex,
);
factory Error.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $ErrorCodec codec = $ErrorCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $ErrorCodec with _i1.Codec<Error> {
const $ErrorCodec();
@override
Error decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Error.pauseFailed;
case 1:
return Error.resumeFailed;
case 2:
return Error.changePending;
case 3:
return Error.tooSoon;
case 4:
return Error.invalidKeyOwnershipProof;
case 5:
return Error.invalidEquivocationProof;
case 6:
return Error.duplicateOffenceReport;
default:
throw Exception('Error: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Error value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i5;
import '../../sp_consensus_grandpa/app/public.dart' as _i4;
import '../../tuples.dart' as _i3;
/// The `Event` enum of this pallet
abstract class Event {
const Event();
factory Event.decode(_i1.Input input) {
return codec.decode(input);
}
static const $EventCodec codec = $EventCodec();
static const $Event values = $Event();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, dynamic> toJson();
}
class $Event {
const $Event();
NewAuthorities newAuthorities(
{required List<_i3.Tuple2<_i4.Public, BigInt>> authoritySet}) {
return NewAuthorities(authoritySet: authoritySet);
}
Paused paused() {
return Paused();
}
Resumed resumed() {
return Resumed();
}
}
class $EventCodec with _i1.Codec<Event> {
const $EventCodec();
@override
Event decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return NewAuthorities._decode(input);
case 1:
return const Paused();
case 2:
return const Resumed();
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case NewAuthorities:
(value as NewAuthorities).encodeTo(output);
break;
case Paused:
(value as Paused).encodeTo(output);
break;
case Resumed:
(value as Resumed).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case NewAuthorities:
return (value as NewAuthorities)._sizeHint();
case Paused:
return 1;
case Resumed:
return 1;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// New authority set has been applied.
class NewAuthorities extends Event {
const NewAuthorities({required this.authoritySet});
factory NewAuthorities._decode(_i1.Input input) {
return NewAuthorities(
authoritySet: const _i1.SequenceCodec<_i3.Tuple2<_i4.Public, BigInt>>(
_i3.Tuple2Codec<_i4.Public, BigInt>(
_i4.PublicCodec(),
_i1.U64Codec.codec,
)).decode(input));
}
/// AuthorityList
final List<_i3.Tuple2<_i4.Public, BigInt>> authoritySet;
@override
Map<String, Map<String, List<List<dynamic>>>> toJson() => {
'NewAuthorities': {
'authoritySet': authoritySet
.map((value) => [
value.value0.toList(),
value.value1,
])
.toList()
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i1.SequenceCodec<_i3.Tuple2<_i4.Public, BigInt>>(
_i3.Tuple2Codec<_i4.Public, BigInt>(
_i4.PublicCodec(),
_i1.U64Codec.codec,
)).sizeHint(authoritySet);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.SequenceCodec<_i3.Tuple2<_i4.Public, BigInt>>(
_i3.Tuple2Codec<_i4.Public, BigInt>(
_i4.PublicCodec(),
_i1.U64Codec.codec,
)).encodeTo(
authoritySet,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is NewAuthorities &&
_i5.listsEqual(
other.authoritySet,
authoritySet,
);
@override
int get hashCode => authoritySet.hashCode;
}
/// Current authority set has been paused.
class Paused extends Event {
const Paused();
@override
Map<String, dynamic> toJson() => {'Paused': null};
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
}
@override
bool operator ==(Object other) => other is Paused;
@override
int get hashCode => runtimeType.hashCode;
}
/// Current authority set has been resumed.
class Resumed extends Event {
const Resumed();
@override
Map<String, dynamic> toJson() => {'Resumed': null};
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
}
@override
bool operator ==(Object other) => other is Resumed;
@override
int get hashCode => runtimeType.hashCode;
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i4;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i5;
import '../sp_consensus_grandpa/app/public.dart' as _i3;
import '../tuples.dart' as _i2;
class StoredPendingChange {
const StoredPendingChange({
required this.scheduledAt,
required this.delay,
required this.nextAuthorities,
this.forced,
});
factory StoredPendingChange.decode(_i1.Input input) {
return codec.decode(input);
}
/// N
final int scheduledAt;
/// N
final int delay;
/// BoundedAuthorityList<Limit>
final List<_i2.Tuple2<_i3.Public, BigInt>> nextAuthorities;
/// Option<N>
final int? forced;
static const $StoredPendingChangeCodec codec = $StoredPendingChangeCodec();
_i4.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'scheduledAt': scheduledAt,
'delay': delay,
'nextAuthorities': nextAuthorities
.map((value) => [
value.value0.toList(),
value.value1,
])
.toList(),
'forced': forced,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is StoredPendingChange &&
other.scheduledAt == scheduledAt &&
other.delay == delay &&
_i5.listsEqual(
other.nextAuthorities,
nextAuthorities,
) &&
other.forced == forced;
@override
int get hashCode => Object.hash(
scheduledAt,
delay,
nextAuthorities,
forced,
);
}
class $StoredPendingChangeCodec with _i1.Codec<StoredPendingChange> {
const $StoredPendingChangeCodec();
@override
void encodeTo(
StoredPendingChange obj,
_i1.Output output,
) {
_i1.U32Codec.codec.encodeTo(
obj.scheduledAt,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.delay,
output,
);
const _i1.SequenceCodec<_i2.Tuple2<_i3.Public, BigInt>>(
_i2.Tuple2Codec<_i3.Public, BigInt>(
_i3.PublicCodec(),
_i1.U64Codec.codec,
)).encodeTo(
obj.nextAuthorities,
output,
);
const _i1.OptionCodec<int>(_i1.U32Codec.codec).encodeTo(
obj.forced,
output,
);
}
@override
StoredPendingChange decode(_i1.Input input) {
return StoredPendingChange(
scheduledAt: _i1.U32Codec.codec.decode(input),
delay: _i1.U32Codec.codec.decode(input),
nextAuthorities: const _i1.SequenceCodec<_i2.Tuple2<_i3.Public, BigInt>>(
_i2.Tuple2Codec<_i3.Public, BigInt>(
_i3.PublicCodec(),
_i1.U64Codec.codec,
)).decode(input),
forced: const _i1.OptionCodec<int>(_i1.U32Codec.codec).decode(input),
);
}
@override
int sizeHint(StoredPendingChange obj) {
int size = 0;
size = size + _i1.U32Codec.codec.sizeHint(obj.scheduledAt);
size = size + _i1.U32Codec.codec.sizeHint(obj.delay);
size = size +
const _i1.SequenceCodec<_i2.Tuple2<_i3.Public, BigInt>>(
_i2.Tuple2Codec<_i3.Public, BigInt>(
_i3.PublicCodec(),
_i1.U64Codec.codec,
)).sizeHint(obj.nextAuthorities);
size = size +
const _i1.OptionCodec<int>(_i1.U32Codec.codec).sizeHint(obj.forced);
return size;
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
abstract class StoredState {
const StoredState();
factory StoredState.decode(_i1.Input input) {
return codec.decode(input);
}
static const $StoredStateCodec codec = $StoredStateCodec();
static const $StoredState values = $StoredState();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, dynamic> toJson();
}
class $StoredState {
const $StoredState();
Live live() {
return Live();
}
PendingPause pendingPause({
required int scheduledAt,
required int delay,
}) {
return PendingPause(
scheduledAt: scheduledAt,
delay: delay,
);
}
Paused paused() {
return Paused();
}
PendingResume pendingResume({
required int scheduledAt,
required int delay,
}) {
return PendingResume(
scheduledAt: scheduledAt,
delay: delay,
);
}
}
class $StoredStateCodec with _i1.Codec<StoredState> {
const $StoredStateCodec();
@override
StoredState decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return const Live();
case 1:
return PendingPause._decode(input);
case 2:
return const Paused();
case 3:
return PendingResume._decode(input);
default:
throw Exception('StoredState: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
StoredState value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Live:
(value as Live).encodeTo(output);
break;
case PendingPause:
(value as PendingPause).encodeTo(output);
break;
case Paused:
(value as Paused).encodeTo(output);
break;
case PendingResume:
(value as PendingResume).encodeTo(output);
break;
default:
throw Exception(
'StoredState: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(StoredState value) {
switch (value.runtimeType) {
case Live:
return 1;
case PendingPause:
return (value as PendingPause)._sizeHint();
case Paused:
return 1;
case PendingResume:
return (value as PendingResume)._sizeHint();
default:
throw Exception(
'StoredState: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
class Live extends StoredState {
const Live();
@override
Map<String, dynamic> toJson() => {'Live': null};
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
}
@override
bool operator ==(Object other) => other is Live;
@override
int get hashCode => runtimeType.hashCode;
}
class PendingPause extends StoredState {
const PendingPause({
required this.scheduledAt,
required this.delay,
});
factory PendingPause._decode(_i1.Input input) {
return PendingPause(
scheduledAt: _i1.U32Codec.codec.decode(input),
delay: _i1.U32Codec.codec.decode(input),
);
}
/// N
final int scheduledAt;
/// N
final int delay;
@override
Map<String, Map<String, int>> toJson() => {
'PendingPause': {
'scheduledAt': scheduledAt,
'delay': delay,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(scheduledAt);
size = size + _i1.U32Codec.codec.sizeHint(delay);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i1.U32Codec.codec.encodeTo(
scheduledAt,
output,
);
_i1.U32Codec.codec.encodeTo(
delay,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is PendingPause &&
other.scheduledAt == scheduledAt &&
other.delay == delay;
@override
int get hashCode => Object.hash(
scheduledAt,
delay,
);
}
class Paused extends StoredState {
const Paused();
@override
Map<String, dynamic> toJson() => {'Paused': null};
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
}
@override
bool operator ==(Object other) => other is Paused;
@override
int get hashCode => runtimeType.hashCode;
}
class PendingResume extends StoredState {
const PendingResume({
required this.scheduledAt,
required this.delay,
});
factory PendingResume._decode(_i1.Input input) {
return PendingResume(
scheduledAt: _i1.U32Codec.codec.decode(input),
delay: _i1.U32Codec.codec.decode(input),
);
}
/// N
final int scheduledAt;
/// N
final int delay;
@override
Map<String, Map<String, int>> toJson() => {
'PendingResume': {
'scheduledAt': scheduledAt,
'delay': delay,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(scheduledAt);
size = size + _i1.U32Codec.codec.sizeHint(delay);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
_i1.U32Codec.codec.encodeTo(
scheduledAt,
output,
);
_i1.U32Codec.codec.encodeTo(
delay,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is PendingResume &&
other.scheduledAt == scheduledAt &&
other.delay == delay;
@override
int get hashCode => Object.hash(
scheduledAt,
delay,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i6;
import '../../sp_core/crypto/account_id32.dart' as _i3;
import '../../sp_runtime/multi_signature.dart' as _i5;
import '../types/idty_name.dart' as _i4;
/// Contains a variant per dispatchable extrinsic that this pallet has.
abstract class Call {
const Call();
factory Call.decode(_i1.Input input) {
return codec.decode(input);
}
static const $CallCodec codec = $CallCodec();
static const $Call values = $Call();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, Map<String, dynamic>> toJson();
}
class $Call {
const $Call();
CreateIdentity createIdentity({required _i3.AccountId32 ownerKey}) {
return CreateIdentity(ownerKey: ownerKey);
}
ConfirmIdentity confirmIdentity({required _i4.IdtyName idtyName}) {
return ConfirmIdentity(idtyName: idtyName);
}
ChangeOwnerKey changeOwnerKey({
required _i3.AccountId32 newKey,
required _i5.MultiSignature newKeySig,
}) {
return ChangeOwnerKey(
newKey: newKey,
newKeySig: newKeySig,
);
}
RevokeIdentity revokeIdentity({
required int idtyIndex,
required _i3.AccountId32 revocationKey,
required _i5.MultiSignature revocationSig,
}) {
return RevokeIdentity(
idtyIndex: idtyIndex,
revocationKey: revocationKey,
revocationSig: revocationSig,
);
}
PruneItemIdentitiesNames pruneItemIdentitiesNames(
{required List<_i4.IdtyName> names}) {
return PruneItemIdentitiesNames(names: names);
}
FixSufficients fixSufficients({
required _i3.AccountId32 ownerKey,
required bool inc,
}) {
return FixSufficients(
ownerKey: ownerKey,
inc: inc,
);
}
LinkAccount linkAccount({
required _i3.AccountId32 accountId,
required _i5.MultiSignature payloadSig,
}) {
return LinkAccount(
accountId: accountId,
payloadSig: payloadSig,
);
}
}
class $CallCodec with _i1.Codec<Call> {
const $CallCodec();
@override
Call decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return CreateIdentity._decode(input);
case 1:
return ConfirmIdentity._decode(input);
case 3:
return ChangeOwnerKey._decode(input);
case 4:
return RevokeIdentity._decode(input);
case 6:
return PruneItemIdentitiesNames._decode(input);
case 7:
return FixSufficients._decode(input);
case 8:
return LinkAccount._decode(input);
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
switch (value.runtimeType) {
case CreateIdentity:
(value as CreateIdentity).encodeTo(output);
break;
case ConfirmIdentity:
(value as ConfirmIdentity).encodeTo(output);
break;
case ChangeOwnerKey:
(value as ChangeOwnerKey).encodeTo(output);
break;
case RevokeIdentity:
(value as RevokeIdentity).encodeTo(output);
break;
case PruneItemIdentitiesNames:
(value as PruneItemIdentitiesNames).encodeTo(output);
break;
case FixSufficients:
(value as FixSufficients).encodeTo(output);
break;
case LinkAccount:
(value as LinkAccount).encodeTo(output);
break;
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Call value) {
switch (value.runtimeType) {
case CreateIdentity:
return (value as CreateIdentity)._sizeHint();
case ConfirmIdentity:
return (value as ConfirmIdentity)._sizeHint();
case ChangeOwnerKey:
return (value as ChangeOwnerKey)._sizeHint();
case RevokeIdentity:
return (value as RevokeIdentity)._sizeHint();
case PruneItemIdentitiesNames:
return (value as PruneItemIdentitiesNames)._sizeHint();
case FixSufficients:
return (value as FixSufficients)._sizeHint();
case LinkAccount:
return (value as LinkAccount)._sizeHint();
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// Create an identity for an existing account
///
/// - `owner_key`: the public key corresponding to the identity to be created
///
/// The origin must be allowed to create an identity.
class CreateIdentity extends Call {
const CreateIdentity({required this.ownerKey});
factory CreateIdentity._decode(_i1.Input input) {
return CreateIdentity(ownerKey: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::AccountId
final _i3.AccountId32 ownerKey;
@override
Map<String, Map<String, List<int>>> toJson() => {
'create_identity': {'ownerKey': ownerKey.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(ownerKey);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
ownerKey,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is CreateIdentity &&
_i6.listsEqual(
other.ownerKey,
ownerKey,
);
@override
int get hashCode => ownerKey.hashCode;
}
/// Confirm the creation of an identity and give it a name
///
/// - `idty_name`: the name uniquely associated to this identity. Must match the validation rules defined by the runtime.
///
/// The identity must have been created using `create_identity` before it can be confirmed.
class ConfirmIdentity extends Call {
const ConfirmIdentity({required this.idtyName});
factory ConfirmIdentity._decode(_i1.Input input) {
return ConfirmIdentity(idtyName: _i1.U8SequenceCodec.codec.decode(input));
}
/// IdtyName
final _i4.IdtyName idtyName;
@override
Map<String, Map<String, List<int>>> toJson() => {
'confirm_identity': {'idtyName': idtyName}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.IdtyNameCodec().sizeHint(idtyName);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i1.U8SequenceCodec.codec.encodeTo(
idtyName,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ConfirmIdentity &&
_i6.listsEqual(
other.idtyName,
idtyName,
);
@override
int get hashCode => idtyName.hashCode;
}
/// Change identity owner key.
///
/// - `new_key`: the new owner key.
/// - `new_key_sig`: the signature of the encoded form of `IdtyIndexAccountIdPayload`.
/// Must be signed by `new_key`.
///
/// The origin should be the old identity owner key.
class ChangeOwnerKey extends Call {
const ChangeOwnerKey({
required this.newKey,
required this.newKeySig,
});
factory ChangeOwnerKey._decode(_i1.Input input) {
return ChangeOwnerKey(
newKey: const _i1.U8ArrayCodec(32).decode(input),
newKeySig: _i5.MultiSignature.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 newKey;
/// T::Signature
final _i5.MultiSignature newKeySig;
@override
Map<String, Map<String, dynamic>> toJson() => {
'change_owner_key': {
'newKey': newKey.toList(),
'newKeySig': newKeySig.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(newKey);
size = size + _i5.MultiSignature.codec.sizeHint(newKeySig);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
newKey,
output,
);
_i5.MultiSignature.codec.encodeTo(
newKeySig,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ChangeOwnerKey &&
_i6.listsEqual(
other.newKey,
newKey,
) &&
other.newKeySig == newKeySig;
@override
int get hashCode => Object.hash(
newKey,
newKeySig,
);
}
/// Revoke an identity using a revocation signature
///
/// - `idty_index`: the index of the identity to be revoked.
/// - `revocation_key`: the key used to sign the revocation payload.
/// - `revocation_sig`: the signature of the encoded form of `RevocationPayload`.
/// Must be signed by `revocation_key`.
///
/// Any signed origin can execute this call.
class RevokeIdentity extends Call {
const RevokeIdentity({
required this.idtyIndex,
required this.revocationKey,
required this.revocationSig,
});
factory RevokeIdentity._decode(_i1.Input input) {
return RevokeIdentity(
idtyIndex: _i1.U32Codec.codec.decode(input),
revocationKey: const _i1.U8ArrayCodec(32).decode(input),
revocationSig: _i5.MultiSignature.codec.decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// T::AccountId
final _i3.AccountId32 revocationKey;
/// T::Signature
final _i5.MultiSignature revocationSig;
@override
Map<String, Map<String, dynamic>> toJson() => {
'revoke_identity': {
'idtyIndex': idtyIndex,
'revocationKey': revocationKey.toList(),
'revocationSig': revocationSig.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i3.AccountId32Codec().sizeHint(revocationKey);
size = size + _i5.MultiSignature.codec.sizeHint(revocationSig);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
4,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
revocationKey,
output,
);
_i5.MultiSignature.codec.encodeTo(
revocationSig,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is RevokeIdentity &&
other.idtyIndex == idtyIndex &&
_i6.listsEqual(
other.revocationKey,
revocationKey,
) &&
other.revocationSig == revocationSig;
@override
int get hashCode => Object.hash(
idtyIndex,
revocationKey,
revocationSig,
);
}
/// Remove identity names from storage.
///
/// This function allows a privileged root origin to remove multiple identity names from storage
/// in bulk.
///
/// - `origin` - The origin of the call. It must be root.
/// - `names` - A vector containing the identity names to be removed from storage.
class PruneItemIdentitiesNames extends Call {
const PruneItemIdentitiesNames({required this.names});
factory PruneItemIdentitiesNames._decode(_i1.Input input) {
return PruneItemIdentitiesNames(
names: const _i1.SequenceCodec<_i4.IdtyName>(_i4.IdtyNameCodec())
.decode(input));
}
/// Vec<IdtyName>
final List<_i4.IdtyName> names;
@override
Map<String, Map<String, List<List<int>>>> toJson() => {
'prune_item_identities_names': {
'names': names.map((value) => value).toList()
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i1.SequenceCodec<_i4.IdtyName>(_i4.IdtyNameCodec())
.sizeHint(names);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
6,
output,
);
const _i1.SequenceCodec<_i4.IdtyName>(_i4.IdtyNameCodec()).encodeTo(
names,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is PruneItemIdentitiesNames &&
_i6.listsEqual(
other.names,
names,
);
@override
int get hashCode => names.hashCode;
}
/// Change sufficient reference count for a given key.
///
/// This function allows a privileged root origin to increment or decrement the sufficient
/// reference count associated with a specified owner key.
///
/// - `origin` - The origin of the call. It must be root.
/// - `owner_key` - The account whose sufficient reference count will be modified.
/// - `inc` - A boolean indicating whether to increment (`true`) or decrement (`false`) the count.
///
class FixSufficients extends Call {
const FixSufficients({
required this.ownerKey,
required this.inc,
});
factory FixSufficients._decode(_i1.Input input) {
return FixSufficients(
ownerKey: const _i1.U8ArrayCodec(32).decode(input),
inc: _i1.BoolCodec.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 ownerKey;
/// bool
final bool inc;
@override
Map<String, Map<String, dynamic>> toJson() => {
'fix_sufficients': {
'ownerKey': ownerKey.toList(),
'inc': inc,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(ownerKey);
size = size + _i1.BoolCodec.codec.sizeHint(inc);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
7,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
ownerKey,
output,
);
_i1.BoolCodec.codec.encodeTo(
inc,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is FixSufficients &&
_i6.listsEqual(
other.ownerKey,
ownerKey,
) &&
other.inc == inc;
@override
int get hashCode => Object.hash(
ownerKey,
inc,
);
}
/// Link an account to an identity.
///
/// This function links a specified account to an identity, requiring both the account and the
/// identity to sign the operation.
///
/// - `origin` - The origin of the call, which must have an associated identity index.
/// - `account_id` - The account ID to link, which must sign the payload.
/// - `payload_sig` - The signature with the linked identity.
class LinkAccount extends Call {
const LinkAccount({
required this.accountId,
required this.payloadSig,
});
factory LinkAccount._decode(_i1.Input input) {
return LinkAccount(
accountId: const _i1.U8ArrayCodec(32).decode(input),
payloadSig: _i5.MultiSignature.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 accountId;
/// T::Signature
final _i5.MultiSignature payloadSig;
@override
Map<String, Map<String, dynamic>> toJson() => {
'link_account': {
'accountId': accountId.toList(),
'payloadSig': payloadSig.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(accountId);
size = size + _i5.MultiSignature.codec.sizeHint(payloadSig);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
8,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
accountId,
output,
);
_i5.MultiSignature.codec.encodeTo(
payloadSig,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is LinkAccount &&
_i6.listsEqual(
other.accountId,
accountId,
) &&
other.payloadSig == payloadSig;
@override
int get hashCode => Object.hash(
accountId,
payloadSig,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
/// The `Error` enum of this pallet.
enum Error {
/// Identity already confirmed.
idtyAlreadyConfirmed('IdtyAlreadyConfirmed', 0),
/// Identity already created.
idtyAlreadyCreated('IdtyAlreadyCreated', 1),
/// Identity index not found.
idtyIndexNotFound('IdtyIndexNotFound', 2),
/// Identity name already exists.
idtyNameAlreadyExist('IdtyNameAlreadyExist', 3),
/// Invalid identity name.
idtyNameInvalid('IdtyNameInvalid', 4),
/// Identity not found.
idtyNotFound('IdtyNotFound', 5),
/// Invalid payload signature.
invalidSignature('InvalidSignature', 6),
/// Invalid revocation key.
invalidRevocationKey('InvalidRevocationKey', 7),
/// Issuer is not member and can not perform this action.
issuerNotMember('IssuerNotMember', 8),
/// Identity creation period is not respected.
notRespectIdtyCreationPeriod('NotRespectIdtyCreationPeriod', 9),
/// Owner key already changed recently.
ownerKeyAlreadyRecentlyChanged('OwnerKeyAlreadyRecentlyChanged', 10),
/// Owner key already used.
ownerKeyAlreadyUsed('OwnerKeyAlreadyUsed', 11),
/// Reverting to an old key is prohibited.
prohibitedToRevertToAnOldKey('ProhibitedToRevertToAnOldKey', 12),
/// Already revoked.
alreadyRevoked('AlreadyRevoked', 13),
/// Can not revoke identity that never was member.
canNotRevokeUnconfirmed('CanNotRevokeUnconfirmed', 14),
/// Can not revoke identity that never was member.
canNotRevokeUnvalidated('CanNotRevokeUnvalidated', 15),
/// Cannot link to an inexisting account.
accountNotExist('AccountNotExist', 16),
/// Insufficient balance to create an identity.
insufficientBalance('InsufficientBalance', 17),
/// Owner key currently used as validator.
ownerKeyUsedAsValidator('OwnerKeyUsedAsValidator', 18);
const Error(
this.variantName,
this.codecIndex,
);
factory Error.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $ErrorCodec codec = $ErrorCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $ErrorCodec with _i1.Codec<Error> {
const $ErrorCodec();
@override
Error decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Error.idtyAlreadyConfirmed;
case 1:
return Error.idtyAlreadyCreated;
case 2:
return Error.idtyIndexNotFound;
case 3:
return Error.idtyNameAlreadyExist;
case 4:
return Error.idtyNameInvalid;
case 5:
return Error.idtyNotFound;
case 6:
return Error.invalidSignature;
case 7:
return Error.invalidRevocationKey;
case 8:
return Error.issuerNotMember;
case 9:
return Error.notRespectIdtyCreationPeriod;
case 10:
return Error.ownerKeyAlreadyRecentlyChanged;
case 11:
return Error.ownerKeyAlreadyUsed;
case 12:
return Error.prohibitedToRevertToAnOldKey;
case 13:
return Error.alreadyRevoked;
case 14:
return Error.canNotRevokeUnconfirmed;
case 15:
return Error.canNotRevokeUnvalidated;
case 16:
return Error.accountNotExist;
case 17:
return Error.insufficientBalance;
case 18:
return Error.ownerKeyUsedAsValidator;
default:
throw Exception('Error: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Error value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i7;
import '../../sp_core/crypto/account_id32.dart' as _i3;
import '../types/idty_name.dart' as _i4;
import '../types/removal_reason.dart' as _i6;
import '../types/revocation_reason.dart' as _i5;
/// The `Event` enum of this pallet
abstract class Event {
const Event();
factory Event.decode(_i1.Input input) {
return codec.decode(input);
}
static const $EventCodec codec = $EventCodec();
static const $Event values = $Event();
_i2.Uint8List encode() {
final output = _i1.ByteOutput(codec.sizeHint(this));
codec.encodeTo(this, output);
return output.toBytes();
}
int sizeHint() {
return codec.sizeHint(this);
}
Map<String, Map<String, dynamic>> toJson();
}
class $Event {
const $Event();
IdtyCreated idtyCreated({
required int idtyIndex,
required _i3.AccountId32 ownerKey,
}) {
return IdtyCreated(
idtyIndex: idtyIndex,
ownerKey: ownerKey,
);
}
IdtyConfirmed idtyConfirmed({
required int idtyIndex,
required _i3.AccountId32 ownerKey,
required _i4.IdtyName name,
}) {
return IdtyConfirmed(
idtyIndex: idtyIndex,
ownerKey: ownerKey,
name: name,
);
}
IdtyValidated idtyValidated({required int idtyIndex}) {
return IdtyValidated(idtyIndex: idtyIndex);
}
IdtyChangedOwnerKey idtyChangedOwnerKey({
required int idtyIndex,
required _i3.AccountId32 newOwnerKey,
}) {
return IdtyChangedOwnerKey(
idtyIndex: idtyIndex,
newOwnerKey: newOwnerKey,
);
}
IdtyRevoked idtyRevoked({
required int idtyIndex,
required _i5.RevocationReason reason,
}) {
return IdtyRevoked(
idtyIndex: idtyIndex,
reason: reason,
);
}
IdtyRemoved idtyRemoved({
required int idtyIndex,
required _i6.RemovalReason reason,
}) {
return IdtyRemoved(
idtyIndex: idtyIndex,
reason: reason,
);
}
}
class $EventCodec with _i1.Codec<Event> {
const $EventCodec();
@override
Event decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return IdtyCreated._decode(input);
case 1:
return IdtyConfirmed._decode(input);
case 2:
return IdtyValidated._decode(input);
case 3:
return IdtyChangedOwnerKey._decode(input);
case 4:
return IdtyRevoked._decode(input);
case 5:
return IdtyRemoved._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case IdtyCreated:
(value as IdtyCreated).encodeTo(output);
break;
case IdtyConfirmed:
(value as IdtyConfirmed).encodeTo(output);
break;
case IdtyValidated:
(value as IdtyValidated).encodeTo(output);
break;
case IdtyChangedOwnerKey:
(value as IdtyChangedOwnerKey).encodeTo(output);
break;
case IdtyRevoked:
(value as IdtyRevoked).encodeTo(output);
break;
case IdtyRemoved:
(value as IdtyRemoved).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case IdtyCreated:
return (value as IdtyCreated)._sizeHint();
case IdtyConfirmed:
return (value as IdtyConfirmed)._sizeHint();
case IdtyValidated:
return (value as IdtyValidated)._sizeHint();
case IdtyChangedOwnerKey:
return (value as IdtyChangedOwnerKey)._sizeHint();
case IdtyRevoked:
return (value as IdtyRevoked)._sizeHint();
case IdtyRemoved:
return (value as IdtyRemoved)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A new identity has been created.
class IdtyCreated extends Event {
const IdtyCreated({
required this.idtyIndex,
required this.ownerKey,
});
factory IdtyCreated._decode(_i1.Input input) {
return IdtyCreated(
idtyIndex: _i1.U32Codec.codec.decode(input),
ownerKey: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// T::AccountId
final _i3.AccountId32 ownerKey;
@override
Map<String, Map<String, dynamic>> toJson() => {
'IdtyCreated': {
'idtyIndex': idtyIndex,
'ownerKey': ownerKey.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i3.AccountId32Codec().sizeHint(ownerKey);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
ownerKey,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is IdtyCreated &&
other.idtyIndex == idtyIndex &&
_i7.listsEqual(
other.ownerKey,
ownerKey,
);
@override
int get hashCode => Object.hash(
idtyIndex,
ownerKey,
);
}
/// An identity has been confirmed by its owner.
class IdtyConfirmed extends Event {
const IdtyConfirmed({
required this.idtyIndex,
required this.ownerKey,
required this.name,
});
factory IdtyConfirmed._decode(_i1.Input input) {
return IdtyConfirmed(
idtyIndex: _i1.U32Codec.codec.decode(input),
ownerKey: const _i1.U8ArrayCodec(32).decode(input),
name: _i1.U8SequenceCodec.codec.decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// T::AccountId
final _i3.AccountId32 ownerKey;
/// IdtyName
final _i4.IdtyName name;
@override
Map<String, Map<String, dynamic>> toJson() => {
'IdtyConfirmed': {
'idtyIndex': idtyIndex,
'ownerKey': ownerKey.toList(),
'name': name,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i3.AccountId32Codec().sizeHint(ownerKey);
size = size + const _i4.IdtyNameCodec().sizeHint(name);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
ownerKey,
output,
);
_i1.U8SequenceCodec.codec.encodeTo(
name,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is IdtyConfirmed &&
other.idtyIndex == idtyIndex &&
_i7.listsEqual(
other.ownerKey,
ownerKey,
) &&
_i7.listsEqual(
other.name,
name,
);
@override
int get hashCode => Object.hash(
idtyIndex,
ownerKey,
name,
);
}
/// An identity has been validated.
class IdtyValidated extends Event {
const IdtyValidated({required this.idtyIndex});
factory IdtyValidated._decode(_i1.Input input) {
return IdtyValidated(idtyIndex: _i1.U32Codec.codec.decode(input));
}
/// T::IdtyIndex
final int idtyIndex;
@override
Map<String, Map<String, int>> toJson() => {
'IdtyValidated': {'idtyIndex': idtyIndex}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is IdtyValidated && other.idtyIndex == idtyIndex;
@override
int get hashCode => idtyIndex.hashCode;
}
class IdtyChangedOwnerKey extends Event {
const IdtyChangedOwnerKey({
required this.idtyIndex,
required this.newOwnerKey,
});
factory IdtyChangedOwnerKey._decode(_i1.Input input) {
return IdtyChangedOwnerKey(
idtyIndex: _i1.U32Codec.codec.decode(input),
newOwnerKey: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// T::AccountId
final _i3.AccountId32 newOwnerKey;
@override
Map<String, Map<String, dynamic>> toJson() => {
'IdtyChangedOwnerKey': {
'idtyIndex': idtyIndex,
'newOwnerKey': newOwnerKey.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + const _i3.AccountId32Codec().sizeHint(newOwnerKey);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
newOwnerKey,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is IdtyChangedOwnerKey &&
other.idtyIndex == idtyIndex &&
_i7.listsEqual(
other.newOwnerKey,
newOwnerKey,
);
@override
int get hashCode => Object.hash(
idtyIndex,
newOwnerKey,
);
}
/// An identity has been revoked.
class IdtyRevoked extends Event {
const IdtyRevoked({
required this.idtyIndex,
required this.reason,
});
factory IdtyRevoked._decode(_i1.Input input) {
return IdtyRevoked(
idtyIndex: _i1.U32Codec.codec.decode(input),
reason: _i5.RevocationReason.codec.decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// RevocationReason
final _i5.RevocationReason reason;
@override
Map<String, Map<String, dynamic>> toJson() => {
'IdtyRevoked': {
'idtyIndex': idtyIndex,
'reason': reason.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + _i5.RevocationReason.codec.sizeHint(reason);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
4,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
_i5.RevocationReason.codec.encodeTo(
reason,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is IdtyRevoked &&
other.idtyIndex == idtyIndex &&
other.reason == reason;
@override
int get hashCode => Object.hash(
idtyIndex,
reason,
);
}
/// An identity has been removed.
class IdtyRemoved extends Event {
const IdtyRemoved({
required this.idtyIndex,
required this.reason,
});
factory IdtyRemoved._decode(_i1.Input input) {
return IdtyRemoved(
idtyIndex: _i1.U32Codec.codec.decode(input),
reason: _i6.RemovalReason.codec.decode(input),
);
}
/// T::IdtyIndex
final int idtyIndex;
/// RemovalReason
final _i6.RemovalReason reason;
@override
Map<String, Map<String, dynamic>> toJson() => {
'IdtyRemoved': {
'idtyIndex': idtyIndex,
'reason': reason.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(idtyIndex);
size = size + _i6.RemovalReason.codec.sizeHint(reason);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
5,
output,
);
_i1.U32Codec.codec.encodeTo(
idtyIndex,
output,
);
_i6.RemovalReason.codec.encodeTo(
reason,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is IdtyRemoved &&
other.idtyIndex == idtyIndex &&
other.reason == reason;
@override
int get hashCode => Object.hash(
idtyIndex,
reason,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:polkadart/scale_codec.dart' as _i1;
typedef IdtyName = List<int>;
class IdtyNameCodec with _i1.Codec<IdtyName> {
const IdtyNameCodec();
@override
IdtyName decode(_i1.Input input) {
return _i1.U8SequenceCodec.codec.decode(input);
}
@override
void encodeTo(
IdtyName value,
_i1.Output output,
) {
_i1.U8SequenceCodec.codec.encodeTo(
value,
output,
);
}
@override
int sizeHint(IdtyName value) {
return _i1.U8SequenceCodec.codec.sizeHint(value);
}
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
enum IdtyStatus {
unconfirmed('Unconfirmed', 0),
unvalidated('Unvalidated', 1),
member('Member', 2),
notMember('NotMember', 3),
revoked('Revoked', 4);
const IdtyStatus(
this.variantName,
this.codecIndex,
);
factory IdtyStatus.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $IdtyStatusCodec codec = $IdtyStatusCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $IdtyStatusCodec with _i1.Codec<IdtyStatus> {
const $IdtyStatusCodec();
@override
IdtyStatus decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return IdtyStatus.unconfirmed;
case 1:
return IdtyStatus.unvalidated;
case 2:
return IdtyStatus.member;
case 3:
return IdtyStatus.notMember;
case 4:
return IdtyStatus.revoked;
default:
throw Exception('IdtyStatus: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
IdtyStatus value,
_i1.Output output,
) {
_i1.U8Codec.codec.encodeTo(
value.codecIndex,
output,
);
}
}