Repository navigation
Conversation
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
| export type ClaimTxConfirmCallback = (message: string) => void | Promise<void> | ||
|
|
||
| export type ClaimTransactionSubmittedCallback = ( | ||
| hash: `0x${string}`, | ||
| ) => void | Promise<void> | ||
|
|
||
| export interface ClaimOptions { | ||
| /** Called during the balance check step to confirm faucet or retry actions. */ | ||
| txConfirm?: ClaimTxConfirmCallback | ||
| /** Called once after the claim transaction is broadcast and before receipt confirmation. */ | ||
| onTransactionSubmitted?: ClaimTransactionSubmittedCallback | ||
| /** @deprecated Use onTransactionSubmitted for the post-broadcast, pre-confirmation stage. */ | ||
| onTxHash?: ClaimTransactionSubmittedCallback | ||
| /** @deprecated Use onTransactionSubmitted; this alias preserves integrations that used the lowercase-h spelling. */ | ||
| onTxhash?: ClaimTransactionSubmittedCallback | ||
| } | ||
|
|
|
@copilot fix review comments |
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Addressed in |
|
|
||
| const hash = await this.walletClient.writeContract(request) | ||
| onHash?.(hash) | ||
| await safeInvokeSubmittedCallback( |
There was a problem hiding this comment.
Awaited callback can hang claim()
The submitted callback is now awaited. A consumer callback that resolves slowly or never (rare cases) blocks the 5s sleep and waitForTransactionReceipt, so claim() hangs even after the tx confirms.
Worth either keeping it fire-and-forget or wrapping it in a timeout.
| const onClaimSubmitted = vi.fn(() => { | ||
| events.push("submitted") | ||
| }) | ||
| vi.spyOn(sdk, "submitAndWait").mockImplementation( |
There was a problem hiding this comment.
The test mocks out submitAndWait and invokes the callback itself, so the real callback-before-confirmation ordering inside ClaimSDK.submitAndWait is never exercised. A regression there wouldn't fail the suite.
|
@sirpy |
|
@sirpy The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
3 similar comments
|
@sirpy The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
|
@sirpy The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
|
@sirpy The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
|
@sirpy The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
1 similar comment
|
@sirpy The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
…ring Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Claim consumers need to distinguish wallet signing from the pending-on-chain stage. The claim flow now exposes a reliable post-broadcast callback before receipt confirmation.
Claim API
claim({ onTransactionSubmitted })for the post-submission / pre-confirmation hook.claim(txConfirm)support.onTxHash/onTxhash.Callback behavior
writeContractsucceeds.Coverage
txConfirm.