Skip to content

Improve Chains Class interface to usage with wallets #8

Open
@Pessina

Description

Proposal for More Granular Transaction Processing in Chain Classes

Currently, the Chain Classes interface in multichain-tools only supports calling handleTransaction. The process should be more granular, allowing the caller to interact with intermediate transaction states. Below is the proposed interface:

Chain Class Methods

  • Chain.getAddressAndPublicKey(mpcPublicKey, path): { address, publicKey }
  • Chain.attachProperties(tx): tx // Fetch all the necessary online information. All subsequent steps should be able to be performed on-chain (offline).
  • Chain.serializeAndHash(tx): hashedTx // Should be able to be performed on-chain (offline).
  • Chain.parseSignature(mpcSignature): chainSignature // Parses the rsvSignature and returns the chain-specific signature.
  • Chain.broadcastTx(signedTx): txHash // Broadcasts the transaction.

Chain Properties

  • async sign(txHash): mpcSignature // Provides enough information for the caller to sign using a wallet or local signer.
  • async offlineSigner(offlineDataReady): void // Provides enough information for the caller to use their own smart contract to generate the signature. All the data that include web requests should have been done before this function it's called.

Contract Methods

  • Contract.getPublicKey(contractId): mpcPublicKey
  • Contract.getCurrentFee(contractId): currentFee
  • Contract.sign(hashedTx): rsvSignature

Goal

The goal of this proposal is to provide more granularity in transaction state management for signing.

It should enable users to access two key stages of the transaction:

  • A transaction ready to be signed by a wallet, either via signDelegate or a prepared transaction.
  • A transaction ready to be sent to a smart contract (offline), including all necessary data, allowing the contract to handle offline preparations, sign, and return the signature.

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status

    In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions