capi icon indicating copy to clipboard operation
capi copied to clipboard

`SignablePatternRune` & `SignedPatternRune`

Open harrysolovay opened this issue 2 years ago • 2 comments

Is there any design for a SignablePatternRune and SignedPatternRune, which could somehow...

  • shield the consumer from the complexity of typing the signature constraints + signed method
  • allow us to attach common methods (such as verify)

The signed method's params will be the same across inheritors. The difference is in what they return.

signed<SU>(signatureFactory: SignatureDataFactory<C, U, SU>) {
  return Rune.fn($extrinsic)
    .call(this.chain.metadata)
    .into(CodecRune)
    .encoded(Rune.rec({
      protocolVersion: 4,
      call: this,
      signature: signatureFactory(this.chain),
    }))
    .into(SignedExtrinsicRune, this.chain)
}

... I'd imagine most patterns will make use of such a flow (being .signed). Would be nice if we could further simplify. Thoughts @nythrox?

harrysolovay avatar Mar 25 '23 16:03 harrysolovay

Or, a signableRune factory

harrysolovay avatar Mar 27 '23 17:03 harrysolovay

Blocked on #517

harrysolovay avatar Jun 21 '23 04:06 harrysolovay