Skip to content

Commit

Permalink
Bump dependency on cardano-wallet-agda (#4966)
Browse files Browse the repository at this point in the history
This pull request updates the Deposit Wallet to the latest state of the
[cardano-wallet-agda](https://github.com/cardano-foundation/cardano-wallet-agda)
repository.

Specifically, this pull request adapts to the function `fromXPubAndMax`
that is described in the updated specification and which replaces the
previous `fromXPubAndCount`.
  • Loading branch information
HeinrichApfelmus authored Feb 4, 2025
2 parents c58ba4b + 733aa85 commit 6342471
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/cardano-foundation/cardano-wallet-agda
tag: f3479b501a2efe50bcf1ee0d09bc2d1325a982e7
--sha256: 10d6k7mw1zw9vpzz8dhb52vfmj2rshsk225nvyl8nrc94fr627kz
tag: 11bee0f47c1950cd444835552a481d8b080c0299
--sha256: 1fg95ls2dy9ahjpw73pmilx5n3y434pffvllkd47q3my8iwfssjm
subdir:
lib/customer-deposit-wallet-pure
lib/cardano-wallet-read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ findTheDepositWalletOnDisk env dir action = do
ds <- scanDirectoryForDepositPrefix dir
case ds of
[d] -> do
(credentials, users) <-
(credentials, maxCustomer) <-
deserialise <$> BL.readFile (dir </> d)
let state =
fromCredentialsAndGenesis
credentials
(fromIntegral @Int users)
(fromIntegral @Int maxCustomer)
(genesisData env)
store <- newStore
writeS store state
Expand Down Expand Up @@ -311,7 +311,7 @@ createTheDepositWalletOnDisk
-> Credentials
-- ^ Id of the wallet
-> Word31
-- ^ Max number of users ?
-- ^ Maximum customer index
-> (Maybe WalletIO.WalletStore -> IO a)
-- ^ Action to run if the wallet is created
-> IO a
Expand Down
4 changes: 2 additions & 2 deletions lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ withWalletInit
, ..
}
credentials
knownCustomerCount
maxCustomer
action = do
walletState <-
DBVar.initDBVar store
$ Wallet.fromCredentialsAndGenesis
credentials
knownCustomerCount
maxCustomer
genesisData
withWalletDBVar wtc env walletState action

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ applyBlock
-> UTxO
-> (DeltaUTxO, UTxO, ValueTransferMap)
applyBlock isOurs block u0 =
(DeltaUTxO.concat $ reverse dus, u1, totalValueTransfer)
(DeltaUTxO.appends $ reverse dus, u1, totalValueTransfer)
where
(dus, (u1, totalValueTransfer)) =
mapAccumL' applyTx' (u0, mempty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ rootXPrvFromCredentials (XPrvCredentials xprv _) = Just xprv

fromCredentialsAndGenesis
:: Credentials -> Word31 -> Read.GenesisData -> WalletState
fromCredentialsAndGenesis credentials knownCustomerCount genesisData =
fromCredentialsAndGenesis credentials maxCustomer genesisData =
WalletState
{ walletTip = Read.GenesisPoint
, addresses =
Address.fromXPubAndCount
Address.fromXPubAndMax
network
(accountXPubFromCredentials credentials)
knownCustomerCount
maxCustomer
, utxoHistory = UTxOHistory.fromOrigin initialUTxO
, txHistory = mempty
, submissions = Sbm.empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ data Scenario p a where
type ScenarioP p m = ProgramT (Scenario p) m

wallet :: Int -> Text -> Text -> ScenarioP p m ()
wallet users seed passphrase =
singleton (ResetWallet users seed passphrase)
wallet maxCustomer seed passphrase =
singleton (ResetWallet maxCustomer seed passphrase)

existsTx :: ScenarioP p m TxI
existsTx = singleton ExistsTx
Expand Down Expand Up @@ -333,12 +333,12 @@ interpret w runP slotTimes p = flip evalStateT w $ do
put walletState'
where
go = viewT >=> eval
eval (ResetWallet users seed passphrase :>>= k) = do
eval (ResetWallet maxCustomer seed passphrase :>>= k) = do
Right mnemonics <- pure $ createMnemonicFromWords seed
let new =
Wallet.fromCredentialsAndGenesis
(credentialsFromMnemonics mnemonics passphrase)
(fromIntegral users)
(fromIntegral maxCustomer)
Read.mockGenesisDataMainnet
id .= (new, freshInterpreterState)
go $ k ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,6 @@ spec = do
encodeAddress
$ fst
$ createAddress 0
$ Address.fromXPubAndCount Mainnet xpub 1
$ Address.fromXPubAndMax Mainnet xpub 1

addr `shouldBe` address0

0 comments on commit 6342471

Please sign in to comment.