diff --git a/CIP-0106/README.md b/CIP-0106/README.md new file mode 100644 index 0000000000..a6289c366d --- /dev/null +++ b/CIP-0106/README.md @@ -0,0 +1,146 @@ +--- +CIP: 106 +Title: Web-Wallet Bridge - Multisig wallets +Status: Proposed +Category: Wallets +Authors: + - Leo +Implementors: + - BroClanWallet +Discussions: + - https://github.com/cardano-foundation/CIPs/pull/617 +Created: 2023-10-12 +License: CC-BY-4.0 +--- + +## Abstract + +This document describes a CIP-30 extension allowing webpages (i.e. dApps) to interface with Cardano Multisig-wallets. This document is a work in progress and is not yet finalized. It is expected to be updated as the ecosystem evolves. + +## Motivation: why is this CIP necessary? + +In order to facilitate future dApp development, we will need a way for dApps to communicate with multisig wallets, given the unique complexities of native script based addresses. Special provisions need to be made to make the connector compatible with them. + +Specifically, apps building transactions need to be able to get the following information from the wallet: +- Script descriptor + - Any transaction consuming a UTXO from a Plutus-based address must attach the corresponding script. +- `ScriptRequirements` + - The `TxContext` that is required to be able to validate the transaction. It encompasses all the possible combinations of requirements for the transaction to be valid, as such it is represented by an array of `ScriptRequirement` objects. +- Change Datum + - The datum that will be used as the change output for the transaction. This is required for wallets based on Plutus V2 and before, as the change output must contain a datum to be valid and spendable. + +Additionally, apps need to be able to submit a transaction to the wallet for signing in an asynchronous manner, as gathering of signatures can take a long time and each wallet provider will have its own way of handling this process. + +Finally, the signTx() and signData() endpoints will have to be disabled when using this extension since they are not compatible with native script based addresses. + +## Specification + +### Data Types + +#### KeyHash + +A hex-encoded string of the corresponding bytes. This represents the hash of the public key used to sign transactions. + +```ts +type KeyHash = String +``` + +#### ScriptRequirements + +```ts +type ScriptRequirementsCode = { + Signer: 1, + Before: 2, + After: 3, +} +type ScriptRequirement = { + code: ScriptRequirementsCode, + value: KeyHash|number, +} +``` + +### Aditional Error Types + +#### CompletedTxError + +```ts +CompletedTxErrorCode = { + NotFound: 1, + NotReady: 2 +} +``` + +* NotFound - The transaction with the given id was not found. +* NotReady - The transaction with the given id is not ready yet. + +### Additional API Endpoints + +#### api.cip106.getCollateralAddress(): Promise\
+ +For Plutus V2 and later, partial collateral is supported. This function returns an address that can be used to add collateral to a transaction. The address returned must be owned by one of the signers in the list of signers returned by `api.getScriptRequirements()`. + +dApp developers can choose to use this address to add collateral to a transaction, or they can choose to use the `api.getCollateral()` function to get a list of UTXOs that can be used as collateral. If the dApp chooses to use this address, they must ensure that the address is not used for any other purpose, as the wallet may be using it to track collateral, and that the collateral return address is the same one. + +#### api.cip106.getScriptRequirements: Promise\