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

Remove dependency on requestAll #52

Merged
merged 3 commits into from
Feb 15, 2024
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
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@ Funds new Testnet accounts

### Run the server:

1. Add / update `.env` with the following values:

```
NODE_ENV="production"
PORT=3000
RIPPLED_URI="wss://s.altnet.rippletest.net:51233"
FUNDING_ADDRESS=<address>
FUNDING_SECRET=<secret>
XRP_AMOUNT=10000
```

- For testing, create an account on testnet or use an existing one by updating `FUNDING_ADDRESS` and `FUNDING_SECRET`
- For production testnet faucet, use the account with the address `rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe` and it's corresponding secret
- Production environments should also configure either the BigQuery or Caspian environment variables as specified below

2. Run the following commands:

```
npm install
NODE_ENV="production" PORT=3000 RIPPLED_URI="wss://s.altnet.rippletest.net:51233" FUNDING_ADDRESS=rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe FUNDING_SECRET=<secret> XRP_AMOUNT=10000
npm start
```

Expand Down Expand Up @@ -66,4 +82,3 @@ Please replace `BIGQUERY_PROJECT_ID`, `BIGQUERY_CLIENT_EMAIL`, and `BIGQUERY_PRI
- `BIGQUERY_PRIVATE_KEY`: The private key from your service account JSON key file. Be sure to include the full private key, including the header and footer.

In case you are running this application in a trusted environment (like Google Cloud Platform), you don't need to provide the `BIGQUERY_CLIENT_EMAIL` and `BIGQUERY_PRIVATE_KEY`. The application will use Application Default Credentials (ADC) provided by the environment.

20 changes: 14 additions & 6 deletions src/ticket-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ let createTicketsPromise: Promise<void | TxResponse<TicketCreate>> = null;
// this will be called when client is connected
export async function populateTicketQueue(client: Client) {
// Get account info
const responses: AccountObjectsResponse[] = await client.requestAll({
command: "account_objects",
account: fundingWallet.address,
type: "ticket",
limit: 300,
});
let marker = undefined;
const responses: AccountObjectsResponse[] = [];
do {
const response: AccountObjectsResponse = await client.request({
command: "account_objects",
account: fundingWallet.address,
type: "ticket",
limit: 300,
marker,
});
responses.push(response);
marker = response.result.marker;
} while (Boolean(marker));

// Empty the ticket queue before refilling it
ticketQueue = [];

Expand Down
Loading