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 4167 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;
/// The `Error` enum of this pallet.
enum Error {
/// Account is not a member
notMember('NotMember', 0),
/// Duplicate proposals not allowed
duplicateProposal('DuplicateProposal', 1),
/// Proposal must exist
proposalMissing('ProposalMissing', 2),
/// Mismatched index
wrongIndex('WrongIndex', 3),
/// Duplicate vote ignored
duplicateVote('DuplicateVote', 4),
/// Members are already initialized!
alreadyInitialized('AlreadyInitialized', 5),
/// The close call was made too early, before the end of the voting.
tooEarly('TooEarly', 6),
/// There can only be a maximum of `MaxProposals` active proposals.
tooManyProposals('TooManyProposals', 7),
/// The given weight bound for the proposal was too low.
wrongProposalWeight('WrongProposalWeight', 8),
/// The given length bound for the proposal was too low.
wrongProposalLength('WrongProposalLength', 9),
/// Prime account is not a member
primeAccountNotMember('PrimeAccountNotMember', 10);
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.notMember;
case 1:
return Error.duplicateProposal;
case 2:
return Error.proposalMissing;
case 3:
return Error.wrongIndex;
case 4:
return Error.duplicateVote;
case 5:
return Error.alreadyInitialized;
case 6:
return Error.tooEarly;
case 7:
return Error.tooManyProposals;
case 8:
return Error.wrongProposalWeight;
case 9:
return Error.wrongProposalLength;
case 10:
return Error.primeAccountNotMember;
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 _i6;
import '../../primitive_types/h256.dart' as _i4;
import '../../sp_core/crypto/account_id32.dart' as _i3;
import '../../sp_runtime/dispatch_error.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();
Proposed proposed({
required _i3.AccountId32 account,
required int proposalIndex,
required _i4.H256 proposalHash,
required int threshold,
}) {
return Proposed(
account: account,
proposalIndex: proposalIndex,
proposalHash: proposalHash,
threshold: threshold,
);
}
Voted voted({
required _i3.AccountId32 account,
required _i4.H256 proposalHash,
required bool voted,
required int yes,
required int no,
}) {
return Voted(
account: account,
proposalHash: proposalHash,
voted: voted,
yes: yes,
no: no,
);
}
Approved approved({required _i4.H256 proposalHash}) {
return Approved(proposalHash: proposalHash);
}
Disapproved disapproved({required _i4.H256 proposalHash}) {
return Disapproved(proposalHash: proposalHash);
}
Executed executed({
required _i4.H256 proposalHash,
required _i1.Result<dynamic, _i5.DispatchError> result,
}) {
return Executed(
proposalHash: proposalHash,
result: result,
);
}
MemberExecuted memberExecuted({
required _i4.H256 proposalHash,
required _i1.Result<dynamic, _i5.DispatchError> result,
}) {
return MemberExecuted(
proposalHash: proposalHash,
result: result,
);
}
Closed closed({
required _i4.H256 proposalHash,
required int yes,
required int no,
}) {
return Closed(
proposalHash: proposalHash,
yes: yes,
no: no,
);
}
}
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 Proposed._decode(input);
case 1:
return Voted._decode(input);
case 2:
return Approved._decode(input);
case 3:
return Disapproved._decode(input);
case 4:
return Executed._decode(input);
case 5:
return MemberExecuted._decode(input);
case 6:
return Closed._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Proposed:
(value as Proposed).encodeTo(output);
break;
case Voted:
(value as Voted).encodeTo(output);
break;
case Approved:
(value as Approved).encodeTo(output);
break;
case Disapproved:
(value as Disapproved).encodeTo(output);
break;
case Executed:
(value as Executed).encodeTo(output);
break;
case MemberExecuted:
(value as MemberExecuted).encodeTo(output);
break;
case Closed:
(value as Closed).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case Proposed:
return (value as Proposed)._sizeHint();
case Voted:
return (value as Voted)._sizeHint();
case Approved:
return (value as Approved)._sizeHint();
case Disapproved:
return (value as Disapproved)._sizeHint();
case Executed:
return (value as Executed)._sizeHint();
case MemberExecuted:
return (value as MemberExecuted)._sizeHint();
case Closed:
return (value as Closed)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A motion (given hash) has been proposed (by given account) with a threshold (given
/// `MemberCount`).
class Proposed extends Event {
const Proposed({
required this.account,
required this.proposalIndex,
required this.proposalHash,
required this.threshold,
});
factory Proposed._decode(_i1.Input input) {
return Proposed(
account: const _i1.U8ArrayCodec(32).decode(input),
proposalIndex: _i1.U32Codec.codec.decode(input),
proposalHash: const _i1.U8ArrayCodec(32).decode(input),
threshold: _i1.U32Codec.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 account;
/// ProposalIndex
final int proposalIndex;
/// T::Hash
final _i4.H256 proposalHash;
/// MemberCount
final int threshold;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Proposed': {
'account': account.toList(),
'proposalIndex': proposalIndex,
'proposalHash': proposalHash.toList(),
'threshold': threshold,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(account);
size = size + _i1.U32Codec.codec.sizeHint(proposalIndex);
size = size + const _i4.H256Codec().sizeHint(proposalHash);
size = size + _i1.U32Codec.codec.sizeHint(threshold);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
account,
output,
);
_i1.U32Codec.codec.encodeTo(
proposalIndex,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
_i1.U32Codec.codec.encodeTo(
threshold,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Proposed &&
_i6.listsEqual(
other.account,
account,
) &&
other.proposalIndex == proposalIndex &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
) &&
other.threshold == threshold;
@override
int get hashCode => Object.hash(
account,
proposalIndex,
proposalHash,
threshold,
);
}
/// A motion (given hash) has been voted on by given account, leaving
/// a tally (yes votes and no votes given respectively as `MemberCount`).
class Voted extends Event {
const Voted({
required this.account,
required this.proposalHash,
required this.voted,
required this.yes,
required this.no,
});
factory Voted._decode(_i1.Input input) {
return Voted(
account: const _i1.U8ArrayCodec(32).decode(input),
proposalHash: const _i1.U8ArrayCodec(32).decode(input),
voted: _i1.BoolCodec.codec.decode(input),
yes: _i1.U32Codec.codec.decode(input),
no: _i1.U32Codec.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 account;
/// T::Hash
final _i4.H256 proposalHash;
/// bool
final bool voted;
/// MemberCount
final int yes;
/// MemberCount
final int no;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Voted': {
'account': account.toList(),
'proposalHash': proposalHash.toList(),
'voted': voted,
'yes': yes,
'no': no,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(account);
size = size + const _i4.H256Codec().sizeHint(proposalHash);
size = size + _i1.BoolCodec.codec.sizeHint(voted);
size = size + _i1.U32Codec.codec.sizeHint(yes);
size = size + _i1.U32Codec.codec.sizeHint(no);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
account,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
_i1.BoolCodec.codec.encodeTo(
voted,
output,
);
_i1.U32Codec.codec.encodeTo(
yes,
output,
);
_i1.U32Codec.codec.encodeTo(
no,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Voted &&
_i6.listsEqual(
other.account,
account,
) &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
) &&
other.voted == voted &&
other.yes == yes &&
other.no == no;
@override
int get hashCode => Object.hash(
account,
proposalHash,
voted,
yes,
no,
);
}
/// A motion was approved by the required threshold.
class Approved extends Event {
const Approved({required this.proposalHash});
factory Approved._decode(_i1.Input input) {
return Approved(proposalHash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i4.H256 proposalHash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'Approved': {'proposalHash': proposalHash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.H256Codec().sizeHint(proposalHash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Approved &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
);
@override
int get hashCode => proposalHash.hashCode;
}
/// A motion was not approved by the required threshold.
class Disapproved extends Event {
const Disapproved({required this.proposalHash});
factory Disapproved._decode(_i1.Input input) {
return Disapproved(proposalHash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i4.H256 proposalHash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'Disapproved': {'proposalHash': proposalHash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.H256Codec().sizeHint(proposalHash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Disapproved &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
);
@override
int get hashCode => proposalHash.hashCode;
}
/// A motion was executed; result will be `Ok` if it returned without error.
class Executed extends Event {
const Executed({
required this.proposalHash,
required this.result,
});
factory Executed._decode(_i1.Input input) {
return Executed(
proposalHash: const _i1.U8ArrayCodec(32).decode(input),
result: const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).decode(input),
);
}
/// T::Hash
final _i4.H256 proposalHash;
/// DispatchResult
final _i1.Result<dynamic, _i5.DispatchError> result;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Executed': {
'proposalHash': proposalHash.toList(),
'result': result.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.H256Codec().sizeHint(proposalHash);
size = size +
const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).sizeHint(result);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
4,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).encodeTo(
result,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Executed &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
) &&
other.result == result;
@override
int get hashCode => Object.hash(
proposalHash,
result,
);
}
/// A single member did some action; result will be `Ok` if it returned without error.
class MemberExecuted extends Event {
const MemberExecuted({
required this.proposalHash,
required this.result,
});
factory MemberExecuted._decode(_i1.Input input) {
return MemberExecuted(
proposalHash: const _i1.U8ArrayCodec(32).decode(input),
result: const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).decode(input),
);
}
/// T::Hash
final _i4.H256 proposalHash;
/// DispatchResult
final _i1.Result<dynamic, _i5.DispatchError> result;
@override
Map<String, Map<String, dynamic>> toJson() => {
'MemberExecuted': {
'proposalHash': proposalHash.toList(),
'result': result.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.H256Codec().sizeHint(proposalHash);
size = size +
const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).sizeHint(result);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
5,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).encodeTo(
result,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is MemberExecuted &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
) &&
other.result == result;
@override
int get hashCode => Object.hash(
proposalHash,
result,
);
}
/// A proposal was closed because its threshold was reached or after its duration was up.
class Closed extends Event {
const Closed({
required this.proposalHash,
required this.yes,
required this.no,
});
factory Closed._decode(_i1.Input input) {
return Closed(
proposalHash: const _i1.U8ArrayCodec(32).decode(input),
yes: _i1.U32Codec.codec.decode(input),
no: _i1.U32Codec.codec.decode(input),
);
}
/// T::Hash
final _i4.H256 proposalHash;
/// MemberCount
final int yes;
/// MemberCount
final int no;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Closed': {
'proposalHash': proposalHash.toList(),
'yes': yes,
'no': no,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i4.H256Codec().sizeHint(proposalHash);
size = size + _i1.U32Codec.codec.sizeHint(yes);
size = size + _i1.U32Codec.codec.sizeHint(no);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
6,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
proposalHash,
output,
);
_i1.U32Codec.codec.encodeTo(
yes,
output,
);
_i1.U32Codec.codec.encodeTo(
no,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Closed &&
_i6.listsEqual(
other.proposalHash,
proposalHash,
) &&
other.yes == yes &&
other.no == no;
@override
int get hashCode => Object.hash(
proposalHash,
yes,
no,
);
}
// 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;
abstract class RawOrigin {
const RawOrigin();
factory RawOrigin.decode(_i1.Input input) {
return codec.decode(input);
}
static const $RawOriginCodec codec = $RawOriginCodec();
static const $RawOrigin values = $RawOrigin();
_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 $RawOrigin {
const $RawOrigin();
Members members(
int value0,
int value1,
) {
return Members(
value0,
value1,
);
}
Member member(_i3.AccountId32 value0) {
return Member(value0);
}
Phantom phantom() {
return Phantom();
}
}
class $RawOriginCodec with _i1.Codec<RawOrigin> {
const $RawOriginCodec();
@override
RawOrigin decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Members._decode(input);
case 1:
return Member._decode(input);
case 2:
return const Phantom();
default:
throw Exception('RawOrigin: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
RawOrigin value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Members:
(value as Members).encodeTo(output);
break;
case Member:
(value as Member).encodeTo(output);
break;
case Phantom:
(value as Phantom).encodeTo(output);
break;
default:
throw Exception(
'RawOrigin: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(RawOrigin value) {
switch (value.runtimeType) {
case Members:
return (value as Members)._sizeHint();
case Member:
return (value as Member)._sizeHint();
case Phantom:
return 1;
default:
throw Exception(
'RawOrigin: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
class Members extends RawOrigin {
const Members(
this.value0,
this.value1,
);
factory Members._decode(_i1.Input input) {
return Members(
_i1.U32Codec.codec.decode(input),
_i1.U32Codec.codec.decode(input),
);
}
/// MemberCount
final int value0;
/// MemberCount
final int value1;
@override
Map<String, List<int>> toJson() => {
'Members': [
value0,
value1,
]
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(value0);
size = size + _i1.U32Codec.codec.sizeHint(value1);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i1.U32Codec.codec.encodeTo(
value0,
output,
);
_i1.U32Codec.codec.encodeTo(
value1,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Members && other.value0 == value0 && other.value1 == value1;
@override
int get hashCode => Object.hash(
value0,
value1,
);
}
class Member extends RawOrigin {
const Member(this.value0);
factory Member._decode(_i1.Input input) {
return Member(const _i1.U8ArrayCodec(32).decode(input));
}
/// AccountId
final _i3.AccountId32 value0;
@override
Map<String, List<int>> toJson() => {'Member': 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 Member &&
_i4.listsEqual(
other.value0,
value0,
);
@override
int get hashCode => value0.hashCode;
}
class Phantom extends RawOrigin {
const Phantom();
@override
Map<String, dynamic> toJson() => {'_Phantom': null};
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
}
@override
bool operator ==(Object other) => other is Phantom;
@override
int get hashCode => runtimeType.hashCode;
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i3;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i4;
import '../sp_core/crypto/account_id32.dart' as _i2;
class Votes {
const Votes({
required this.index,
required this.threshold,
required this.ayes,
required this.nays,
required this.end,
});
factory Votes.decode(_i1.Input input) {
return codec.decode(input);
}
/// ProposalIndex
final int index;
/// MemberCount
final int threshold;
/// Vec<AccountId>
final List<_i2.AccountId32> ayes;
/// Vec<AccountId>
final List<_i2.AccountId32> nays;
/// BlockNumber
final int end;
static const $VotesCodec codec = $VotesCodec();
_i3.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'index': index,
'threshold': threshold,
'ayes': ayes.map((value) => value.toList()).toList(),
'nays': nays.map((value) => value.toList()).toList(),
'end': end,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Votes &&
other.index == index &&
other.threshold == threshold &&
_i4.listsEqual(
other.ayes,
ayes,
) &&
_i4.listsEqual(
other.nays,
nays,
) &&
other.end == end;
@override
int get hashCode => Object.hash(
index,
threshold,
ayes,
nays,
end,
);
}
class $VotesCodec with _i1.Codec<Votes> {
const $VotesCodec();
@override
void encodeTo(
Votes obj,
_i1.Output output,
) {
_i1.U32Codec.codec.encodeTo(
obj.index,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.threshold,
output,
);
const _i1.SequenceCodec<_i2.AccountId32>(_i2.AccountId32Codec()).encodeTo(
obj.ayes,
output,
);
const _i1.SequenceCodec<_i2.AccountId32>(_i2.AccountId32Codec()).encodeTo(
obj.nays,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.end,
output,
);
}
@override
Votes decode(_i1.Input input) {
return Votes(
index: _i1.U32Codec.codec.decode(input),
threshold: _i1.U32Codec.codec.decode(input),
ayes: const _i1.SequenceCodec<_i2.AccountId32>(_i2.AccountId32Codec())
.decode(input),
nays: const _i1.SequenceCodec<_i2.AccountId32>(_i2.AccountId32Codec())
.decode(input),
end: _i1.U32Codec.codec.decode(input),
);
}
@override
int sizeHint(Votes obj) {
int size = 0;
size = size + _i1.U32Codec.codec.sizeHint(obj.index);
size = size + _i1.U32Codec.codec.sizeHint(obj.threshold);
size = size +
const _i1.SequenceCodec<_i2.AccountId32>(_i2.AccountId32Codec())
.sizeHint(obj.ayes);
size = size +
const _i1.SequenceCodec<_i2.AccountId32>(_i2.AccountId32Codec())
.sizeHint(obj.nays);
size = size + _i1.U32Codec.codec.sizeHint(obj.end);
return size;
}
}
// 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_arithmetic/per_things/perbill.dart' as _i3;
import '../../tuples.dart' as _i2;
class MedianAcc {
const MedianAcc({
required this.samples,
this.medianIndex,
required this.medianSubindex,
});
factory MedianAcc.decode(_i1.Input input) {
return codec.decode(input);
}
/// BoundedVec<(T, u32), ConstU32<S>>
final List<_i2.Tuple2<_i3.Perbill, int>> samples;
/// Option<u32>
final int? medianIndex;
/// u32
final int medianSubindex;
static const $MedianAccCodec codec = $MedianAccCodec();
_i4.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'samples': samples
.map((value) => [
value.value0,
value.value1,
])
.toList(),
'medianIndex': medianIndex,
'medianSubindex': medianSubindex,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is MedianAcc &&
_i5.listsEqual(
other.samples,
samples,
) &&
other.medianIndex == medianIndex &&
other.medianSubindex == medianSubindex;
@override
int get hashCode => Object.hash(
samples,
medianIndex,
medianSubindex,
);
}
class $MedianAccCodec with _i1.Codec<MedianAcc> {
const $MedianAccCodec();
@override
void encodeTo(
MedianAcc obj,
_i1.Output output,
) {
const _i1.SequenceCodec<_i2.Tuple2<_i3.Perbill, int>>(
_i2.Tuple2Codec<_i3.Perbill, int>(
_i3.PerbillCodec(),
_i1.U32Codec.codec,
)).encodeTo(
obj.samples,
output,
);
const _i1.OptionCodec<int>(_i1.U32Codec.codec).encodeTo(
obj.medianIndex,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.medianSubindex,
output,
);
}
@override
MedianAcc decode(_i1.Input input) {
return MedianAcc(
samples: const _i1.SequenceCodec<_i2.Tuple2<_i3.Perbill, int>>(
_i2.Tuple2Codec<_i3.Perbill, int>(
_i3.PerbillCodec(),
_i1.U32Codec.codec,
)).decode(input),
medianIndex: const _i1.OptionCodec<int>(_i1.U32Codec.codec).decode(input),
medianSubindex: _i1.U32Codec.codec.decode(input),
);
}
@override
int sizeHint(MedianAcc obj) {
int size = 0;
size = size +
const _i1.SequenceCodec<_i2.Tuple2<_i3.Perbill, int>>(
_i2.Tuple2Codec<_i3.Perbill, int>(
_i3.PerbillCodec(),
_i1.U32Codec.codec,
)).sizeHint(obj.samples);
size = size +
const _i1.OptionCodec<int>(_i1.U32Codec.codec)
.sizeHint(obj.medianIndex);
size = size + _i1.U32Codec.codec.sizeHint(obj.medianSubindex);
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;
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,
);
}