Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Chains Class interface to usage with wallets #8

Open
Pessina opened this issue Sep 28, 2024 · 0 comments
Open

Improve Chains Class interface to usage with wallets #8

Pessina opened this issue Sep 28, 2024 · 0 comments
Assignees

Comments

@Pessina
Copy link
Collaborator

Pessina commented Sep 28, 2024

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.
@Pessina Pessina self-assigned this Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

1 participant