Skip to content

Commit

Permalink
Merge pull request #1638 from Plutonomicon/dshuiski/gov
Browse files Browse the repository at this point in the history
Governance / CIP-95
  • Loading branch information
klntsky authored Aug 14, 2024
2 parents 3c134ea + fe6bbde commit 3cc3a1b
Show file tree
Hide file tree
Showing 96 changed files with 2,237 additions and 723 deletions.
96 changes: 72 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,72 +7,120 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [[v9.1.0]](#v910)
- [[v9.2.0]](#v920)
- [Added](#added)
- [Changed](#changed)
- [Removed](#removed)
- [Fixed](#fixed)
- [[v9.0.0]](#v900)
- [Deprecated](#deprecated)
- [[v9.1.0]](#v910)
- [Added](#added-1)
- [Removed](#removed-1)
- [Changed](#changed-1)
- [Removed](#removed-1)
- [Fixed](#fixed-1)
- [[v8.0.0]](#v800)
- [[v9.0.0]](#v900)
- [Deprecated](#deprecated)
- [Added](#added-2)
- [Removed](#removed-2)
- [Changed](#changed-2)
- [Fixed](#fixed-2)
- [Removed](#removed-2)
- [[v7.0.0]](#v700)
- [[v8.0.0]](#v800)
- [Added](#added-3)
- [Changed](#changed-3)
- [Fixed](#fixed-3)
- [Removed](#removed-3)
- [[v6.0.0]](#v600)
- [[v7.0.0]](#v700)
- [Added](#added-4)
- [Changed](#changed-4)
- [Fixed](#fixed-4)
- [Removed](#removed-4)
- [[v5.0.0]](#v500)
- [[v6.0.0]](#v600)
- [Added](#added-5)
- [Changed](#changed-5)
- [Removed](#removed-5)
- [Fixed](#fixed-5)
- [Runtime Dependencies](#runtime-dependencies)
- [[v4.0.2] - 2023-01-17](#v402---2023-01-17)
- [Fixed](#fixed-6)
- [[v4.0.1] - 2022-12-20](#v401---2022-12-20)
- [Removed](#removed-5)
- [[v5.0.0]](#v500)
- [Added](#added-6)
- [[v4.0.0] - 2022-12-15](#v400---2022-12-15)
- [Added](#added-7)
- [Changed](#changed-6)
- [Removed](#removed-6)
- [Fixed](#fixed-6)
- [Runtime Dependencies](#runtime-dependencies)
- [[v4.0.2] - 2023-01-17](#v402---2023-01-17)
- [Fixed](#fixed-7)
- [Runtime Dependencies](#runtime-dependencies-1)
- [[3.0.0] - 2022-11-21](#300---2022-11-21)
- [[v4.0.1] - 2022-12-20](#v401---2022-12-20)
- [Added](#added-7)
- [[v4.0.0] - 2022-12-15](#v400---2022-12-15)
- [Added](#added-8)
- [Changed](#changed-7)
- [Removed](#removed-7)
- [Fixed](#fixed-8)
- [Runtime Dependencies](#runtime-dependencies-2)
- [[2.0.0] - 2022-09-12](#200---2022-09-12)
- [Runtime Dependencies](#runtime-dependencies-1)
- [[3.0.0] - 2022-11-21](#300---2022-11-21)
- [Added](#added-9)
- [Changed](#changed-8)
- [Removed](#removed-8)
- [Fixed](#fixed-9)
- [[2.0.0-alpha] - 2022-07-05](#200-alpha---2022-07-05)
- [Runtime Dependencies](#runtime-dependencies-2)
- [[2.0.0] - 2022-09-12](#200---2022-09-12)
- [Added](#added-10)
- [Removed](#removed-9)
- [Changed](#changed-9)
- [Removed](#removed-9)
- [Fixed](#fixed-10)
- [[1.1.0] - 2022-06-30](#110---2022-06-30)
- [[2.0.0-alpha] - 2022-07-05](#200-alpha---2022-07-05)
- [Added](#added-11)
- [Removed](#removed-10)
- [Changed](#changed-10)
- [Fixed](#fixed-11)
- [[1.0.1] - 2022-06-17](#101---2022-06-17)
- [[1.1.0] - 2022-06-30](#110---2022-06-30)
- [Fixed](#fixed-12)
- [[1.0.1] - 2022-06-17](#101---2022-06-17)
- [Fixed](#fixed-13)
- [[1.0.0] - 2022-06-10](#100---2022-06-10)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## [v9.2.0]

### Added

- CIP-95 methods for querying the connected wallet account's public DRep key and
its registered and unregistered public stake keys: `ownDrepPubKey`,
`ownDrepPubKeyHash`, `ownRegisteredPubStakeKeys`, `ownUnregisteredPubStakeKeys`.
These new functions can be imported from `Contract.Wallet`.
**WARNING**: KeyWallet does not distinguish between registered and unregistered
stake keys due to the limitations of the underlying query layer. This means that
all controlled stake keys are returned as part of `ownUnregisteredPubStakeKeys`,
and the response of `ownRegisteredPubStakeKeys` is always an empty array.
([#1638](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1638))

- New examples demonstrating various interactions with the Cardano governance
system: `Gov.DelegateVoteAbstain`, `Gov.ManageDrep`, `Gov.ManageDrepScript`,
`Gov.SubmitVote`, `Gov.SubmitVoteScript`.
([#1638](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1638))

### Changed

- `signData` for KeyWallet: Previously, the supplied address was discarded,
and the wallet's address was used as part of the COSE `Sig_structure`. Now,
the provided address is inspected, and the keys associated with that address
are used. Additionally, KeyWallet now supports signing with the DRep key as
specified in CIP-95. Keep in mind that if the wallet does not have the required
keys, an error will be thrown.
([#1638](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1638))

### Removed

- Constructors for individual wallets (like Nami or Eternl) from `WalletSpec`.
Use `ConnectToGenericCip30` with the right wallet identifier instead. To obtain
the identifier of a known wallet, refer to `KnownWallet` and `walletName` from
`Contract.Config`.
([#1638](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1638))

### Fixed

- `getRewardAddresses` for KeyWallet now returns actual reward addresses
without the payment part.
([#1638](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1638))

## [v9.1.0]

This version provides basic Conway support and replaces Plutip with `cardano-testnet`.
Expand Down
13 changes: 11 additions & 2 deletions examples/AdditionalUtxos.purs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ import Contract.BalanceTxConstraints
( BalancerConstraints
, mustUseAdditionalUtxos
)
import Contract.Config (ContractParams, testnetNamiConfig)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
)
import Contract.Log (logInfo')
import Contract.Monad (Contract, launchAff_, runContract)
import Contract.PlutusData (Datum, PlutusData(Integer))
Expand All @@ -53,7 +59,10 @@ import Test.QuickCheck (arbitrary)
import Test.QuickCheck.Gen (randomSampleOne)

main :: Effect Unit
main = example testnetNamiConfig
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
}

example :: ContractParams -> Effect Unit
example contractParams =
Expand Down
13 changes: 11 additions & 2 deletions examples/AlwaysMints.purs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ import Cardano.Types.Int as Int
import Cardano.Types.PlutusScript as PlutusScript
import Cardano.Types.RedeemerDatum as RedeemerDatum
import Cardano.Types.Transaction as Transaction
import Contract.Config (ContractParams, testnetNamiConfig)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
)
import Contract.Log (logInfo')
import Contract.Monad (Contract, launchAff_, liftContractM, runContract)
import Contract.TextEnvelope (decodeTextEnvelope, plutusScriptFromEnvelope)
Expand All @@ -30,7 +36,10 @@ import Ctl.Examples.Helpers (mkAssetName) as Helpers
import Data.Map as Map

main :: Effect Unit
main = example testnetNamiConfig
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
}

contract :: Contract Unit
contract = do
Expand Down
13 changes: 11 additions & 2 deletions examples/AlwaysSucceeds.purs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ import Cardano.Types.RedeemerDatum as RedeemerDatum
import Cardano.Types.Transaction as Transaction
import Cardano.Types.TransactionUnspentOutput (toUtxoMap)
import Contract.Address (mkAddress)
import Contract.Config (ContractParams, testnetNamiConfig)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
)
import Contract.Log (logInfo')
import Contract.Monad (Contract, launchAff_, runContract)
import Contract.TextEnvelope (decodeTextEnvelope, plutusScriptFromEnvelope)
Expand All @@ -54,7 +60,10 @@ import Data.Map as Map
import Effect.Exception (error)

main :: Effect Unit
main = example testnetNamiConfig
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
}

contract :: Contract Unit
contract = do
Expand Down
13 changes: 11 additions & 2 deletions examples/AwaitTxConfirmedWithTimeout.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ module Ctl.Examples.AwaitTxConfirmedWithTimeout
import Contract.Prelude

import Cardano.AsCbor (decodeCbor)
import Contract.Config (ContractParams, testnetNamiConfig)
import Contract.Config
( ContractParams
, KnownWallet(Nami)
, WalletSpec(ConnectToGenericCip30)
, testnetConfig
, walletName
)
import Contract.Log (logInfo')
import Contract.Monad (Contract, launchAff_, runContract, throwContractError)
import Contract.Prim.ByteArray (hexToByteArrayUnsafe)
Expand All @@ -20,7 +26,10 @@ import Control.Monad.Error.Class (try)
import Partial.Unsafe (unsafePartial)

main :: Effect Unit
main = example testnetNamiConfig
main = example $ testnetConfig
{ walletSpec =
Just $ ConnectToGenericCip30 (walletName Nami) { cip95: false }
}

example :: ContractParams -> Effect Unit
example cfg = launchAff_ do
Expand Down
Loading

0 comments on commit 3cc3a1b

Please sign in to comment.