Skip to content

Commit

Permalink
Acceptance script appended with pending extrinsics and submit extrinsic
Browse files Browse the repository at this point in the history
  • Loading branch information
gregzaitsev committed Jul 30, 2019
1 parent 9edb199 commit 4842931
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
32 changes: 29 additions & 3 deletions doc/demo_milestone2.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,34 @@ bin/wssubscribe_all
### Support following RPC methods

author_submitExtrinsic
- All transaction types are supported, but for the demonstration sending DOT transaction is used in this E2E test
```
bin/submit_extrinsic <sender address> <recipient address> <amount in fDOTs> <sender private key (hex)>
for example:
bin/submit_extrinsic 5ECcjykmdAQK71qHBCkEWpWkoMJY6NXvpdKy8UeMx16q5gFr 5FpxCaAovn3t2sTsbBeT5pWTj2rg392E8QoduwAyENcPrKht 1000000000000000000 0xABCDEF123.....123
(private key was corrupted on purpose, both hex formats with or without leading 0x are supported)
```

Alternate RPC method with waiting - author_submitAndWatchExtrinsic
```
bin/submit_extrinsicNWatch <sender address> <recipient address> <amount in fDOTs> <sender private key (hex)>
for example:
bin/submit_extrinsicNWatch 5ECcjykmdAQK71qHBCkEWpWkoMJY6NXvpdKy8UeMx16q5gFr 5FpxCaAovn3t2sTsbBeT5pWTj2rg392E8QoduwAyENcPrKht 1000000000000000000 0xABCDEF123.....123
(private key was corrupted on purpose, both hex formats with or without leading 0x are supported)
```

author_pendingExtrinsics

The method may be examined with the following command with different parameters. Sometimes the default node (wss://alex.unfrastructure.io/public/ws) does not report any pending extrinsics. In order to get a non-empty result, we used alternate node: wss://poc3-rpc.polkadot.io/
```
bin/get_pending_extrinsics wss://alex.unfrastructure.io/public/ws
bin/get_pending_extrinsics wss://poc3-rpc.polkadot.io/
```

author_removeExtrinsic
```
TBD
Expand All @@ -111,6 +138,5 @@ TBD
### Support following WebSocket subscriptions

author_extrinsicUpdate
```
TBD
```

Method submit_extrinsicNWatch subscribes to extrinsicUpdate's.
11 changes: 7 additions & 4 deletions test/get_pending_extrinsics.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#include "../src/polkadot.h"
#include "helpers/cli.h"
#include "helpers/mockjsonrpc.h"
#undef NDEBUG
#include <cassert>

#define BUFSIZE 100

int main(int argc, char *argv[]) {
auto app = polkadot::api::getInstance()->app();
app->connect();
app->connect(getNodeUrlParam(argc, argv));

cout << endl << endl << "============================ Get Pending Extrinsics ============================" << endl;
GenericExtrinsic peBuf[20];
int count = app->pendingExtrinsics(peBuf, 20);
GenericExtrinsic peBuf[BUFSIZE];
int count = app->pendingExtrinsics(peBuf, BUFSIZE);

cout << endl << count << " pending extrinsics returned" << endl;
for (int i = 0; i < count; ++i) {
if (i < 20) {
if (i < BUFSIZE) {
// Checks
assert(peBuf[i].signerAddress.length() != 0);
assert(peBuf[i].length >= 100); // Minimum length == length of signature structure
Expand Down

0 comments on commit 4842931

Please sign in to comment.