Open remzrn opened 3 years ago
sdk 0.1.1 released.
It seems that this change prevents handling of cases where the js api would return the state with a format where scalars only are returned. For Edgeware, the the tokendecimals are returned as an int and the tokensymbol as a string. Thereafter, it creates multiple failures when serializing and caching. What would be the best way to handle the new format?
It seems that this change prevents handling of cases where the js api would return the state with a format where scalars only are returned. For Edgeware, the the tokendecimals are returned as an int and the tokensymbol as a string. Thereafter, it creates multiple failures when serializing and caching. What would be the best way to handle the new format?
Thanks to the comments there #23 , I have also mostly fixed the issues I had (most of them were in fact coming from the network metadata that I did not update.). I also started from the development branch of the Kusama plugin. I am now able to get all information I need filled in within all screens, and all UI interactions seem to work except from transactions unfortunately. Now every transaction I have tried (transfer, voting, bonding) resulted in the following exception:
I/flutter (29254): received msg: {"path":"uid=63;keyring.sendTx","data":{"error":"1002: Verification Error: Runtime error: Execution failed: Other(\"Wasm execution trapped: wasm trap: unreachable\\nwasm backtrace:\\n 0: 0x22f0 - <unknown>!rust_begin_unwind\\n 1: 0x1fcb - <unknown>!core::panicking::panic_fmt::hc25d2b1c8c5e1365\\n 2: 0xcdd66 - <unknown>!TaggedTransactionQueue_validate_transaction\\n\"): RuntimeApi, Execution failed: Other, \\\"Wasm execution trapped: wasm trap: unreachable\\\\nwasm backtrace:\\\\n 0: 0x22f0 - <unknown>!rust_begin_unwind\\\\n 1: 0x1fcb - <unknown>!core::panicking::panic_fmt::hc25d2b1c8c5e1365\\\\n 2: 0xcdd66 - <unknown>!Tagged…"}}
for the transaction:
I/flutter (29254): {module: balances, call: transfer, sender: {address: ngHmKuz5oBmxWXDcnMZU1UsUC4yMe8756PjeLxQP4E3UKbp, pubKey: 0xe48d8276e5a3946ddc9e5db70baeff1307fbef2e3f260980d39acf07ec792917}, tip: 0, isUnsigned: false, proxy: null, txName: null}
and parameters:
I/flutter (29254): ["mL7QVhpMNEf4W1F743g1Whp7LLrgFw1t4UAhD5JaX8AWS19","1200000000000000000"]
The txInfo seems to carry on the right data (on older versions, with the same info, it gets through), so I am wondering what can fail. I thought this is either related to my setup, or the fact the transaction on Edgeware need to be built differently (though I assume all substrate chains follow the same protocol by default and nothing has been changed for Edgeware regarding this). Maybe you have an idea of what is going on before I dive in?
If Edgeware works in https://polkadot.js.org/apps/?rpc=wss://mainnet4.edgewa.re#/explorer, you may try upgrading polkadot-js/api
in your js_service_edgeware/package.json
like polkadot-js/apps/package.json
, and modify your ts files accordingly.
You can open js_service_edgeware/test/index.html
in Chrome and test all the js functions in Chrome devtool console.
Thanks! I will try your path for debugging, since I am struggling with my setup. I did not find a way to explore the calls to the js/ts code from visual studio code, apart from console.logging everything.
On another note, I compiled back the version I had in December that I wanted to merge, and where I could send transactions. The closest I could get to is before SignAndSend
is sent to the polkadot api in the SendTx
function. I modified the functions to output as much as possible (I am stringifying objects and just printing them). Strangely enough, everything looks like the same. The Keypairs are the same (expected from WhenCreated and WhenEdited obviously), paramList
is identitical but the result of api.tx[txInfo.module][txInfo.call](...paramList)
has a two byte difference in position 9 and 10,
0xb4040600ffa8ed7efd1ff0d8c9843ec3a7bb44fe960dd2a7b4b81bc326a6fbe9506ae0d91c13000064a7b3b6e00d
vs
0xb404060000a8ed7efd1ff0d8c9843ec3a7bb44fe960dd2a7b4b81bc326a6fbe9506ae0d91c13000064a7b3b6e00d
The first transaction succeeds immediately, the second one fails. I am not sure those bytes are the cause of the failure, but this is so far the only difference i could find. Since the old transaction is the one getting through, doesn't it suggest that I should rather try to downgrade the API?
Result of api.tx[txInfo.module][txInfo.call](...paramList)
differences may caused by the differences of api
instance.
Downgrade is OK, the acala plugin and laminar plugin do use their own version of polkadot-js/api
. But my suggestion is to upgrade and keep up with https://polkadot.js.org/apps/?rpc=wss://mainnet4.edgewa.re#/explorer.
Then I will try to upgrade first and possibly downgrade thereafter if not successful. Thanks again!
Just committed the plugin with the upgrade of the polkadot api. Everything seems to work back as you predicted. Tested all voting for referrenda, councillors, bonding, unbonding, transfers. The app is not tested under ios unfortunately. I only tested the android build.
We have a new release of Polkawallet SDK
with bug fix. see https://github.com/polkawallet-io/app/issues/23#issuecomment-810118193.
Will do.
The last version takes the update into account. I noticed that we need to ensure the git version of the polkawallet_ui of the plugin matches the one of the SDK otherwise there is a conflict in the version when getting the packages. It was not a problem to update, but it seems to be duplicated information. I am not sure whether there is an elegant way to remove the need of it.
Sorry for missing the info of polkawallet_ui, they are two separate packages, both need to be upgraded. pub.dev
doesn't support polkawallet_ui upload so we have to use a git source.
new polkawallet_ui with commit c4346ecf37f277d6b61480f4782a9e78c99c68e2
, fixed input issue of number keyboard with a comma decimal separator.
Thanks. Updated accordingly.
Plugin successfully. Will be in the app in next release.
I noticed that Edgeware in https://polkadot.js.org/apps has a blue theme color, but the plugin is green. Would you consider making them consistent?
Good remark! I had not thought about it since I think the blue theme on polkadot.js was chosen a bit at random (the same as I did when I started to use green), but getting unification between the two tools is definitely useful.
Unhandled Exception: type 'int' is not a subtype of type 'String' ApiStaking.fetchAccountRewards (package:polkawallet_plugin_edgeware/service/staking.dart:27:64) _PayoutPageState._queryLatestRewards (package:polkawallet_plugin_edgeware/pages/staking/actions/payoutPage.dart:35:10)
type 'String' is not a subtype of type 'int' (package:polkawallet_plugin_edgeware/pages/governance/treasury/tipDetailPage.dart:229:7)
and you may need to update this subscan data bug fix: https://github.com/polkawallet-io/polkawallet_plugin_kusama/commit/527f205b9a0ca3ebc317456e38e5ce976e6364a3
I have performed the change, but I would like to know how you managed to get the exception. I got the payouts rewards without hitting it.
Just add polkawallet_plugin_edgeware in polkawallet-io/app and run debug in AndroidStudio. Got that exception when I went to payouts page.
Sorry about that the previous bug fix didn't work well, new update here: https://github.com/polkawallet-io/polkawallet_plugin_kusama/commit/f6f73b6896a6239f980063589fe1e1e3ef74ad78
I will, but I am a bit puzzled by the bugs as I got the opposite behaviour when debugging in the same case:for the exception you mentioned here:
Unhandled Exception: type 'int' is not a subtype of type 'String' ApiStaking.fetchAccountRewards (package:polkawallet_plugin_edgeware/service/staking.dart:27:64
The code is
BigInt.parse(store.staking.ownStashInfo.stakingLedger['active']);
which requires the parse, because store.staking.ownStashInfo.stakingLedger['active'] is stored as an Hex string.
One thing I could think about is that I have bonded stake, while you haven't and the stashinfo may not be initialized in one case. Can you confirm if you have a bonded stake? If not I will try to debug with empty accounts to handle those cases.
Yes! it seems to be it: in case of no bonded stake, the result of `store.staking.ownStashInfo.stakingLedger['active'], is 0, while it is a hex string otherwise. I will handle that case. Maybe the same issue exists with Kusama though. I don't have KSM bonded to test, but it is maybe valuable to investigate whether something similar to the parsing I added is also required there, in case some payouts are waiting.
Pushed the changes. The Reward page is now fixed, as well as the treasury details. Thanks for the notification. I have synchronized your changes too.
Failed assertion: boolean expression must not be null (package:polkawallet_plugin_edgeware/pages/staking/validators/validatorDetailPage.dart:57:34)
see https://github.com/polkawallet-io/sdk/commit/681c3c585e7d0855e9a94b50859c5d7bb200876e
Thanks I fixed this. I also added a fix for the payout_stakers display, after successfully having transacted the payouts, one can try to display the details, but then it fails when attempting to get the address from the public key of the validator, which is likely not in the map here, unless the validator is part of the accounts. Additionally, that map itself may not be necessarily set when attempting to view the transaction. In those cases, I chose to display the public key for now, for a lack of a better alternative. I am not sure whether it would be efficient enough and relevant to make an asynchronous call to get the address from the public key. I will do it if you think it is worth it. You may want to check the Kusama plugin, as I suspect it would also fail in this case.
Thanks I fixed this. I also added a fix for the payout_stakers display, after successfully having transacted the payouts, one can try to display the details, but then it fails when attempting to get the address from the public key of the validator, which is likely not in the map here, unless the validator is part of the accounts. Additionally, that map itself may not be necessarily set when attempting to view the transaction. In those cases, I chose to display the public key for now, for a lack of a better alternative. I am not sure whether it would be efficient enough and relevant to make an asynchronous call to get the address from the public key. I will do it if you think it is worth it. You may want to check the Kusama plugin, as I suspect it would also fail in this case.
display the public key is Ok because converting it to address needs to sending a query to webview through message channel which is inefficient. BTW, I fixed another bug of tx list refreshing: https://github.com/polkawallet-io/polkawallet_plugin_kusama/commit/41ef4628d669604e5182cc2526a9b41a32a1444b
Updated accordingly.
Hello, I just updated the SDK to keep up with your recent changes. I have a suggestion to move the class TokenIcon to the SDK too: at the moment, the app repo has a hard link on the acala plugin here. This is a inconvenient when trying to build following development versions, because flutter does not allow for mixing versions from git and local repos, so disabling some plugins could be useful for testing, rather than checking out the latest development versions of all plugins, ui, sdk, and re-linking everything to local folders in the different .yaml files.
will fix the acala plugin hard link, thanks for your suggestion.
2 update:
I have looked at the change, but it is big and I am not sure I understand everything yet. The removal of the hashes and the reference to substrateNetworkBase is probably handled somewhere else, but I am not sure how. I will look at this deeper over the week end.
I updated the plugin for compatibility with app 7f30c707c17366270bbba0e66b504b644acfc65e According to the overrides there, it uses fully polkawallet_sdk 0.1.6 and polkawallet_ui 0.1.5 (not sure if the difference in versioning is intended). Upon usage, I noticed that the current version of polkawallet as released on the app store does not seem to be able to fetch the token prices, while the developer version that I sideloaded could.
dependency source of polkawallet_ui is github link, so it's version number is not well maintained.
token pricees fetching was moved to the app repo, try the develop branch(merged to master just now).
The token fetching price works now and it was before on all my development builds. Where is does not work is from the version currently in the app store. My last commit 4e0d7dffee5222c493f70a310ce5f9b5b24f4d90 updated the theme to be consistent with the newer plugins and use the new sdk. You can safely update it for the release, since it works with the latest app version.
Hello, I have committed a minor bugfix this morning on the Edgware plugin. I also have opened two PRs, one in the UI repo and one in the SDK one to allow for the display of onchain identities when those are set.
New sdk 1.0.8 released! Check changes in latest commits of branch develop of polkawallet_plugin_kusama
.
Hi there! Thanks for the notice. I saw your changes, and attempted to backport them, but I cannot compile my plugin, since it seems to require an update of the UI module (and the develop branch does depend on some local paths). I committed the changes in a develop branch for now. I also experienced a bigger issue with the latest release of flutter, since it seems it breaks every dependency to ffi, which is used by the biometric_sorage package amongst others. I am not sure whether you experienced the same issue, but I cannot build the app at the moment. My version of flutter is (Channel master, 2.3.0-13.0.pre.118)
It do takes me hours to fix the dependencies errors, you can clone the develop branch of dependencies into local path to run the app. We need more testing before merge it into master.
more details:
pubspec.yaml
to fix errors of flutter pub get
.flutter build
.flutter build
.I managed to build eventually. I had to update ext.kotlin_version to 1.4.31 and gradle to 4.0.1 in build.gradle I also had to update the distributionUrl in gradle-wrapper.properties to 6.5-all Maybe only a subset would be sufficient, but with the new UI and SDK, this seems to work on my side. Thanks for all.
The App is ready for new release, please update to polkawallet_sdk 0.1.8+ and submit as soon as possible.
Done!
Got error while enter treasury -> tips
DRR: Unable to decode storage tips.tips: entry 8:: createType(OpenTip):: {"reason":"Hash","who":"AccountId","finder":"AccountId","deposit":"Balance","closes":"Option<BlockNumber>","tips":"Vec<OpenTipTip>","findersFee":"bool"}:: Decoded input doesn't match input, received 0xbadf8dd46cb2ed9ccfef14156414b9b947d91e0f5f7aa46ac5673258e4f8e16a…d5eb5b73559259755fdcd85a40a5dc6e00000000000000000000000000000000 (259 bytes), created 0xbadf8dd46cb2ed9ccfef14156414b9b947d91e0f5f7aa46ac5673258e4f8e16a…55509c92c8b2fafbc9804aaee10200008140c6bcc81a00000000000000000000 (115 bytes)
In https://polkadot.js.org/apps/, go to Developer -> Storage -> tips.tips and click query, got the same error in Chrome console. So maybe this is an issue of edgeware&js, not of your plugin.
I have looked into this and reproduced it. On polkadot.js/apps, I have no developer->storage path though, but I saw the same error in the console while opening the tips page. My it seems that the newer versions of the API are not fully compatible with substrate 2 anymore. I thought that this commit caused the issue but reverting back the API update did not seem to solve it. I am wondering whether I have not forgotten to clean some cache that prevented the versions on my build to get effectively downgraded. But so far I did not manage to solve it. I will need more time to look into it, so since I don't want to delay your release and if you are ready before I can solve it, I suggest you release regardless with a release note stipulating the tipping functionality on the Edgeware plugin is broken.
Sorry, the path is Developer -> Chain State -> Storage -> tips.tips.
Please check the latest commit: I just had to remove the yarn.lock that kept the api versions to the latest ones. Reverting the @polkadot/api upgrade seems to have fixed it! :heart:
@remzrn we did some update in js_api
to make the app more robust:
you can copy & replace those 5 functions from https://github.com/polkawallet-io/sdk/blob/develop/js_api/src/service/keyring.ts into /lib/js_api_edgeware/src/service/keyring.ts
.
Thanks a lot for the notification. I have updated the api following your advice. The most reliable way to reach me is to PM me on Matrix if necessary.
Para-chain name Edgeware
Description Overview of your para-chain.
Plugin functions The functions are identical to Kusama, excepted polkassembly.