Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğecko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Ğecko
Commits
2d1b3731
Commit
2d1b3731
authored
2 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
batch call is working for claimUd
parent
99c559d3
No related branches found
Branches containing commit
Tags
v0.0.9+18
Tags containing commit
1 merge request
!26
Features gdev2
Pipeline
#16722
waiting for manual action
Stage: format
Stage: build_and_test
Stage: package
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/providers/substrate_sdk.dart
+35
-66
35 additions, 66 deletions
lib/providers/substrate_sdk.dart
lib/screens/wallet_view.dart
+6
-4
6 additions, 4 deletions
lib/screens/wallet_view.dart
with
41 additions
and
70 deletions
lib/providers/substrate_sdk.dart
+
35
−
66
View file @
2d1b3731
...
...
@@ -37,15 +37,11 @@ class SubstrateSdk with ChangeNotifier {
////////// 1: API METHODS ///////////
/////////////////////////////////////
Future
<
String
>
executeCall
(
TxInfoData
txInfo
,
txOptions
,
String
password
)
async
{
Future
<
String
>
executeCall
(
TxInfoData
txInfo
,
txOptions
,
String
password
,
[
String
?
rawParams
]
)
async
{
try
{
final
hash
=
await
sdk
.
api
.
tx
.
signAndSend
(
txInfo
,
txOptions
,
password
,
)
.
signAndSend
(
txInfo
,
txOptions
,
password
,
rawParam:
rawParams
)
.
timeout
(
const
Duration
(
seconds:
12
),
onTimeout:
()
=
>
{},
...
...
@@ -72,16 +68,6 @@ class SubstrateSdk with ChangeNotifier {
return
await
sdk
.
webView
!.
evalJavascript
(
'api.query.
$call
'
);
}
List
batchCall
(
TxSenderData
sender
,
List
calls
)
{
TxInfoData
txInfo
=
TxInfoData
(
'utility'
,
'batchAll'
,
sender
,
);
return
[
txInfo
,
calls
];
}
TxSenderData
_setSender
()
{
return
TxSenderData
(
keyring
.
current
.
address
,
...
...
@@ -625,17 +611,8 @@ class SubstrateSdk with ChangeNotifier {
final
globalBalance
=
await
getBalance
(
fromAddress
);
TxInfoData
txInfo
;
List
txOptions
;
log
.
d
(
globalBalance
);
// if (globalBalance['unclaimedUds'] != 0) {
// claimUDs(password);
// }
// txInfo = TxInfoData(
// 'balances', amount == -1 ? 'transferAll' : 'transferKeepAlive', sender);
// txOptions = [destAddress, amount == -1 ? false : amountUnit];
List
txOptions
=
[];
String
?
rawParams
;
if
(
globalBalance
[
'unclaimedUds'
]
==
0
)
{
txInfo
=
TxInfoData
(
'balances'
,
...
...
@@ -647,28 +624,16 @@ class SubstrateSdk with ChangeNotifier {
'batchAll'
,
sender
,
);
const
tx1
=
'api.tx.universalDividend.claimUds()'
;
final
tx2
=
amount
==
-
1
?
'api.tx.balances.transferAll(false)'
:
'api.tx.balances.transferKeepAlive("
$destAddress
",
$amountUnit
)'
;
txOptions
=
[
[
'api.tx.universalDividend.claimUds()'
]
];
// 'balances.transferKeepAlive($destAddress, $amountUnit)'
// amount == -1
// ? 'balances.transferAll(false)'
// : 'balances.transferKeepAlive([$destAddress, $amountUnit])'
rawParams
=
'[[
$tx1
,
$tx2
]]'
;
}
log
.
d
(
'yooooo:
${txInfo.module}
,
${txInfo.call}
,
$txOptions
'
);
// Map tata = await sdk.webView!
// .evalJavascript('api.tx.universalDividend.claimUds()',
// wrapPromise: false)
// .timeout(
// const Duration(seconds: 12),
// onTimeout: () => {},
// );
// return tata.toString();
return
await
executeCall
(
txInfo
,
txOptions
,
password
);
// log.d('yooooo: ${txInfo.module}, ${txInfo.call}, $txOptions, $rawParams');
return
await
executeCall
(
txInfo
,
txOptions
,
password
,
rawParams
);
}
Future
<
String
>
certify
(
...
...
@@ -690,6 +655,7 @@ class SubstrateSdk with ChangeNotifier {
final
sender
=
_setSender
();
TxInfoData
txInfo
;
List
txOptions
=
[];
String
?
rawParams
;
final
toCerts
=
await
getCerts
(
toAddress
);
final
currencyParameters
=
await
getParameters
();
...
...
@@ -706,12 +672,15 @@ class SubstrateSdk with ChangeNotifier {
if
(
toCerts
[
0
]
>
=
currencyParameters
[
'wotMinCertForMembership'
]
&&
toIdtyStatus
!=
'Validated'
)
{
log
.
i
(
'Batch cert and membership validation'
);
List
batch
=
batchCall
(
sender
,
[
'cert.addCert(
$fromIndex
,
$toIndex
)'
,
'identity.validateIdentity(
$toIndex
)'
]);
txInfo
=
batch
[
0
];
txOptions
=
batch
[
1
];
txInfo
=
TxInfoData
(
'utility'
,
'batchAll'
,
sender
,
);
final
tx1
=
'cert.addCert(
$fromIndex
,
$toIndex
)'
;
final
tx2
=
'identity.validateIdentity(
$toIndex
)'
;
rawParams
=
'[[
$tx1
,
$tx2
]]'
;
}
else
{
txInfo
=
TxInfoData
(
'cert'
,
...
...
@@ -727,23 +696,23 @@ class SubstrateSdk with ChangeNotifier {
}
log
.
d
(
'Cert action:
${txInfo.call!}
'
);
return
await
executeCall
(
txInfo
,
txOptions
,
password
);
return
await
executeCall
(
txInfo
,
txOptions
,
password
,
rawParams
);
}
Future
claimUDs
(
String
password
)
async
{
final
sender
=
TxSenderData
(
keyring
.
current
.
address
,
keyring
.
current
.
pubKey
,
);
//
Future claimUDs(String password) async {
//
final sender = TxSenderData(
//
keyring.current.address,
//
keyring.current.pubKey,
//
);
final
txInfo
=
TxInfoData
(
'universalDividend'
,
'claimUds'
,
sender
,
);
//
final txInfo = TxInfoData(
//
'universalDividend',
//
'claimUds',
//
sender,
//
);
return
await
executeCall
(
txInfo
,
[],
password
);
}
//
return await executeCall(txInfo, [], password);
//
}
Future
<
String
>
confirmIdentity
(
String
fromAddress
,
String
name
,
String
password
)
async
{
...
...
This diff is collapsed.
Click to expand it.
lib/screens/wallet_view.dart
+
6
−
4
View file @
2d1b3731
...
...
@@ -129,8 +129,8 @@ class WalletViewScreen extends StatelessWidget {
builder:
(
context
,
AsyncSnapshot
<
Map
<
String
,
int
>>
snapshot
)
{
if
(
snapshot
.
data
==
null
)
return
const
SizedBox
();
String
duration
=
''
;
log
.
d
(
snapshot
.
data
!
[
'certDelay'
]);
log
.
d
(
snapshot
.
data
!
[
'certRenewable'
]);
log
.
d
(
'certDelay
${
snapshot.data!['certDelay']
}
'
);
log
.
d
(
'certRenewable
${
snapshot.data!['certRenewable']
}
'
);
if
(
snapshot
.
data
!
[
'certDelay'
]
!=
null
||
snapshot
.
data
!
[
'certRenewable'
]
!=
null
)
{
...
...
@@ -518,7 +518,8 @@ class WalletViewScreen extends StatelessWidget {
future:
sub
.
getBalance
(
defaultWallet
.
address
!
),
builder:
(
BuildContext
context
,
AsyncSnapshot
<
Map
<
String
,
double
>>
globalBalance
)
{
AsyncSnapshot
<
Map
<
String
,
double
>>
globalBalance
)
{
if
(
globalBalance
.
connectionState
!=
ConnectionState
.
done
||
globalBalance
.
hasError
)
{
...
...
@@ -542,7 +543,8 @@ class WalletViewScreen extends StatelessWidget {
}
}
balanceCache
[
defaultWallet
.
address
!
]
=
globalBalance
.
data
!
[
'transferableBalance'
]
!
;
globalBalance
.
data
!
[
'transferableBalance'
]
!
;
return
Text
(
"
${balanceCache[defaultWallet.address!]}
$currencyName
"
,
style:
const
TextStyle
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment