Skip to content

Commit

Permalink
Merge pull request #1573 from encointer/cl/merge-v1.11.3-to-fdroid
Browse files Browse the repository at this point in the history
Merge11.3 into fdroid
  • Loading branch information
clangenb authored Nov 30, 2023
2 parents 5d47cce + 2eea6d2 commit 19ecd77
Show file tree
Hide file tree
Showing 133 changed files with 4,629 additions and 1,685 deletions.
20 changes: 11 additions & 9 deletions .github/ISSUE_TEMPLATE/release-testing-rococo.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Tested on commit <enter-commit>
- [ ] with invoice amount
- [ ] without invoice amount
- [ ] Send flow:
- [ ] manual flow works
- [ ] manual flow works
- [ ] scanning invoice flow works:
- [ ] with invoice amount
- [ ] without invoice amount
Expand All @@ -29,7 +29,7 @@ Tested on commit <enter-commit>
- [ ] Add contact with contact qr-code works
- [ ] Add contact with invoice qr-code works
- [ ] Endorsing newcomer works
- [ ] Endorsing newcomer with reputable works
- [ ] Endorsing a newcomer with reputable works
- [ ] Profile Page
- [ ] Removing single account works
- [ ] Add account works:
Expand All @@ -43,14 +43,16 @@ Tested on commit <enter-commit>
- [ ] Reaping Works

## Meetup Flow
This needs to be tested on rococo, it needs one bootstrapper account and two freshly created accounts, where one will be endorsed and the other will be a newbie.
This needs to be tested on rococo, it needs one bootstrapper account and two freshly created accounts, where one will be endorsed, and the other will be a newbie.

- [ ] Registering 1 bootstrappers, 1 endorsee and 1 newbie and performing meetup works. (This needs the rococo single councillor account to call next phase.)
- [ ] Registering 1 bootstrappers, 1 endorsee and 1 newbie and performing meetup works. (This needs the rococo single councillor account to call `nextPhase`.)
- [ ] Claiming rewards works
- [ ] early rewards payout in attesting phase
- [ ] regular rewards payout in next registering phase
- [ ] Registering 1 bootstrapper and two reputables and performing meetup works. (This needs the rococo single councillor account to call next phase.)
- [ ] Test that unregistering the reputable refunds the reputation and the reputable can register again.
- [ ] early reward payout in attesting phase
- [ ] regular reward payout in the next registering phase
- [ ] Registering 1 bootstrapper and two reputables and performing meetup works. (This needs the rococo single councillor account to call `nextPhase`.)
- [ ] Test that unregistering the reputable refunds the reputation, and the reputable can register again.

## Other
- [ ] inform slack channel about new release
- [ ] inform Slack channel about new release
- [ ] update f-droid branch and create vx.x.x-froid tag
- [ ] verify f-droid has been released
26 changes: 0 additions & 26 deletions app/js_service_encointer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,6 @@ JS in the webView.
In the [settings.js](src/service/settings.js) we initialize the window fields, e.g. `window.chain`, this will make the chain
module available as top-level entrypoint from dart. All the module functions exported in the `export default` section of the JS-file can be called from the dart side.

### Example getter
JS-part

```js

export async function getBootstrappers (cid) {
// all the types passed from dart to JS are just a json map.
// It is good practive to first create a type in with the
// input value.
const cidT = api.createType('CommunityIdentifier', cid);

// The polkadot-js/api automatically creates getters based on the encointer-node metadata, and make it queryable
// like: api.query.<module-name>.<storage-name>()
// This example queries a map because the storage is declared as such, thus the function takes one argument.
// See rust declaration: https://github.com/encointer/pallets/blob/3fc6c4fcef549d32e0ed7beb73ac940b43b25af3/communities/src/lib.rs#L395
return await api.query.encointerCommunities.bootstrappers(cidT);
}
```

Dart part
```dart
// parse the dynamic type into a List<String>
final bootstrappers =
await jsApi.evalJavascript('encointer.getBootstrappers($cid)').then((bs) => List<String>.from(bs as Iterable));
```

### Caveats
* Always double check how you are passing the values from dart to JS. As JS does simply parse strings, many things can go wrong.
* JS does not know types, but polkadot-js/api helps us with `api.createType` for complex types. Trying to transform a function arg into a type will uncover errors early.
Expand Down
2 changes: 0 additions & 2 deletions app/js_service_encointer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import 'regenerator-runtime/runtime.js';
import account from './service/account.js';
import encointer from './service/encointer.js';
import settings from './service/settings.js';
import chain from './service/chain.js';

window.addEventListener('flutterInAppWebViewPlatformReady', function (event) {

window.send = send;

window.account = account;
window.chain = chain;
window.encointer = encointer;
window.settings = settings;

Expand Down
56 changes: 0 additions & 56 deletions app/js_service_encointer/src/service/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto';
import {
hexToU8a,
u8aToHex,
hexToString,
} from '@polkadot/util';
import BN from 'bn.js';
import { Keyring } from '@polkadot/keyring';
Expand All @@ -11,7 +10,6 @@ import {
encointerBalances,
transfer
} from '../config/consts.js';
import { unsubscribe } from '../utils/unsubscribe.js';
import { extractEvents } from '@encointer/node-api';
import { stringNumberToEncointerBalanceU8a } from '../utils/utils.js';

Expand Down Expand Up @@ -99,46 +97,6 @@ async function addressFromUri(uri) {
return keyring.encodeAddress(pubKey, ss58);
}

/**
* get ERT balance of an address
* @param {String} address
* @returns {String} balance
*/
async function getBalance (address) {
const all = await api.derive.balances.all(address);
const lockedBreakdown = all.lockedBreakdown.map((i) => {
return {
...i,
use: hexToString(i.id.toHex())
};
});
return {
...all,
lockedBreakdown
};
}

/**
* subscribes to ERT balance of an address
* @param msgChannel channel that the message handler uses on the dart side
* @param {String} address
* @returns {String} balance
*/
async function subscribeBalance (msgChannel, address) {
return await api.derive.balances.all(address, (all) => {
const lockedBreakdown = all.lockedBreakdown.map((i) => {
return {
...i,
use: hexToString(i.id.toHex())
};
});
send(msgChannel, {
...all,
lockedBreakdown
});
}).then((unsub) => unsubscribe(unsub, msgChannel));
}

function getBlockTime (blocks) {
return new Promise((resolve) => {
const res = [];
Expand Down Expand Up @@ -293,17 +251,6 @@ export async function _getXt (keyPair, txInfo, paramList) {
return tx.signAsync(keyPair, signerOptions);
}

export function sendFaucetTx (address, amount) {
const alice = keyring.addFromUri('//Alice', { name: 'Alice default' });
const paramList = [address, amount];
const txInfo = {
module: 'balances',
call: 'transfer',
tip: 0
};
return sendTxWithPair(alice, txInfo, paramList);
}

function checkPassword (pubKey, pass) {
return new Promise((resolve) => {
const keyPair = keyring.getPair(hexToU8a(pubKey));
Expand Down Expand Up @@ -346,14 +293,11 @@ export default {
addressFromUri,
gen,
recover,
getBalance,
subscribeBalance,
getBlockTime,
txFeeEstimate,
sendTx,
sendTxWithPair,
getXt,
sendFaucetTx,
checkPassword,
changePassword,
};
20 changes: 0 additions & 20 deletions app/js_service_encointer/src/service/chain.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
import { unsubscribe } from '../utils/unsubscribe.js';

/**
* Mainly debug method introduced to test subscriptions. Subscribes to the timestamp of the last block
* @param msgChannel channel that the message handler uses on the dart side
* @returns {Promise<void>}
*/
export async function subscribeTimestamp (msgChannel) {
await api.query.timestamp.now((moment) => {
send(msgChannel, moment);
}).then((unsub) => unsubscribe(unsub, msgChannel));
}

export async function subscribeNewHeads (msgChannel) {
await api.rpc.chain.subscribeNewHeads((lastHeader) => {
send(msgChannel, lastHeader);
}).then((unsub) => unsubscribe(unsub, msgChannel));
}

export async function getFinalizedHeader () {
const hash = await api.rpc.chain.getFinalizedHead();
return api.rpc.chain.getHeader(hash);
}

export default {
subscribeTimestamp,
subscribeNewHeads,
getFinalizedHeader,
};
Loading

0 comments on commit 19ecd77

Please sign in to comment.