Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nameservice interact #168

Closed
wants to merge 21 commits into from
Closed

Nameservice interact #168

wants to merge 21 commits into from

Conversation

IvantheTricourne
Copy link
Contributor

Closes #157

@IvantheTricourne
Copy link
Contributor Author

Merge after #151 and #162

--------------------------------------------------------------------------------

genNames :: Int -> IO [Name]
genNames 0 = return []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genNames = replicateM (fmap fromString genName)

names <- genNames (x - 1)
return (aName:names)

genVals :: Int -> IO [Text]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genVals = replicateM (fmap cs Lorem.word)

createName :: User -> Name -> Text -> IO ()
createName user name val = buyName user name val 0

createNames :: User -> [(Name, Text)] -> IO ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createNames user = mapM_ (uncurry . createName user)

rawTx = mkSignedRawTransactionWithRoute "nameservice" userPrivKey msg
in runTransaction_ rawTx

buyNames :: User -> [(Name, Text, Amount)] -> IO ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buyNames user = mapM_ (uncurry . buyName user)

rawTx = mkSignedRawTransactionWithRoute "nameservice" userPrivKey msg
in runTransaction_ rawTx

deleteNames :: User -> [Name] -> IO ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createNames user = mapM_ (uncurry . deleteName user)


setNames :: User -> [(Name, Text)] -> IO ()
setNames _ [] = return ()
setNames user ((name, val):rst) = do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createNames user = mapM_ (uncurry . setName user)

mConc <- lookupEnv "TX_COUNT"
let conc = maybe 1 read mConc
putStrLn $ "Running nameservice interaction w/ TX_COUNT: " <> show conc
faucetAccount user1 10000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should faucet inside the loop


main :: IO ()
main = do
mConc <- lookupEnv "TX_COUNT"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is mConc? use a variable name that's more transparent

@martyall martyall closed this Jan 6, 2020
@martyall martyall deleted the nameservice-interact branch January 21, 2020 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make script for interacting with the nameservice app
2 participants