-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Request Amount of Tez Within a Range + getTez Programmatic Faucet (#17)
* Allow range of tez amount request. Remove profiles. * getTez.js: Allow range of tez + option for timing challenges * WIP getTez package * Better typescript support for getTez * getTez updates * Validate amount + add comments * getTez: Add license and readme + update package.json * Implement progress bar + cleanup * Cleanup UserInfo * Use handleError function * Cleanup * Cleanup + fixes * Use the same worker for all challenges * Make the webworker inline * Set worker event listeners before posting msg * Validate worker args * getTez: Log progress percentage * Update readme * getTez: Add timeouts to fetch requests
- Loading branch information
Showing
25 changed files
with
1,060 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Oxhead Alpha | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# get-tez | ||
|
||
This zero dependency package provides a programmatic interface to interact with the [Tezos faucet](https://github.com/oxheadalpha/tezos-faucet-backend). It is a script that can be run from a JavaScript/Typescript program or directly from a shell. | ||
|
||
## Installation | ||
|
||
You can install the package from npm: | ||
|
||
```bash | ||
npm install @oxheadalpha/get-tez | ||
``` | ||
|
||
## Usage | ||
|
||
### JS / TS | ||
After installing the package, you can import it in your Node.js JavaScript or TypeScript project: | ||
|
||
```javascript | ||
const getTez = require("@oxheadalpha/get-tez") | ||
|
||
// OR | ||
|
||
import getTez from "@oxheadalpha/get-tez" | ||
``` | ||
|
||
You can then use the `getTez` function to interact with the Tezos faucet. The function takes an object as an argument, with the following properties: | ||
|
||
- `address`: The address to send Tez to. | ||
- `amount`: The amount of Tez to request. | ||
- `network`: The faucet's network name. Must match a network name with a faucet listed at https://teztnets.xyz. Ignored if `faucetUrl` is set. | ||
- `faucetUrl`: The custom faucet URL. Ignores `network`. | ||
|
||
Here is an example of how to use the `getTez` function: | ||
|
||
```javascript | ||
const txHash = await getTez({ | ||
address: "tz1...", | ||
amount: 10, | ||
network: "ghostnet", | ||
}) | ||
``` | ||
|
||
Example using the `faucetUrl` parameter: | ||
```js | ||
const txHash = await getTez({ | ||
address: "tz1...", | ||
amount: 10, | ||
faucetUrl: "https://my-custom-faucet-url.com", | ||
}) | ||
``` | ||
|
||
### CLI | ||
|
||
You can also run the script directly from the command line with Node.js. When you install the package via npm, the JavaScript file will be located at `node_modules/@oxheadalpha/get-tez/dist/getTez.js`. You can run it with the following command: | ||
|
||
```bash | ||
node node_modules/@oxheadalpha/get-tez/dist/getTez.js tz1... --amount 10 --network ghostnet | ||
``` | ||
|
||
Run the script with the `--help` flag for more information. |
Oops, something went wrong.