Skip to content

Commit

Permalink
review improvements - part 1
Browse files Browse the repository at this point in the history
merge compile fix
  • Loading branch information
paweljakubas committed Apr 8, 2021
1 parent a39a1ba commit 8b59e33
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 36 deletions.
1 change: 1 addition & 0 deletions lib/core/src/Cardano/Wallet/DB/Sqlite.hs
Expand Up @@ -2435,6 +2435,7 @@ instance
, SoftDerivation k
, WalletKey k
, Typeable n
, Seq.GetPurpose k
) => PersistState (Shared.SharedState n k) where
insertState (wid, sl) st = do

Expand Down
19 changes: 0 additions & 19 deletions lib/core/src/Cardano/Wallet/Primitive/AddressDerivation/Byron.hs
Expand Up @@ -58,7 +58,6 @@ import Cardano.Crypto.Wallet
, unXPub
, xPrvChangePass
, xprv
, xpub
)
import Cardano.Mnemonic
( SomeMnemonic (..), entropyToBytes, mnemonicToEntropy )
Expand All @@ -73,7 +72,6 @@ import Cardano.Wallet.Primitive.AddressDerivation
, Passphrase (..)
, PaymentAddress (..)
, PersistPrivateKey (..)
, PersistPublicKey (..)
, WalletKey (..)
, fromHex
, hex
Expand Down Expand Up @@ -407,23 +405,6 @@ instance PersistPrivateKey (ByronKey 'RootK) where
_ ->
Left "Key input must be two hex strings separated by :"

instance PersistPublicKey (ByronKey 'AccountK) where
serializeXPub (ByronKey k _ (Passphrase p)) =
hex (unXPub k) <> ":" <> hex p

unsafeDeserializeXPub kp =
either err (id . mkKey) (deserializeKey kp)
where
err _ = error "unsafeDeserializeXPub: unable to deserialize ByronKey"
mkKey (key, pwd) = ByronKey key (Index 0) pwd
deserializeKey b = case map (fromHex @ByteString) (B8.split ':' b) of
[Right rawK, Right p] ->
case xpub rawK of
Right k' -> Right (k', Passphrase (BA.convert p))
Left e -> Left e
_ ->
Left "Key input must be two hex strings separated by :"

{-------------------------------------------------------------------------------
Utils
-------------------------------------------------------------------------------}
Expand Down
33 changes: 16 additions & 17 deletions specifications/api/swagger.yaml
Expand Up @@ -283,18 +283,17 @@ x-walletAccountPubkey: &walletAccountPubkey

x-cosigner: &cosigner
type: string
pattern: "^(cosigner#)[0-9]*$"
pattern: "^(cosigner#)[0-9]+$"

x-cosigners: &cosigners
description: Map of cosigners and their account public keys. Use key as in &cosigner, eg. "cosigner#"
type: object
additionalProperties: *walletAccountPubkey
# Note: propertyNames pattern not supported in current OpenAPI version.
# propertyNames:
# pattern: '^(cosigner#)[0-9]*$'
# pattern: '^(cosigner#)[0-9]+$'
example:
0: { "cosigner#0": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db11423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db1" }
1: { "cosigner#0": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db11423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db1"
0: { "cosigner#0": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db11423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db1"
, "cosigner#3": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db11423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db2" }

x-walletId: &walletId
Expand Down Expand Up @@ -4963,12 +4962,12 @@ paths:
┏─────────┓
SCRIPT = ──┬───────────────────────┤ pub key ├─────────────────────┬──
│ ┗─────────┛ │
│ ┏─────────────
├───────────────────────┤ active_from ├─────────────────┤
│ ┗─────────────
│ ┏──────────────
├───────────────────────┤ active_until ├────────────────┤
│ ┗──────────────
│ ┏──────────────────┓
├───────────────────────┤ ACTIVE_FROM slot ├──── ───────┤
│ ┗──────────────────┛
│ ┏───────────────────┓
├───────────────────────┤ ACTIVE_UNTIL slot ├───────────┤
│ ┗───────────────────┛
│ │
│ ╭─────╮ ╭────────╮ │
├──┤ ALL ├───┤ SCRIPT ├─┬───────────────────────────────┤
Expand All @@ -4977,7 +4976,7 @@ paths:
│ └───┤ , ├────┘ │
│ ╰───╯ │
│ ╭─────╮ ╭────────╮ │
├──┤ ALL ├───┤ SCRIPT ├─┬───────────────────────────────┤
├──┤ ANY ├───┤ SCRIPT ├─┬───────────────────────────────┤
│ ╰─────╯ ^ ╰────────╯ │ │
│ │ ╭───╮ │ │
│ └───┤ , ├────┘ │
Expand Down Expand Up @@ -5059,7 +5058,7 @@ paths:
tags: ["Shared Wallets"]
summary: Get
description: |
<p align="right">status: <strong>unstable</strong></p>
<p align="right">status: <strong>stable</strong></p>
parameters:
- *parametersWalletId
responses: *responsesGetSharedWallet
Expand All @@ -5069,7 +5068,7 @@ paths:
tags: ["Shared Wallets"]
summary: Delete
description: |
<p align="right">status: <strong>unstable</strong></p>
<p align="right">status: <strong>stable</strong></p>
parameters:
- *parametersWalletId
responses: *responsesDeleteWallet
Expand All @@ -5078,9 +5077,9 @@ paths:
patch:
operationId: patchSharedWalletInPayment
tags: ["Shared Wallets"]
summary: Update
summary: Update Payment
description: |
<p align="right">status: <strong>unstable</strong></p>
<p align="right">status: <strong>stable</strong></p>
parameters:
- *parametersWalletId
requestBody:
Expand All @@ -5094,9 +5093,9 @@ paths:
patch:
operationId: patchSharedWalletInDelegation
tags: ["Shared Wallets"]
summary: Update
summary: Update Delegation
description: |
<p align="right">status: <strong>unstable</strong></p>
<p align="right">status: <strong>stable</strong></p>
parameters:
- *parametersWalletId
requestBody:
Expand Down

0 comments on commit 8b59e33

Please sign in to comment.