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

feat: get txpool API #1364

Merged
merged 3 commits into from
Jun 25, 2024
Merged

feat: get txpool API #1364

merged 3 commits into from
Jun 25, 2024

Conversation

kehiy
Copy link
Member

@kehiy kehiy commented Jun 25, 2024

Description

This Pull request adds a new API that helps devs and users to get and read txpool.

You can run a local net with 2 nodes and make bulk TXs using this script can then check the HTTP route to see the tx pool:

#!/bin/bash

# Check if addresses string and amount were provided as arguments
if [ $# -lt 2 ]; then
    echo "Usage: $0 <addresses> <amount>"
    exit 1
fi

# Get the addresses string and amount from the command-line arguments
addresses=$1
amount=$2

# Split the addresses string into an array
IFS=' ' read -r -a address_array <<< "$addresses"
echo $addresses
echo $amount
# Transfer specified amount to each address
for address in "${address_array[@]}"; do
    echo $address
    # Construct the command
    command="pw tx transfer tpc1z7a0yu7j8krm9wwgvk0exk6rkntqfm5u0qkkpdg $address $amount --path default_wallet"
    
    # Run the command and automatically input 'y' followed by enter
    echo -e "y\n" | $command

    # Check the exit status of the command
    if [ $? -ne 0 ]; then
        echo "Error transferring $amount to address: $address"
    else
        echo "Transferred $amount to address: $address"
    fi
done

echo "Bulk transfer completed."

Result example:
Screenshot from 2024-06-25 12-30-16

@kehiy kehiy requested a review from ansh-devs June 25, 2024 12:39
node/node.go Outdated Show resolved Hide resolved
txpool/interface.go Show resolved Hide resolved
@kehiy kehiy requested a review from b00f June 25, 2024 15:30
@kehiy
Copy link
Member Author

kehiy commented Jun 25, 2024

@b00f @ansh-devs please re-check the PR and first description message.

@b00f b00f merged commit 13a2571 into pactus-project:main Jun 25, 2024
11 checks passed
@kehiy kehiy deleted the feature/txpool-api branch June 25, 2024 17:05
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.

None yet

2 participants