@mavrykdynamics/get-mav
v1.0.8
Published
Programmatic script to get Mavryk from faucet
Readme
get-mav
This zero dependency package provides a programmatic interface to interact with the Mavryk faucet. It is a script that can be run from a JavaScript/Typescript program or directly from a shell. Your NodeJS version should support the fetch api.
Installation
You can install the package from npm:
npm install @mavrykdynamics/get-mavUsage
JS / TS
After installing the package, you can import it in your Node.js JavaScript or TypeScript project:
const getMav = require("@mavrykdynamics/get-mav")
// OR
import getMav from "@mavrykdynamics/get-mav"You can then use the getMav function to interact with the Mavryk faucet. The function takes an object as an argument, with the following properties:
address: The address to send Mav to. This can be a raw Mavryk public key hash or a local address's alias.amount: The amount of Mav to request.network: The faucet's network name. Must match a network name with a faucet listed at https://teztnets.xyz. Ignored iffaucetUrlis set.faucetUrl: The custom faucet URL. Ignoresnetwork.clientDir: (Optional) Specifies a custom client directory path to look up an address alias. If not set, it will default to$HOME/.tezos-client/or$TEZOS_CLIENT_DIRif theTEZOS_CLIENT_DIRenvironment variable is set.
Here is an example of how to use the getMav function:
const txHash = await getMav({
address: "mv1...",
amount: 10,
network: "basenet",
})
// txHash: ooaEskbj...Using an address alias:
const txHash = await getMav({
address: "alice",
amount: 10,
network: "basenet",
})
// txHash: ooaEskbj...Example using the faucetUrl parameter:
const txHash = await getMav({
address: "mv1...",
amount: 10,
faucetUrl: "https://my-custom-faucet-url.com",
})
// txHash: ooaEskbj...CLI
You can also run get-mav directly from the command line with npx:
npx @mavrykdynamics/get-mav mv1... --amount 10 --network basenetRun the script with the --help flag for more information.
