Repository navigation
fix(account): give new sign-ups their initial testnet top-up - #857
Closed
fraseragain wants to merge 1 commit into
Closed
fraseragain wants to merge 1 commit into
fraseragain wants to merge 1 commit into
Conversation
CustomerService.create also creates the customer's default testnet payment account, so by the time bootstrap and POST /account/create read the accounts it always exists. isNewTestnetAccount (added in 56d3f25) was therefore false for every new sign-up and nobody was topped up. The top-up now applies when the call created the customer. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closing: we decided accounts should not be topped up automatically on sign-up, because people may want to fund an external wallet instead. New users will be told to request testnet CHEQ on the dashboard, and the sign-up top-up code is being removed instead (follow-up PR). |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A brand-new Studio account on production has a testnet payment account with a balance of 0 (
Account 'cheqd1…' does not exist on chain), so Studio's own DID and resource calls fail with a 500 until the user requests tokens from the faucet. The sign-up top-up the docs describe never happens.Cause
56d3f25 (in 3.18.0) made the initial top-up run only for a newly created testnet account:
CustomerService.createalready creates the customer's default testnet payment account, beforebootstrap(andPOST /account/create) read the accounts. So for a new sign-up the testnet account always exists, the flag is alwaysfalse, andtopupTestnetreturns without doing anything. The existing tests only calltopupTestnetdirectly with the flag set.What changed
isNewTestnetAccount(customerCreatedNow, hadTestnetAccount)insrc/helpers/testnet-topup.ts. It is true when the call created the customer, or when the testnet account didn't exist.bootstrapsetscustomerCreatedNowat both places it creates a customer.createsets it when there is no customer on the request.How to test
npm run test:unit: newtests/unit/account/testnet-topup.test.ts(3 tests), including the case that was broken. All 24 suites and 216 tests pass, andtsc --noEmitexits 0.GET /account/balances. The testnet balance should be 10,000 CHEQ, andfaucet.quota.usedshould show 10,000.Notes
faucetRequestrow.🤖 Generated with Claude Code