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 3937 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 _i6;
import '../../sp_core/crypto/account_id32.dart' as _i3;
import '../../sp_runtime/dispatch_error.dart' as _i5;
import '../timepoint.dart' as _i4;
/// 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();
NewMultisig newMultisig({
required _i3.AccountId32 approving,
required _i3.AccountId32 multisig,
required List<int> callHash,
}) {
return NewMultisig(
approving: approving,
multisig: multisig,
callHash: callHash,
);
}
MultisigApproval multisigApproval({
required _i3.AccountId32 approving,
required _i4.Timepoint timepoint,
required _i3.AccountId32 multisig,
required List<int> callHash,
}) {
return MultisigApproval(
approving: approving,
timepoint: timepoint,
multisig: multisig,
callHash: callHash,
);
}
MultisigExecuted multisigExecuted({
required _i3.AccountId32 approving,
required _i4.Timepoint timepoint,
required _i3.AccountId32 multisig,
required List<int> callHash,
required _i1.Result<dynamic, _i5.DispatchError> result,
}) {
return MultisigExecuted(
approving: approving,
timepoint: timepoint,
multisig: multisig,
callHash: callHash,
result: result,
);
}
MultisigCancelled multisigCancelled({
required _i3.AccountId32 cancelling,
required _i4.Timepoint timepoint,
required _i3.AccountId32 multisig,
required List<int> callHash,
}) {
return MultisigCancelled(
cancelling: cancelling,
timepoint: timepoint,
multisig: multisig,
callHash: callHash,
);
}
}
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 NewMultisig._decode(input);
case 1:
return MultisigApproval._decode(input);
case 2:
return MultisigExecuted._decode(input);
case 3:
return MultisigCancelled._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case NewMultisig:
(value as NewMultisig).encodeTo(output);
break;
case MultisigApproval:
(value as MultisigApproval).encodeTo(output);
break;
case MultisigExecuted:
(value as MultisigExecuted).encodeTo(output);
break;
case MultisigCancelled:
(value as MultisigCancelled).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case NewMultisig:
return (value as NewMultisig)._sizeHint();
case MultisigApproval:
return (value as MultisigApproval)._sizeHint();
case MultisigExecuted:
return (value as MultisigExecuted)._sizeHint();
case MultisigCancelled:
return (value as MultisigCancelled)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A new multisig operation has begun.
class NewMultisig extends Event {
const NewMultisig({
required this.approving,
required this.multisig,
required this.callHash,
});
factory NewMultisig._decode(_i1.Input input) {
return NewMultisig(
approving: const _i1.U8ArrayCodec(32).decode(input),
multisig: const _i1.U8ArrayCodec(32).decode(input),
callHash: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 approving;
/// T::AccountId
final _i3.AccountId32 multisig;
/// CallHash
final List<int> callHash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'NewMultisig': {
'approving': approving.toList(),
'multisig': multisig.toList(),
'callHash': callHash.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(approving);
size = size + const _i3.AccountId32Codec().sizeHint(multisig);
size = size + const _i1.U8ArrayCodec(32).sizeHint(callHash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
approving,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
multisig,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
callHash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is NewMultisig &&
_i6.listsEqual(
other.approving,
approving,
) &&
_i6.listsEqual(
other.multisig,
multisig,
) &&
_i6.listsEqual(
other.callHash,
callHash,
);
@override
int get hashCode => Object.hash(
approving,
multisig,
callHash,
);
}
/// A multisig operation has been approved by someone.
class MultisigApproval extends Event {
const MultisigApproval({
required this.approving,
required this.timepoint,
required this.multisig,
required this.callHash,
});
factory MultisigApproval._decode(_i1.Input input) {
return MultisigApproval(
approving: const _i1.U8ArrayCodec(32).decode(input),
timepoint: _i4.Timepoint.codec.decode(input),
multisig: const _i1.U8ArrayCodec(32).decode(input),
callHash: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 approving;
/// Timepoint<BlockNumberFor<T>>
final _i4.Timepoint timepoint;
/// T::AccountId
final _i3.AccountId32 multisig;
/// CallHash
final List<int> callHash;
@override
Map<String, Map<String, dynamic>> toJson() => {
'MultisigApproval': {
'approving': approving.toList(),
'timepoint': timepoint.toJson(),
'multisig': multisig.toList(),
'callHash': callHash.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(approving);
size = size + _i4.Timepoint.codec.sizeHint(timepoint);
size = size + const _i3.AccountId32Codec().sizeHint(multisig);
size = size + const _i1.U8ArrayCodec(32).sizeHint(callHash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
approving,
output,
);
_i4.Timepoint.codec.encodeTo(
timepoint,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
multisig,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
callHash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is MultisigApproval &&
_i6.listsEqual(
other.approving,
approving,
) &&
other.timepoint == timepoint &&
_i6.listsEqual(
other.multisig,
multisig,
) &&
_i6.listsEqual(
other.callHash,
callHash,
);
@override
int get hashCode => Object.hash(
approving,
timepoint,
multisig,
callHash,
);
}
/// A multisig operation has been executed.
class MultisigExecuted extends Event {
const MultisigExecuted({
required this.approving,
required this.timepoint,
required this.multisig,
required this.callHash,
required this.result,
});
factory MultisigExecuted._decode(_i1.Input input) {
return MultisigExecuted(
approving: const _i1.U8ArrayCodec(32).decode(input),
timepoint: _i4.Timepoint.codec.decode(input),
multisig: const _i1.U8ArrayCodec(32).decode(input),
callHash: const _i1.U8ArrayCodec(32).decode(input),
result: const _i1.ResultCodec<dynamic, _i5.DispatchError>(
_i1.NullCodec.codec,
_i5.DispatchError.codec,
).decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 approving;
/// Timepoint<BlockNumberFor<T>>
final _i4.Timepoint timepoint;
/// T::AccountId
final _i3.AccountId32 multisig;
/// CallHash
final List<int> callHash;
/// DispatchResult
final _i1.Result<dynamic, _i5.DispatchError> result;
@override
Map<String, Map<String, dynamic>> toJson() => {
'MultisigExecuted': {
'approving': approving.toList(),
'timepoint': timepoint.toJson(),
'multisig': multisig.toList(),
'callHash': callHash.toList(),
'result': result.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(approving);
size = size + _i4.Timepoint.codec.sizeHint(timepoint);
size = size + const _i3.AccountId32Codec().sizeHint(multisig);
size = size + const _i1.U8ArrayCodec(32).sizeHint(callHash);
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(
2,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
approving,
output,
);
_i4.Timepoint.codec.encodeTo(
timepoint,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
multisig,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
callHash,
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 MultisigExecuted &&
_i6.listsEqual(
other.approving,
approving,
) &&
other.timepoint == timepoint &&
_i6.listsEqual(
other.multisig,
multisig,
) &&
_i6.listsEqual(
other.callHash,
callHash,
) &&
other.result == result;
@override
int get hashCode => Object.hash(
approving,
timepoint,
multisig,
callHash,
result,
);
}
/// A multisig operation has been cancelled.
class MultisigCancelled extends Event {
const MultisigCancelled({
required this.cancelling,
required this.timepoint,
required this.multisig,
required this.callHash,
});
factory MultisigCancelled._decode(_i1.Input input) {
return MultisigCancelled(
cancelling: const _i1.U8ArrayCodec(32).decode(input),
timepoint: _i4.Timepoint.codec.decode(input),
multisig: const _i1.U8ArrayCodec(32).decode(input),
callHash: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 cancelling;
/// Timepoint<BlockNumberFor<T>>
final _i4.Timepoint timepoint;
/// T::AccountId
final _i3.AccountId32 multisig;
/// CallHash
final List<int> callHash;
@override
Map<String, Map<String, dynamic>> toJson() => {
'MultisigCancelled': {
'cancelling': cancelling.toList(),
'timepoint': timepoint.toJson(),
'multisig': multisig.toList(),
'callHash': callHash.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(cancelling);
size = size + _i4.Timepoint.codec.sizeHint(timepoint);
size = size + const _i3.AccountId32Codec().sizeHint(multisig);
size = size + const _i1.U8ArrayCodec(32).sizeHint(callHash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
cancelling,
output,
);
_i4.Timepoint.codec.encodeTo(
timepoint,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
multisig,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
callHash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is MultisigCancelled &&
_i6.listsEqual(
other.cancelling,
cancelling,
) &&
other.timepoint == timepoint &&
_i6.listsEqual(
other.multisig,
multisig,
) &&
_i6.listsEqual(
other.callHash,
callHash,
);
@override
int get hashCode => Object.hash(
cancelling,
timepoint,
multisig,
callHash,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
class Timepoint {
const Timepoint({
required this.height,
required this.index,
});
factory Timepoint.decode(_i1.Input input) {
return codec.decode(input);
}
/// BlockNumber
final int height;
/// u32
final int index;
static const $TimepointCodec codec = $TimepointCodec();
_i2.Uint8List encode() {
return codec.encode(this);
}
Map<String, int> toJson() => {
'height': height,
'index': index,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Timepoint && other.height == height && other.index == index;
@override
int get hashCode => Object.hash(
height,
index,
);
}
class $TimepointCodec with _i1.Codec<Timepoint> {
const $TimepointCodec();
@override
void encodeTo(
Timepoint obj,
_i1.Output output,
) {
_i1.U32Codec.codec.encodeTo(
obj.height,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.index,
output,
);
}
@override
Timepoint decode(_i1.Input input) {
return Timepoint(
height: _i1.U32Codec.codec.decode(input),
index: _i1.U32Codec.codec.decode(input),
);
}
@override
int sizeHint(Timepoint obj) {
int size = 0;
size = size + _i1.U32Codec.codec.sizeHint(obj.height);
size = size + _i1.U32Codec.codec.sizeHint(obj.index);
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 _i3;
/// Events type.
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, List<int>>> toJson();
}
class $Event {
const $Event();
Offence offence({
required List<int> kind,
required List<int> timeslot,
}) {
return Offence(
kind: kind,
timeslot: timeslot,
);
}
}
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 Offence._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Offence:
(value as Offence).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case Offence:
return (value as Offence)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// An offense was reported during the specified time slot. This event is not deposited for duplicate slashes.
class Offence extends Event {
const Offence({
required this.kind,
required this.timeslot,
});
factory Offence._decode(_i1.Input input) {
return Offence(
kind: const _i1.U8ArrayCodec(16).decode(input),
timeslot: _i1.U8SequenceCodec.codec.decode(input),
);
}
/// Kind
final List<int> kind;
/// OpaqueTimeSlot
final List<int> timeslot;
@override
Map<String, Map<String, List<int>>> toJson() => {
'Offence': {
'kind': kind.toList(),
'timeslot': timeslot,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i1.U8ArrayCodec(16).sizeHint(kind);
size = size + _i1.U8SequenceCodec.codec.sizeHint(timeslot);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(16).encodeTo(
kind,
output,
);
_i1.U8SequenceCodec.codec.encodeTo(
timeslot,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Offence &&
_i3.listsEqual(
other.kind,
kind,
) &&
_i3.listsEqual(
other.timeslot,
timeslot,
);
@override
int get hashCode => Object.hash(
kind,
timeslot,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:polkadart/scale_codec.dart' as _i2;
import '../../frame_system/extensions/check_nonce/check_nonce.dart' as _i1;
typedef CheckNonce = _i1.CheckNonce;
class CheckNonceCodec with _i2.Codec<CheckNonce> {
const CheckNonceCodec();
@override
CheckNonce decode(_i2.Input input) {
return _i2.CompactBigIntCodec.codec.decode(input);
}
@override
void encodeTo(
CheckNonce value,
_i2.Output output,
) {
_i2.CompactBigIntCodec.codec.encodeTo(
value,
output,
);
}
@override
int sizeHint(CheckNonce value) {
return const _i1.CheckNonceCodec().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;
import '../../sp_runtime/multiaddress/multi_address.dart' as _i3;
import '../types/account.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();
CreateOneshotAccount createOneshotAccount({
required _i3.MultiAddress dest,
required BigInt value,
}) {
return CreateOneshotAccount(
dest: dest,
value: value,
);
}
ConsumeOneshotAccount consumeOneshotAccount({
required int blockHeight,
required _i4.Account dest,
}) {
return ConsumeOneshotAccount(
blockHeight: blockHeight,
dest: dest,
);
}
ConsumeOneshotAccountWithRemaining consumeOneshotAccountWithRemaining({
required int blockHeight,
required _i4.Account dest,
required _i4.Account remainingTo,
required BigInt balance,
}) {
return ConsumeOneshotAccountWithRemaining(
blockHeight: blockHeight,
dest: dest,
remainingTo: remainingTo,
balance: balance,
);
}
}
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 CreateOneshotAccount._decode(input);
case 1:
return ConsumeOneshotAccount._decode(input);
case 2:
return ConsumeOneshotAccountWithRemaining._decode(input);
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
switch (value.runtimeType) {
case CreateOneshotAccount:
(value as CreateOneshotAccount).encodeTo(output);
break;
case ConsumeOneshotAccount:
(value as ConsumeOneshotAccount).encodeTo(output);
break;
case ConsumeOneshotAccountWithRemaining:
(value as ConsumeOneshotAccountWithRemaining).encodeTo(output);
break;
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Call value) {
switch (value.runtimeType) {
case CreateOneshotAccount:
return (value as CreateOneshotAccount)._sizeHint();
case ConsumeOneshotAccount:
return (value as ConsumeOneshotAccount)._sizeHint();
case ConsumeOneshotAccountWithRemaining:
return (value as ConsumeOneshotAccountWithRemaining)._sizeHint();
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// Create an account that can only be consumed once
///
/// - `dest`: The oneshot account to be created.
/// - `balance`: The balance to be transfered to this oneshot account.
///
/// Origin account is kept alive.
class CreateOneshotAccount extends Call {
const CreateOneshotAccount({
required this.dest,
required this.value,
});
factory CreateOneshotAccount._decode(_i1.Input input) {
return CreateOneshotAccount(
dest: _i3.MultiAddress.codec.decode(input),
value: _i1.CompactBigIntCodec.codec.decode(input),
);
}
/// <T::Lookup as StaticLookup>::Source
final _i3.MultiAddress dest;
/// BalanceOf<T>
final BigInt value;
@override
Map<String, Map<String, dynamic>> toJson() => {
'create_oneshot_account': {
'dest': dest.toJson(),
'value': value,
}
};
int _sizeHint() {
int size = 1;
size = size + _i3.MultiAddress.codec.sizeHint(dest);
size = size + _i1.CompactBigIntCodec.codec.sizeHint(value);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i3.MultiAddress.codec.encodeTo(
dest,
output,
);
_i1.CompactBigIntCodec.codec.encodeTo(
value,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is CreateOneshotAccount &&
other.dest == dest &&
other.value == value;
@override
int get hashCode => Object.hash(
dest,
value,
);
}
/// Consume a oneshot account and transfer its balance to an account
///
/// - `block_height`: Must be a recent block number. The limit is `BlockHashCount` in the past. (this is to prevent replay attacks)
/// - `dest`: The destination account.
/// - `dest_is_oneshot`: If set to `true`, then a oneshot account is created at `dest`. Else, `dest` has to be an existing account.
class ConsumeOneshotAccount extends Call {
const ConsumeOneshotAccount({
required this.blockHeight,
required this.dest,
});
factory ConsumeOneshotAccount._decode(_i1.Input input) {
return ConsumeOneshotAccount(
blockHeight: _i1.U32Codec.codec.decode(input),
dest: _i4.Account.codec.decode(input),
);
}
/// BlockNumberFor<T>
final int blockHeight;
/// Account<<T::Lookup as StaticLookup>::Source>
final _i4.Account dest;
@override
Map<String, Map<String, dynamic>> toJson() => {
'consume_oneshot_account': {
'blockHeight': blockHeight,
'dest': dest.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(blockHeight);
size = size + _i4.Account.codec.sizeHint(dest);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i1.U32Codec.codec.encodeTo(
blockHeight,
output,
);
_i4.Account.codec.encodeTo(
dest,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ConsumeOneshotAccount &&
other.blockHeight == blockHeight &&
other.dest == dest;
@override
int get hashCode => Object.hash(
blockHeight,
dest,
);
}
/// Consume a oneshot account then transfer some amount to an account,
/// and the remaining amount to another account.
///
/// - `block_height`: Must be a recent block number.
/// The limit is `BlockHashCount` in the past. (this is to prevent replay attacks)
/// - `dest`: The destination account.
/// - `dest_is_oneshot`: If set to `true`, then a oneshot account is created at `dest`. Else, `dest` has to be an existing account.
/// - `dest2`: The second destination account.
/// - `dest2_is_oneshot`: If set to `true`, then a oneshot account is created at `dest2`. Else, `dest2` has to be an existing account.
/// - `balance1`: The amount transfered to `dest`, the leftover being transfered to `dest2`.
class ConsumeOneshotAccountWithRemaining extends Call {
const ConsumeOneshotAccountWithRemaining({
required this.blockHeight,
required this.dest,
required this.remainingTo,
required this.balance,
});
factory ConsumeOneshotAccountWithRemaining._decode(_i1.Input input) {
return ConsumeOneshotAccountWithRemaining(
blockHeight: _i1.U32Codec.codec.decode(input),
dest: _i4.Account.codec.decode(input),
remainingTo: _i4.Account.codec.decode(input),
balance: _i1.CompactBigIntCodec.codec.decode(input),
);
}
/// BlockNumberFor<T>
final int blockHeight;
/// Account<<T::Lookup as StaticLookup>::Source>
final _i4.Account dest;
/// Account<<T::Lookup as StaticLookup>::Source>
final _i4.Account remainingTo;
/// BalanceOf<T>
final BigInt balance;
@override
Map<String, Map<String, dynamic>> toJson() => {
'consume_oneshot_account_with_remaining': {
'blockHeight': blockHeight,
'dest': dest.toJson(),
'remainingTo': remainingTo.toJson(),
'balance': balance,
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U32Codec.codec.sizeHint(blockHeight);
size = size + _i4.Account.codec.sizeHint(dest);
size = size + _i4.Account.codec.sizeHint(remainingTo);
size = size + _i1.CompactBigIntCodec.codec.sizeHint(balance);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
_i1.U32Codec.codec.encodeTo(
blockHeight,
output,
);
_i4.Account.codec.encodeTo(
dest,
output,
);
_i4.Account.codec.encodeTo(
remainingTo,
output,
);
_i1.CompactBigIntCodec.codec.encodeTo(
balance,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is ConsumeOneshotAccountWithRemaining &&
other.blockHeight == blockHeight &&
other.dest == dest &&
other.remainingTo == remainingTo &&
other.balance == balance;
@override
int get hashCode => Object.hash(
blockHeight,
dest,
remainingTo,
balance,
);
}
// 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 {
/// Block height is in the future.
blockHeightInFuture('BlockHeightInFuture', 0),
/// Block height is too old.
blockHeightTooOld('BlockHeightTooOld', 1),
/// Destination account does not exist.
destAccountNotExist('DestAccountNotExist', 2),
/// Destination account has a balance less than the existential deposit.
existentialDeposit('ExistentialDeposit', 3),
/// Source account has insufficient balance.
insufficientBalance('InsufficientBalance', 4),
/// Destination oneshot account already exists.
oneshotAccountAlreadyCreated('OneshotAccountAlreadyCreated', 5),
/// Source oneshot account does not exist.
oneshotAccountNotExist('OneshotAccountNotExist', 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.blockHeightInFuture;
case 1:
return Error.blockHeightTooOld;
case 2:
return Error.destAccountNotExist;
case 3:
return Error.existentialDeposit;
case 4:
return Error.insufficientBalance;
case 5:
return Error.oneshotAccountAlreadyCreated;
case 6:
return Error.oneshotAccountNotExist;
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_core/crypto/account_id32.dart' as _i3;
import '../../tuples.dart' as _i4;
/// 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();
OneshotAccountCreated oneshotAccountCreated({
required _i3.AccountId32 account,
required BigInt balance,
required _i3.AccountId32 creator,
}) {
return OneshotAccountCreated(
account: account,
balance: balance,
creator: creator,
);
}
OneshotAccountConsumed oneshotAccountConsumed({
required _i3.AccountId32 account,
required _i4.Tuple2<_i3.AccountId32, BigInt> dest1,
_i4.Tuple2<_i3.AccountId32, BigInt>? dest2,
}) {
return OneshotAccountConsumed(
account: account,
dest1: dest1,
dest2: dest2,
);
}
Withdraw withdraw({
required _i3.AccountId32 account,
required BigInt balance,
}) {
return Withdraw(
account: account,
balance: balance,
);
}
}
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 OneshotAccountCreated._decode(input);
case 1:
return OneshotAccountConsumed._decode(input);
case 2:
return Withdraw._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case OneshotAccountCreated:
(value as OneshotAccountCreated).encodeTo(output);
break;
case OneshotAccountConsumed:
(value as OneshotAccountConsumed).encodeTo(output);
break;
case Withdraw:
(value as Withdraw).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case OneshotAccountCreated:
return (value as OneshotAccountCreated)._sizeHint();
case OneshotAccountConsumed:
return (value as OneshotAccountConsumed)._sizeHint();
case Withdraw:
return (value as Withdraw)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A oneshot account was created.
class OneshotAccountCreated extends Event {
const OneshotAccountCreated({
required this.account,
required this.balance,
required this.creator,
});
factory OneshotAccountCreated._decode(_i1.Input input) {
return OneshotAccountCreated(
account: const _i1.U8ArrayCodec(32).decode(input),
balance: _i1.U64Codec.codec.decode(input),
creator: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 account;
/// BalanceOf<T>
final BigInt balance;
/// T::AccountId
final _i3.AccountId32 creator;
@override
Map<String, Map<String, dynamic>> toJson() => {
'OneshotAccountCreated': {
'account': account.toList(),
'balance': balance,
'creator': creator.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(account);
size = size + _i1.U64Codec.codec.sizeHint(balance);
size = size + const _i3.AccountId32Codec().sizeHint(creator);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
account,
output,
);
_i1.U64Codec.codec.encodeTo(
balance,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
creator,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is OneshotAccountCreated &&
_i5.listsEqual(
other.account,
account,
) &&
other.balance == balance &&
_i5.listsEqual(
other.creator,
creator,
);
@override
int get hashCode => Object.hash(
account,
balance,
creator,
);
}
/// A oneshot account was consumed.
class OneshotAccountConsumed extends Event {
const OneshotAccountConsumed({
required this.account,
required this.dest1,
this.dest2,
});
factory OneshotAccountConsumed._decode(_i1.Input input) {
return OneshotAccountConsumed(
account: const _i1.U8ArrayCodec(32).decode(input),
dest1: const _i4.Tuple2Codec<_i3.AccountId32, BigInt>(
_i3.AccountId32Codec(),
_i1.U64Codec.codec,
).decode(input),
dest2: const _i1.OptionCodec<_i4.Tuple2<_i3.AccountId32, BigInt>>(
_i4.Tuple2Codec<_i3.AccountId32, BigInt>(
_i3.AccountId32Codec(),
_i1.U64Codec.codec,
)).decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 account;
/// (T::AccountId, BalanceOf<T>)
final _i4.Tuple2<_i3.AccountId32, BigInt> dest1;
/// Option<(T::AccountId, BalanceOf<T>)>
final _i4.Tuple2<_i3.AccountId32, BigInt>? dest2;
@override
Map<String, Map<String, List<dynamic>?>> toJson() => {
'OneshotAccountConsumed': {
'account': account.toList(),
'dest1': [
dest1.value0.toList(),
dest1.value1,
],
'dest2': [
dest2?.value0.toList(),
dest2?.value1,
],
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(account);
size = size +
const _i4.Tuple2Codec<_i3.AccountId32, BigInt>(
_i3.AccountId32Codec(),
_i1.U64Codec.codec,
).sizeHint(dest1);
size = size +
const _i1.OptionCodec<_i4.Tuple2<_i3.AccountId32, BigInt>>(
_i4.Tuple2Codec<_i3.AccountId32, BigInt>(
_i3.AccountId32Codec(),
_i1.U64Codec.codec,
)).sizeHint(dest2);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
account,
output,
);
const _i4.Tuple2Codec<_i3.AccountId32, BigInt>(
_i3.AccountId32Codec(),
_i1.U64Codec.codec,
).encodeTo(
dest1,
output,
);
const _i1.OptionCodec<_i4.Tuple2<_i3.AccountId32, BigInt>>(
_i4.Tuple2Codec<_i3.AccountId32, BigInt>(
_i3.AccountId32Codec(),
_i1.U64Codec.codec,
)).encodeTo(
dest2,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is OneshotAccountConsumed &&
_i5.listsEqual(
other.account,
account,
) &&
other.dest1 == dest1 &&
other.dest2 == dest2;
@override
int get hashCode => Object.hash(
account,
dest1,
dest2,
);
}
/// A withdrawal was executed on a oneshot account.
class Withdraw extends Event {
const Withdraw({
required this.account,
required this.balance,
});
factory Withdraw._decode(_i1.Input input) {
return Withdraw(
account: const _i1.U8ArrayCodec(32).decode(input),
balance: _i1.U64Codec.codec.decode(input),
);
}
/// T::AccountId
final _i3.AccountId32 account;
/// BalanceOf<T>
final BigInt balance;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Withdraw': {
'account': account.toList(),
'balance': balance,
}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.AccountId32Codec().sizeHint(account);
size = size + _i1.U64Codec.codec.sizeHint(balance);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
account,
output,
);
_i1.U64Codec.codec.encodeTo(
balance,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Withdraw &&
_i5.listsEqual(
other.account,
account,
) &&
other.balance == balance;
@override
int get hashCode => Object.hash(
account,
balance,
);
}
// 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_runtime/multiaddress/multi_address.dart' as _i3;
abstract class Account {
const Account();
factory Account.decode(_i1.Input input) {
return codec.decode(input);
}
static const $AccountCodec codec = $AccountCodec();
static const $Account values = $Account();
_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 $Account {
const $Account();
Normal normal(_i3.MultiAddress value0) {
return Normal(value0);
}
Oneshot oneshot(_i3.MultiAddress value0) {
return Oneshot(value0);
}
}
class $AccountCodec with _i1.Codec<Account> {
const $AccountCodec();
@override
Account decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Normal._decode(input);
case 1:
return Oneshot._decode(input);
default:
throw Exception('Account: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Account value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Normal:
(value as Normal).encodeTo(output);
break;
case Oneshot:
(value as Oneshot).encodeTo(output);
break;
default:
throw Exception(
'Account: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Account value) {
switch (value.runtimeType) {
case Normal:
return (value as Normal)._sizeHint();
case Oneshot:
return (value as Oneshot)._sizeHint();
default:
throw Exception(
'Account: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
class Normal extends Account {
const Normal(this.value0);
factory Normal._decode(_i1.Input input) {
return Normal(_i3.MultiAddress.codec.decode(input));
}
/// AccountId
final _i3.MultiAddress value0;
@override
Map<String, Map<String, dynamic>> toJson() => {'Normal': value0.toJson()};
int _sizeHint() {
int size = 1;
size = size + _i3.MultiAddress.codec.sizeHint(value0);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i3.MultiAddress.codec.encodeTo(
value0,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Normal && other.value0 == value0;
@override
int get hashCode => value0.hashCode;
}
class Oneshot extends Account {
const Oneshot(this.value0);
factory Oneshot._decode(_i1.Input input) {
return Oneshot(_i3.MultiAddress.codec.decode(input));
}
/// AccountId
final _i3.MultiAddress value0;
@override
Map<String, Map<String, dynamic>> toJson() => {'Oneshot': value0.toJson()};
int _sizeHint() {
int size = 1;
size = size + _i3.MultiAddress.codec.sizeHint(value0);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i3.MultiAddress.codec.encodeTo(
value0,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Oneshot && 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;
import '../sp_core/crypto/account_id32.dart' as _i4;
import '../tuples.dart' as _i3;
abstract class OldRequestStatus {
const OldRequestStatus();
factory OldRequestStatus.decode(_i1.Input input) {
return codec.decode(input);
}
static const $OldRequestStatusCodec codec = $OldRequestStatusCodec();
static const $OldRequestStatus values = $OldRequestStatus();
_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 $OldRequestStatus {
const $OldRequestStatus();
Unrequested unrequested({
required _i3.Tuple2<_i4.AccountId32, BigInt> deposit,
required int len,
}) {
return Unrequested(
deposit: deposit,
len: len,
);
}
Requested requested({
_i3.Tuple2<_i4.AccountId32, BigInt>? deposit,
required int count,
int? len,
}) {
return Requested(
deposit: deposit,
count: count,
len: len,
);
}
}
class $OldRequestStatusCodec with _i1.Codec<OldRequestStatus> {
const $OldRequestStatusCodec();
@override
OldRequestStatus decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Unrequested._decode(input);
case 1:
return Requested._decode(input);
default:
throw Exception('OldRequestStatus: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
OldRequestStatus value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Unrequested:
(value as Unrequested).encodeTo(output);
break;
case Requested:
(value as Requested).encodeTo(output);
break;
default:
throw Exception(
'OldRequestStatus: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(OldRequestStatus value) {
switch (value.runtimeType) {
case Unrequested:
return (value as Unrequested)._sizeHint();
case Requested:
return (value as Requested)._sizeHint();
default:
throw Exception(
'OldRequestStatus: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
class Unrequested extends OldRequestStatus {
const Unrequested({
required this.deposit,
required this.len,
});
factory Unrequested._decode(_i1.Input input) {
return Unrequested(
deposit: const _i3.Tuple2Codec<_i4.AccountId32, BigInt>(
_i4.AccountId32Codec(),
_i1.U64Codec.codec,
).decode(input),
len: _i1.U32Codec.codec.decode(input),
);
}
/// (AccountId, Balance)
final _i3.Tuple2<_i4.AccountId32, BigInt> deposit;
/// u32
final int len;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Unrequested': {
'deposit': [
deposit.value0.toList(),
deposit.value1,
],
'len': len,
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i3.Tuple2Codec<_i4.AccountId32, BigInt>(
_i4.AccountId32Codec(),
_i1.U64Codec.codec,
).sizeHint(deposit);
size = size + _i1.U32Codec.codec.sizeHint(len);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i3.Tuple2Codec<_i4.AccountId32, BigInt>(
_i4.AccountId32Codec(),
_i1.U64Codec.codec,
).encodeTo(
deposit,
output,
);
_i1.U32Codec.codec.encodeTo(
len,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Unrequested && other.deposit == deposit && other.len == len;
@override
int get hashCode => Object.hash(
deposit,
len,
);
}
class Requested extends OldRequestStatus {
const Requested({
this.deposit,
required this.count,
this.len,
});
factory Requested._decode(_i1.Input input) {
return Requested(
deposit: const _i1.OptionCodec<_i3.Tuple2<_i4.AccountId32, BigInt>>(
_i3.Tuple2Codec<_i4.AccountId32, BigInt>(
_i4.AccountId32Codec(),
_i1.U64Codec.codec,
)).decode(input),
count: _i1.U32Codec.codec.decode(input),
len: const _i1.OptionCodec<int>(_i1.U32Codec.codec).decode(input),
);
}
/// Option<(AccountId, Balance)>
final _i3.Tuple2<_i4.AccountId32, BigInt>? deposit;
/// u32
final int count;
/// Option<u32>
final int? len;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Requested': {
'deposit': [
deposit?.value0.toList(),
deposit?.value1,
],
'count': count,
'len': len,
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i1.OptionCodec<_i3.Tuple2<_i4.AccountId32, BigInt>>(
_i3.Tuple2Codec<_i4.AccountId32, BigInt>(
_i4.AccountId32Codec(),
_i1.U64Codec.codec,
)).sizeHint(deposit);
size = size + _i1.U32Codec.codec.sizeHint(count);
size = size + const _i1.OptionCodec<int>(_i1.U32Codec.codec).sizeHint(len);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.OptionCodec<_i3.Tuple2<_i4.AccountId32, BigInt>>(
_i3.Tuple2Codec<_i4.AccountId32, BigInt>(
_i4.AccountId32Codec(),
_i1.U64Codec.codec,
)).encodeTo(
deposit,
output,
);
_i1.U32Codec.codec.encodeTo(
count,
output,
);
const _i1.OptionCodec<int>(_i1.U32Codec.codec).encodeTo(
len,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Requested &&
other.deposit == deposit &&
other.count == count &&
other.len == len;
@override
int get hashCode => Object.hash(
deposit,
count,
len,
);
}
// 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 '../../primitive_types/h256.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, Map<String, List<dynamic>>> toJson();
}
class $Call {
const $Call();
NotePreimage notePreimage({required List<int> bytes}) {
return NotePreimage(bytes: bytes);
}
UnnotePreimage unnotePreimage({required _i3.H256 hash}) {
return UnnotePreimage(hash: hash);
}
RequestPreimage requestPreimage({required _i3.H256 hash}) {
return RequestPreimage(hash: hash);
}
UnrequestPreimage unrequestPreimage({required _i3.H256 hash}) {
return UnrequestPreimage(hash: hash);
}
EnsureUpdated ensureUpdated({required List<_i3.H256> hashes}) {
return EnsureUpdated(hashes: hashes);
}
}
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 NotePreimage._decode(input);
case 1:
return UnnotePreimage._decode(input);
case 2:
return RequestPreimage._decode(input);
case 3:
return UnrequestPreimage._decode(input);
case 4:
return EnsureUpdated._decode(input);
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
switch (value.runtimeType) {
case NotePreimage:
(value as NotePreimage).encodeTo(output);
break;
case UnnotePreimage:
(value as UnnotePreimage).encodeTo(output);
break;
case RequestPreimage:
(value as RequestPreimage).encodeTo(output);
break;
case UnrequestPreimage:
(value as UnrequestPreimage).encodeTo(output);
break;
case EnsureUpdated:
(value as EnsureUpdated).encodeTo(output);
break;
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Call value) {
switch (value.runtimeType) {
case NotePreimage:
return (value as NotePreimage)._sizeHint();
case UnnotePreimage:
return (value as UnnotePreimage)._sizeHint();
case RequestPreimage:
return (value as RequestPreimage)._sizeHint();
case UnrequestPreimage:
return (value as UnrequestPreimage)._sizeHint();
case EnsureUpdated:
return (value as EnsureUpdated)._sizeHint();
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// Register a preimage on-chain.
///
/// If the preimage was previously requested, no fees or deposits are taken for providing
/// the preimage. Otherwise, a deposit is taken proportional to the size of the preimage.
class NotePreimage extends Call {
const NotePreimage({required this.bytes});
factory NotePreimage._decode(_i1.Input input) {
return NotePreimage(bytes: _i1.U8SequenceCodec.codec.decode(input));
}
/// Vec<u8>
final List<int> bytes;
@override
Map<String, Map<String, List<int>>> toJson() => {
'note_preimage': {'bytes': bytes}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U8SequenceCodec.codec.sizeHint(bytes);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i1.U8SequenceCodec.codec.encodeTo(
bytes,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is NotePreimage &&
_i4.listsEqual(
other.bytes,
bytes,
);
@override
int get hashCode => bytes.hashCode;
}
/// Clear an unrequested preimage from the runtime storage.
///
/// If `len` is provided, then it will be a much cheaper operation.
///
/// - `hash`: The hash of the preimage to be removed from the store.
/// - `len`: The length of the preimage of `hash`.
class UnnotePreimage extends Call {
const UnnotePreimage({required this.hash});
factory UnnotePreimage._decode(_i1.Input input) {
return UnnotePreimage(hash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i3.H256 hash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'unnote_preimage': {'hash': hash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.H256Codec().sizeHint(hash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
hash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is UnnotePreimage &&
_i4.listsEqual(
other.hash,
hash,
);
@override
int get hashCode => hash.hashCode;
}
/// Request a preimage be uploaded to the chain without paying any fees or deposits.
///
/// If the preimage requests has already been provided on-chain, we unreserve any deposit
/// a user may have paid, and take the control of the preimage out of their hands.
class RequestPreimage extends Call {
const RequestPreimage({required this.hash});
factory RequestPreimage._decode(_i1.Input input) {
return RequestPreimage(hash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i3.H256 hash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'request_preimage': {'hash': hash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.H256Codec().sizeHint(hash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
hash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is RequestPreimage &&
_i4.listsEqual(
other.hash,
hash,
);
@override
int get hashCode => hash.hashCode;
}
/// Clear a previously made request for a preimage.
///
/// NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`.
class UnrequestPreimage extends Call {
const UnrequestPreimage({required this.hash});
factory UnrequestPreimage._decode(_i1.Input input) {
return UnrequestPreimage(hash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i3.H256 hash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'unrequest_preimage': {'hash': hash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.H256Codec().sizeHint(hash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
3,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
hash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is UnrequestPreimage &&
_i4.listsEqual(
other.hash,
hash,
);
@override
int get hashCode => hash.hashCode;
}
/// Ensure that the a bulk of pre-images is upgraded.
///
/// The caller pays no fee if at least 90% of pre-images were successfully updated.
class EnsureUpdated extends Call {
const EnsureUpdated({required this.hashes});
factory EnsureUpdated._decode(_i1.Input input) {
return EnsureUpdated(
hashes:
const _i1.SequenceCodec<_i3.H256>(_i3.H256Codec()).decode(input));
}
/// Vec<T::Hash>
final List<_i3.H256> hashes;
@override
Map<String, Map<String, List<List<int>>>> toJson() => {
'ensure_updated': {
'hashes': hashes.map((value) => value.toList()).toList()
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i1.SequenceCodec<_i3.H256>(_i3.H256Codec()).sizeHint(hashes);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
4,
output,
);
const _i1.SequenceCodec<_i3.H256>(_i3.H256Codec()).encodeTo(
hashes,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is EnsureUpdated &&
_i4.listsEqual(
other.hashes,
hashes,
);
@override
int get hashCode => hashes.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 {
/// Preimage is too large to store on-chain.
tooBig('TooBig', 0),
/// Preimage has already been noted on-chain.
alreadyNoted('AlreadyNoted', 1),
/// The user is not authorized to perform this action.
notAuthorized('NotAuthorized', 2),
/// The preimage cannot be removed since it has not yet been noted.
notNoted('NotNoted', 3),
/// A preimage may not be removed when there are outstanding requests.
requested('Requested', 4),
/// The preimage request cannot be removed since no outstanding requests exist.
notRequested('NotRequested', 5),
/// More than `MAX_HASH_UPGRADE_BULK_COUNT` hashes were requested to be upgraded at once.
tooMany('TooMany', 6),
/// Too few hashes were requested to be upgraded (i.e. zero).
tooFew('TooFew', 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.tooBig;
case 1:
return Error.alreadyNoted;
case 2:
return Error.notAuthorized;
case 3:
return Error.notNoted;
case 4:
return Error.requested;
case 5:
return Error.notRequested;
case 6:
return Error.tooMany;
case 7:
return Error.tooFew;
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 _i4;
import '../../primitive_types/h256.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, List<int>>> toJson();
}
class $Event {
const $Event();
Noted noted({required _i3.H256 hash}) {
return Noted(hash: hash);
}
Requested requested({required _i3.H256 hash}) {
return Requested(hash: hash);
}
Cleared cleared({required _i3.H256 hash}) {
return Cleared(hash: hash);
}
}
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 Noted._decode(input);
case 1:
return Requested._decode(input);
case 2:
return Cleared._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Noted:
(value as Noted).encodeTo(output);
break;
case Requested:
(value as Requested).encodeTo(output);
break;
case Cleared:
(value as Cleared).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case Noted:
return (value as Noted)._sizeHint();
case Requested:
return (value as Requested)._sizeHint();
case Cleared:
return (value as Cleared)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A preimage has been noted.
class Noted extends Event {
const Noted({required this.hash});
factory Noted._decode(_i1.Input input) {
return Noted(hash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i3.H256 hash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'Noted': {'hash': hash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.H256Codec().sizeHint(hash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
hash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Noted &&
_i4.listsEqual(
other.hash,
hash,
);
@override
int get hashCode => hash.hashCode;
}
/// A preimage has been requested.
class Requested extends Event {
const Requested({required this.hash});
factory Requested._decode(_i1.Input input) {
return Requested(hash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i3.H256 hash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'Requested': {'hash': hash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.H256Codec().sizeHint(hash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
hash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Requested &&
_i4.listsEqual(
other.hash,
hash,
);
@override
int get hashCode => hash.hashCode;
}
/// A preimage has ben cleared.
class Cleared extends Event {
const Cleared({required this.hash});
factory Cleared._decode(_i1.Input input) {
return Cleared(hash: const _i1.U8ArrayCodec(32).decode(input));
}
/// T::Hash
final _i3.H256 hash;
@override
Map<String, Map<String, List<int>>> toJson() => {
'Cleared': {'hash': hash.toList()}
};
int _sizeHint() {
int size = 1;
size = size + const _i3.H256Codec().sizeHint(hash);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
2,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
hash,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Cleared &&
_i4.listsEqual(
other.hash,
hash,
);
@override
int get hashCode => hash.hashCode;
}
// 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 {
preimage('Preimage', 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.preimage;
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 _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
import '../sp_core/crypto/account_id32.dart' as _i4;
import '../tuples.dart' as _i3;
abstract class RequestStatus {
const RequestStatus();
factory RequestStatus.decode(_i1.Input input) {
return codec.decode(input);
}
static const $RequestStatusCodec codec = $RequestStatusCodec();
static const $RequestStatus values = $RequestStatus();
_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 $RequestStatus {
const $RequestStatus();
Unrequested unrequested({
required _i3.Tuple2<_i4.AccountId32, dynamic> ticket,
required int len,
}) {
return Unrequested(
ticket: ticket,
len: len,
);
}
Requested requested({
_i3.Tuple2<_i4.AccountId32, dynamic>? maybeTicket,
required int count,
int? maybeLen,
}) {
return Requested(
maybeTicket: maybeTicket,
count: count,
maybeLen: maybeLen,
);
}
}
class $RequestStatusCodec with _i1.Codec<RequestStatus> {
const $RequestStatusCodec();
@override
RequestStatus decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return Unrequested._decode(input);
case 1:
return Requested._decode(input);
default:
throw Exception('RequestStatus: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
RequestStatus value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Unrequested:
(value as Unrequested).encodeTo(output);
break;
case Requested:
(value as Requested).encodeTo(output);
break;
default:
throw Exception(
'RequestStatus: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(RequestStatus value) {
switch (value.runtimeType) {
case Unrequested:
return (value as Unrequested)._sizeHint();
case Requested:
return (value as Requested)._sizeHint();
default:
throw Exception(
'RequestStatus: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
class Unrequested extends RequestStatus {
const Unrequested({
required this.ticket,
required this.len,
});
factory Unrequested._decode(_i1.Input input) {
return Unrequested(
ticket: const _i3.Tuple2Codec<_i4.AccountId32, dynamic>(
_i4.AccountId32Codec(),
_i1.NullCodec.codec,
).decode(input),
len: _i1.U32Codec.codec.decode(input),
);
}
/// (AccountId, Ticket)
final _i3.Tuple2<_i4.AccountId32, dynamic> ticket;
/// u32
final int len;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Unrequested': {
'ticket': [
ticket.value0.toList(),
null,
],
'len': len,
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i3.Tuple2Codec<_i4.AccountId32, dynamic>(
_i4.AccountId32Codec(),
_i1.NullCodec.codec,
).sizeHint(ticket);
size = size + _i1.U32Codec.codec.sizeHint(len);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
const _i3.Tuple2Codec<_i4.AccountId32, dynamic>(
_i4.AccountId32Codec(),
_i1.NullCodec.codec,
).encodeTo(
ticket,
output,
);
_i1.U32Codec.codec.encodeTo(
len,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Unrequested && other.ticket == ticket && other.len == len;
@override
int get hashCode => Object.hash(
ticket,
len,
);
}
class Requested extends RequestStatus {
const Requested({
this.maybeTicket,
required this.count,
this.maybeLen,
});
factory Requested._decode(_i1.Input input) {
return Requested(
maybeTicket: const _i1.OptionCodec<_i3.Tuple2<_i4.AccountId32, dynamic>>(
_i3.Tuple2Codec<_i4.AccountId32, dynamic>(
_i4.AccountId32Codec(),
_i1.NullCodec.codec,
)).decode(input),
count: _i1.U32Codec.codec.decode(input),
maybeLen: const _i1.OptionCodec<int>(_i1.U32Codec.codec).decode(input),
);
}
/// Option<(AccountId, Ticket)>
final _i3.Tuple2<_i4.AccountId32, dynamic>? maybeTicket;
/// u32
final int count;
/// Option<u32>
final int? maybeLen;
@override
Map<String, Map<String, dynamic>> toJson() => {
'Requested': {
'maybeTicket': [
maybeTicket?.value0.toList(),
null,
],
'count': count,
'maybeLen': maybeLen,
}
};
int _sizeHint() {
int size = 1;
size = size +
const _i1.OptionCodec<_i3.Tuple2<_i4.AccountId32, dynamic>>(
_i3.Tuple2Codec<_i4.AccountId32, dynamic>(
_i4.AccountId32Codec(),
_i1.NullCodec.codec,
)).sizeHint(maybeTicket);
size = size + _i1.U32Codec.codec.sizeHint(count);
size = size +
const _i1.OptionCodec<int>(_i1.U32Codec.codec).sizeHint(maybeLen);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
const _i1.OptionCodec<_i3.Tuple2<_i4.AccountId32, dynamic>>(
_i3.Tuple2Codec<_i4.AccountId32, dynamic>(
_i4.AccountId32Codec(),
_i1.NullCodec.codec,
)).encodeTo(
maybeTicket,
output,
);
_i1.U32Codec.codec.encodeTo(
count,
output,
);
const _i1.OptionCodec<int>(_i1.U32Codec.codec).encodeTo(
maybeLen,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Requested &&
other.maybeTicket == maybeTicket &&
other.count == count &&
other.maybeLen == maybeLen;
@override
int get hashCode => Object.hash(
maybeTicket,
count,
maybeLen,
);
}
// 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 '../../primitive_types/h256.dart' as _i4;
import '../types/randomness_type.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, Map<String, dynamic>> toJson();
}
class $Call {
const $Call();
Request request({
required _i3.RandomnessType randomnessType,
required _i4.H256 salt,
}) {
return Request(
randomnessType: randomnessType,
salt: salt,
);
}
}
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 Request._decode(input);
default:
throw Exception('Call: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Call value,
_i1.Output output,
) {
switch (value.runtimeType) {
case Request:
(value as Request).encodeTo(output);
break;
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Call value) {
switch (value.runtimeType) {
case Request:
return (value as Request)._sizeHint();
default:
throw Exception(
'Call: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// Request randomness.
class Request extends Call {
const Request({
required this.randomnessType,
required this.salt,
});
factory Request._decode(_i1.Input input) {
return Request(
randomnessType: _i3.RandomnessType.codec.decode(input),
salt: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// RandomnessType
final _i3.RandomnessType randomnessType;
/// H256
final _i4.H256 salt;
@override
Map<String, Map<String, dynamic>> toJson() => {
'request': {
'randomnessType': randomnessType.toJson(),
'salt': salt.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i3.RandomnessType.codec.sizeHint(randomnessType);
size = size + const _i4.H256Codec().sizeHint(salt);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i3.RandomnessType.codec.encodeTo(
randomnessType,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
salt,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Request &&
other.randomnessType == randomnessType &&
_i5.listsEqual(
other.salt,
salt,
);
@override
int get hashCode => Object.hash(
randomnessType,
salt,
);
}
// 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 {
/// Request randomness queue is full.
queueFull('QueueFull', 0);
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.queueFull;
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 '../../primitive_types/h256.dart' as _i3;
import '../types/randomness_type.dart' as _i4;
/// 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();
FilledRandomness filledRandomness({
required BigInt requestId,
required _i3.H256 randomness,
}) {
return FilledRandomness(
requestId: requestId,
randomness: randomness,
);
}
RequestedRandomness requestedRandomness({
required BigInt requestId,
required _i3.H256 salt,
required _i4.RandomnessType type,
}) {
return RequestedRandomness(
requestId: requestId,
salt: salt,
type: type,
);
}
}
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 FilledRandomness._decode(input);
case 1:
return RequestedRandomness._decode(input);
default:
throw Exception('Event: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
Event value,
_i1.Output output,
) {
switch (value.runtimeType) {
case FilledRandomness:
(value as FilledRandomness).encodeTo(output);
break;
case RequestedRandomness:
(value as RequestedRandomness).encodeTo(output);
break;
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
@override
int sizeHint(Event value) {
switch (value.runtimeType) {
case FilledRandomness:
return (value as FilledRandomness)._sizeHint();
case RequestedRandomness:
return (value as RequestedRandomness)._sizeHint();
default:
throw Exception(
'Event: Unsupported "$value" of type "${value.runtimeType}"');
}
}
}
/// A request for randomness was fulfilled.
class FilledRandomness extends Event {
const FilledRandomness({
required this.requestId,
required this.randomness,
});
factory FilledRandomness._decode(_i1.Input input) {
return FilledRandomness(
requestId: _i1.U64Codec.codec.decode(input),
randomness: const _i1.U8ArrayCodec(32).decode(input),
);
}
/// RequestId
final BigInt requestId;
/// H256
final _i3.H256 randomness;
@override
Map<String, Map<String, dynamic>> toJson() => {
'FilledRandomness': {
'requestId': requestId,
'randomness': randomness.toList(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U64Codec.codec.sizeHint(requestId);
size = size + const _i3.H256Codec().sizeHint(randomness);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
0,
output,
);
_i1.U64Codec.codec.encodeTo(
requestId,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
randomness,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is FilledRandomness &&
other.requestId == requestId &&
_i5.listsEqual(
other.randomness,
randomness,
);
@override
int get hashCode => Object.hash(
requestId,
randomness,
);
}
/// A request for randomness was made.
class RequestedRandomness extends Event {
const RequestedRandomness({
required this.requestId,
required this.salt,
required this.type,
});
factory RequestedRandomness._decode(_i1.Input input) {
return RequestedRandomness(
requestId: _i1.U64Codec.codec.decode(input),
salt: const _i1.U8ArrayCodec(32).decode(input),
type: _i4.RandomnessType.codec.decode(input),
);
}
/// RequestId
final BigInt requestId;
/// H256
final _i3.H256 salt;
/// RandomnessType
final _i4.RandomnessType type;
@override
Map<String, Map<String, dynamic>> toJson() => {
'RequestedRandomness': {
'requestId': requestId,
'salt': salt.toList(),
'r#type': type.toJson(),
}
};
int _sizeHint() {
int size = 1;
size = size + _i1.U64Codec.codec.sizeHint(requestId);
size = size + const _i3.H256Codec().sizeHint(salt);
size = size + _i4.RandomnessType.codec.sizeHint(type);
return size;
}
void encodeTo(_i1.Output output) {
_i1.U8Codec.codec.encodeTo(
1,
output,
);
_i1.U64Codec.codec.encodeTo(
requestId,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
salt,
output,
);
_i4.RandomnessType.codec.encodeTo(
type,
output,
);
}
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is RequestedRandomness &&
other.requestId == requestId &&
_i5.listsEqual(
other.salt,
salt,
) &&
other.type == type;
@override
int get hashCode => Object.hash(
requestId,
salt,
type,
);
}
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:typed_data' as _i2;
import 'package:polkadart/scale_codec.dart' as _i1;
enum RandomnessType {
randomnessFromPreviousBlock('RandomnessFromPreviousBlock', 0),
randomnessFromOneEpochAgo('RandomnessFromOneEpochAgo', 1),
randomnessFromTwoEpochsAgo('RandomnessFromTwoEpochsAgo', 2);
const RandomnessType(
this.variantName,
this.codecIndex,
);
factory RandomnessType.decode(_i1.Input input) {
return codec.decode(input);
}
final String variantName;
final int codecIndex;
static const $RandomnessTypeCodec codec = $RandomnessTypeCodec();
String toJson() => variantName;
_i2.Uint8List encode() {
return codec.encode(this);
}
}
class $RandomnessTypeCodec with _i1.Codec<RandomnessType> {
const $RandomnessTypeCodec();
@override
RandomnessType decode(_i1.Input input) {
final index = _i1.U8Codec.codec.decode(input);
switch (index) {
case 0:
return RandomnessType.randomnessFromPreviousBlock;
case 1:
return RandomnessType.randomnessFromOneEpochAgo;
case 2:
return RandomnessType.randomnessFromTwoEpochsAgo;
default:
throw Exception('RandomnessType: Invalid variant index: "$index"');
}
}
@override
void encodeTo(
RandomnessType 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 _i3;
import 'package:polkadart/scale_codec.dart' as _i1;
import 'package:quiver/collection.dart' as _i4;
import '../../primitive_types/h256.dart' as _i2;
class Request {
const Request({
required this.requestId,
required this.salt,
});
factory Request.decode(_i1.Input input) {
return codec.decode(input);
}
/// RequestId
final BigInt requestId;
/// H256
final _i2.H256 salt;
static const $RequestCodec codec = $RequestCodec();
_i3.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'requestId': requestId,
'salt': salt.toList(),
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Request &&
other.requestId == requestId &&
_i4.listsEqual(
other.salt,
salt,
);
@override
int get hashCode => Object.hash(
requestId,
salt,
);
}
class $RequestCodec with _i1.Codec<Request> {
const $RequestCodec();
@override
void encodeTo(
Request obj,
_i1.Output output,
) {
_i1.U64Codec.codec.encodeTo(
obj.requestId,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
obj.salt,
output,
);
}
@override
Request decode(_i1.Input input) {
return Request(
requestId: _i1.U64Codec.codec.decode(input),
salt: const _i1.U8ArrayCodec(32).decode(input),
);
}
@override
int sizeHint(Request obj) {
int size = 0;
size = size + _i1.U64Codec.codec.sizeHint(obj.requestId);
size = size + const _i2.H256Codec().sizeHint(obj.salt);
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 '../primitive_types/h256.dart' as _i3;
import '../sp_core/crypto/account_id32.dart' as _i2;
class Announcement {
const Announcement({
required this.real,
required this.callHash,
required this.height,
});
factory Announcement.decode(_i1.Input input) {
return codec.decode(input);
}
/// AccountId
final _i2.AccountId32 real;
/// Hash
final _i3.H256 callHash;
/// BlockNumber
final int height;
static const $AnnouncementCodec codec = $AnnouncementCodec();
_i4.Uint8List encode() {
return codec.encode(this);
}
Map<String, dynamic> toJson() => {
'real': real.toList(),
'callHash': callHash.toList(),
'height': height,
};
@override
bool operator ==(Object other) =>
identical(
this,
other,
) ||
other is Announcement &&
_i5.listsEqual(
other.real,
real,
) &&
_i5.listsEqual(
other.callHash,
callHash,
) &&
other.height == height;
@override
int get hashCode => Object.hash(
real,
callHash,
height,
);
}
class $AnnouncementCodec with _i1.Codec<Announcement> {
const $AnnouncementCodec();
@override
void encodeTo(
Announcement obj,
_i1.Output output,
) {
const _i1.U8ArrayCodec(32).encodeTo(
obj.real,
output,
);
const _i1.U8ArrayCodec(32).encodeTo(
obj.callHash,
output,
);
_i1.U32Codec.codec.encodeTo(
obj.height,
output,
);
}
@override
Announcement decode(_i1.Input input) {
return Announcement(
real: const _i1.U8ArrayCodec(32).decode(input),
callHash: const _i1.U8ArrayCodec(32).decode(input),
height: _i1.U32Codec.codec.decode(input),
);
}
@override
int sizeHint(Announcement obj) {
int size = 0;
size = size + const _i2.AccountId32Codec().sizeHint(obj.real);
size = size + const _i3.H256Codec().sizeHint(obj.callHash);
size = size + _i1.U32Codec.codec.sizeHint(obj.height);
return size;
}
}