leonardocustodio / polkadart

Polkadart provides developers the ability to query a node and interact with the Polkadot based chains using Dart.
https://polkadart.dev
Apache License 2.0
39 stars 16 forks source link

Add sign method #386

Closed justkawal closed 11 months ago

justkawal commented 11 months ago

Note: (Have to add publish_to: None until we publish newest version of polkadart_keyring.)

Have to provide SignatureType to encode() method.

Now possible to do:

 final extrinsic = Extrinsic(
    signer: publicKey,
    method: encodedCall,
    signature: hexSignature,
    eraPeriod: 64,
    blockNumber: blockNumber,
    nonce: 0,
    tip: 0,
  ).encode(api.registry, SignatureType.sr25519).sign(keyPair);

or

 final extrinsic = Extrinsic(
    signer: publicKey,
    method: encodedCall,
    signature: hexSignature,
    eraPeriod: 64,
    blockNumber: blockNumber,
    nonce: 0,
    tip: 0,
  ).encodeAndSign(api.registry, SignatureType.sr25519, keyPair);
codecov[bot] commented 11 months ago

Codecov Report

Attention: 47 lines in your changes are missing coverage. Please review.

Comparison is base (b3c1e4e) 47.06% compared to head (4cba90f) 46.99%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/graphs/tree.svg?width=650&height=150&src=pr&token=HG3K4LW5UN&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio)](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) ```diff @@ Coverage Diff @@ ## justkawal/schnorrkel #386 +/- ## ======================================================== - Coverage 47.06% 46.99% -0.07% ======================================================== Files 162 164 +2 Lines 8899 8911 +12 ======================================================== Hits 4188 4188 - Misses 4711 4723 +12 ``` | [Flag](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | Coverage Δ | | |---|---|---| | [polkadart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `17.01% <0.00%> (-0.17%)` | :arrow_down: | | [polkadart_cli](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `12.06% <ø> (ø)` | | | [polkadart_keyring](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `77.24% <ø> (ø)` | | | [polkadart_scale_codec](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `54.93% <ø> (ø)` | | | [sr25519](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `85.91% <ø> (ø)` | | | [ss58](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `96.87% <ø> (ø)` | | | [substrate_bip39](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `63.35% <ø> (ø)` | | | [substrate_metadata](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `87.61% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | Coverage Δ | | |---|---|---| | [...ckages/polkadart/lib/extrinsic/signature\_type.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvcG9sa2FkYXJ0L2xpYi9leHRyaW5zaWMvc2lnbmF0dXJlX3R5cGUuZGFydA==) | `0.00% <0.00%> (ø)` | | | [.../signed\_extensions/signed\_extensions\_abstract.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvcG9sa2FkYXJ0L2xpYi9leHRyaW5zaWMvc2lnbmVkX2V4dGVuc2lvbnMvc2lnbmVkX2V4dGVuc2lvbnNfYWJzdHJhY3QuZGFydA==) | `0.00% <0.00%> (ø)` | | | [...art/lib/extrinsic/signed\_extensions/asset\_hub.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvcG9sa2FkYXJ0L2xpYi9leHRyaW5zaWMvc2lnbmVkX2V4dGVuc2lvbnMvYXNzZXRfaHViLmRhcnQ=) | `0.00% <0.00%> (ø)` | | | [...art/lib/extrinsic/signed\_extensions/substrate.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvcG9sa2FkYXJ0L2xpYi9leHRyaW5zaWMvc2lnbmVkX2V4dGVuc2lvbnMvc3Vic3RyYXRlLmRhcnQ=) | `0.00% <0.00%> (ø)` | | | [...kages/polkadart/lib/extrinsic/signing\_payload.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvcG9sa2FkYXJ0L2xpYi9leHRyaW5zaWMvc2lnbmluZ19wYXlsb2FkLmRhcnQ=) | `0.00% <0.00%> (ø)` | | | [...ges/polkadart/lib/extrinsic/extrinsic\_payload.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvcG9sa2FkYXJ0L2xpYi9leHRyaW5zaWMvZXh0cmluc2ljX3BheWxvYWQuZGFydA==) | `0.00% <0.00%> (ø)` | |
justkawal commented 11 months ago

@leonardocustodio

leonardocustodio commented 11 months ago

A i'm merging without reviewing as the code is going to appear again in the other pr, that would just "duplicate" the review. We can see everything just a single time in there.