Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
pkgs.purescriptProject {
inherit pkgs src;
projectName = "seabug-contracts";
shell = {
packages = [ pkgs.fd ];
};
};
in
{
Expand Down
1 change: 1 addition & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ You can edit this file as you like.
, "argonaut"
, "argonaut-codecs"
, "arrays"
, "monad-logger"
, "bifunctors"
, "bigints"
, "cardano-transaction-lib"
Expand Down
16 changes: 13 additions & 3 deletions src/Seabug/CallContract.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Contract.Address (Slot(Slot))
import Contract.Monad
( ConfigParams(ConfigParams)
, ContractConfig
, LogLevel
, mkContractConfig
, runContract
, runContract_
Expand Down Expand Up @@ -45,6 +44,7 @@ import Data.UInt as UInt
import Effect (Effect)
import Effect.Aff (error)
import Effect.Class (liftEffect)
import Data.Log.Level (LogLevel(..))
import Effect.Exception (Error)
import Metadata.Seabug (SeabugMetadata(SeabugMetadata))
import Metadata.Seabug.Share (unShare)
Expand Down Expand Up @@ -102,7 +102,7 @@ type ContractConfiguration =
, datumCacheSecureConn :: Boolean
, networkId :: Int
, projectId :: String
, logLevel :: LogLevel
, logLevel :: String -- Trace | Debug | Info | Warn | Error
}

type BuyNftArgs =
Expand Down Expand Up @@ -159,6 +159,8 @@ buildContractConfig cfg = do
$ UInt.fromInt' cfg.datumCachePort
networkId <- liftM (error "Invalid network id")
$ intToNetworkId cfg.networkId
logLevel <- liftM (error "Invalid log level")
$ stringToLogLevel cfg.logLevel

wallet <- Just <$> mkNamiWalletAff
mkContractConfig $ ConfigParams
Expand All @@ -178,11 +180,19 @@ buildContractConfig cfg = do
, secure: cfg.serverSecureConn
}
, networkId: networkId
, logLevel: cfg.logLevel
, logLevel: logLevel
, extraConfig: { projectId: cfg.projectId }
, wallet
}

stringToLogLevel :: String -> Maybe LogLevel
stringToLogLevel "Trace" = Just Trace
stringToLogLevel "Debug" = Just Debug
stringToLogLevel "Info" = Just Info
stringToLogLevel "Warn" = Just Warn
stringToLogLevel "Error" = Just Error
stringToLogLevel _ = Nothing

buildNftList :: NetworkId -> ListNftResult -> ListNftResultOut
buildNftList
network
Expand Down
6 changes: 3 additions & 3 deletions src/Seabug/Seabug.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ module Seabug
, getWalletBalance
) where

import Prelude
import Prelude (bind, ($))

import Control.Promise (Promise, fromAff)
import Data.Maybe (Maybe)
import Effect (Effect)
import QueryM (callNami)
import Seabug.CallContract
import Seabug.CallContract (callMarketPlaceBuy, callMarketPlaceBuyTest, callMarketPlaceListNft)
import Serialization.Types (Value)
import Wallet (Wallet(..), mkNamiWalletAff)

getWalletBalance :: Effect (Promise (Maybe Value))
getWalletBalance = fromAff $ do
(Nami nami) <- mkNamiWalletAff
callNami nami _.getBalance
callNami nami _.getBalance