Skip to content

Commit

Permalink
Strip blockchain module
Browse files Browse the repository at this point in the history
  • Loading branch information
bai-3 authored and bai-3 committed Oct 29, 2024
1 parent c54204d commit b22f72b
Show file tree
Hide file tree
Showing 330 changed files with 24,545 additions and 12,789 deletions.
14 changes: 7 additions & 7 deletions hacks/init_dao.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ import 'dart:io';
import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:dtim/chain/wetee/wetee.dart';
import 'package:dtim/chain/wetee_gen/types/sp_runtime/multiaddress/multi_address.dart';
import 'package:dtim/chain/wetee_gen/types/wetee_org/org_info.dart';
import 'package:dtim/application/chain/wetee/wetee.dart';
import 'package:dtim/application/chain/wetee/wetee_gen/types/sp_runtime/multiaddress/multi_address.dart';
import 'package:dtim/application/chain/wetee/wetee_gen/types/wetee_org/org_info.dart';
import 'package:polkadart/scale_codec.dart';

// ignore: constant_identifier_names
const DAO_ROOT_SEED = "gloom album notable jewel divorce never trouble lesson month neck sign harbor";

void main() async {
final wetee = WeTEE.url('ws://127.0.0.1:9944');
final wetee = WeTEE.url('http://127.0.0.1:9944');
final chainAccount = await getSeedPhrase(seedStr: DAO_ROOT_SEED, name: '', password: '');
await WeTEE.addKeyring(account: chainAccount, password: "");

// 初始化资金
final alicePair = await getFromUri(uri:'//Alice', name: '', password: '');
await WeTEE.addKeyring(account: alicePair, password: "");
final dest = const $MultiAddress().id(hex.decode(chainAccount.address.replaceAll("0x", "")));
var tcall = wetee.tx.balances.transfer(dest: dest, value: BigInt.from(1000000000000000000));
var tcall = wetee.tx.balances.transferKeepAlive(dest: dest, value: BigInt.from(1000000000000000000));
await wetee.signAndSubmit(tcall, alicePair.address);

sleep(const Duration(seconds: 7));

print(chainAccount.meta["ss58Address"]);

// 创建DAO
var runcall = wetee.tx.weteeOrg.createDao(
var runcall = wetee.tx.weTEEOrg.createDao(
name: convertStringToUint8List("ProgrammingDAO"),
bg: convertStringToUint8List(''),
logo: convertStringToUint8List(''),
Expand All @@ -44,7 +44,7 @@ void main() async {

sleep(const Duration(seconds: 7));

final d = await wetee.query.weteeOrg.daos(BigInt.from(5000));
final d = await wetee.query.weTEEOrg.daos(BigInt.from(5000));
print(d!.id.toString());

final orgs = (await wetee.queryMapList(module: 'WeteeOrg', storage: 'Daos')).map((b) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:dtim/chain/wetee_gen/types/wetee_gov/member_data.dart';
import 'package:dtim/chain/wetee_gen/types/wetee_org/quarter_task.dart';
import 'package:dtim/application/chain/wetee/wetee_gen/types/wetee_gov/member_data.dart';
import 'package:dtim/application/chain/wetee/wetee_gen/types/wetee_org/quarter_task.dart';

/// vote yes or no
/// 投票
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import 'package:polkadart/polkadart.dart';
import 'package:polkadart/scale_codec.dart' as codec;
import 'package:polkadart_keyring/polkadart_keyring.dart';

import 'package:dtim/chain/wetee_gen/types/wetee_runtime/runtime_call.dart';
import 'package:dtim/chain/wetee_gen/wetee_gen.dart';
import 'package:dtim/application/chain/wetee/wetee_gen/types/wetee_runtime/runtime_call.dart';
import 'package:dtim/application/chain/wetee/wetee_gen/wetee_gen.dart';
import 'package:dtim/domain/models/models.dart';
import 'type.dart';
export 'type.dart';
export 'key_pair.dart';

/// WeTEE 对象
class WeTEE {
WeTEE(
this.provider,
Expand Down Expand Up @@ -85,9 +86,9 @@ class WeTEE {
late RuntimeCall toCall;
if (gov != null) {
if (gov.runType == 2) {
toCall = tx.weteeSudo.sudo(daoId: gov.daoId, call: rCall);
toCall = tx.weTEESudo.sudo(daoId: gov.daoId, call: rCall);
} else {
toCall = tx.weteeGov.submitProposal(
toCall = tx.weTEEGov.submitProposal(
daoId: gov.daoId,
memberData: gov.member,
proposal: rCall,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5;
import 'dart:typed_data' as _i6;

import 'package:polkadart/polkadart.dart' as _i1;
import 'package:polkadart/scale_codec.dart' as _i3;
Expand Down Expand Up @@ -53,4 +54,26 @@ class Queries {
}
return BigInt.zero; /* Default */
}

/// Returns the storage key for `authorities`.
_i6.Uint8List authoritiesKey() {
final hashedKey = _authorities.hashedKey();
return hashedKey;
}

/// Returns the storage key for `currentSlot`.
_i6.Uint8List currentSlotKey() {
final hashedKey = _currentSlot.hashedKey();
return hashedKey;
}
}

class Constants {
Constants();

/// The slot duration Aura should run with, expressed in milliseconds.
/// The effective value of this type should not change while the chain is running.
///
/// For backwards compatibility either use [`MinimumPeriodTimesTwo`] or a const.
final BigInt slotDuration = BigInt.from(6000);
}
Loading

0 comments on commit b22f72b

Please sign in to comment.