diff --git a/readme.md b/readme.md index a0dd88dc..f8e88e1e 100644 --- a/readme.md +++ b/readme.md @@ -33,9 +33,9 @@ The best approach to reach project’s goals is to use annotations and code gene - [x] `@RpcDecoder`; - [ ] Pallet - - [ ] `@Pallet`; + - [x] `@Pallet`; - [ ] `@Transaction`; - - [ ] `@Query`; + - [x] `@Storage`; - [ ] `@EventHandler`. These allow the generation of scale serializers, deserializers, RPC methods, code for interaction with pallet, etc. @@ -67,101 +67,3 @@ We take care of either lost responses or canceled futures by not holding handler - ### Tests run with substrate node. All API methods related to the substrate node will be tested for operability and compatibility. Currently we use [test containers](https://www.testcontainers.org/) and docker image [parity/substrate:v3.0.0](https://hub.docker.com/layers/parity/substrate/v3.0.0/images/sha256-1aef07509d757c584320773c476dcb6077578bbf2f5e468ceb413dcf908897f1?context=explore). - -## Our vision of the API -### How to generate scale codec for DTO (implemented) -```java -@RequiredArgsConstructor -@Getter -@ScaleWriter -public class SignedExtra implements Extra, SignedExtension { - @Ignore - private final long specVersion; - @Ignore - private final long txVersion; - @Ignore - private final BlockHash genesis; - @Ignore - private final BlockHash eraBlock; - private final E era; - @Scale(ScaleType.CompactBigInteger.class) - private final BigInteger nonce; - @Scale(ScaleType.CompactBigInteger.class) - private final BigInteger tip; - - @Override - public AdditionalExtra getAdditionalExtra() { - return new SignedAdditionalExtra(specVersion, txVersion, genesis, eraBlock); - } -} -``` - -### How to generate RPC interface (implemented) -```java -@RpcInterface(section = "author") -public interface Author { - @RpcCall(method = "hasKey") - CompletableFuture hasKey(@Scale PublicKey publicKey, String keyType); - - @RpcCall(method = "insertKey") - CompletableFuture insertKey(String keyType, String secretUri, @Scale PublicKey publicKey); - - @RpcCall(method = "submitExtrinsic") - @Scale - CompletableFuture submitExtrinsic(@Scale Extrinsic extrinsic); - - @RpcSubscription(type = "extrinsicUpdate", subscribeMethod = "submitAndWatchExtrinsic", unsubscribeMethod = "unwatchExtrinsic") - CompletableFuture>> submitAndWatchExtrinsic(@Scale Extrinsic extrinsic, - BiConsumer callback); -} -``` - -### Create instance of API (TBD) -```java -Api api = Api.builder() - .useWs() - .withNodes("127.0.0.1:9944", "127.0.0.2:9944") - .scanAnnotatedFrom("com.my_company.first", "com.my_company.second") - .build(); -``` - -### RPC: call method (implemented but not integrated into the API) -```java -CompletableFuture versionFuture = api.getRpc() - .getState() - .getRuntimeVersion(); -``` - -### RPC: subscribe (implemented but not integrated into the API) -```java -CompletableFuture unsubscribe = api.getRpc() - .getChain() - .subscribeNewHeads((ex, header) -> { print(header); }); -``` - -### Pallet: transaction (TBD) -```java -api.pallete(MyPallet.class) - .myExtrinsic(someValue) - .signAndSend(KEY_PAIR); -``` - -## To be implemented -- [x] Transport - layer that interacts with a node. It provides async API for RPC requests. -- [x] Scale - - [x] Scale codec - implementation of the [SCALE](https://docs.substrate.io/v3/advanced/scale-codec/) for standard types. - - [x] Scale code generation - approach to generate scale encoders/decoders for annotated classes. -- [ ] Signing: - - [x] SR25519 - - [ ] ED25519 -- [x] RPC code generation - - [x] RPC interfaces with methods - - [x] RPC encoders/decoders - - [ ] Declare known RPC sections and methods. -- [ ] Handling metadata -- [ ] Pallet API - - [ ] Transactions - - [ ] Queries - - [ ] Constants - - [ ] Events -- [ ] Load balancing